first commit
This commit is contained in:
commit
eb2f504652
32490 changed files with 5731109 additions and 0 deletions
21
node_modules/@vue/babel-helper-vue-transform-on/LICENSE
generated
vendored
Normal file
21
node_modules/@vue/babel-helper-vue-transform-on/LICENSE
generated
vendored
Normal 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.
|
||||
5
node_modules/@vue/babel-helper-vue-transform-on/README.md
generated
vendored
Normal file
5
node_modules/@vue/babel-helper-vue-transform-on/README.md
generated
vendored
Normal 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
|
||||
4
node_modules/@vue/babel-helper-vue-transform-on/index.d.ts
generated
vendored
Normal file
4
node_modules/@vue/babel-helper-vue-transform-on/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
declare function transformOn(
|
||||
obj: Record<string, any>
|
||||
): Record<`on${string}`, any>;
|
||||
export default transformOn;
|
||||
9
node_modules/@vue/babel-helper-vue-transform-on/index.js
generated
vendored
Normal file
9
node_modules/@vue/babel-helper-vue-transform-on/index.js
generated
vendored
Normal 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;
|
||||
13
node_modules/@vue/babel-helper-vue-transform-on/package.json
generated
vendored
Normal file
13
node_modules/@vue/babel-helper-vue-transform-on/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"name": "@vue/babel-helper-vue-transform-on",
|
||||
"version": "1.1.5",
|
||||
"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
21
node_modules/@vue/babel-plugin-jsx/LICENSE
generated
vendored
Normal 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.
|
||||
376
node_modules/@vue/babel-plugin-jsx/README.md
generated
vendored
Normal file
376
node_modules/@vue/babel-plugin-jsx/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,376 @@
|
|||
# Babel Plugin JSX for Vue 3
|
||||
|
||||
[](https://www.npmjs.com/package/@vue/babel-plugin-jsx)
|
||||
[](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.
|
||||
|
||||
## 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']]} />
|
||||
```
|
||||
|
||||
```jsx
|
||||
<A v-model={[val, 'argument', ['modifier']]} />
|
||||
```
|
||||
|
||||
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://qn.antdv.com/logo.png"
|
||||
/>
|
||||
<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+**
|
||||
43
node_modules/@vue/babel-plugin-jsx/dist/index.d.mts
generated
vendored
Normal file
43
node_modules/@vue/babel-plugin-jsx/dist/index.d.mts
generated
vendored
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
import * as t from '@babel/types';
|
||||
import * as BabelCore from '@babel/core';
|
||||
import { NodePath } from '@babel/traverse';
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
declare const _default: ({ types }: typeof BabelCore) => {
|
||||
name: string;
|
||||
inherits: any;
|
||||
visitor: {
|
||||
Program: {
|
||||
enter(path: NodePath<t.Program>, state: State): void;
|
||||
exit(path: NodePath<t.Program>): void;
|
||||
};
|
||||
JSXFragment: {
|
||||
enter(path: BabelCore.NodePath<t.JSXElement>, state: State): void;
|
||||
};
|
||||
JSXElement: {
|
||||
exit(path: BabelCore.NodePath<t.JSXElement>, state: State): void;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
export { VueJSXPluginOptions, _default as default };
|
||||
43
node_modules/@vue/babel-plugin-jsx/dist/index.d.ts
generated
vendored
Normal file
43
node_modules/@vue/babel-plugin-jsx/dist/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
import * as t from '@babel/types';
|
||||
import * as BabelCore from '@babel/core';
|
||||
import { NodePath } from '@babel/traverse';
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
declare const _default: ({ types }: typeof BabelCore) => {
|
||||
name: string;
|
||||
inherits: any;
|
||||
visitor: {
|
||||
Program: {
|
||||
enter(path: NodePath<t.Program>, state: State): void;
|
||||
exit(path: NodePath<t.Program>): void;
|
||||
};
|
||||
JSXFragment: {
|
||||
enter(path: BabelCore.NodePath<t.JSXElement>, state: State): void;
|
||||
};
|
||||
JSXElement: {
|
||||
exit(path: BabelCore.NodePath<t.JSXElement>, state: State): void;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
export { VueJSXPluginOptions, _default as default };
|
||||
1020
node_modules/@vue/babel-plugin-jsx/dist/index.js
generated
vendored
Normal file
1020
node_modules/@vue/babel-plugin-jsx/dist/index.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
992
node_modules/@vue/babel-plugin-jsx/dist/index.mjs
generated
vendored
Normal file
992
node_modules/@vue/babel-plugin-jsx/dist/index.mjs
generated
vendored
Normal file
|
|
@ -0,0 +1,992 @@
|
|||
var __defProp = Object.defineProperty;
|
||||
var __defProps = Object.defineProperties;
|
||||
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
||||
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
||||
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
||||
var __spreadValues = (a, b) => {
|
||||
for (var prop in b || (b = {}))
|
||||
if (__hasOwnProp.call(b, prop))
|
||||
__defNormalProp(a, prop, b[prop]);
|
||||
if (__getOwnPropSymbols)
|
||||
for (var prop of __getOwnPropSymbols(b)) {
|
||||
if (__propIsEnum.call(b, prop))
|
||||
__defNormalProp(a, prop, b[prop]);
|
||||
}
|
||||
return a;
|
||||
};
|
||||
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
||||
|
||||
// src/index.ts
|
||||
import * as t5 from "@babel/types";
|
||||
import template from "@babel/template";
|
||||
import syntaxJsx from "@babel/plugin-syntax-jsx";
|
||||
import { addNamed, addNamespace, isModule } from "@babel/helper-module-imports";
|
||||
|
||||
// src/transform-vue-jsx.ts
|
||||
import * as t3 from "@babel/types";
|
||||
import { addDefault } from "@babel/helper-module-imports";
|
||||
|
||||
// src/utils.ts
|
||||
import * as t from "@babel/types";
|
||||
import htmlTags from "html-tags";
|
||||
import svgTags from "svg-tags";
|
||||
|
||||
// src/slotFlags.ts
|
||||
var SlotFlags = /* @__PURE__ */ ((SlotFlags2) => {
|
||||
SlotFlags2[SlotFlags2["STABLE"] = 1] = "STABLE";
|
||||
SlotFlags2[SlotFlags2["DYNAMIC"] = 2] = "DYNAMIC";
|
||||
SlotFlags2[SlotFlags2["FORWARDED"] = 3] = "FORWARDED";
|
||||
return SlotFlags2;
|
||||
})(SlotFlags || {});
|
||||
var slotFlags_default = SlotFlags;
|
||||
|
||||
// src/utils.ts
|
||||
var FRAGMENT = "Fragment";
|
||||
var KEEP_ALIVE = "KeepAlive";
|
||||
var createIdentifier = (state, name) => state.get(name)();
|
||||
var isDirective = (src) => src.startsWith("v-") || src.startsWith("v") && src.length >= 2 && src[1] >= "A" && src[1] <= "Z";
|
||||
var shouldTransformedToSlots = (tag) => !(tag.match(RegExp(`^_?${FRAGMENT}\\d*$`)) || tag === KEEP_ALIVE);
|
||||
var checkIsComponent = (path, state) => {
|
||||
var _a, _b;
|
||||
const namePath = path.get("name");
|
||||
if (namePath.isJSXMemberExpression()) {
|
||||
return shouldTransformedToSlots(namePath.node.property.name);
|
||||
}
|
||||
const tag = namePath.node.name;
|
||||
return !((_b = (_a = state.opts).isCustomElement) == null ? void 0 : _b.call(_a, tag)) && shouldTransformedToSlots(tag) && !htmlTags.includes(tag) && !svgTags.includes(tag);
|
||||
};
|
||||
var transformJSXMemberExpression = (path) => {
|
||||
const objectPath = path.node.object;
|
||||
const propertyPath = path.node.property;
|
||||
const transformedObject = t.isJSXMemberExpression(objectPath) ? transformJSXMemberExpression(
|
||||
path.get("object")
|
||||
) : t.isJSXIdentifier(objectPath) ? t.identifier(objectPath.name) : t.nullLiteral();
|
||||
const transformedProperty = t.identifier(propertyPath.name);
|
||||
return t.memberExpression(transformedObject, transformedProperty);
|
||||
};
|
||||
var getTag = (path, state) => {
|
||||
var _a, _b;
|
||||
const namePath = path.get("openingElement").get("name");
|
||||
if (namePath.isJSXIdentifier()) {
|
||||
const { name } = namePath.node;
|
||||
if (!htmlTags.includes(name) && !svgTags.includes(name)) {
|
||||
return name === FRAGMENT ? createIdentifier(state, FRAGMENT) : path.scope.hasBinding(name) ? t.identifier(name) : ((_b = (_a = state.opts).isCustomElement) == null ? void 0 : _b.call(_a, name)) ? t.stringLiteral(name) : t.callExpression(createIdentifier(state, "resolveComponent"), [
|
||||
t.stringLiteral(name)
|
||||
]);
|
||||
}
|
||||
return t.stringLiteral(name);
|
||||
}
|
||||
if (namePath.isJSXMemberExpression()) {
|
||||
return transformJSXMemberExpression(namePath);
|
||||
}
|
||||
throw new Error(`getTag: ${namePath.type} is not supported`);
|
||||
};
|
||||
var getJSXAttributeName = (path) => {
|
||||
const nameNode = path.node.name;
|
||||
if (t.isJSXIdentifier(nameNode)) {
|
||||
return nameNode.name;
|
||||
}
|
||||
return `${nameNode.namespace.name}:${nameNode.name.name}`;
|
||||
};
|
||||
var transformJSXText = (path) => {
|
||||
const str = transformText(path.node.value);
|
||||
return str !== "" ? t.stringLiteral(str) : null;
|
||||
};
|
||||
var transformText = (text) => {
|
||||
const lines = text.split(/\r\n|\n|\r/);
|
||||
let lastNonEmptyLine = 0;
|
||||
for (let i = 0; i < lines.length; i++) {
|
||||
if (lines[i].match(/[^ \t]/)) {
|
||||
lastNonEmptyLine = i;
|
||||
}
|
||||
}
|
||||
let str = "";
|
||||
for (let i = 0; i < lines.length; i++) {
|
||||
const line = lines[i];
|
||||
const isFirstLine = i === 0;
|
||||
const isLastLine = i === lines.length - 1;
|
||||
const isLastNonEmptyLine = i === lastNonEmptyLine;
|
||||
let trimmedLine = line.replace(/\t/g, " ");
|
||||
if (!isFirstLine) {
|
||||
trimmedLine = trimmedLine.replace(/^[ ]+/, "");
|
||||
}
|
||||
if (!isLastLine) {
|
||||
trimmedLine = trimmedLine.replace(/[ ]+$/, "");
|
||||
}
|
||||
if (trimmedLine) {
|
||||
if (!isLastNonEmptyLine) {
|
||||
trimmedLine += " ";
|
||||
}
|
||||
str += trimmedLine;
|
||||
}
|
||||
}
|
||||
return str;
|
||||
};
|
||||
var transformJSXExpressionContainer = (path) => path.get("expression").node;
|
||||
var transformJSXSpreadChild = (path) => t.spreadElement(path.get("expression").node);
|
||||
var walksScope = (path, name, slotFlag) => {
|
||||
if (path.scope.hasBinding(name) && path.parentPath) {
|
||||
if (t.isJSXElement(path.parentPath.node)) {
|
||||
path.parentPath.setData("slotFlag", slotFlag);
|
||||
}
|
||||
walksScope(path.parentPath, name, slotFlag);
|
||||
}
|
||||
};
|
||||
var buildIIFE = (path, children) => {
|
||||
const { parentPath } = path;
|
||||
if (parentPath.isAssignmentExpression()) {
|
||||
const { left } = parentPath.node;
|
||||
if (t.isIdentifier(left)) {
|
||||
return children.map((child) => {
|
||||
if (t.isIdentifier(child) && child.name === left.name) {
|
||||
const insertName = path.scope.generateUidIdentifier(child.name);
|
||||
parentPath.insertBefore(
|
||||
t.variableDeclaration("const", [
|
||||
t.variableDeclarator(
|
||||
insertName,
|
||||
t.callExpression(
|
||||
t.functionExpression(
|
||||
null,
|
||||
[],
|
||||
t.blockStatement([t.returnStatement(child)])
|
||||
),
|
||||
[]
|
||||
)
|
||||
)
|
||||
])
|
||||
);
|
||||
return insertName;
|
||||
}
|
||||
return child;
|
||||
});
|
||||
}
|
||||
}
|
||||
return children;
|
||||
};
|
||||
var onRE = /^on[^a-z]/;
|
||||
var isOn = (key) => onRE.test(key);
|
||||
var mergeAsArray = (existing, incoming) => {
|
||||
if (t.isArrayExpression(existing.value)) {
|
||||
existing.value.elements.push(incoming.value);
|
||||
} else {
|
||||
existing.value = t.arrayExpression([
|
||||
existing.value,
|
||||
incoming.value
|
||||
]);
|
||||
}
|
||||
};
|
||||
var dedupeProperties = (properties = [], mergeProps) => {
|
||||
if (!mergeProps) {
|
||||
return properties;
|
||||
}
|
||||
const knownProps = /* @__PURE__ */ new Map();
|
||||
const deduped = [];
|
||||
properties.forEach((prop) => {
|
||||
if (t.isStringLiteral(prop.key)) {
|
||||
const { value: name } = prop.key;
|
||||
const existing = knownProps.get(name);
|
||||
if (existing) {
|
||||
if (name === "style" || name === "class" || name.startsWith("on")) {
|
||||
mergeAsArray(existing, prop);
|
||||
}
|
||||
} else {
|
||||
knownProps.set(name, prop);
|
||||
deduped.push(prop);
|
||||
}
|
||||
} else {
|
||||
deduped.push(prop);
|
||||
}
|
||||
});
|
||||
return deduped;
|
||||
};
|
||||
var isConstant = (node) => {
|
||||
if (t.isIdentifier(node)) {
|
||||
return node.name === "undefined";
|
||||
}
|
||||
if (t.isArrayExpression(node)) {
|
||||
const { elements } = node;
|
||||
return elements.every((element) => element && isConstant(element));
|
||||
}
|
||||
if (t.isObjectExpression(node)) {
|
||||
return node.properties.every(
|
||||
(property) => isConstant(property.value)
|
||||
);
|
||||
}
|
||||
if (t.isLiteral(node)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
var transformJSXSpreadAttribute = (nodePath, path, mergeProps, args) => {
|
||||
const argument = path.get("argument");
|
||||
const properties = t.isObjectExpression(argument.node) ? argument.node.properties : void 0;
|
||||
if (!properties) {
|
||||
if (argument.isIdentifier()) {
|
||||
walksScope(
|
||||
nodePath,
|
||||
argument.node.name,
|
||||
slotFlags_default.DYNAMIC
|
||||
);
|
||||
}
|
||||
args.push(mergeProps ? argument.node : t.spreadElement(argument.node));
|
||||
} else if (mergeProps) {
|
||||
args.push(t.objectExpression(properties));
|
||||
} else {
|
||||
args.push(...properties);
|
||||
}
|
||||
};
|
||||
|
||||
// src/parseDirectives.ts
|
||||
import * as t2 from "@babel/types";
|
||||
var getType = (path) => {
|
||||
const typePath = path.get("attributes").find((attribute) => {
|
||||
if (!attribute.isJSXAttribute()) {
|
||||
return false;
|
||||
}
|
||||
return attribute.get("name").isJSXIdentifier() && attribute.get("name").node.name === "type";
|
||||
});
|
||||
return typePath ? typePath.get("value").node : null;
|
||||
};
|
||||
var parseModifiers = (value) => t2.isArrayExpression(value) ? value.elements.map((el) => t2.isStringLiteral(el) ? el.value : "").filter(Boolean) : [];
|
||||
var parseDirectives = (params) => {
|
||||
var _a, _b;
|
||||
const { path, value, state, tag, isComponent } = params;
|
||||
const args = [];
|
||||
const vals = [];
|
||||
const modifiersSet = [];
|
||||
let directiveName;
|
||||
let directiveArgument;
|
||||
let directiveModifiers;
|
||||
if ("namespace" in path.node.name) {
|
||||
[directiveName, directiveArgument] = params.name.split(":");
|
||||
directiveName = path.node.name.namespace.name;
|
||||
directiveArgument = path.node.name.name.name;
|
||||
directiveModifiers = directiveArgument.split("_").slice(1);
|
||||
} else {
|
||||
const underscoreModifiers = params.name.split("_");
|
||||
directiveName = underscoreModifiers.shift() || "";
|
||||
directiveModifiers = underscoreModifiers;
|
||||
}
|
||||
directiveName = directiveName.replace(/^v/, "").replace(/^-/, "").replace(/^\S/, (s) => s.toLowerCase());
|
||||
if (directiveArgument) {
|
||||
args.push(t2.stringLiteral(directiveArgument));
|
||||
}
|
||||
const isVModels = directiveName === "models";
|
||||
const isVModel = directiveName === "model";
|
||||
if (isVModel && !path.get("value").isJSXExpressionContainer()) {
|
||||
throw new Error("You have to use JSX Expression inside your v-model");
|
||||
}
|
||||
if (isVModels && !isComponent) {
|
||||
throw new Error("v-models can only use in custom components");
|
||||
}
|
||||
const shouldResolve = !["html", "text", "model", "models"].includes(directiveName) || isVModel && !isComponent;
|
||||
let modifiers = directiveModifiers;
|
||||
if (t2.isArrayExpression(value)) {
|
||||
const elementsList = isVModels ? value.elements : [value];
|
||||
elementsList.forEach((element) => {
|
||||
if (isVModels && !t2.isArrayExpression(element)) {
|
||||
throw new Error("You should pass a Two-dimensional Arrays to v-models");
|
||||
}
|
||||
const { elements } = element;
|
||||
const [first, second, third] = elements;
|
||||
if (second && !t2.isArrayExpression(second) && !t2.isSpreadElement(second)) {
|
||||
args.push(second);
|
||||
modifiers = parseModifiers(third);
|
||||
} else if (t2.isArrayExpression(second)) {
|
||||
if (!shouldResolve) {
|
||||
args.push(t2.nullLiteral());
|
||||
}
|
||||
modifiers = parseModifiers(second);
|
||||
} else if (!shouldResolve) {
|
||||
args.push(t2.nullLiteral());
|
||||
}
|
||||
modifiersSet.push(new Set(modifiers));
|
||||
vals.push(first);
|
||||
});
|
||||
} else if (isVModel && !shouldResolve) {
|
||||
args.push(t2.nullLiteral());
|
||||
modifiersSet.push(new Set(directiveModifiers));
|
||||
} else {
|
||||
modifiersSet.push(new Set(directiveModifiers));
|
||||
}
|
||||
return {
|
||||
directiveName,
|
||||
modifiers: modifiersSet,
|
||||
values: vals.length ? vals : [value],
|
||||
args,
|
||||
directive: shouldResolve ? [
|
||||
resolveDirective(path, state, tag, directiveName),
|
||||
vals[0] || value,
|
||||
((_a = modifiersSet[0]) == null ? void 0 : _a.size) ? args[0] || t2.unaryExpression("void", t2.numericLiteral(0), true) : args[0],
|
||||
!!((_b = modifiersSet[0]) == null ? void 0 : _b.size) && t2.objectExpression(
|
||||
[...modifiersSet[0]].map(
|
||||
(modifier) => t2.objectProperty(t2.identifier(modifier), t2.booleanLiteral(true))
|
||||
)
|
||||
)
|
||||
].filter(Boolean) : void 0
|
||||
};
|
||||
};
|
||||
var resolveDirective = (path, state, tag, directiveName) => {
|
||||
if (directiveName === "show") {
|
||||
return createIdentifier(state, "vShow");
|
||||
}
|
||||
if (directiveName === "model") {
|
||||
let modelToUse;
|
||||
const type = getType(path.parentPath);
|
||||
switch (tag.value) {
|
||||
case "select":
|
||||
modelToUse = createIdentifier(state, "vModelSelect");
|
||||
break;
|
||||
case "textarea":
|
||||
modelToUse = createIdentifier(state, "vModelText");
|
||||
break;
|
||||
default:
|
||||
if (t2.isStringLiteral(type) || !type) {
|
||||
switch (type == null ? void 0 : type.value) {
|
||||
case "checkbox":
|
||||
modelToUse = createIdentifier(state, "vModelCheckbox");
|
||||
break;
|
||||
case "radio":
|
||||
modelToUse = createIdentifier(state, "vModelRadio");
|
||||
break;
|
||||
default:
|
||||
modelToUse = createIdentifier(state, "vModelText");
|
||||
}
|
||||
} else {
|
||||
modelToUse = createIdentifier(state, "vModelDynamic");
|
||||
}
|
||||
}
|
||||
return modelToUse;
|
||||
}
|
||||
return t2.callExpression(createIdentifier(state, "resolveDirective"), [
|
||||
t2.stringLiteral(directiveName)
|
||||
]);
|
||||
};
|
||||
var parseDirectives_default = parseDirectives;
|
||||
|
||||
// src/transform-vue-jsx.ts
|
||||
var xlinkRE = /^xlink([A-Z])/;
|
||||
var getJSXAttributeValue = (path, state) => {
|
||||
const valuePath = path.get("value");
|
||||
if (valuePath.isJSXElement()) {
|
||||
return transformJSXElement(valuePath, state);
|
||||
}
|
||||
if (valuePath.isStringLiteral()) {
|
||||
return t3.stringLiteral(transformText(valuePath.node.value));
|
||||
}
|
||||
if (valuePath.isJSXExpressionContainer()) {
|
||||
return transformJSXExpressionContainer(valuePath);
|
||||
}
|
||||
return null;
|
||||
};
|
||||
var buildProps = (path, state) => {
|
||||
const tag = getTag(path, state);
|
||||
const isComponent = checkIsComponent(path.get("openingElement"), state);
|
||||
const props = path.get("openingElement").get("attributes");
|
||||
const directives = [];
|
||||
const dynamicPropNames = /* @__PURE__ */ new Set();
|
||||
let slots = null;
|
||||
let patchFlag = 0;
|
||||
if (props.length === 0) {
|
||||
return {
|
||||
tag,
|
||||
isComponent,
|
||||
slots,
|
||||
props: t3.nullLiteral(),
|
||||
directives,
|
||||
patchFlag,
|
||||
dynamicPropNames
|
||||
};
|
||||
}
|
||||
let properties = [];
|
||||
let hasRef = false;
|
||||
let hasClassBinding = false;
|
||||
let hasStyleBinding = false;
|
||||
let hasHydrationEventBinding = false;
|
||||
let hasDynamicKeys = false;
|
||||
const mergeArgs = [];
|
||||
const { mergeProps = true } = state.opts;
|
||||
props.forEach((prop) => {
|
||||
if (prop.isJSXAttribute()) {
|
||||
let name = getJSXAttributeName(prop);
|
||||
const attributeValue = getJSXAttributeValue(prop, state);
|
||||
if (!isConstant(attributeValue) || name === "ref") {
|
||||
if (!isComponent && isOn(name) && // omit the flag for click handlers becaues hydration gives click
|
||||
// dedicated fast path.
|
||||
name.toLowerCase() !== "onclick" && // omit v-model handlers
|
||||
name !== "onUpdate:modelValue") {
|
||||
hasHydrationEventBinding = true;
|
||||
}
|
||||
if (name === "ref") {
|
||||
hasRef = true;
|
||||
} else if (name === "class" && !isComponent) {
|
||||
hasClassBinding = true;
|
||||
} else if (name === "style" && !isComponent) {
|
||||
hasStyleBinding = true;
|
||||
} else if (name !== "key" && !isDirective(name) && name !== "on") {
|
||||
dynamicPropNames.add(name);
|
||||
}
|
||||
}
|
||||
if (state.opts.transformOn && (name === "on" || name === "nativeOn")) {
|
||||
if (!state.get("transformOn")) {
|
||||
state.set(
|
||||
"transformOn",
|
||||
addDefault(path, "@vue/babel-helper-vue-transform-on", {
|
||||
nameHint: "_transformOn"
|
||||
})
|
||||
);
|
||||
}
|
||||
mergeArgs.push(
|
||||
t3.callExpression(state.get("transformOn"), [
|
||||
attributeValue || t3.booleanLiteral(true)
|
||||
])
|
||||
);
|
||||
return;
|
||||
}
|
||||
if (isDirective(name)) {
|
||||
const { directive, modifiers, values, args, directiveName } = parseDirectives_default({
|
||||
tag,
|
||||
isComponent,
|
||||
name,
|
||||
path: prop,
|
||||
state,
|
||||
value: attributeValue
|
||||
});
|
||||
if (directiveName === "slots") {
|
||||
slots = attributeValue;
|
||||
return;
|
||||
}
|
||||
if (directive) {
|
||||
directives.push(t3.arrayExpression(directive));
|
||||
} else if (directiveName === "html") {
|
||||
properties.push(
|
||||
t3.objectProperty(t3.stringLiteral("innerHTML"), values[0])
|
||||
);
|
||||
dynamicPropNames.add("innerHTML");
|
||||
} else if (directiveName === "text") {
|
||||
properties.push(
|
||||
t3.objectProperty(t3.stringLiteral("textContent"), values[0])
|
||||
);
|
||||
dynamicPropNames.add("textContent");
|
||||
}
|
||||
if (["models", "model"].includes(directiveName)) {
|
||||
values.forEach((value, index) => {
|
||||
var _a;
|
||||
const propName = args[index];
|
||||
const isDynamic = propName && !t3.isStringLiteral(propName) && !t3.isNullLiteral(propName);
|
||||
if (!directive) {
|
||||
properties.push(
|
||||
t3.objectProperty(
|
||||
t3.isNullLiteral(propName) ? t3.stringLiteral("modelValue") : propName,
|
||||
value,
|
||||
isDynamic
|
||||
)
|
||||
);
|
||||
if (!isDynamic) {
|
||||
dynamicPropNames.add(
|
||||
(propName == null ? void 0 : propName.value) || "modelValue"
|
||||
);
|
||||
}
|
||||
if ((_a = modifiers[index]) == null ? void 0 : _a.size) {
|
||||
properties.push(
|
||||
t3.objectProperty(
|
||||
isDynamic ? t3.binaryExpression(
|
||||
"+",
|
||||
propName,
|
||||
t3.stringLiteral("Modifiers")
|
||||
) : t3.stringLiteral(
|
||||
`${(propName == null ? void 0 : propName.value) || "model"}Modifiers`
|
||||
),
|
||||
t3.objectExpression(
|
||||
[...modifiers[index]].map(
|
||||
(modifier) => t3.objectProperty(
|
||||
t3.stringLiteral(modifier),
|
||||
t3.booleanLiteral(true)
|
||||
)
|
||||
)
|
||||
),
|
||||
isDynamic
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
const updateName = isDynamic ? t3.binaryExpression("+", t3.stringLiteral("onUpdate"), propName) : t3.stringLiteral(
|
||||
`onUpdate:${(propName == null ? void 0 : propName.value) || "modelValue"}`
|
||||
);
|
||||
properties.push(
|
||||
t3.objectProperty(
|
||||
updateName,
|
||||
t3.arrowFunctionExpression(
|
||||
[t3.identifier("$event")],
|
||||
t3.assignmentExpression(
|
||||
"=",
|
||||
value,
|
||||
t3.identifier("$event")
|
||||
)
|
||||
),
|
||||
isDynamic
|
||||
)
|
||||
);
|
||||
if (!isDynamic) {
|
||||
dynamicPropNames.add(updateName.value);
|
||||
} else {
|
||||
hasDynamicKeys = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
if (name.match(xlinkRE)) {
|
||||
name = name.replace(
|
||||
xlinkRE,
|
||||
(_, firstCharacter) => `xlink:${firstCharacter.toLowerCase()}`
|
||||
);
|
||||
}
|
||||
properties.push(
|
||||
t3.objectProperty(
|
||||
t3.stringLiteral(name),
|
||||
attributeValue || t3.booleanLiteral(true)
|
||||
)
|
||||
);
|
||||
}
|
||||
} else {
|
||||
if (properties.length && mergeProps) {
|
||||
mergeArgs.push(
|
||||
t3.objectExpression(dedupeProperties(properties, mergeProps))
|
||||
);
|
||||
properties = [];
|
||||
}
|
||||
hasDynamicKeys = true;
|
||||
transformJSXSpreadAttribute(
|
||||
path,
|
||||
prop,
|
||||
mergeProps,
|
||||
mergeProps ? mergeArgs : properties
|
||||
);
|
||||
}
|
||||
});
|
||||
if (hasDynamicKeys) {
|
||||
patchFlag |= 16 /* FULL_PROPS */;
|
||||
} else {
|
||||
if (hasClassBinding) {
|
||||
patchFlag |= 2 /* CLASS */;
|
||||
}
|
||||
if (hasStyleBinding) {
|
||||
patchFlag |= 4 /* STYLE */;
|
||||
}
|
||||
if (dynamicPropNames.size) {
|
||||
patchFlag |= 8 /* PROPS */;
|
||||
}
|
||||
if (hasHydrationEventBinding) {
|
||||
patchFlag |= 32 /* HYDRATE_EVENTS */;
|
||||
}
|
||||
}
|
||||
if ((patchFlag === 0 || patchFlag === 32 /* HYDRATE_EVENTS */) && (hasRef || directives.length > 0)) {
|
||||
patchFlag |= 512 /* NEED_PATCH */;
|
||||
}
|
||||
let propsExpression = t3.nullLiteral();
|
||||
if (mergeArgs.length) {
|
||||
if (properties.length) {
|
||||
mergeArgs.push(
|
||||
t3.objectExpression(dedupeProperties(properties, mergeProps))
|
||||
);
|
||||
}
|
||||
if (mergeArgs.length > 1) {
|
||||
propsExpression = t3.callExpression(
|
||||
createIdentifier(state, "mergeProps"),
|
||||
mergeArgs
|
||||
);
|
||||
} else {
|
||||
propsExpression = mergeArgs[0];
|
||||
}
|
||||
} else if (properties.length) {
|
||||
if (properties.length === 1 && t3.isSpreadElement(properties[0])) {
|
||||
propsExpression = properties[0].argument;
|
||||
} else {
|
||||
propsExpression = t3.objectExpression(
|
||||
dedupeProperties(properties, mergeProps)
|
||||
);
|
||||
}
|
||||
}
|
||||
return {
|
||||
tag,
|
||||
props: propsExpression,
|
||||
isComponent,
|
||||
slots,
|
||||
directives,
|
||||
patchFlag,
|
||||
dynamicPropNames
|
||||
};
|
||||
};
|
||||
var getChildren = (paths, state) => paths.map((path) => {
|
||||
if (path.isJSXText()) {
|
||||
const transformedText = transformJSXText(path);
|
||||
if (transformedText) {
|
||||
return t3.callExpression(createIdentifier(state, "createTextVNode"), [
|
||||
transformedText
|
||||
]);
|
||||
}
|
||||
return transformedText;
|
||||
}
|
||||
if (path.isJSXExpressionContainer()) {
|
||||
const expression = transformJSXExpressionContainer(path);
|
||||
if (t3.isIdentifier(expression)) {
|
||||
const { name } = expression;
|
||||
const { referencePaths = [] } = path.scope.getBinding(name) || {};
|
||||
referencePaths.forEach((referencePath) => {
|
||||
walksScope(referencePath, name, slotFlags_default.DYNAMIC);
|
||||
});
|
||||
}
|
||||
return expression;
|
||||
}
|
||||
if (path.isJSXSpreadChild()) {
|
||||
return transformJSXSpreadChild(path);
|
||||
}
|
||||
if (path.isCallExpression()) {
|
||||
return path.node;
|
||||
}
|
||||
if (path.isJSXElement()) {
|
||||
return transformJSXElement(path, state);
|
||||
}
|
||||
throw new Error(`getChildren: ${path.type} is not supported`);
|
||||
}).filter(
|
||||
(value) => value != null && !t3.isJSXEmptyExpression(value)
|
||||
);
|
||||
var transformJSXElement = (path, state) => {
|
||||
const children = getChildren(path.get("children"), state);
|
||||
const {
|
||||
tag,
|
||||
props,
|
||||
isComponent,
|
||||
directives,
|
||||
patchFlag,
|
||||
dynamicPropNames,
|
||||
slots
|
||||
} = buildProps(path, state);
|
||||
const { optimize = false } = state.opts;
|
||||
const slotFlag = path.getData("slotFlag") || slotFlags_default.STABLE;
|
||||
let VNodeChild;
|
||||
if (children.length > 1 || slots) {
|
||||
VNodeChild = isComponent ? children.length ? t3.objectExpression(
|
||||
[
|
||||
!!children.length && t3.objectProperty(
|
||||
t3.identifier("default"),
|
||||
t3.arrowFunctionExpression(
|
||||
[],
|
||||
t3.arrayExpression(buildIIFE(path, children))
|
||||
)
|
||||
),
|
||||
...slots ? t3.isObjectExpression(slots) ? slots.properties : [t3.spreadElement(slots)] : [],
|
||||
optimize && t3.objectProperty(t3.identifier("_"), t3.numericLiteral(slotFlag))
|
||||
].filter(Boolean)
|
||||
) : slots : t3.arrayExpression(children);
|
||||
} else if (children.length === 1) {
|
||||
const { enableObjectSlots = true } = state.opts;
|
||||
const child = children[0];
|
||||
const objectExpression4 = t3.objectExpression(
|
||||
[
|
||||
t3.objectProperty(
|
||||
t3.identifier("default"),
|
||||
t3.arrowFunctionExpression(
|
||||
[],
|
||||
t3.arrayExpression(buildIIFE(path, [child]))
|
||||
)
|
||||
),
|
||||
optimize && t3.objectProperty(
|
||||
t3.identifier("_"),
|
||||
t3.numericLiteral(slotFlag)
|
||||
)
|
||||
].filter(Boolean)
|
||||
);
|
||||
if (t3.isIdentifier(child) && isComponent) {
|
||||
VNodeChild = enableObjectSlots ? t3.conditionalExpression(
|
||||
t3.callExpression(
|
||||
state.get("@vue/babel-plugin-jsx/runtimeIsSlot")(),
|
||||
[child]
|
||||
),
|
||||
child,
|
||||
objectExpression4
|
||||
) : objectExpression4;
|
||||
} else if (t3.isCallExpression(child) && child.loc && isComponent) {
|
||||
if (enableObjectSlots) {
|
||||
const { scope } = path;
|
||||
const slotId = scope.generateUidIdentifier("slot");
|
||||
if (scope) {
|
||||
scope.push({
|
||||
id: slotId,
|
||||
kind: "let"
|
||||
});
|
||||
}
|
||||
const alternate = t3.objectExpression(
|
||||
[
|
||||
t3.objectProperty(
|
||||
t3.identifier("default"),
|
||||
t3.arrowFunctionExpression(
|
||||
[],
|
||||
t3.arrayExpression(buildIIFE(path, [slotId]))
|
||||
)
|
||||
),
|
||||
optimize && t3.objectProperty(
|
||||
t3.identifier("_"),
|
||||
t3.numericLiteral(slotFlag)
|
||||
)
|
||||
].filter(Boolean)
|
||||
);
|
||||
const assignment = t3.assignmentExpression("=", slotId, child);
|
||||
const condition = t3.callExpression(
|
||||
state.get("@vue/babel-plugin-jsx/runtimeIsSlot")(),
|
||||
[assignment]
|
||||
);
|
||||
VNodeChild = t3.conditionalExpression(condition, slotId, alternate);
|
||||
} else {
|
||||
VNodeChild = objectExpression4;
|
||||
}
|
||||
} else if (t3.isFunctionExpression(child) || t3.isArrowFunctionExpression(child)) {
|
||||
VNodeChild = t3.objectExpression([
|
||||
t3.objectProperty(t3.identifier("default"), child)
|
||||
]);
|
||||
} else if (t3.isObjectExpression(child)) {
|
||||
VNodeChild = t3.objectExpression(
|
||||
[
|
||||
...child.properties,
|
||||
optimize && t3.objectProperty(t3.identifier("_"), t3.numericLiteral(slotFlag))
|
||||
].filter(Boolean)
|
||||
);
|
||||
} else {
|
||||
VNodeChild = isComponent ? t3.objectExpression([
|
||||
t3.objectProperty(
|
||||
t3.identifier("default"),
|
||||
t3.arrowFunctionExpression([], t3.arrayExpression([child]))
|
||||
)
|
||||
]) : t3.arrayExpression([child]);
|
||||
}
|
||||
}
|
||||
const createVNode = t3.callExpression(
|
||||
createIdentifier(state, "createVNode"),
|
||||
[
|
||||
tag,
|
||||
props,
|
||||
VNodeChild || t3.nullLiteral(),
|
||||
!!patchFlag && optimize && t3.numericLiteral(patchFlag),
|
||||
!!dynamicPropNames.size && optimize && t3.arrayExpression(
|
||||
[...dynamicPropNames.keys()].map((name) => t3.stringLiteral(name))
|
||||
)
|
||||
].filter(Boolean)
|
||||
);
|
||||
if (!directives.length) {
|
||||
return createVNode;
|
||||
}
|
||||
return t3.callExpression(createIdentifier(state, "withDirectives"), [
|
||||
createVNode,
|
||||
t3.arrayExpression(directives)
|
||||
]);
|
||||
};
|
||||
var transform_vue_jsx_default = {
|
||||
JSXElement: {
|
||||
exit(path, state) {
|
||||
path.replaceWith(transformJSXElement(path, state));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// src/sugar-fragment.ts
|
||||
import * as t4 from "@babel/types";
|
||||
var transformFragment = (path, Fragment) => {
|
||||
const children = path.get("children") || [];
|
||||
return t4.jsxElement(
|
||||
t4.jsxOpeningElement(Fragment, []),
|
||||
t4.jsxClosingElement(Fragment),
|
||||
children.map(({ node }) => node),
|
||||
false
|
||||
);
|
||||
};
|
||||
var sugar_fragment_default = {
|
||||
JSXFragment: {
|
||||
enter(path, state) {
|
||||
const fragmentCallee = createIdentifier(state, FRAGMENT);
|
||||
path.replaceWith(
|
||||
transformFragment(
|
||||
path,
|
||||
t4.isIdentifier(fragmentCallee) ? t4.jsxIdentifier(fragmentCallee.name) : t4.jsxMemberExpression(
|
||||
t4.jsxIdentifier(fragmentCallee.object.name),
|
||||
t4.jsxIdentifier(fragmentCallee.property.name)
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// src/index.ts
|
||||
var hasJSX = (parentPath) => {
|
||||
let fileHasJSX = false;
|
||||
parentPath.traverse({
|
||||
JSXElement(path) {
|
||||
fileHasJSX = true;
|
||||
path.stop();
|
||||
},
|
||||
JSXFragment(path) {
|
||||
fileHasJSX = true;
|
||||
path.stop();
|
||||
}
|
||||
});
|
||||
return fileHasJSX;
|
||||
};
|
||||
var JSX_ANNOTATION_REGEX = /\*?\s*@jsx\s+([^\s]+)/;
|
||||
var src_default = ({ types }) => ({
|
||||
name: "babel-plugin-jsx",
|
||||
inherits: syntaxJsx,
|
||||
visitor: __spreadProps(__spreadValues(__spreadValues({}, transform_vue_jsx_default), sugar_fragment_default), {
|
||||
Program: {
|
||||
enter(path, state) {
|
||||
if (hasJSX(path)) {
|
||||
const importNames = [
|
||||
"createVNode",
|
||||
"Fragment",
|
||||
"resolveComponent",
|
||||
"withDirectives",
|
||||
"vShow",
|
||||
"vModelSelect",
|
||||
"vModelText",
|
||||
"vModelCheckbox",
|
||||
"vModelRadio",
|
||||
"vModelText",
|
||||
"vModelDynamic",
|
||||
"resolveDirective",
|
||||
"mergeProps",
|
||||
"createTextVNode",
|
||||
"isVNode"
|
||||
];
|
||||
if (isModule(path)) {
|
||||
const importMap = {};
|
||||
importNames.forEach((name) => {
|
||||
state.set(name, () => {
|
||||
if (importMap[name]) {
|
||||
return types.cloneNode(importMap[name]);
|
||||
}
|
||||
const identifier5 = addNamed(path, name, "vue", {
|
||||
ensureLiveReference: true
|
||||
});
|
||||
importMap[name] = identifier5;
|
||||
return identifier5;
|
||||
});
|
||||
});
|
||||
const { enableObjectSlots = true } = state.opts;
|
||||
if (enableObjectSlots) {
|
||||
state.set("@vue/babel-plugin-jsx/runtimeIsSlot", () => {
|
||||
if (importMap.runtimeIsSlot) {
|
||||
return importMap.runtimeIsSlot;
|
||||
}
|
||||
const { name: isVNodeName } = state.get(
|
||||
"isVNode"
|
||||
)();
|
||||
const isSlot = path.scope.generateUidIdentifier("isSlot");
|
||||
const ast = template.ast`
|
||||
function ${isSlot.name}(s) {
|
||||
return typeof s === 'function' || (Object.prototype.toString.call(s) === '[object Object]' && !${isVNodeName}(s));
|
||||
}
|
||||
`;
|
||||
const lastImport = path.get("body").filter((p) => p.isImportDeclaration()).pop();
|
||||
if (lastImport) {
|
||||
lastImport.insertAfter(ast);
|
||||
}
|
||||
importMap.runtimeIsSlot = isSlot;
|
||||
return isSlot;
|
||||
});
|
||||
}
|
||||
} else {
|
||||
let sourceName;
|
||||
importNames.forEach((name) => {
|
||||
state.set(name, () => {
|
||||
if (!sourceName) {
|
||||
sourceName = addNamespace(path, "vue", {
|
||||
ensureLiveReference: true
|
||||
});
|
||||
}
|
||||
return t5.memberExpression(sourceName, t5.identifier(name));
|
||||
});
|
||||
});
|
||||
const helpers = {};
|
||||
const { enableObjectSlots = true } = state.opts;
|
||||
if (enableObjectSlots) {
|
||||
state.set("@vue/babel-plugin-jsx/runtimeIsSlot", () => {
|
||||
if (helpers.runtimeIsSlot) {
|
||||
return helpers.runtimeIsSlot;
|
||||
}
|
||||
const isSlot = path.scope.generateUidIdentifier("isSlot");
|
||||
const { object: objectName } = state.get(
|
||||
"isVNode"
|
||||
)();
|
||||
const ast = template.ast`
|
||||
function ${isSlot.name}(s) {
|
||||
return typeof s === 'function' || (Object.prototype.toString.call(s) === '[object Object]' && !${objectName.name}.isVNode(s));
|
||||
}
|
||||
`;
|
||||
const nodePaths = path.get("body");
|
||||
const lastImport = nodePaths.filter(
|
||||
(p) => p.isVariableDeclaration() && p.node.declarations.some(
|
||||
(d) => {
|
||||
var _a;
|
||||
return ((_a = d.id) == null ? void 0 : _a.name) === sourceName.name;
|
||||
}
|
||||
)
|
||||
).pop();
|
||||
if (lastImport) {
|
||||
lastImport.insertAfter(ast);
|
||||
}
|
||||
return isSlot;
|
||||
});
|
||||
}
|
||||
}
|
||||
const {
|
||||
opts: { pragma = "" },
|
||||
file
|
||||
} = state;
|
||||
if (pragma) {
|
||||
state.set("createVNode", () => t5.identifier(pragma));
|
||||
}
|
||||
if (file.ast.comments) {
|
||||
for (const comment of file.ast.comments) {
|
||||
const jsxMatches = JSX_ANNOTATION_REGEX.exec(comment.value);
|
||||
if (jsxMatches) {
|
||||
state.set("createVNode", () => t5.identifier(jsxMatches[1]));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
exit(path) {
|
||||
const body = path.get("body");
|
||||
const specifiersMap = /* @__PURE__ */ new Map();
|
||||
body.filter(
|
||||
(nodePath) => t5.isImportDeclaration(nodePath.node) && nodePath.node.source.value === "vue"
|
||||
).forEach((nodePath) => {
|
||||
const { specifiers: specifiers2 } = nodePath.node;
|
||||
let shouldRemove = false;
|
||||
specifiers2.forEach((specifier) => {
|
||||
if (!specifier.loc && t5.isImportSpecifier(specifier) && t5.isIdentifier(specifier.imported)) {
|
||||
specifiersMap.set(specifier.imported.name, specifier);
|
||||
shouldRemove = true;
|
||||
}
|
||||
});
|
||||
if (shouldRemove) {
|
||||
nodePath.remove();
|
||||
}
|
||||
});
|
||||
const specifiers = [...specifiersMap.keys()].map(
|
||||
(imported) => specifiersMap.get(imported)
|
||||
);
|
||||
if (specifiers.length) {
|
||||
path.unshiftContainer(
|
||||
"body",
|
||||
t5.importDeclaration(specifiers, t5.stringLiteral("vue"))
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
export {
|
||||
src_default as default
|
||||
};
|
||||
50
node_modules/@vue/babel-plugin-jsx/package.json
generated
vendored
Normal file
50
node_modules/@vue/babel-plugin-jsx/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
{
|
||||
"name": "@vue/babel-plugin-jsx",
|
||||
"version": "1.1.5",
|
||||
"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.5",
|
||||
"@babel/plugin-syntax-jsx": "^7.22.5",
|
||||
"@babel/template": "^7.22.5",
|
||||
"@babel/traverse": "^7.22.5",
|
||||
"@babel/types": "^7.22.5",
|
||||
"camelcase": "^6.3.0",
|
||||
"html-tags": "^3.3.1",
|
||||
"svg-tags": "^1.0.0",
|
||||
"@vue/babel-helper-vue-transform-on": "^1.1.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.22.5",
|
||||
"@babel/preset-env": "^7.22.5",
|
||||
"@types/babel__template": "^7.4.1",
|
||||
"@types/babel__traverse": "^7.20.1",
|
||||
"@types/svg-tags": "^1.0.0",
|
||||
"@vue/runtime-dom": "^3.3.4",
|
||||
"@vue/test-utils": "^2.4.0",
|
||||
"regenerator-runtime": "^0.13.11",
|
||||
"vue": "^3.3.4"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@babel/core": "^7.0.0-0"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "tsup",
|
||||
"watch": "tsup --watch"
|
||||
}
|
||||
}
|
||||
21
node_modules/@vue/compiler-core/LICENSE
generated
vendored
Normal file
21
node_modules/@vue/compiler-core/LICENSE
generated
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2018-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.
|
||||
1
node_modules/@vue/compiler-core/README.md
generated
vendored
Normal file
1
node_modules/@vue/compiler-core/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
# @vue/compiler-core
|
||||
5486
node_modules/@vue/compiler-core/dist/compiler-core.cjs.js
generated
vendored
Normal file
5486
node_modules/@vue/compiler-core/dist/compiler-core.cjs.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
5355
node_modules/@vue/compiler-core/dist/compiler-core.cjs.prod.js
generated
vendored
Normal file
5355
node_modules/@vue/compiler-core/dist/compiler-core.cjs.prod.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
992
node_modules/@vue/compiler-core/dist/compiler-core.d.ts
generated
vendored
Normal file
992
node_modules/@vue/compiler-core/dist/compiler-core.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,992 @@
|
|||
import { ParserPlugin } from '@babel/parser';
|
||||
import { RawSourceMap, SourceMapGenerator } from 'source-map-js';
|
||||
import { Node as Node$1, Identifier, Function, BlockStatement as BlockStatement$1, Program, ObjectProperty } from '@babel/types';
|
||||
export { generateCodeFrame } from '@vue/shared';
|
||||
|
||||
type OptionalOptions = 'whitespace' | 'isNativeTag' | 'isBuiltInComponent' | keyof CompilerCompatOptions;
|
||||
type MergedParserOptions = Omit<Required<ParserOptions>, OptionalOptions> & Pick<ParserOptions, OptionalOptions>;
|
||||
export declare const enum TextModes {
|
||||
DATA = 0,
|
||||
RCDATA = 1,
|
||||
RAWTEXT = 2,
|
||||
CDATA = 3,
|
||||
ATTRIBUTE_VALUE = 4
|
||||
}
|
||||
interface ParserContext {
|
||||
options: MergedParserOptions;
|
||||
readonly originalSource: string;
|
||||
source: string;
|
||||
offset: number;
|
||||
line: number;
|
||||
column: number;
|
||||
inPre: boolean;
|
||||
inVPre: boolean;
|
||||
onWarn: NonNullable<ErrorHandlingOptions['onWarn']>;
|
||||
}
|
||||
export declare function baseParse(content: string, options?: ParserOptions): RootNode;
|
||||
|
||||
type CompilerCompatConfig = Partial<Record<CompilerDeprecationTypes, boolean | 'suppress-warning'>> & {
|
||||
MODE?: 2 | 3;
|
||||
};
|
||||
interface CompilerCompatOptions {
|
||||
compatConfig?: CompilerCompatConfig;
|
||||
}
|
||||
export declare const enum CompilerDeprecationTypes {
|
||||
COMPILER_IS_ON_ELEMENT = "COMPILER_IS_ON_ELEMENT",
|
||||
COMPILER_V_BIND_SYNC = "COMPILER_V_BIND_SYNC",
|
||||
COMPILER_V_BIND_PROP = "COMPILER_V_BIND_PROP",
|
||||
COMPILER_V_BIND_OBJECT_ORDER = "COMPILER_V_BIND_OBJECT_ORDER",
|
||||
COMPILER_V_ON_NATIVE = "COMPILER_V_ON_NATIVE",
|
||||
COMPILER_V_IF_V_FOR_PRECEDENCE = "COMPILER_V_IF_V_FOR_PRECEDENCE",
|
||||
COMPILER_NATIVE_TEMPLATE = "COMPILER_NATIVE_TEMPLATE",
|
||||
COMPILER_INLINE_TEMPLATE = "COMPILER_INLINE_TEMPLATE",
|
||||
COMPILER_FILTERS = "COMPILER_FILTER"
|
||||
}
|
||||
export declare function checkCompatEnabled(key: CompilerDeprecationTypes, context: ParserContext | TransformContext, loc: SourceLocation | null, ...args: any[]): boolean;
|
||||
export declare function warnDeprecation(key: CompilerDeprecationTypes, context: ParserContext | TransformContext, loc: SourceLocation | null, ...args: any[]): void;
|
||||
|
||||
export type NodeTransform = (node: RootNode | TemplateChildNode, context: TransformContext) => void | (() => void) | (() => void)[];
|
||||
export type DirectiveTransform = (dir: DirectiveNode, node: ElementNode, context: TransformContext, augmentor?: (ret: DirectiveTransformResult) => DirectiveTransformResult) => DirectiveTransformResult;
|
||||
interface DirectiveTransformResult {
|
||||
props: Property[];
|
||||
needRuntime?: boolean | symbol;
|
||||
ssrTagParts?: TemplateLiteral['elements'];
|
||||
}
|
||||
export type StructuralDirectiveTransform = (node: ElementNode, dir: DirectiveNode, context: TransformContext) => void | (() => void);
|
||||
interface ImportItem {
|
||||
exp: string | ExpressionNode;
|
||||
path: string;
|
||||
}
|
||||
export interface TransformContext extends Required<Omit<TransformOptions, 'filename' | keyof CompilerCompatOptions>>, CompilerCompatOptions {
|
||||
selfName: string | null;
|
||||
root: RootNode;
|
||||
helpers: Map<symbol, number>;
|
||||
components: Set<string>;
|
||||
directives: Set<string>;
|
||||
hoists: (JSChildNode | null)[];
|
||||
imports: ImportItem[];
|
||||
temps: number;
|
||||
cached: number;
|
||||
identifiers: {
|
||||
[name: string]: number | undefined;
|
||||
};
|
||||
scopes: {
|
||||
vFor: number;
|
||||
vSlot: number;
|
||||
vPre: number;
|
||||
vOnce: number;
|
||||
};
|
||||
parent: ParentNode | null;
|
||||
childIndex: number;
|
||||
currentNode: RootNode | TemplateChildNode | null;
|
||||
inVOnce: boolean;
|
||||
helper<T extends symbol>(name: T): T;
|
||||
removeHelper<T extends symbol>(name: T): void;
|
||||
helperString(name: symbol): string;
|
||||
replaceNode(node: TemplateChildNode): void;
|
||||
removeNode(node?: TemplateChildNode): void;
|
||||
onNodeRemoved(): void;
|
||||
addIdentifiers(exp: ExpressionNode | string): void;
|
||||
removeIdentifiers(exp: ExpressionNode | string): void;
|
||||
hoist(exp: string | JSChildNode | ArrayExpression): SimpleExpressionNode;
|
||||
cache<T extends JSChildNode>(exp: T, isVNode?: boolean): CacheExpression | T;
|
||||
constantCache: Map<TemplateChildNode, ConstantTypes>;
|
||||
filters?: Set<string>;
|
||||
}
|
||||
export declare function createTransformContext(root: RootNode, { filename, prefixIdentifiers, hoistStatic, cacheHandlers, nodeTransforms, directiveTransforms, transformHoist, isBuiltInComponent, isCustomElement, expressionPlugins, scopeId, slotted, ssr, inSSR, ssrCssVars, bindingMetadata, inline, isTS, onError, onWarn, compatConfig }: TransformOptions): TransformContext;
|
||||
export declare function transform(root: RootNode, options: TransformOptions): void;
|
||||
export declare function traverseNode(node: RootNode | TemplateChildNode, context: TransformContext): void;
|
||||
export declare function createStructuralDirectiveTransform(name: string | RegExp, fn: StructuralDirectiveTransform): NodeTransform;
|
||||
|
||||
export declare function processFor(node: ElementNode, dir: DirectiveNode, context: TransformContext, processCodegen?: (forNode: ForNode) => (() => void) | undefined): (() => void) | undefined;
|
||||
interface ForParseResult {
|
||||
source: ExpressionNode;
|
||||
value: ExpressionNode | undefined;
|
||||
key: ExpressionNode | undefined;
|
||||
index: ExpressionNode | undefined;
|
||||
}
|
||||
export declare function createForLoopParams({ value, key, index }: ForParseResult, memoArgs?: ExpressionNode[]): ExpressionNode[];
|
||||
|
||||
export declare const FRAGMENT: unique symbol;
|
||||
export declare const TELEPORT: unique symbol;
|
||||
export declare const SUSPENSE: unique symbol;
|
||||
export declare const KEEP_ALIVE: unique symbol;
|
||||
export declare const BASE_TRANSITION: unique symbol;
|
||||
export declare const OPEN_BLOCK: unique symbol;
|
||||
export declare const CREATE_BLOCK: unique symbol;
|
||||
export declare const CREATE_ELEMENT_BLOCK: unique symbol;
|
||||
export declare const CREATE_VNODE: unique symbol;
|
||||
export declare const CREATE_ELEMENT_VNODE: unique symbol;
|
||||
export declare const CREATE_COMMENT: unique symbol;
|
||||
export declare const CREATE_TEXT: unique symbol;
|
||||
export declare const CREATE_STATIC: unique symbol;
|
||||
export declare const RESOLVE_COMPONENT: unique symbol;
|
||||
export declare const RESOLVE_DYNAMIC_COMPONENT: unique symbol;
|
||||
export declare const RESOLVE_DIRECTIVE: unique symbol;
|
||||
export declare const RESOLVE_FILTER: unique symbol;
|
||||
export declare const WITH_DIRECTIVES: unique symbol;
|
||||
export declare const RENDER_LIST: unique symbol;
|
||||
export declare const RENDER_SLOT: unique symbol;
|
||||
export declare const CREATE_SLOTS: unique symbol;
|
||||
export declare const TO_DISPLAY_STRING: unique symbol;
|
||||
export declare const MERGE_PROPS: unique symbol;
|
||||
export declare const NORMALIZE_CLASS: unique symbol;
|
||||
export declare const NORMALIZE_STYLE: unique symbol;
|
||||
export declare const NORMALIZE_PROPS: unique symbol;
|
||||
export declare const GUARD_REACTIVE_PROPS: unique symbol;
|
||||
export declare const TO_HANDLERS: unique symbol;
|
||||
export declare const CAMELIZE: unique symbol;
|
||||
export declare const CAPITALIZE: unique symbol;
|
||||
export declare const TO_HANDLER_KEY: unique symbol;
|
||||
export declare const SET_BLOCK_TRACKING: unique symbol;
|
||||
export declare const PUSH_SCOPE_ID: unique symbol;
|
||||
export declare const POP_SCOPE_ID: unique symbol;
|
||||
export declare const WITH_CTX: unique symbol;
|
||||
export declare const UNREF: unique symbol;
|
||||
export declare const IS_REF: unique symbol;
|
||||
export declare const WITH_MEMO: unique symbol;
|
||||
export declare const IS_MEMO_SAME: unique symbol;
|
||||
export declare const helperNameMap: Record<symbol, string>;
|
||||
export declare function registerRuntimeHelpers(helpers: Record<symbol, string>): void;
|
||||
|
||||
export declare const transformElement: NodeTransform;
|
||||
export declare function resolveComponentType(node: ComponentNode, context: TransformContext, ssr?: boolean): string | symbol | CallExpression;
|
||||
export type PropsExpression = ObjectExpression | CallExpression | ExpressionNode;
|
||||
export declare function buildProps(node: ElementNode, context: TransformContext, props: (DirectiveNode | AttributeNode)[] | undefined, isComponent: boolean, isDynamicComponent: boolean, ssr?: boolean): {
|
||||
props: PropsExpression | undefined;
|
||||
directives: DirectiveNode[];
|
||||
patchFlag: number;
|
||||
dynamicPropNames: string[];
|
||||
shouldUseBlock: boolean;
|
||||
};
|
||||
export declare function buildDirectiveArgs(dir: DirectiveNode, context: TransformContext): ArrayExpression;
|
||||
|
||||
export type Namespace = number;
|
||||
export declare const enum Namespaces {
|
||||
HTML = 0
|
||||
}
|
||||
export declare const enum NodeTypes {
|
||||
ROOT = 0,
|
||||
ELEMENT = 1,
|
||||
TEXT = 2,
|
||||
COMMENT = 3,
|
||||
SIMPLE_EXPRESSION = 4,
|
||||
INTERPOLATION = 5,
|
||||
ATTRIBUTE = 6,
|
||||
DIRECTIVE = 7,
|
||||
COMPOUND_EXPRESSION = 8,
|
||||
IF = 9,
|
||||
IF_BRANCH = 10,
|
||||
FOR = 11,
|
||||
TEXT_CALL = 12,
|
||||
VNODE_CALL = 13,
|
||||
JS_CALL_EXPRESSION = 14,
|
||||
JS_OBJECT_EXPRESSION = 15,
|
||||
JS_PROPERTY = 16,
|
||||
JS_ARRAY_EXPRESSION = 17,
|
||||
JS_FUNCTION_EXPRESSION = 18,
|
||||
JS_CONDITIONAL_EXPRESSION = 19,
|
||||
JS_CACHE_EXPRESSION = 20,
|
||||
JS_BLOCK_STATEMENT = 21,
|
||||
JS_TEMPLATE_LITERAL = 22,
|
||||
JS_IF_STATEMENT = 23,
|
||||
JS_ASSIGNMENT_EXPRESSION = 24,
|
||||
JS_SEQUENCE_EXPRESSION = 25,
|
||||
JS_RETURN_STATEMENT = 26
|
||||
}
|
||||
export declare const enum ElementTypes {
|
||||
ELEMENT = 0,
|
||||
COMPONENT = 1,
|
||||
SLOT = 2,
|
||||
TEMPLATE = 3
|
||||
}
|
||||
export interface Node {
|
||||
type: NodeTypes;
|
||||
loc: SourceLocation;
|
||||
}
|
||||
export interface SourceLocation {
|
||||
start: Position;
|
||||
end: Position;
|
||||
source: string;
|
||||
}
|
||||
export interface Position {
|
||||
offset: number;
|
||||
line: number;
|
||||
column: number;
|
||||
}
|
||||
export type ParentNode = RootNode | ElementNode | IfBranchNode | ForNode;
|
||||
export type ExpressionNode = SimpleExpressionNode | CompoundExpressionNode;
|
||||
export type TemplateChildNode = ElementNode | InterpolationNode | CompoundExpressionNode | TextNode | CommentNode | IfNode | IfBranchNode | ForNode | TextCallNode;
|
||||
export interface RootNode extends Node {
|
||||
type: NodeTypes.ROOT;
|
||||
children: TemplateChildNode[];
|
||||
helpers: Set<symbol>;
|
||||
components: string[];
|
||||
directives: string[];
|
||||
hoists: (JSChildNode | null)[];
|
||||
imports: ImportItem[];
|
||||
cached: number;
|
||||
temps: number;
|
||||
ssrHelpers?: symbol[];
|
||||
codegenNode?: TemplateChildNode | JSChildNode | BlockStatement;
|
||||
filters?: string[];
|
||||
}
|
||||
export type ElementNode = PlainElementNode | ComponentNode | SlotOutletNode | TemplateNode;
|
||||
export interface BaseElementNode extends Node {
|
||||
type: NodeTypes.ELEMENT;
|
||||
ns: Namespace;
|
||||
tag: string;
|
||||
tagType: ElementTypes;
|
||||
isSelfClosing: boolean;
|
||||
props: Array<AttributeNode | DirectiveNode>;
|
||||
children: TemplateChildNode[];
|
||||
}
|
||||
export interface PlainElementNode extends BaseElementNode {
|
||||
tagType: ElementTypes.ELEMENT;
|
||||
codegenNode: VNodeCall | SimpleExpressionNode | CacheExpression | MemoExpression | undefined;
|
||||
ssrCodegenNode?: TemplateLiteral;
|
||||
}
|
||||
export interface ComponentNode extends BaseElementNode {
|
||||
tagType: ElementTypes.COMPONENT;
|
||||
codegenNode: VNodeCall | CacheExpression | MemoExpression | undefined;
|
||||
ssrCodegenNode?: CallExpression;
|
||||
}
|
||||
export interface SlotOutletNode extends BaseElementNode {
|
||||
tagType: ElementTypes.SLOT;
|
||||
codegenNode: RenderSlotCall | CacheExpression | undefined;
|
||||
ssrCodegenNode?: CallExpression;
|
||||
}
|
||||
export interface TemplateNode extends BaseElementNode {
|
||||
tagType: ElementTypes.TEMPLATE;
|
||||
codegenNode: undefined;
|
||||
}
|
||||
export interface TextNode extends Node {
|
||||
type: NodeTypes.TEXT;
|
||||
content: string;
|
||||
}
|
||||
export interface CommentNode extends Node {
|
||||
type: NodeTypes.COMMENT;
|
||||
content: string;
|
||||
}
|
||||
export interface AttributeNode extends Node {
|
||||
type: NodeTypes.ATTRIBUTE;
|
||||
name: string;
|
||||
value: TextNode | undefined;
|
||||
}
|
||||
export interface DirectiveNode extends Node {
|
||||
type: NodeTypes.DIRECTIVE;
|
||||
name: string;
|
||||
exp: ExpressionNode | undefined;
|
||||
arg: ExpressionNode | undefined;
|
||||
modifiers: string[];
|
||||
/**
|
||||
* optional property to cache the expression parse result for v-for
|
||||
*/
|
||||
parseResult?: ForParseResult;
|
||||
}
|
||||
/**
|
||||
* Static types have several levels.
|
||||
* Higher levels implies lower levels. e.g. a node that can be stringified
|
||||
* can always be hoisted and skipped for patch.
|
||||
*/
|
||||
export declare const enum ConstantTypes {
|
||||
NOT_CONSTANT = 0,
|
||||
CAN_SKIP_PATCH = 1,
|
||||
CAN_HOIST = 2,
|
||||
CAN_STRINGIFY = 3
|
||||
}
|
||||
export interface SimpleExpressionNode extends Node {
|
||||
type: NodeTypes.SIMPLE_EXPRESSION;
|
||||
content: string;
|
||||
isStatic: boolean;
|
||||
constType: ConstantTypes;
|
||||
/**
|
||||
* Indicates this is an identifier for a hoist vnode call and points to the
|
||||
* hoisted node.
|
||||
*/
|
||||
hoisted?: JSChildNode;
|
||||
/**
|
||||
* an expression parsed as the params of a function will track
|
||||
* the identifiers declared inside the function body.
|
||||
*/
|
||||
identifiers?: string[];
|
||||
isHandlerKey?: boolean;
|
||||
}
|
||||
export interface InterpolationNode extends Node {
|
||||
type: NodeTypes.INTERPOLATION;
|
||||
content: ExpressionNode;
|
||||
}
|
||||
export interface CompoundExpressionNode extends Node {
|
||||
type: NodeTypes.COMPOUND_EXPRESSION;
|
||||
children: (SimpleExpressionNode | CompoundExpressionNode | InterpolationNode | TextNode | string | symbol)[];
|
||||
/**
|
||||
* an expression parsed as the params of a function will track
|
||||
* the identifiers declared inside the function body.
|
||||
*/
|
||||
identifiers?: string[];
|
||||
isHandlerKey?: boolean;
|
||||
}
|
||||
export interface IfNode extends Node {
|
||||
type: NodeTypes.IF;
|
||||
branches: IfBranchNode[];
|
||||
codegenNode?: IfConditionalExpression | CacheExpression;
|
||||
}
|
||||
export interface IfBranchNode extends Node {
|
||||
type: NodeTypes.IF_BRANCH;
|
||||
condition: ExpressionNode | undefined;
|
||||
children: TemplateChildNode[];
|
||||
userKey?: AttributeNode | DirectiveNode;
|
||||
isTemplateIf?: boolean;
|
||||
}
|
||||
export interface ForNode extends Node {
|
||||
type: NodeTypes.FOR;
|
||||
source: ExpressionNode;
|
||||
valueAlias: ExpressionNode | undefined;
|
||||
keyAlias: ExpressionNode | undefined;
|
||||
objectIndexAlias: ExpressionNode | undefined;
|
||||
parseResult: ForParseResult;
|
||||
children: TemplateChildNode[];
|
||||
codegenNode?: ForCodegenNode;
|
||||
}
|
||||
export interface TextCallNode extends Node {
|
||||
type: NodeTypes.TEXT_CALL;
|
||||
content: TextNode | InterpolationNode | CompoundExpressionNode;
|
||||
codegenNode: CallExpression | SimpleExpressionNode;
|
||||
}
|
||||
export type TemplateTextChildNode = TextNode | InterpolationNode | CompoundExpressionNode;
|
||||
export interface VNodeCall extends Node {
|
||||
type: NodeTypes.VNODE_CALL;
|
||||
tag: string | symbol | CallExpression;
|
||||
props: PropsExpression | undefined;
|
||||
children: TemplateChildNode[] | TemplateTextChildNode | SlotsExpression | ForRenderListExpression | SimpleExpressionNode | undefined;
|
||||
patchFlag: string | undefined;
|
||||
dynamicProps: string | SimpleExpressionNode | undefined;
|
||||
directives: DirectiveArguments | undefined;
|
||||
isBlock: boolean;
|
||||
disableTracking: boolean;
|
||||
isComponent: boolean;
|
||||
}
|
||||
export type JSChildNode = VNodeCall | CallExpression | ObjectExpression | ArrayExpression | ExpressionNode | FunctionExpression | ConditionalExpression | CacheExpression | AssignmentExpression | SequenceExpression;
|
||||
export interface CallExpression extends Node {
|
||||
type: NodeTypes.JS_CALL_EXPRESSION;
|
||||
callee: string | symbol;
|
||||
arguments: (string | symbol | JSChildNode | SSRCodegenNode | TemplateChildNode | TemplateChildNode[])[];
|
||||
}
|
||||
export interface ObjectExpression extends Node {
|
||||
type: NodeTypes.JS_OBJECT_EXPRESSION;
|
||||
properties: Array<Property>;
|
||||
}
|
||||
export interface Property extends Node {
|
||||
type: NodeTypes.JS_PROPERTY;
|
||||
key: ExpressionNode;
|
||||
value: JSChildNode;
|
||||
}
|
||||
export interface ArrayExpression extends Node {
|
||||
type: NodeTypes.JS_ARRAY_EXPRESSION;
|
||||
elements: Array<string | Node>;
|
||||
}
|
||||
export interface FunctionExpression extends Node {
|
||||
type: NodeTypes.JS_FUNCTION_EXPRESSION;
|
||||
params: ExpressionNode | string | (ExpressionNode | string)[] | undefined;
|
||||
returns?: TemplateChildNode | TemplateChildNode[] | JSChildNode;
|
||||
body?: BlockStatement | IfStatement;
|
||||
newline: boolean;
|
||||
/**
|
||||
* This flag is for codegen to determine whether it needs to generate the
|
||||
* withScopeId() wrapper
|
||||
*/
|
||||
isSlot: boolean;
|
||||
/**
|
||||
* __COMPAT__ only, indicates a slot function that should be excluded from
|
||||
* the legacy $scopedSlots instance property.
|
||||
*/
|
||||
isNonScopedSlot?: boolean;
|
||||
}
|
||||
export interface ConditionalExpression extends Node {
|
||||
type: NodeTypes.JS_CONDITIONAL_EXPRESSION;
|
||||
test: JSChildNode;
|
||||
consequent: JSChildNode;
|
||||
alternate: JSChildNode;
|
||||
newline: boolean;
|
||||
}
|
||||
export interface CacheExpression extends Node {
|
||||
type: NodeTypes.JS_CACHE_EXPRESSION;
|
||||
index: number;
|
||||
value: JSChildNode;
|
||||
isVNode: boolean;
|
||||
}
|
||||
export interface MemoExpression extends CallExpression {
|
||||
callee: typeof WITH_MEMO;
|
||||
arguments: [ExpressionNode, MemoFactory, string, string];
|
||||
}
|
||||
interface MemoFactory extends FunctionExpression {
|
||||
returns: BlockCodegenNode;
|
||||
}
|
||||
export type SSRCodegenNode = BlockStatement | TemplateLiteral | IfStatement | AssignmentExpression | ReturnStatement | SequenceExpression;
|
||||
export interface BlockStatement extends Node {
|
||||
type: NodeTypes.JS_BLOCK_STATEMENT;
|
||||
body: (JSChildNode | IfStatement)[];
|
||||
}
|
||||
export interface TemplateLiteral extends Node {
|
||||
type: NodeTypes.JS_TEMPLATE_LITERAL;
|
||||
elements: (string | JSChildNode)[];
|
||||
}
|
||||
export interface IfStatement extends Node {
|
||||
type: NodeTypes.JS_IF_STATEMENT;
|
||||
test: ExpressionNode;
|
||||
consequent: BlockStatement;
|
||||
alternate: IfStatement | BlockStatement | ReturnStatement | undefined;
|
||||
}
|
||||
export interface AssignmentExpression extends Node {
|
||||
type: NodeTypes.JS_ASSIGNMENT_EXPRESSION;
|
||||
left: SimpleExpressionNode;
|
||||
right: JSChildNode;
|
||||
}
|
||||
export interface SequenceExpression extends Node {
|
||||
type: NodeTypes.JS_SEQUENCE_EXPRESSION;
|
||||
expressions: JSChildNode[];
|
||||
}
|
||||
export interface ReturnStatement extends Node {
|
||||
type: NodeTypes.JS_RETURN_STATEMENT;
|
||||
returns: TemplateChildNode | TemplateChildNode[] | JSChildNode;
|
||||
}
|
||||
export interface DirectiveArguments extends ArrayExpression {
|
||||
elements: DirectiveArgumentNode[];
|
||||
}
|
||||
export interface DirectiveArgumentNode extends ArrayExpression {
|
||||
elements: [string] | [string, ExpressionNode] | [string, ExpressionNode, ExpressionNode] | [string, ExpressionNode, ExpressionNode, ObjectExpression];
|
||||
}
|
||||
export interface RenderSlotCall extends CallExpression {
|
||||
callee: typeof RENDER_SLOT;
|
||||
arguments: [string, string | ExpressionNode] | [string, string | ExpressionNode, PropsExpression] | [
|
||||
string,
|
||||
string | ExpressionNode,
|
||||
PropsExpression | '{}',
|
||||
TemplateChildNode[]
|
||||
];
|
||||
}
|
||||
export type SlotsExpression = SlotsObjectExpression | DynamicSlotsExpression;
|
||||
export interface SlotsObjectExpression extends ObjectExpression {
|
||||
properties: SlotsObjectProperty[];
|
||||
}
|
||||
export interface SlotsObjectProperty extends Property {
|
||||
value: SlotFunctionExpression;
|
||||
}
|
||||
export interface SlotFunctionExpression extends FunctionExpression {
|
||||
returns: TemplateChildNode[];
|
||||
}
|
||||
export interface DynamicSlotsExpression extends CallExpression {
|
||||
callee: typeof CREATE_SLOTS;
|
||||
arguments: [SlotsObjectExpression, DynamicSlotEntries];
|
||||
}
|
||||
export interface DynamicSlotEntries extends ArrayExpression {
|
||||
elements: (ConditionalDynamicSlotNode | ListDynamicSlotNode)[];
|
||||
}
|
||||
export interface ConditionalDynamicSlotNode extends ConditionalExpression {
|
||||
consequent: DynamicSlotNode;
|
||||
alternate: DynamicSlotNode | SimpleExpressionNode;
|
||||
}
|
||||
export interface ListDynamicSlotNode extends CallExpression {
|
||||
callee: typeof RENDER_LIST;
|
||||
arguments: [ExpressionNode, ListDynamicSlotIterator];
|
||||
}
|
||||
export interface ListDynamicSlotIterator extends FunctionExpression {
|
||||
returns: DynamicSlotNode;
|
||||
}
|
||||
export interface DynamicSlotNode extends ObjectExpression {
|
||||
properties: [Property, DynamicSlotFnProperty];
|
||||
}
|
||||
export interface DynamicSlotFnProperty extends Property {
|
||||
value: SlotFunctionExpression;
|
||||
}
|
||||
export type BlockCodegenNode = VNodeCall | RenderSlotCall;
|
||||
export interface IfConditionalExpression extends ConditionalExpression {
|
||||
consequent: BlockCodegenNode | MemoExpression;
|
||||
alternate: BlockCodegenNode | IfConditionalExpression | MemoExpression;
|
||||
}
|
||||
export interface ForCodegenNode extends VNodeCall {
|
||||
isBlock: true;
|
||||
tag: typeof FRAGMENT;
|
||||
props: undefined;
|
||||
children: ForRenderListExpression;
|
||||
patchFlag: string;
|
||||
disableTracking: boolean;
|
||||
}
|
||||
export interface ForRenderListExpression extends CallExpression {
|
||||
callee: typeof RENDER_LIST;
|
||||
arguments: [ExpressionNode, ForIteratorExpression];
|
||||
}
|
||||
export interface ForIteratorExpression extends FunctionExpression {
|
||||
returns: BlockCodegenNode;
|
||||
}
|
||||
export declare const locStub: SourceLocation;
|
||||
export declare function createRoot(children: TemplateChildNode[], loc?: SourceLocation): RootNode;
|
||||
export declare function createVNodeCall(context: TransformContext | null, tag: VNodeCall['tag'], props?: VNodeCall['props'], children?: VNodeCall['children'], patchFlag?: VNodeCall['patchFlag'], dynamicProps?: VNodeCall['dynamicProps'], directives?: VNodeCall['directives'], isBlock?: VNodeCall['isBlock'], disableTracking?: VNodeCall['disableTracking'], isComponent?: VNodeCall['isComponent'], loc?: SourceLocation): VNodeCall;
|
||||
export declare function createArrayExpression(elements: ArrayExpression['elements'], loc?: SourceLocation): ArrayExpression;
|
||||
export declare function createObjectExpression(properties: ObjectExpression['properties'], loc?: SourceLocation): ObjectExpression;
|
||||
export declare function createObjectProperty(key: Property['key'] | string, value: Property['value']): Property;
|
||||
export declare function createSimpleExpression(content: SimpleExpressionNode['content'], isStatic?: SimpleExpressionNode['isStatic'], loc?: SourceLocation, constType?: ConstantTypes): SimpleExpressionNode;
|
||||
export declare function createInterpolation(content: InterpolationNode['content'] | string, loc: SourceLocation): InterpolationNode;
|
||||
export declare function createCompoundExpression(children: CompoundExpressionNode['children'], loc?: SourceLocation): CompoundExpressionNode;
|
||||
type InferCodegenNodeType<T> = T extends typeof RENDER_SLOT ? RenderSlotCall : CallExpression;
|
||||
export declare function createCallExpression<T extends CallExpression['callee']>(callee: T, args?: CallExpression['arguments'], loc?: SourceLocation): InferCodegenNodeType<T>;
|
||||
export declare function createFunctionExpression(params: FunctionExpression['params'], returns?: FunctionExpression['returns'], newline?: boolean, isSlot?: boolean, loc?: SourceLocation): FunctionExpression;
|
||||
export declare function createConditionalExpression(test: ConditionalExpression['test'], consequent: ConditionalExpression['consequent'], alternate: ConditionalExpression['alternate'], newline?: boolean): ConditionalExpression;
|
||||
export declare function createCacheExpression(index: number, value: JSChildNode, isVNode?: boolean): CacheExpression;
|
||||
export declare function createBlockStatement(body: BlockStatement['body']): BlockStatement;
|
||||
export declare function createTemplateLiteral(elements: TemplateLiteral['elements']): TemplateLiteral;
|
||||
export declare function createIfStatement(test: IfStatement['test'], consequent: IfStatement['consequent'], alternate?: IfStatement['alternate']): IfStatement;
|
||||
export declare function createAssignmentExpression(left: AssignmentExpression['left'], right: AssignmentExpression['right']): AssignmentExpression;
|
||||
export declare function createSequenceExpression(expressions: SequenceExpression['expressions']): SequenceExpression;
|
||||
export declare function createReturnStatement(returns: ReturnStatement['returns']): ReturnStatement;
|
||||
export declare function getVNodeHelper(ssr: boolean, isComponent: boolean): typeof CREATE_VNODE | typeof CREATE_ELEMENT_VNODE;
|
||||
export declare function getVNodeBlockHelper(ssr: boolean, isComponent: boolean): typeof CREATE_BLOCK | typeof CREATE_ELEMENT_BLOCK;
|
||||
export declare function convertToBlock(node: VNodeCall, { helper, removeHelper, inSSR }: TransformContext): void;
|
||||
|
||||
export interface CompilerError extends SyntaxError {
|
||||
code: number | string;
|
||||
loc?: SourceLocation;
|
||||
}
|
||||
export interface CoreCompilerError extends CompilerError {
|
||||
code: ErrorCodes;
|
||||
}
|
||||
type InferCompilerError<T> = T extends ErrorCodes ? CoreCompilerError : CompilerError;
|
||||
export declare function createCompilerError<T extends number>(code: T, loc?: SourceLocation, messages?: {
|
||||
[code: number]: string;
|
||||
}, additionalMessage?: string): InferCompilerError<T>;
|
||||
export declare const enum ErrorCodes {
|
||||
ABRUPT_CLOSING_OF_EMPTY_COMMENT = 0,
|
||||
CDATA_IN_HTML_CONTENT = 1,
|
||||
DUPLICATE_ATTRIBUTE = 2,
|
||||
END_TAG_WITH_ATTRIBUTES = 3,
|
||||
END_TAG_WITH_TRAILING_SOLIDUS = 4,
|
||||
EOF_BEFORE_TAG_NAME = 5,
|
||||
EOF_IN_CDATA = 6,
|
||||
EOF_IN_COMMENT = 7,
|
||||
EOF_IN_SCRIPT_HTML_COMMENT_LIKE_TEXT = 8,
|
||||
EOF_IN_TAG = 9,
|
||||
INCORRECTLY_CLOSED_COMMENT = 10,
|
||||
INCORRECTLY_OPENED_COMMENT = 11,
|
||||
INVALID_FIRST_CHARACTER_OF_TAG_NAME = 12,
|
||||
MISSING_ATTRIBUTE_VALUE = 13,
|
||||
MISSING_END_TAG_NAME = 14,
|
||||
MISSING_WHITESPACE_BETWEEN_ATTRIBUTES = 15,
|
||||
NESTED_COMMENT = 16,
|
||||
UNEXPECTED_CHARACTER_IN_ATTRIBUTE_NAME = 17,
|
||||
UNEXPECTED_CHARACTER_IN_UNQUOTED_ATTRIBUTE_VALUE = 18,
|
||||
UNEXPECTED_EQUALS_SIGN_BEFORE_ATTRIBUTE_NAME = 19,
|
||||
UNEXPECTED_NULL_CHARACTER = 20,
|
||||
UNEXPECTED_QUESTION_MARK_INSTEAD_OF_TAG_NAME = 21,
|
||||
UNEXPECTED_SOLIDUS_IN_TAG = 22,
|
||||
X_INVALID_END_TAG = 23,
|
||||
X_MISSING_END_TAG = 24,
|
||||
X_MISSING_INTERPOLATION_END = 25,
|
||||
X_MISSING_DIRECTIVE_NAME = 26,
|
||||
X_MISSING_DYNAMIC_DIRECTIVE_ARGUMENT_END = 27,
|
||||
X_V_IF_NO_EXPRESSION = 28,
|
||||
X_V_IF_SAME_KEY = 29,
|
||||
X_V_ELSE_NO_ADJACENT_IF = 30,
|
||||
X_V_FOR_NO_EXPRESSION = 31,
|
||||
X_V_FOR_MALFORMED_EXPRESSION = 32,
|
||||
X_V_FOR_TEMPLATE_KEY_PLACEMENT = 33,
|
||||
X_V_BIND_NO_EXPRESSION = 34,
|
||||
X_V_ON_NO_EXPRESSION = 35,
|
||||
X_V_SLOT_UNEXPECTED_DIRECTIVE_ON_SLOT_OUTLET = 36,
|
||||
X_V_SLOT_MIXED_SLOT_USAGE = 37,
|
||||
X_V_SLOT_DUPLICATE_SLOT_NAMES = 38,
|
||||
X_V_SLOT_EXTRANEOUS_DEFAULT_SLOT_CHILDREN = 39,
|
||||
X_V_SLOT_MISPLACED = 40,
|
||||
X_V_MODEL_NO_EXPRESSION = 41,
|
||||
X_V_MODEL_MALFORMED_EXPRESSION = 42,
|
||||
X_V_MODEL_ON_SCOPE_VARIABLE = 43,
|
||||
X_V_MODEL_ON_PROPS = 44,
|
||||
X_INVALID_EXPRESSION = 45,
|
||||
X_KEEP_ALIVE_INVALID_CHILDREN = 46,
|
||||
X_PREFIX_ID_NOT_SUPPORTED = 47,
|
||||
X_MODULE_MODE_NOT_SUPPORTED = 48,
|
||||
X_CACHE_HANDLER_NOT_SUPPORTED = 49,
|
||||
X_SCOPE_ID_NOT_SUPPORTED = 50,
|
||||
DEPRECATION_VNODE_HOOKS = 51,
|
||||
DEPRECATION_V_IS = 52,
|
||||
__EXTEND_POINT__ = 53
|
||||
}
|
||||
|
||||
interface ErrorHandlingOptions {
|
||||
onWarn?: (warning: CompilerError) => void;
|
||||
onError?: (error: CompilerError) => void;
|
||||
}
|
||||
export interface ParserOptions extends ErrorHandlingOptions, CompilerCompatOptions {
|
||||
/**
|
||||
* e.g. platform native elements, e.g. `<div>` for browsers
|
||||
*/
|
||||
isNativeTag?: (tag: string) => boolean;
|
||||
/**
|
||||
* e.g. native elements that can self-close, e.g. `<img>`, `<br>`, `<hr>`
|
||||
*/
|
||||
isVoidTag?: (tag: string) => boolean;
|
||||
/**
|
||||
* e.g. elements that should preserve whitespace inside, e.g. `<pre>`
|
||||
*/
|
||||
isPreTag?: (tag: string) => boolean;
|
||||
/**
|
||||
* Platform-specific built-in components e.g. `<Transition>`
|
||||
*/
|
||||
isBuiltInComponent?: (tag: string) => symbol | void;
|
||||
/**
|
||||
* Separate option for end users to extend the native elements list
|
||||
*/
|
||||
isCustomElement?: (tag: string) => boolean | void;
|
||||
/**
|
||||
* Get tag namespace
|
||||
*/
|
||||
getNamespace?: (tag: string, parent: ElementNode | undefined) => Namespace;
|
||||
/**
|
||||
* Get text parsing mode for this element
|
||||
*/
|
||||
getTextMode?: (node: ElementNode, parent: ElementNode | undefined) => TextModes;
|
||||
/**
|
||||
* @default ['{{', '}}']
|
||||
*/
|
||||
delimiters?: [string, string];
|
||||
/**
|
||||
* Whitespace handling strategy
|
||||
*/
|
||||
whitespace?: 'preserve' | 'condense';
|
||||
/**
|
||||
* Only needed for DOM compilers
|
||||
*/
|
||||
decodeEntities?: (rawText: string, asAttr: boolean) => string;
|
||||
/**
|
||||
* Whether to keep comments in the templates AST.
|
||||
* This defaults to `true` in development and `false` in production builds.
|
||||
*/
|
||||
comments?: boolean;
|
||||
}
|
||||
export type HoistTransform = (children: TemplateChildNode[], context: TransformContext, parent: ParentNode) => void;
|
||||
export declare const enum BindingTypes {
|
||||
/**
|
||||
* returned from data()
|
||||
*/
|
||||
DATA = "data",
|
||||
/**
|
||||
* declared as a prop
|
||||
*/
|
||||
PROPS = "props",
|
||||
/**
|
||||
* a local alias of a `<script setup>` destructured prop.
|
||||
* the original is stored in __propsAliases of the bindingMetadata object.
|
||||
*/
|
||||
PROPS_ALIASED = "props-aliased",
|
||||
/**
|
||||
* a let binding (may or may not be a ref)
|
||||
*/
|
||||
SETUP_LET = "setup-let",
|
||||
/**
|
||||
* a const binding that can never be a ref.
|
||||
* these bindings don't need `unref()` calls when processed in inlined
|
||||
* template expressions.
|
||||
*/
|
||||
SETUP_CONST = "setup-const",
|
||||
/**
|
||||
* a const binding that does not need `unref()`, but may be mutated.
|
||||
*/
|
||||
SETUP_REACTIVE_CONST = "setup-reactive-const",
|
||||
/**
|
||||
* a const binding that may be a ref.
|
||||
*/
|
||||
SETUP_MAYBE_REF = "setup-maybe-ref",
|
||||
/**
|
||||
* bindings that are guaranteed to be refs
|
||||
*/
|
||||
SETUP_REF = "setup-ref",
|
||||
/**
|
||||
* declared by other options, e.g. computed, inject
|
||||
*/
|
||||
OPTIONS = "options",
|
||||
/**
|
||||
* a literal constant, e.g. 'foo', 1, true
|
||||
*/
|
||||
LITERAL_CONST = "literal-const"
|
||||
}
|
||||
export type BindingMetadata = {
|
||||
[key: string]: BindingTypes | undefined;
|
||||
} & {
|
||||
__isScriptSetup?: boolean;
|
||||
__propsAliases?: Record<string, string>;
|
||||
};
|
||||
interface SharedTransformCodegenOptions {
|
||||
/**
|
||||
* Transform expressions like {{ foo }} to `_ctx.foo`.
|
||||
* If this option is false, the generated code will be wrapped in a
|
||||
* `with (this) { ... }` block.
|
||||
* - This is force-enabled in module mode, since modules are by default strict
|
||||
* and cannot use `with`
|
||||
* @default mode === 'module'
|
||||
*/
|
||||
prefixIdentifiers?: boolean;
|
||||
/**
|
||||
* Control whether generate SSR-optimized render functions instead.
|
||||
* The resulting function must be attached to the component via the
|
||||
* `ssrRender` option instead of `render`.
|
||||
*
|
||||
* When compiler generates code for SSR's fallback branch, we need to set it to false:
|
||||
* - context.ssr = false
|
||||
*
|
||||
* see `subTransform` in `ssrTransformComponent.ts`
|
||||
*/
|
||||
ssr?: boolean;
|
||||
/**
|
||||
* Indicates whether the compiler generates code for SSR,
|
||||
* it is always true when generating code for SSR,
|
||||
* regardless of whether we are generating code for SSR's fallback branch,
|
||||
* this means that when the compiler generates code for SSR's fallback branch:
|
||||
* - context.ssr = false
|
||||
* - context.inSSR = true
|
||||
*/
|
||||
inSSR?: boolean;
|
||||
/**
|
||||
* Optional binding metadata analyzed from script - used to optimize
|
||||
* binding access when `prefixIdentifiers` is enabled.
|
||||
*/
|
||||
bindingMetadata?: BindingMetadata;
|
||||
/**
|
||||
* Compile the function for inlining inside setup().
|
||||
* This allows the function to directly access setup() local bindings.
|
||||
*/
|
||||
inline?: boolean;
|
||||
/**
|
||||
* Indicates that transforms and codegen should try to output valid TS code
|
||||
*/
|
||||
isTS?: boolean;
|
||||
/**
|
||||
* Filename for source map generation.
|
||||
* Also used for self-recursive reference in templates
|
||||
* @default 'template.vue.html'
|
||||
*/
|
||||
filename?: string;
|
||||
}
|
||||
export interface TransformOptions extends SharedTransformCodegenOptions, ErrorHandlingOptions, CompilerCompatOptions {
|
||||
/**
|
||||
* An array of node transforms to be applied to every AST node.
|
||||
*/
|
||||
nodeTransforms?: NodeTransform[];
|
||||
/**
|
||||
* An object of { name: transform } to be applied to every directive attribute
|
||||
* node found on element nodes.
|
||||
*/
|
||||
directiveTransforms?: Record<string, DirectiveTransform | undefined>;
|
||||
/**
|
||||
* An optional hook to transform a node being hoisted.
|
||||
* used by compiler-dom to turn hoisted nodes into stringified HTML vnodes.
|
||||
* @default null
|
||||
*/
|
||||
transformHoist?: HoistTransform | null;
|
||||
/**
|
||||
* If the pairing runtime provides additional built-in elements, use this to
|
||||
* mark them as built-in so the compiler will generate component vnodes
|
||||
* for them.
|
||||
*/
|
||||
isBuiltInComponent?: (tag: string) => symbol | void;
|
||||
/**
|
||||
* Used by some transforms that expects only native elements
|
||||
*/
|
||||
isCustomElement?: (tag: string) => boolean | void;
|
||||
/**
|
||||
* Transform expressions like {{ foo }} to `_ctx.foo`.
|
||||
* If this option is false, the generated code will be wrapped in a
|
||||
* `with (this) { ... }` block.
|
||||
* - This is force-enabled in module mode, since modules are by default strict
|
||||
* and cannot use `with`
|
||||
* @default mode === 'module'
|
||||
*/
|
||||
prefixIdentifiers?: boolean;
|
||||
/**
|
||||
* Hoist static VNodes and props objects to `_hoisted_x` constants
|
||||
* @default false
|
||||
*/
|
||||
hoistStatic?: boolean;
|
||||
/**
|
||||
* Cache v-on handlers to avoid creating new inline functions on each render,
|
||||
* also avoids the need for dynamically patching the handlers by wrapping it.
|
||||
* e.g `@click="foo"` by default is compiled to `{ onClick: foo }`. With this
|
||||
* option it's compiled to:
|
||||
* ```js
|
||||
* { onClick: _cache[0] || (_cache[0] = e => _ctx.foo(e)) }
|
||||
* ```
|
||||
* - Requires "prefixIdentifiers" to be enabled because it relies on scope
|
||||
* analysis to determine if a handler is safe to cache.
|
||||
* @default false
|
||||
*/
|
||||
cacheHandlers?: boolean;
|
||||
/**
|
||||
* A list of parser plugins to enable for `@babel/parser`, which is used to
|
||||
* parse expressions in bindings and interpolations.
|
||||
* https://babeljs.io/docs/en/next/babel-parser#plugins
|
||||
*/
|
||||
expressionPlugins?: ParserPlugin[];
|
||||
/**
|
||||
* SFC scoped styles ID
|
||||
*/
|
||||
scopeId?: string | null;
|
||||
/**
|
||||
* Indicates this SFC template has used :slotted in its styles
|
||||
* Defaults to `true` for backwards compatibility - SFC tooling should set it
|
||||
* to `false` if no `:slotted` usage is detected in `<style>`
|
||||
*/
|
||||
slotted?: boolean;
|
||||
/**
|
||||
* SFC `<style vars>` injection string
|
||||
* Should already be an object expression, e.g. `{ 'xxxx-color': color }`
|
||||
* needed to render inline CSS variables on component root
|
||||
*/
|
||||
ssrCssVars?: string;
|
||||
}
|
||||
export interface CodegenOptions extends SharedTransformCodegenOptions {
|
||||
/**
|
||||
* - `module` mode will generate ES module import statements for helpers
|
||||
* and export the render function as the default export.
|
||||
* - `function` mode will generate a single `const { helpers... } = Vue`
|
||||
* statement and return the render function. It expects `Vue` to be globally
|
||||
* available (or passed by wrapping the code with an IIFE). It is meant to be
|
||||
* used with `new Function(code)()` to generate a render function at runtime.
|
||||
* @default 'function'
|
||||
*/
|
||||
mode?: 'module' | 'function';
|
||||
/**
|
||||
* Generate source map?
|
||||
* @default false
|
||||
*/
|
||||
sourceMap?: boolean;
|
||||
/**
|
||||
* SFC scoped styles ID
|
||||
*/
|
||||
scopeId?: string | null;
|
||||
/**
|
||||
* Option to optimize helper import bindings via variable assignment
|
||||
* (only used for webpack code-split)
|
||||
* @default false
|
||||
*/
|
||||
optimizeImports?: boolean;
|
||||
/**
|
||||
* Customize where to import runtime helpers from.
|
||||
* @default 'vue'
|
||||
*/
|
||||
runtimeModuleName?: string;
|
||||
/**
|
||||
* Customize where to import ssr runtime helpers from/**
|
||||
* @default 'vue/server-renderer'
|
||||
*/
|
||||
ssrRuntimeModuleName?: string;
|
||||
/**
|
||||
* Customize the global variable name of `Vue` to get helpers from
|
||||
* in function mode
|
||||
* @default 'Vue'
|
||||
*/
|
||||
runtimeGlobalName?: string;
|
||||
}
|
||||
export type CompilerOptions = ParserOptions & TransformOptions & CodegenOptions;
|
||||
|
||||
type CodegenNode = TemplateChildNode | JSChildNode | SSRCodegenNode;
|
||||
export interface CodegenResult {
|
||||
code: string;
|
||||
preamble: string;
|
||||
ast: RootNode;
|
||||
map?: RawSourceMap;
|
||||
}
|
||||
export interface CodegenContext extends Omit<Required<CodegenOptions>, 'bindingMetadata' | 'inline'> {
|
||||
source: string;
|
||||
code: string;
|
||||
line: number;
|
||||
column: number;
|
||||
offset: number;
|
||||
indentLevel: number;
|
||||
pure: boolean;
|
||||
map?: SourceMapGenerator;
|
||||
helper(key: symbol): string;
|
||||
push(code: string, node?: CodegenNode): void;
|
||||
indent(): void;
|
||||
deindent(withoutNewLine?: boolean): void;
|
||||
newline(): void;
|
||||
}
|
||||
export declare function generate(ast: RootNode, options?: CodegenOptions & {
|
||||
onContextCreated?: (context: CodegenContext) => void;
|
||||
}): CodegenResult;
|
||||
|
||||
export type TransformPreset = [
|
||||
NodeTransform[],
|
||||
Record<string, DirectiveTransform>
|
||||
];
|
||||
export declare function getBaseTransformPreset(prefixIdentifiers?: boolean): TransformPreset;
|
||||
export declare function baseCompile(template: string | RootNode, options?: CompilerOptions): CodegenResult;
|
||||
|
||||
export declare const isStaticExp: (p: JSChildNode) => p is SimpleExpressionNode;
|
||||
export declare const isBuiltInType: (tag: string, expected: string) => boolean;
|
||||
export declare function isCoreComponent(tag: string): symbol | void;
|
||||
export declare const isSimpleIdentifier: (name: string) => boolean;
|
||||
/**
|
||||
* Simple lexer to check if an expression is a member expression. This is
|
||||
* lax and only checks validity at the root level (i.e. does not validate exps
|
||||
* inside square brackets), but it's ok since these are only used on template
|
||||
* expressions and false positives are invalid expressions in the first place.
|
||||
*/
|
||||
export declare const isMemberExpressionBrowser: (path: string) => boolean;
|
||||
export declare const isMemberExpressionNode: (path: string, context: TransformContext) => boolean;
|
||||
export declare const isMemberExpression: (path: string, context: TransformContext) => boolean;
|
||||
export declare function getInnerRange(loc: SourceLocation, offset: number, length: number): SourceLocation;
|
||||
export declare function advancePositionWithClone(pos: Position, source: string, numberOfCharacters?: number): Position;
|
||||
export declare function advancePositionWithMutation(pos: Position, source: string, numberOfCharacters?: number): Position;
|
||||
export declare function assert(condition: boolean, msg?: string): void;
|
||||
export declare function findDir(node: ElementNode, name: string | RegExp, allowEmpty?: boolean): DirectiveNode | undefined;
|
||||
export declare function findProp(node: ElementNode, name: string, dynamicOnly?: boolean, allowEmpty?: boolean): ElementNode['props'][0] | undefined;
|
||||
export declare function isStaticArgOf(arg: DirectiveNode['arg'], name: string): boolean;
|
||||
export declare function hasDynamicKeyVBind(node: ElementNode): boolean;
|
||||
export declare function isText(node: TemplateChildNode): node is TextNode | InterpolationNode;
|
||||
export declare function isVSlot(p: ElementNode['props'][0]): p is DirectiveNode;
|
||||
export declare function isTemplateNode(node: RootNode | TemplateChildNode): node is TemplateNode;
|
||||
export declare function isSlotOutlet(node: RootNode | TemplateChildNode): node is SlotOutletNode;
|
||||
export declare function injectProp(node: VNodeCall | RenderSlotCall, prop: Property, context: TransformContext): void;
|
||||
export declare function toValidAssetId(name: string, type: 'component' | 'directive' | 'filter'): string;
|
||||
export declare function hasScopeRef(node: TemplateChildNode | IfBranchNode | ExpressionNode | undefined, ids: TransformContext['identifiers']): boolean;
|
||||
export declare function getMemoedVNodeCall(node: BlockCodegenNode | MemoExpression): VNodeCall | RenderSlotCall;
|
||||
|
||||
export declare function walkIdentifiers(root: Node$1, onIdentifier: (node: Identifier, parent: Node$1, parentStack: Node$1[], isReference: boolean, isLocal: boolean) => void, includeAll?: boolean, parentStack?: Node$1[], knownIds?: Record<string, number>): void;
|
||||
export declare function isReferencedIdentifier(id: Identifier, parent: Node$1 | null, parentStack: Node$1[]): boolean;
|
||||
export declare function isInDestructureAssignment(parent: Node$1, parentStack: Node$1[]): boolean;
|
||||
export declare function walkFunctionParams(node: Function, onIdent: (id: Identifier) => void): void;
|
||||
export declare function walkBlockDeclarations(block: BlockStatement$1 | Program, onIdent: (node: Identifier) => void): void;
|
||||
export declare function extractIdentifiers(param: Node$1, nodes?: Identifier[]): Identifier[];
|
||||
export declare const isFunctionType: (node: Node$1) => node is Function;
|
||||
export declare const isStaticProperty: (node: Node$1) => node is ObjectProperty;
|
||||
export declare const isStaticPropertyKey: (node: Node$1, parent: Node$1) => boolean;
|
||||
export declare const TS_NODE_TYPES: string[];
|
||||
|
||||
export declare const transformModel: DirectiveTransform;
|
||||
|
||||
export declare const transformOn: DirectiveTransform;
|
||||
|
||||
export declare const transformBind: DirectiveTransform;
|
||||
|
||||
export declare const noopDirectiveTransform: DirectiveTransform;
|
||||
|
||||
export declare function processIf(node: ElementNode, dir: DirectiveNode, context: TransformContext, processCodegen?: (node: IfNode, branch: IfBranchNode, isRoot: boolean) => (() => void) | undefined): (() => void) | undefined;
|
||||
|
||||
export declare const transformExpression: NodeTransform;
|
||||
export declare function processExpression(node: SimpleExpressionNode, context: TransformContext, asParams?: boolean, asRawStatements?: boolean, localVars?: Record<string, number>): ExpressionNode;
|
||||
export declare function stringifyExpression(exp: ExpressionNode | string): string;
|
||||
|
||||
export declare const trackSlotScopes: NodeTransform;
|
||||
export declare const trackVForSlotScopes: NodeTransform;
|
||||
export type SlotFnBuilder = (slotProps: ExpressionNode | undefined, slotChildren: TemplateChildNode[], loc: SourceLocation) => FunctionExpression;
|
||||
export declare function buildSlots(node: ElementNode, context: TransformContext, buildSlotFn?: SlotFnBuilder): {
|
||||
slots: SlotsExpression;
|
||||
hasDynamicSlots: boolean;
|
||||
};
|
||||
|
||||
interface SlotOutletProcessResult {
|
||||
slotName: string | ExpressionNode;
|
||||
slotProps: PropsExpression | undefined;
|
||||
}
|
||||
export declare function processSlotOutlet(node: SlotOutletNode, context: TransformContext): SlotOutletProcessResult;
|
||||
|
||||
export declare function getConstantType(node: TemplateChildNode | SimpleExpressionNode, context: TransformContext): ConstantTypes;
|
||||
|
||||
4699
node_modules/@vue/compiler-core/dist/compiler-core.esm-bundler.js
generated
vendored
Normal file
4699
node_modules/@vue/compiler-core/dist/compiler-core.esm-bundler.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
7
node_modules/@vue/compiler-core/index.js
generated
vendored
Normal file
7
node_modules/@vue/compiler-core/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
'use strict'
|
||||
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
module.exports = require('./dist/compiler-core.cjs.prod.js')
|
||||
} else {
|
||||
module.exports = require('./dist/compiler-core.cjs.js')
|
||||
}
|
||||
43
node_modules/@vue/compiler-core/package.json
generated
vendored
Normal file
43
node_modules/@vue/compiler-core/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
{
|
||||
"name": "@vue/compiler-core",
|
||||
"version": "3.3.4",
|
||||
"description": "@vue/compiler-core",
|
||||
"main": "index.js",
|
||||
"module": "dist/compiler-core.esm-bundler.js",
|
||||
"types": "dist/compiler-core.d.ts",
|
||||
"files": [
|
||||
"index.js",
|
||||
"dist"
|
||||
],
|
||||
"buildOptions": {
|
||||
"name": "VueCompilerCore",
|
||||
"compat": true,
|
||||
"formats": [
|
||||
"esm-bundler",
|
||||
"cjs"
|
||||
]
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/vuejs/core.git",
|
||||
"directory": "packages/compiler-core"
|
||||
},
|
||||
"keywords": [
|
||||
"vue"
|
||||
],
|
||||
"author": "Evan You",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/vuejs/core/issues"
|
||||
},
|
||||
"homepage": "https://github.com/vuejs/core/tree/main/packages/compiler-core#readme",
|
||||
"dependencies": {
|
||||
"@babel/parser": "^7.21.3",
|
||||
"@vue/shared": "3.3.4",
|
||||
"estree-walker": "^2.0.2",
|
||||
"source-map-js": "^1.0.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/types": "^7.21.3"
|
||||
}
|
||||
}
|
||||
21
node_modules/@vue/compiler-dom/LICENSE
generated
vendored
Normal file
21
node_modules/@vue/compiler-dom/LICENSE
generated
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2018-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.
|
||||
1
node_modules/@vue/compiler-dom/README.md
generated
vendored
Normal file
1
node_modules/@vue/compiler-dom/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
# @vue/compiler-dom
|
||||
3047
node_modules/@vue/compiler-dom/dist/compiler-dom.cjs.js
generated
vendored
Normal file
3047
node_modules/@vue/compiler-dom/dist/compiler-dom.cjs.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
2978
node_modules/@vue/compiler-dom/dist/compiler-dom.cjs.prod.js
generated
vendored
Normal file
2978
node_modules/@vue/compiler-dom/dist/compiler-dom.cjs.prod.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
42
node_modules/@vue/compiler-dom/dist/compiler-dom.d.ts
generated
vendored
Normal file
42
node_modules/@vue/compiler-dom/dist/compiler-dom.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
import { ParserOptions, NodeTransform, SourceLocation, CompilerError, DirectiveTransform, CompilerOptions, CodegenResult, RootNode } from '@vue/compiler-core';
|
||||
export * from '@vue/compiler-core';
|
||||
|
||||
export declare const parserOptions: ParserOptions;
|
||||
|
||||
export declare const V_MODEL_RADIO: unique symbol;
|
||||
export declare const V_MODEL_CHECKBOX: unique symbol;
|
||||
export declare const V_MODEL_TEXT: unique symbol;
|
||||
export declare const V_MODEL_SELECT: unique symbol;
|
||||
export declare const V_MODEL_DYNAMIC: unique symbol;
|
||||
export declare const V_ON_WITH_MODIFIERS: unique symbol;
|
||||
export declare const V_ON_WITH_KEYS: unique symbol;
|
||||
export declare const V_SHOW: unique symbol;
|
||||
export declare const TRANSITION: unique symbol;
|
||||
export declare const TRANSITION_GROUP: unique symbol;
|
||||
|
||||
export declare const transformStyle: NodeTransform;
|
||||
|
||||
interface DOMCompilerError extends CompilerError {
|
||||
code: DOMErrorCodes;
|
||||
}
|
||||
export declare function createDOMCompilerError(code: DOMErrorCodes, loc?: SourceLocation): DOMCompilerError;
|
||||
export declare const enum DOMErrorCodes {
|
||||
X_V_HTML_NO_EXPRESSION = 53,
|
||||
X_V_HTML_WITH_CHILDREN = 54,
|
||||
X_V_TEXT_NO_EXPRESSION = 55,
|
||||
X_V_TEXT_WITH_CHILDREN = 56,
|
||||
X_V_MODEL_ON_INVALID_ELEMENT = 57,
|
||||
X_V_MODEL_ARG_ON_ELEMENT = 58,
|
||||
X_V_MODEL_ON_FILE_INPUT_ELEMENT = 59,
|
||||
X_V_MODEL_UNNECESSARY_VALUE = 60,
|
||||
X_V_SHOW_NO_EXPRESSION = 61,
|
||||
X_TRANSITION_INVALID_CHILDREN = 62,
|
||||
X_IGNORED_SIDE_EFFECT_TAG = 63,
|
||||
__EXTEND_POINT__ = 64
|
||||
}
|
||||
|
||||
export declare const DOMNodeTransforms: NodeTransform[];
|
||||
export declare const DOMDirectiveTransforms: Record<string, DirectiveTransform>;
|
||||
export declare function compile(template: string, options?: CompilerOptions): CodegenResult;
|
||||
export declare function parse(template: string, options?: ParserOptions): RootNode;
|
||||
|
||||
5309
node_modules/@vue/compiler-dom/dist/compiler-dom.esm-browser.js
generated
vendored
Normal file
5309
node_modules/@vue/compiler-dom/dist/compiler-dom.esm-browser.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
1
node_modules/@vue/compiler-dom/dist/compiler-dom.esm-browser.prod.js
generated
vendored
Normal file
1
node_modules/@vue/compiler-dom/dist/compiler-dom.esm-browser.prod.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
489
node_modules/@vue/compiler-dom/dist/compiler-dom.esm-bundler.js
generated
vendored
Normal file
489
node_modules/@vue/compiler-dom/dist/compiler-dom.esm-bundler.js
generated
vendored
Normal file
|
|
@ -0,0 +1,489 @@
|
|||
import { registerRuntimeHelpers, isBuiltInType, createSimpleExpression, createCompilerError, createObjectProperty, getConstantType, createCallExpression, TO_DISPLAY_STRING, transformModel as transformModel$1, findProp, hasDynamicKeyVBind, transformOn as transformOn$1, isStaticExp, createCompoundExpression, checkCompatEnabled, noopDirectiveTransform, baseCompile, baseParse } from '@vue/compiler-core';
|
||||
export * from '@vue/compiler-core';
|
||||
import { isVoidTag, isHTMLTag, isSVGTag, makeMap, parseStringStyle, capitalize, extend } from '@vue/shared';
|
||||
|
||||
const V_MODEL_RADIO = Symbol(!!(process.env.NODE_ENV !== "production") ? `vModelRadio` : ``);
|
||||
const V_MODEL_CHECKBOX = Symbol(!!(process.env.NODE_ENV !== "production") ? `vModelCheckbox` : ``);
|
||||
const V_MODEL_TEXT = Symbol(!!(process.env.NODE_ENV !== "production") ? `vModelText` : ``);
|
||||
const V_MODEL_SELECT = Symbol(!!(process.env.NODE_ENV !== "production") ? `vModelSelect` : ``);
|
||||
const V_MODEL_DYNAMIC = Symbol(!!(process.env.NODE_ENV !== "production") ? `vModelDynamic` : ``);
|
||||
const V_ON_WITH_MODIFIERS = Symbol(!!(process.env.NODE_ENV !== "production") ? `vOnModifiersGuard` : ``);
|
||||
const V_ON_WITH_KEYS = Symbol(!!(process.env.NODE_ENV !== "production") ? `vOnKeysGuard` : ``);
|
||||
const V_SHOW = Symbol(!!(process.env.NODE_ENV !== "production") ? `vShow` : ``);
|
||||
const TRANSITION = Symbol(!!(process.env.NODE_ENV !== "production") ? `Transition` : ``);
|
||||
const TRANSITION_GROUP = Symbol(!!(process.env.NODE_ENV !== "production") ? `TransitionGroup` : ``);
|
||||
registerRuntimeHelpers({
|
||||
[V_MODEL_RADIO]: `vModelRadio`,
|
||||
[V_MODEL_CHECKBOX]: `vModelCheckbox`,
|
||||
[V_MODEL_TEXT]: `vModelText`,
|
||||
[V_MODEL_SELECT]: `vModelSelect`,
|
||||
[V_MODEL_DYNAMIC]: `vModelDynamic`,
|
||||
[V_ON_WITH_MODIFIERS]: `withModifiers`,
|
||||
[V_ON_WITH_KEYS]: `withKeys`,
|
||||
[V_SHOW]: `vShow`,
|
||||
[TRANSITION]: `Transition`,
|
||||
[TRANSITION_GROUP]: `TransitionGroup`
|
||||
});
|
||||
|
||||
let decoder;
|
||||
function decodeHtmlBrowser(raw, asAttr = false) {
|
||||
if (!decoder) {
|
||||
decoder = document.createElement("div");
|
||||
}
|
||||
if (asAttr) {
|
||||
decoder.innerHTML = `<div foo="${raw.replace(/"/g, """)}">`;
|
||||
return decoder.children[0].getAttribute("foo");
|
||||
} else {
|
||||
decoder.innerHTML = raw;
|
||||
return decoder.textContent;
|
||||
}
|
||||
}
|
||||
|
||||
const isRawTextContainer = /* @__PURE__ */ makeMap(
|
||||
"style,iframe,script,noscript",
|
||||
true
|
||||
);
|
||||
const parserOptions = {
|
||||
isVoidTag,
|
||||
isNativeTag: (tag) => isHTMLTag(tag) || isSVGTag(tag),
|
||||
isPreTag: (tag) => tag === "pre",
|
||||
decodeEntities: decodeHtmlBrowser ,
|
||||
isBuiltInComponent: (tag) => {
|
||||
if (isBuiltInType(tag, `Transition`)) {
|
||||
return TRANSITION;
|
||||
} else if (isBuiltInType(tag, `TransitionGroup`)) {
|
||||
return TRANSITION_GROUP;
|
||||
}
|
||||
},
|
||||
// https://html.spec.whatwg.org/multipage/parsing.html#tree-construction-dispatcher
|
||||
getNamespace(tag, parent) {
|
||||
let ns = parent ? parent.ns : 0;
|
||||
if (parent && ns === 2) {
|
||||
if (parent.tag === "annotation-xml") {
|
||||
if (tag === "svg") {
|
||||
return 1;
|
||||
}
|
||||
if (parent.props.some(
|
||||
(a) => a.type === 6 && a.name === "encoding" && a.value != null && (a.value.content === "text/html" || a.value.content === "application/xhtml+xml")
|
||||
)) {
|
||||
ns = 0;
|
||||
}
|
||||
} else if (/^m(?:[ions]|text)$/.test(parent.tag) && tag !== "mglyph" && tag !== "malignmark") {
|
||||
ns = 0;
|
||||
}
|
||||
} else if (parent && ns === 1) {
|
||||
if (parent.tag === "foreignObject" || parent.tag === "desc" || parent.tag === "title") {
|
||||
ns = 0;
|
||||
}
|
||||
}
|
||||
if (ns === 0) {
|
||||
if (tag === "svg") {
|
||||
return 1;
|
||||
}
|
||||
if (tag === "math") {
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
return ns;
|
||||
},
|
||||
// https://html.spec.whatwg.org/multipage/parsing.html#parsing-html-fragments
|
||||
getTextMode({ tag, ns }) {
|
||||
if (ns === 0) {
|
||||
if (tag === "textarea" || tag === "title") {
|
||||
return 1;
|
||||
}
|
||||
if (isRawTextContainer(tag)) {
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
const transformStyle = (node) => {
|
||||
if (node.type === 1) {
|
||||
node.props.forEach((p, i) => {
|
||||
if (p.type === 6 && p.name === "style" && p.value) {
|
||||
node.props[i] = {
|
||||
type: 7,
|
||||
name: `bind`,
|
||||
arg: createSimpleExpression(`style`, true, p.loc),
|
||||
exp: parseInlineCSS(p.value.content, p.loc),
|
||||
modifiers: [],
|
||||
loc: p.loc
|
||||
};
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
const parseInlineCSS = (cssText, loc) => {
|
||||
const normalized = parseStringStyle(cssText);
|
||||
return createSimpleExpression(
|
||||
JSON.stringify(normalized),
|
||||
false,
|
||||
loc,
|
||||
3
|
||||
);
|
||||
};
|
||||
|
||||
function createDOMCompilerError(code, loc) {
|
||||
return createCompilerError(
|
||||
code,
|
||||
loc,
|
||||
!!(process.env.NODE_ENV !== "production") || false ? DOMErrorMessages : void 0
|
||||
);
|
||||
}
|
||||
const DOMErrorMessages = {
|
||||
[53]: `v-html is missing expression.`,
|
||||
[54]: `v-html will override element children.`,
|
||||
[55]: `v-text is missing expression.`,
|
||||
[56]: `v-text will override element children.`,
|
||||
[57]: `v-model can only be used on <input>, <textarea> and <select> elements.`,
|
||||
[58]: `v-model argument is not supported on plain elements.`,
|
||||
[59]: `v-model cannot be used on file inputs since they are read-only. Use a v-on:change listener instead.`,
|
||||
[60]: `Unnecessary value binding used alongside v-model. It will interfere with v-model's behavior.`,
|
||||
[61]: `v-show is missing expression.`,
|
||||
[62]: `<Transition> expects exactly one child element or component.`,
|
||||
[63]: `Tags with side effect (<script> and <style>) are ignored in client component templates.`
|
||||
};
|
||||
|
||||
const transformVHtml = (dir, node, context) => {
|
||||
const { exp, loc } = dir;
|
||||
if (!exp) {
|
||||
context.onError(
|
||||
createDOMCompilerError(53, loc)
|
||||
);
|
||||
}
|
||||
if (node.children.length) {
|
||||
context.onError(
|
||||
createDOMCompilerError(54, loc)
|
||||
);
|
||||
node.children.length = 0;
|
||||
}
|
||||
return {
|
||||
props: [
|
||||
createObjectProperty(
|
||||
createSimpleExpression(`innerHTML`, true, loc),
|
||||
exp || createSimpleExpression("", true)
|
||||
)
|
||||
]
|
||||
};
|
||||
};
|
||||
|
||||
const transformVText = (dir, node, context) => {
|
||||
const { exp, loc } = dir;
|
||||
if (!exp) {
|
||||
context.onError(
|
||||
createDOMCompilerError(55, loc)
|
||||
);
|
||||
}
|
||||
if (node.children.length) {
|
||||
context.onError(
|
||||
createDOMCompilerError(56, loc)
|
||||
);
|
||||
node.children.length = 0;
|
||||
}
|
||||
return {
|
||||
props: [
|
||||
createObjectProperty(
|
||||
createSimpleExpression(`textContent`, true),
|
||||
exp ? getConstantType(exp, context) > 0 ? exp : createCallExpression(
|
||||
context.helperString(TO_DISPLAY_STRING),
|
||||
[exp],
|
||||
loc
|
||||
) : createSimpleExpression("", true)
|
||||
)
|
||||
]
|
||||
};
|
||||
};
|
||||
|
||||
const transformModel = (dir, node, context) => {
|
||||
const baseResult = transformModel$1(dir, node, context);
|
||||
if (!baseResult.props.length || node.tagType === 1) {
|
||||
return baseResult;
|
||||
}
|
||||
if (dir.arg) {
|
||||
context.onError(
|
||||
createDOMCompilerError(
|
||||
58,
|
||||
dir.arg.loc
|
||||
)
|
||||
);
|
||||
}
|
||||
function checkDuplicatedValue() {
|
||||
const value = findProp(node, "value");
|
||||
if (value) {
|
||||
context.onError(
|
||||
createDOMCompilerError(
|
||||
60,
|
||||
value.loc
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
const { tag } = node;
|
||||
const isCustomElement = context.isCustomElement(tag);
|
||||
if (tag === "input" || tag === "textarea" || tag === "select" || isCustomElement) {
|
||||
let directiveToUse = V_MODEL_TEXT;
|
||||
let isInvalidType = false;
|
||||
if (tag === "input" || isCustomElement) {
|
||||
const type = findProp(node, `type`);
|
||||
if (type) {
|
||||
if (type.type === 7) {
|
||||
directiveToUse = V_MODEL_DYNAMIC;
|
||||
} else if (type.value) {
|
||||
switch (type.value.content) {
|
||||
case "radio":
|
||||
directiveToUse = V_MODEL_RADIO;
|
||||
break;
|
||||
case "checkbox":
|
||||
directiveToUse = V_MODEL_CHECKBOX;
|
||||
break;
|
||||
case "file":
|
||||
isInvalidType = true;
|
||||
context.onError(
|
||||
createDOMCompilerError(
|
||||
59,
|
||||
dir.loc
|
||||
)
|
||||
);
|
||||
break;
|
||||
default:
|
||||
!!(process.env.NODE_ENV !== "production") && checkDuplicatedValue();
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if (hasDynamicKeyVBind(node)) {
|
||||
directiveToUse = V_MODEL_DYNAMIC;
|
||||
} else {
|
||||
!!(process.env.NODE_ENV !== "production") && checkDuplicatedValue();
|
||||
}
|
||||
} else if (tag === "select") {
|
||||
directiveToUse = V_MODEL_SELECT;
|
||||
} else {
|
||||
!!(process.env.NODE_ENV !== "production") && checkDuplicatedValue();
|
||||
}
|
||||
if (!isInvalidType) {
|
||||
baseResult.needRuntime = context.helper(directiveToUse);
|
||||
}
|
||||
} else {
|
||||
context.onError(
|
||||
createDOMCompilerError(
|
||||
57,
|
||||
dir.loc
|
||||
)
|
||||
);
|
||||
}
|
||||
baseResult.props = baseResult.props.filter(
|
||||
(p) => !(p.key.type === 4 && p.key.content === "modelValue")
|
||||
);
|
||||
return baseResult;
|
||||
};
|
||||
|
||||
const isEventOptionModifier = /* @__PURE__ */ makeMap(`passive,once,capture`);
|
||||
const isNonKeyModifier = /* @__PURE__ */ makeMap(
|
||||
// event propagation management
|
||||
`stop,prevent,self,ctrl,shift,alt,meta,exact,middle`
|
||||
);
|
||||
const maybeKeyModifier = /* @__PURE__ */ makeMap("left,right");
|
||||
const isKeyboardEvent = /* @__PURE__ */ makeMap(
|
||||
`onkeyup,onkeydown,onkeypress`,
|
||||
true
|
||||
);
|
||||
const resolveModifiers = (key, modifiers, context, loc) => {
|
||||
const keyModifiers = [];
|
||||
const nonKeyModifiers = [];
|
||||
const eventOptionModifiers = [];
|
||||
for (let i = 0; i < modifiers.length; i++) {
|
||||
const modifier = modifiers[i];
|
||||
if (modifier === "native" && checkCompatEnabled(
|
||||
"COMPILER_V_ON_NATIVE",
|
||||
context,
|
||||
loc
|
||||
)) {
|
||||
eventOptionModifiers.push(modifier);
|
||||
} else if (isEventOptionModifier(modifier)) {
|
||||
eventOptionModifiers.push(modifier);
|
||||
} else {
|
||||
if (maybeKeyModifier(modifier)) {
|
||||
if (isStaticExp(key)) {
|
||||
if (isKeyboardEvent(key.content)) {
|
||||
keyModifiers.push(modifier);
|
||||
} else {
|
||||
nonKeyModifiers.push(modifier);
|
||||
}
|
||||
} else {
|
||||
keyModifiers.push(modifier);
|
||||
nonKeyModifiers.push(modifier);
|
||||
}
|
||||
} else {
|
||||
if (isNonKeyModifier(modifier)) {
|
||||
nonKeyModifiers.push(modifier);
|
||||
} else {
|
||||
keyModifiers.push(modifier);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return {
|
||||
keyModifiers,
|
||||
nonKeyModifiers,
|
||||
eventOptionModifiers
|
||||
};
|
||||
};
|
||||
const transformClick = (key, event) => {
|
||||
const isStaticClick = isStaticExp(key) && key.content.toLowerCase() === "onclick";
|
||||
return isStaticClick ? createSimpleExpression(event, true) : key.type !== 4 ? createCompoundExpression([
|
||||
`(`,
|
||||
key,
|
||||
`) === "onClick" ? "${event}" : (`,
|
||||
key,
|
||||
`)`
|
||||
]) : key;
|
||||
};
|
||||
const transformOn = (dir, node, context) => {
|
||||
return transformOn$1(dir, node, context, (baseResult) => {
|
||||
const { modifiers } = dir;
|
||||
if (!modifiers.length)
|
||||
return baseResult;
|
||||
let { key, value: handlerExp } = baseResult.props[0];
|
||||
const { keyModifiers, nonKeyModifiers, eventOptionModifiers } = resolveModifiers(key, modifiers, context, dir.loc);
|
||||
if (nonKeyModifiers.includes("right")) {
|
||||
key = transformClick(key, `onContextmenu`);
|
||||
}
|
||||
if (nonKeyModifiers.includes("middle")) {
|
||||
key = transformClick(key, `onMouseup`);
|
||||
}
|
||||
if (nonKeyModifiers.length) {
|
||||
handlerExp = createCallExpression(context.helper(V_ON_WITH_MODIFIERS), [
|
||||
handlerExp,
|
||||
JSON.stringify(nonKeyModifiers)
|
||||
]);
|
||||
}
|
||||
if (keyModifiers.length && // if event name is dynamic, always wrap with keys guard
|
||||
(!isStaticExp(key) || isKeyboardEvent(key.content))) {
|
||||
handlerExp = createCallExpression(context.helper(V_ON_WITH_KEYS), [
|
||||
handlerExp,
|
||||
JSON.stringify(keyModifiers)
|
||||
]);
|
||||
}
|
||||
if (eventOptionModifiers.length) {
|
||||
const modifierPostfix = eventOptionModifiers.map(capitalize).join("");
|
||||
key = isStaticExp(key) ? createSimpleExpression(`${key.content}${modifierPostfix}`, true) : createCompoundExpression([`(`, key, `) + "${modifierPostfix}"`]);
|
||||
}
|
||||
return {
|
||||
props: [createObjectProperty(key, handlerExp)]
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
const transformShow = (dir, node, context) => {
|
||||
const { exp, loc } = dir;
|
||||
if (!exp) {
|
||||
context.onError(
|
||||
createDOMCompilerError(61, loc)
|
||||
);
|
||||
}
|
||||
return {
|
||||
props: [],
|
||||
needRuntime: context.helper(V_SHOW)
|
||||
};
|
||||
};
|
||||
|
||||
const transformTransition = (node, context) => {
|
||||
if (node.type === 1 && node.tagType === 1) {
|
||||
const component = context.isBuiltInComponent(node.tag);
|
||||
if (component === TRANSITION) {
|
||||
return () => {
|
||||
if (!node.children.length) {
|
||||
return;
|
||||
}
|
||||
if (hasMultipleChildren(node)) {
|
||||
context.onError(
|
||||
createDOMCompilerError(
|
||||
62,
|
||||
{
|
||||
start: node.children[0].loc.start,
|
||||
end: node.children[node.children.length - 1].loc.end,
|
||||
source: ""
|
||||
}
|
||||
)
|
||||
);
|
||||
}
|
||||
const child = node.children[0];
|
||||
if (child.type === 1) {
|
||||
for (const p of child.props) {
|
||||
if (p.type === 7 && p.name === "show") {
|
||||
node.props.push({
|
||||
type: 6,
|
||||
name: "persisted",
|
||||
value: void 0,
|
||||
loc: node.loc
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
};
|
||||
function hasMultipleChildren(node) {
|
||||
const children = node.children = node.children.filter(
|
||||
(c) => c.type !== 3 && !(c.type === 2 && !c.content.trim())
|
||||
);
|
||||
const child = children[0];
|
||||
return children.length !== 1 || child.type === 11 || child.type === 9 && child.branches.some(hasMultipleChildren);
|
||||
}
|
||||
|
||||
const ignoreSideEffectTags = (node, context) => {
|
||||
if (node.type === 1 && node.tagType === 0 && (node.tag === "script" || node.tag === "style")) {
|
||||
!!(process.env.NODE_ENV !== "production") && context.onError(
|
||||
createDOMCompilerError(
|
||||
63,
|
||||
node.loc
|
||||
)
|
||||
);
|
||||
context.removeNode();
|
||||
}
|
||||
};
|
||||
|
||||
const DOMNodeTransforms = [
|
||||
transformStyle,
|
||||
...!!(process.env.NODE_ENV !== "production") ? [transformTransition] : []
|
||||
];
|
||||
const DOMDirectiveTransforms = {
|
||||
cloak: noopDirectiveTransform,
|
||||
html: transformVHtml,
|
||||
text: transformVText,
|
||||
model: transformModel,
|
||||
// override compiler-core
|
||||
on: transformOn,
|
||||
// override compiler-core
|
||||
show: transformShow
|
||||
};
|
||||
function compile(template, options = {}) {
|
||||
return baseCompile(
|
||||
template,
|
||||
extend({}, parserOptions, options, {
|
||||
nodeTransforms: [
|
||||
// ignore <script> and <tag>
|
||||
// this is not put inside DOMNodeTransforms because that list is used
|
||||
// by compiler-ssr to generate vnode fallback branches
|
||||
ignoreSideEffectTags,
|
||||
...DOMNodeTransforms,
|
||||
...options.nodeTransforms || []
|
||||
],
|
||||
directiveTransforms: extend(
|
||||
{},
|
||||
DOMDirectiveTransforms,
|
||||
options.directiveTransforms || {}
|
||||
),
|
||||
transformHoist: null
|
||||
})
|
||||
);
|
||||
}
|
||||
function parse(template, options = {}) {
|
||||
return baseParse(template, extend({}, parserOptions, options));
|
||||
}
|
||||
|
||||
export { DOMDirectiveTransforms, DOMNodeTransforms, TRANSITION, TRANSITION_GROUP, V_MODEL_CHECKBOX, V_MODEL_DYNAMIC, V_MODEL_RADIO, V_MODEL_SELECT, V_MODEL_TEXT, V_ON_WITH_KEYS, V_ON_WITH_MODIFIERS, V_SHOW, compile, createDOMCompilerError, parse, parserOptions, transformStyle };
|
||||
5459
node_modules/@vue/compiler-dom/dist/compiler-dom.global.js
generated
vendored
Normal file
5459
node_modules/@vue/compiler-dom/dist/compiler-dom.global.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
1
node_modules/@vue/compiler-dom/dist/compiler-dom.global.prod.js
generated
vendored
Normal file
1
node_modules/@vue/compiler-dom/dist/compiler-dom.global.prod.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
7
node_modules/@vue/compiler-dom/index.js
generated
vendored
Normal file
7
node_modules/@vue/compiler-dom/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
'use strict'
|
||||
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
module.exports = require('./dist/compiler-dom.cjs.prod.js')
|
||||
} else {
|
||||
module.exports = require('./dist/compiler-dom.cjs.js')
|
||||
}
|
||||
43
node_modules/@vue/compiler-dom/package.json
generated
vendored
Normal file
43
node_modules/@vue/compiler-dom/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
{
|
||||
"name": "@vue/compiler-dom",
|
||||
"version": "3.3.4",
|
||||
"description": "@vue/compiler-dom",
|
||||
"main": "index.js",
|
||||
"module": "dist/compiler-dom.esm-bundler.js",
|
||||
"types": "dist/compiler-dom.d.ts",
|
||||
"unpkg": "dist/compiler-dom.global.js",
|
||||
"jsdelivr": "dist/compiler-dom.global.js",
|
||||
"files": [
|
||||
"index.js",
|
||||
"dist"
|
||||
],
|
||||
"sideEffects": false,
|
||||
"buildOptions": {
|
||||
"name": "VueCompilerDOM",
|
||||
"compat": true,
|
||||
"formats": [
|
||||
"esm-bundler",
|
||||
"esm-browser",
|
||||
"cjs",
|
||||
"global"
|
||||
]
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/vuejs/core.git",
|
||||
"directory": "packages/compiler-dom"
|
||||
},
|
||||
"keywords": [
|
||||
"vue"
|
||||
],
|
||||
"author": "Evan You",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/vuejs/core/issues"
|
||||
},
|
||||
"homepage": "https://github.com/vuejs/core/tree/main/packages/compiler-dom#readme",
|
||||
"dependencies": {
|
||||
"@vue/shared": "3.3.4",
|
||||
"@vue/compiler-core": "3.3.4"
|
||||
}
|
||||
}
|
||||
21
node_modules/@vue/compiler-sfc/LICENSE
generated
vendored
Normal file
21
node_modules/@vue/compiler-sfc/LICENSE
generated
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2018-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.
|
||||
80
node_modules/@vue/compiler-sfc/README.md
generated
vendored
Normal file
80
node_modules/@vue/compiler-sfc/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
# @vue/compiler-sfc
|
||||
|
||||
> Lower level utilities for compiling Vue Single File Components
|
||||
|
||||
**Note: as of 3.2.13+, this package is included as a dependency of the main `vue` package and can be accessed as `vue/compiler-sfc`. This means you no longer need to explicitly install this package and ensure its version match that of `vue`'s. Just use the main `vue/compiler-sfc` deep import instead.**
|
||||
|
||||
This package contains lower level utilities that you can use if you are writing a plugin / transform for a bundler or module system that compiles Vue Single File Components (SFCs) into JavaScript. It is used in [vue-loader](https://github.com/vuejs/vue-loader), [rollup-plugin-vue](https://github.com/vuejs/rollup-plugin-vue) and [vite](https://github.com/vitejs/vite).
|
||||
|
||||
## API
|
||||
|
||||
The API is intentionally low-level due to the various considerations when integrating Vue SFCs in a build system:
|
||||
|
||||
- Separate hot-module replacement (HMR) for script, template and styles
|
||||
|
||||
- template updates should not reset component state
|
||||
- style updates should be performed without component re-render
|
||||
|
||||
- Leveraging the tool's plugin system for pre-processor handling. e.g. `<style lang="scss">` should be processed by the corresponding webpack loader.
|
||||
|
||||
- In some cases, transformers of each block in an SFC do not share the same execution context. For example, when used with `thread-loader` or other parallelized configurations, the template sub-loader in `vue-loader` may not have access to the full SFC and its descriptor.
|
||||
|
||||
The general idea is to generate a facade module that imports the individual blocks of the component. The trick is the module imports itself with different query strings so that the build system can handle each request as "virtual" modules:
|
||||
|
||||
```
|
||||
+--------------------+
|
||||
| |
|
||||
| script transform |
|
||||
+----->+ |
|
||||
| +--------------------+
|
||||
|
|
||||
+--------------------+ | +--------------------+
|
||||
| | | | |
|
||||
| facade transform +----------->+ template transform |
|
||||
| | | | |
|
||||
+--------------------+ | +--------------------+
|
||||
|
|
||||
| +--------------------+
|
||||
+----->+ |
|
||||
| style transform |
|
||||
| |
|
||||
+--------------------+
|
||||
```
|
||||
|
||||
Where the facade module looks like this:
|
||||
|
||||
```js
|
||||
// main script
|
||||
import script from '/project/foo.vue?vue&type=script'
|
||||
// template compiled to render function
|
||||
import { render } from '/project/foo.vue?vue&type=template&id=xxxxxx'
|
||||
// css
|
||||
import '/project/foo.vue?vue&type=style&index=0&id=xxxxxx'
|
||||
|
||||
// attach render function to script
|
||||
script.render = render
|
||||
|
||||
// attach additional metadata
|
||||
// some of these should be dev only
|
||||
script.__file = 'example.vue'
|
||||
script.__scopeId = 'xxxxxx'
|
||||
|
||||
// additional tooling-specific HMR handling code
|
||||
// using __VUE_HMR_API__ global
|
||||
|
||||
export default script
|
||||
```
|
||||
|
||||
### High Level Workflow
|
||||
|
||||
1. In facade transform, parse the source into descriptor with the `parse` API and generate the above facade module code based on the descriptor;
|
||||
|
||||
2. In script transform, use `compileScript` to process the script. This handles features like `<script setup>` and CSS variable injection. Alternatively, this can be done directly in the facade module (with the code inlined instead of imported), but it will require rewriting `export default` to a temp variable (a `rewriteDefault` convenience API is provided for this purpose) so additional options can be attached to the exported object.
|
||||
|
||||
3. In template transform, use `compileTemplate` to compile the raw template into render function code.
|
||||
|
||||
4. In style transform, use `compileStyle` to compile raw CSS to handle `<style scoped>`, `<style module>` and CSS variable injection.
|
||||
|
||||
Options needed for these APIs can be passed via the query string.
|
||||
|
||||
For detailed API references and options, check out the source type definitions. For actual usage of these APIs, check out [rollup-plugin-vue](https://github.com/vuejs/rollup-plugin-vue/tree/next) or [vue-loader](https://github.com/vuejs/vue-loader/tree/next).
|
||||
20636
node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js
generated
vendored
Normal file
20636
node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
473
node_modules/@vue/compiler-sfc/dist/compiler-sfc.d.ts
generated
vendored
Normal file
473
node_modules/@vue/compiler-sfc/dist/compiler-sfc.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,473 @@
|
|||
import * as _babel_types from '@babel/types';
|
||||
import { Statement, Expression, TSType, Program, Node, ObjectPattern, TSModuleDeclaration, TSPropertySignature, TSMethodSignature, TSCallSignatureDeclaration, TSFunctionType } from '@babel/types';
|
||||
import { CompilerOptions, CodegenResult, ParserOptions, RootNode, CompilerError, SourceLocation, ElementNode, BindingMetadata as BindingMetadata$1 } from '@vue/compiler-core';
|
||||
export { BindingMetadata, CompilerError, CompilerOptions, extractIdentifiers, generateCodeFrame, isInDestructureAssignment, isStaticProperty, walkIdentifiers } from '@vue/compiler-core';
|
||||
import { RawSourceMap } from 'source-map-js';
|
||||
import { ParserPlugin } from '@babel/parser';
|
||||
export { parse as babelParse } from '@babel/parser';
|
||||
import { Result, LazyResult } from 'postcss';
|
||||
import MagicString from 'magic-string';
|
||||
export { default as MagicString } from 'magic-string';
|
||||
export { shouldTransform as shouldTransformRef, transform as transformRef, transformAST as transformRefAST } from '@vue/reactivity-transform';
|
||||
|
||||
export interface AssetURLTagConfig {
|
||||
[name: string]: string[];
|
||||
}
|
||||
export interface AssetURLOptions {
|
||||
/**
|
||||
* If base is provided, instead of transforming relative asset urls into
|
||||
* imports, they will be directly rewritten to absolute urls.
|
||||
*/
|
||||
base?: string | null;
|
||||
/**
|
||||
* If true, also processes absolute urls.
|
||||
*/
|
||||
includeAbsolute?: boolean;
|
||||
tags?: AssetURLTagConfig;
|
||||
}
|
||||
|
||||
export interface TemplateCompiler {
|
||||
compile(template: string, options: CompilerOptions): CodegenResult;
|
||||
parse(template: string, options: ParserOptions): RootNode;
|
||||
}
|
||||
export interface SFCTemplateCompileResults {
|
||||
code: string;
|
||||
ast?: RootNode;
|
||||
preamble?: string;
|
||||
source: string;
|
||||
tips: string[];
|
||||
errors: (string | CompilerError)[];
|
||||
map?: RawSourceMap;
|
||||
}
|
||||
export interface SFCTemplateCompileOptions {
|
||||
source: string;
|
||||
filename: string;
|
||||
id: string;
|
||||
scoped?: boolean;
|
||||
slotted?: boolean;
|
||||
isProd?: boolean;
|
||||
ssr?: boolean;
|
||||
ssrCssVars?: string[];
|
||||
inMap?: RawSourceMap;
|
||||
compiler?: TemplateCompiler;
|
||||
compilerOptions?: CompilerOptions;
|
||||
preprocessLang?: string;
|
||||
preprocessOptions?: any;
|
||||
/**
|
||||
* In some cases, compiler-sfc may not be inside the project root (e.g. when
|
||||
* linked or globally installed). In such cases a custom `require` can be
|
||||
* passed to correctly resolve the preprocessors.
|
||||
*/
|
||||
preprocessCustomRequire?: (id: string) => any;
|
||||
/**
|
||||
* Configure what tags/attributes to transform into asset url imports,
|
||||
* or disable the transform altogether with `false`.
|
||||
*/
|
||||
transformAssetUrls?: AssetURLOptions | AssetURLTagConfig | boolean;
|
||||
}
|
||||
export declare function compileTemplate(options: SFCTemplateCompileOptions): SFCTemplateCompileResults;
|
||||
|
||||
export interface SFCScriptCompileOptions {
|
||||
/**
|
||||
* Scope ID for prefixing injected CSS variables.
|
||||
* This must be consistent with the `id` passed to `compileStyle`.
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* Production mode. Used to determine whether to generate hashed CSS variables
|
||||
*/
|
||||
isProd?: boolean;
|
||||
/**
|
||||
* Enable/disable source map. Defaults to true.
|
||||
*/
|
||||
sourceMap?: boolean;
|
||||
/**
|
||||
* https://babeljs.io/docs/en/babel-parser#plugins
|
||||
*/
|
||||
babelParserPlugins?: ParserPlugin[];
|
||||
/**
|
||||
* A list of files to parse for global types to be made available for type
|
||||
* resolving in SFC macros. The list must be fully resolved file system paths.
|
||||
*/
|
||||
globalTypeFiles?: string[];
|
||||
/**
|
||||
* Compile the template and inline the resulting render function
|
||||
* directly inside setup().
|
||||
* - Only affects `<script setup>`
|
||||
* - This should only be used in production because it prevents the template
|
||||
* from being hot-reloaded separately from component state.
|
||||
*/
|
||||
inlineTemplate?: boolean;
|
||||
/**
|
||||
* Generate the final component as a variable instead of default export.
|
||||
* This is useful in e.g. @vitejs/plugin-vue where the script needs to be
|
||||
* placed inside the main module.
|
||||
*/
|
||||
genDefaultAs?: string;
|
||||
/**
|
||||
* Options for template compilation when inlining. Note these are options that
|
||||
* would normally be passed to `compiler-sfc`'s own `compileTemplate()`, not
|
||||
* options passed to `compiler-dom`.
|
||||
*/
|
||||
templateOptions?: Partial<SFCTemplateCompileOptions>;
|
||||
/**
|
||||
* Hoist <script setup> static constants.
|
||||
* - Only enables when one `<script setup>` exists.
|
||||
* @default true
|
||||
*/
|
||||
hoistStatic?: boolean;
|
||||
/**
|
||||
* (**Experimental**) Enable macro `defineModel`
|
||||
* @default false
|
||||
*/
|
||||
defineModel?: boolean;
|
||||
/**
|
||||
* (**Experimental**) Enable reactive destructure for `defineProps`
|
||||
* @default false
|
||||
*/
|
||||
propsDestructure?: boolean;
|
||||
/**
|
||||
* File system access methods to be used when resolving types
|
||||
* imported in SFC macros. Defaults to ts.sys in Node.js, can be overwritten
|
||||
* to use a virtual file system for use in browsers (e.g. in REPLs)
|
||||
*/
|
||||
fs?: {
|
||||
fileExists(file: string): boolean;
|
||||
readFile(file: string): string | undefined;
|
||||
};
|
||||
/**
|
||||
* (Experimental) Enable syntax transform for using refs without `.value` and
|
||||
* using destructured props with reactivity
|
||||
* @deprecated the Reactivity Transform proposal has been dropped. This
|
||||
* feature will be removed from Vue core in 3.4. If you intend to continue
|
||||
* using it, disable this and switch to the [Vue Macros implementation](https://vue-macros.sxzz.moe/features/reactivity-transform.html).
|
||||
*/
|
||||
reactivityTransform?: boolean;
|
||||
}
|
||||
interface ImportBinding {
|
||||
isType: boolean;
|
||||
imported: string;
|
||||
local: string;
|
||||
source: string;
|
||||
isFromSetup: boolean;
|
||||
isUsedInTemplate: boolean;
|
||||
}
|
||||
/**
|
||||
* Compile `<script setup>`
|
||||
* It requires the whole SFC descriptor because we need to handle and merge
|
||||
* normal `<script>` + `<script setup>` if both are present.
|
||||
*/
|
||||
export declare function compileScript(sfc: SFCDescriptor, options: SFCScriptCompileOptions): SFCScriptBlock;
|
||||
|
||||
export interface SFCParseOptions {
|
||||
filename?: string;
|
||||
sourceMap?: boolean;
|
||||
sourceRoot?: string;
|
||||
pad?: boolean | 'line' | 'space';
|
||||
ignoreEmpty?: boolean;
|
||||
compiler?: TemplateCompiler;
|
||||
}
|
||||
export interface SFCBlock {
|
||||
type: string;
|
||||
content: string;
|
||||
attrs: Record<string, string | true>;
|
||||
loc: SourceLocation;
|
||||
map?: RawSourceMap;
|
||||
lang?: string;
|
||||
src?: string;
|
||||
}
|
||||
export interface SFCTemplateBlock extends SFCBlock {
|
||||
type: 'template';
|
||||
ast: ElementNode;
|
||||
}
|
||||
export interface SFCScriptBlock extends SFCBlock {
|
||||
type: 'script';
|
||||
setup?: string | boolean;
|
||||
bindings?: BindingMetadata$1;
|
||||
imports?: Record<string, ImportBinding>;
|
||||
scriptAst?: _babel_types.Statement[];
|
||||
scriptSetupAst?: _babel_types.Statement[];
|
||||
warnings?: string[];
|
||||
/**
|
||||
* Fully resolved dependency file paths (unix slashes) with imported types
|
||||
* used in macros, used for HMR cache busting in @vitejs/plugin-vue and
|
||||
* vue-loader.
|
||||
*/
|
||||
deps?: string[];
|
||||
}
|
||||
export interface SFCStyleBlock extends SFCBlock {
|
||||
type: 'style';
|
||||
scoped?: boolean;
|
||||
module?: string | boolean;
|
||||
}
|
||||
export interface SFCDescriptor {
|
||||
filename: string;
|
||||
source: string;
|
||||
template: SFCTemplateBlock | null;
|
||||
script: SFCScriptBlock | null;
|
||||
scriptSetup: SFCScriptBlock | null;
|
||||
styles: SFCStyleBlock[];
|
||||
customBlocks: SFCBlock[];
|
||||
cssVars: string[];
|
||||
/**
|
||||
* whether the SFC uses :slotted() modifier.
|
||||
* this is used as a compiler optimization hint.
|
||||
*/
|
||||
slotted: boolean;
|
||||
/**
|
||||
* compare with an existing descriptor to determine whether HMR should perform
|
||||
* a reload vs. re-render.
|
||||
*
|
||||
* Note: this comparison assumes the prev/next script are already identical,
|
||||
* and only checks the special case where <script setup lang="ts"> unused import
|
||||
* pruning result changes due to template changes.
|
||||
*/
|
||||
shouldForceReload: (prevImports: Record<string, ImportBinding>) => boolean;
|
||||
}
|
||||
export interface SFCParseResult {
|
||||
descriptor: SFCDescriptor;
|
||||
errors: (CompilerError | SyntaxError)[];
|
||||
}
|
||||
export declare const parseCache: Map<string, SFCParseResult> & {
|
||||
max?: number | undefined;
|
||||
};
|
||||
export declare function parse(source: string, { sourceMap, filename, sourceRoot, pad, ignoreEmpty, compiler }?: SFCParseOptions): SFCParseResult;
|
||||
|
||||
type PreprocessLang = 'less' | 'sass' | 'scss' | 'styl' | 'stylus';
|
||||
|
||||
export interface SFCStyleCompileOptions {
|
||||
source: string;
|
||||
filename: string;
|
||||
id: string;
|
||||
scoped?: boolean;
|
||||
trim?: boolean;
|
||||
isProd?: boolean;
|
||||
inMap?: RawSourceMap;
|
||||
preprocessLang?: PreprocessLang;
|
||||
preprocessOptions?: any;
|
||||
preprocessCustomRequire?: (id: string) => any;
|
||||
postcssOptions?: any;
|
||||
postcssPlugins?: any[];
|
||||
/**
|
||||
* @deprecated use `inMap` instead.
|
||||
*/
|
||||
map?: RawSourceMap;
|
||||
}
|
||||
/**
|
||||
* Aligns with postcss-modules
|
||||
* https://github.com/css-modules/postcss-modules
|
||||
*/
|
||||
interface CSSModulesOptions {
|
||||
scopeBehaviour?: 'global' | 'local';
|
||||
generateScopedName?: string | ((name: string, filename: string, css: string) => string);
|
||||
hashPrefix?: string;
|
||||
localsConvention?: 'camelCase' | 'camelCaseOnly' | 'dashes' | 'dashesOnly';
|
||||
exportGlobals?: boolean;
|
||||
globalModulePaths?: RegExp[];
|
||||
}
|
||||
export interface SFCAsyncStyleCompileOptions extends SFCStyleCompileOptions {
|
||||
isAsync?: boolean;
|
||||
modules?: boolean;
|
||||
modulesOptions?: CSSModulesOptions;
|
||||
}
|
||||
export interface SFCStyleCompileResults {
|
||||
code: string;
|
||||
map: RawSourceMap | undefined;
|
||||
rawResult: Result | LazyResult | undefined;
|
||||
errors: Error[];
|
||||
modules?: Record<string, string>;
|
||||
dependencies: Set<string>;
|
||||
}
|
||||
export declare function compileStyle(options: SFCStyleCompileOptions): SFCStyleCompileResults;
|
||||
export declare function compileStyleAsync(options: SFCAsyncStyleCompileOptions): Promise<SFCStyleCompileResults>;
|
||||
|
||||
export declare function rewriteDefault(input: string, as: string, parserPlugins?: ParserPlugin[]): string;
|
||||
/**
|
||||
* Utility for rewriting `export default` in a script block into a variable
|
||||
* declaration so that we can inject things into it
|
||||
*/
|
||||
export declare function rewriteDefaultAST(ast: Statement[], s: MagicString, as: string): void;
|
||||
|
||||
type PropsDestructureBindings = Record<string, // public prop key
|
||||
{
|
||||
local: string;
|
||||
default?: Expression;
|
||||
}>;
|
||||
|
||||
interface ModelDecl {
|
||||
type: TSType | undefined;
|
||||
options: string | undefined;
|
||||
identifier: string | undefined;
|
||||
}
|
||||
|
||||
declare const enum BindingTypes {
|
||||
/**
|
||||
* returned from data()
|
||||
*/
|
||||
DATA = "data",
|
||||
/**
|
||||
* declared as a prop
|
||||
*/
|
||||
PROPS = "props",
|
||||
/**
|
||||
* a local alias of a `<script setup>` destructured prop.
|
||||
* the original is stored in __propsAliases of the bindingMetadata object.
|
||||
*/
|
||||
PROPS_ALIASED = "props-aliased",
|
||||
/**
|
||||
* a let binding (may or may not be a ref)
|
||||
*/
|
||||
SETUP_LET = "setup-let",
|
||||
/**
|
||||
* a const binding that can never be a ref.
|
||||
* these bindings don't need `unref()` calls when processed in inlined
|
||||
* template expressions.
|
||||
*/
|
||||
SETUP_CONST = "setup-const",
|
||||
/**
|
||||
* a const binding that does not need `unref()`, but may be mutated.
|
||||
*/
|
||||
SETUP_REACTIVE_CONST = "setup-reactive-const",
|
||||
/**
|
||||
* a const binding that may be a ref.
|
||||
*/
|
||||
SETUP_MAYBE_REF = "setup-maybe-ref",
|
||||
/**
|
||||
* bindings that are guaranteed to be refs
|
||||
*/
|
||||
SETUP_REF = "setup-ref",
|
||||
/**
|
||||
* declared by other options, e.g. computed, inject
|
||||
*/
|
||||
OPTIONS = "options",
|
||||
/**
|
||||
* a literal constant, e.g. 'foo', 1, true
|
||||
*/
|
||||
LITERAL_CONST = "literal-const"
|
||||
}
|
||||
type BindingMetadata = {
|
||||
[key: string]: BindingTypes | undefined;
|
||||
} & {
|
||||
__isScriptSetup?: boolean;
|
||||
__propsAliases?: Record<string, string>;
|
||||
};
|
||||
|
||||
export declare class ScriptCompileContext {
|
||||
descriptor: SFCDescriptor;
|
||||
options: Partial<SFCScriptCompileOptions>;
|
||||
isJS: boolean;
|
||||
isTS: boolean;
|
||||
scriptAst: Program | null;
|
||||
scriptSetupAst: Program | null;
|
||||
source: string;
|
||||
filename: string;
|
||||
s: MagicString;
|
||||
startOffset: number | undefined;
|
||||
endOffset: number | undefined;
|
||||
scope?: TypeScope;
|
||||
globalScopes?: TypeScope[];
|
||||
userImports: Record<string, ImportBinding>;
|
||||
hasDefinePropsCall: boolean;
|
||||
hasDefineEmitCall: boolean;
|
||||
hasDefineExposeCall: boolean;
|
||||
hasDefaultExportName: boolean;
|
||||
hasDefaultExportRender: boolean;
|
||||
hasDefineOptionsCall: boolean;
|
||||
hasDefineSlotsCall: boolean;
|
||||
hasDefineModelCall: boolean;
|
||||
propsIdentifier: string | undefined;
|
||||
propsRuntimeDecl: Node | undefined;
|
||||
propsTypeDecl: Node | undefined;
|
||||
propsDestructureDecl: ObjectPattern | undefined;
|
||||
propsDestructuredBindings: PropsDestructureBindings;
|
||||
propsDestructureRestId: string | undefined;
|
||||
propsRuntimeDefaults: Node | undefined;
|
||||
emitsRuntimeDecl: Node | undefined;
|
||||
emitsTypeDecl: Node | undefined;
|
||||
emitIdentifier: string | undefined;
|
||||
modelDecls: Record<string, ModelDecl>;
|
||||
optionsRuntimeDecl: Node | undefined;
|
||||
bindingMetadata: BindingMetadata;
|
||||
helperImports: Set<string>;
|
||||
helper(key: string): string;
|
||||
/**
|
||||
* to be exposed on compiled script block for HMR cache busting
|
||||
*/
|
||||
deps?: Set<string>;
|
||||
/**
|
||||
* cache for resolved fs
|
||||
*/
|
||||
fs?: NonNullable<SFCScriptCompileOptions['fs']>;
|
||||
constructor(descriptor: SFCDescriptor, options: Partial<SFCScriptCompileOptions>);
|
||||
getString(node: Node, scriptSetup?: boolean): string;
|
||||
error(msg: string, node: Node, scope?: TypeScope): never;
|
||||
}
|
||||
|
||||
/**
|
||||
* TypeResolveContext is compatible with ScriptCompileContext
|
||||
* but also allows a simpler version of it with minimal required properties
|
||||
* when resolveType needs to be used in a non-SFC context, e.g. in a babel
|
||||
* plugin. The simplest context can be just:
|
||||
* ```ts
|
||||
* const ctx: SimpleTypeResolveContext = {
|
||||
* filename: '...',
|
||||
* source: '...',
|
||||
* options: {},
|
||||
* error() {},
|
||||
* ast: []
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
export type SimpleTypeResolveContext = Pick<ScriptCompileContext, 'source' | 'filename' | 'error' | 'options'> & Partial<Pick<ScriptCompileContext, 'scope' | 'globalScopes' | 'deps' | 'fs'>> & {
|
||||
ast: Statement[];
|
||||
};
|
||||
export type TypeResolveContext = ScriptCompileContext | SimpleTypeResolveContext;
|
||||
type Import = Pick<ImportBinding, 'source' | 'imported'>;
|
||||
interface WithScope {
|
||||
_ownerScope: TypeScope;
|
||||
}
|
||||
type ScopeTypeNode = Node & WithScope & {
|
||||
_ns?: TSModuleDeclaration & WithScope;
|
||||
};
|
||||
declare class TypeScope {
|
||||
filename: string;
|
||||
source: string;
|
||||
offset: number;
|
||||
imports: Record<string, Import>;
|
||||
types: Record<string, ScopeTypeNode>;
|
||||
declares: Record<string, ScopeTypeNode>;
|
||||
constructor(filename: string, source: string, offset?: number, imports?: Record<string, Import>, types?: Record<string, ScopeTypeNode>, declares?: Record<string, ScopeTypeNode>);
|
||||
resolvedImportSources: Record<string, string>;
|
||||
exportedTypes: Record<string, ScopeTypeNode>;
|
||||
exportedDeclares: Record<string, ScopeTypeNode>;
|
||||
}
|
||||
interface MaybeWithScope {
|
||||
_ownerScope?: TypeScope;
|
||||
}
|
||||
interface ResolvedElements {
|
||||
props: Record<string, (TSPropertySignature | TSMethodSignature) & {
|
||||
_ownerScope: TypeScope;
|
||||
}>;
|
||||
calls?: (TSCallSignatureDeclaration | TSFunctionType)[];
|
||||
}
|
||||
/**
|
||||
* Resolve arbitrary type node to a list of type elements that can be then
|
||||
* mapped to runtime props or emits.
|
||||
*/
|
||||
export declare function resolveTypeElements(ctx: TypeResolveContext, node: Node & MaybeWithScope & {
|
||||
_resolvedElements?: ResolvedElements;
|
||||
}, scope?: TypeScope): ResolvedElements;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export declare function registerTS(_ts: any): void;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export declare function invalidateTypeCache(filename: string): void;
|
||||
export declare function inferRuntimeType(ctx: TypeResolveContext, node: Node & MaybeWithScope, scope?: TypeScope): string[];
|
||||
|
||||
export declare const version: string;
|
||||
|
||||
export declare const walk: any;
|
||||
|
||||
50309
node_modules/@vue/compiler-sfc/dist/compiler-sfc.esm-browser.js
generated
vendored
Normal file
50309
node_modules/@vue/compiler-sfc/dist/compiler-sfc.esm-browser.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
60
node_modules/@vue/compiler-sfc/package.json
generated
vendored
Normal file
60
node_modules/@vue/compiler-sfc/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
{
|
||||
"name": "@vue/compiler-sfc",
|
||||
"version": "3.3.4",
|
||||
"description": "@vue/compiler-sfc",
|
||||
"main": "dist/compiler-sfc.cjs.js",
|
||||
"module": "dist/compiler-sfc.esm-browser.js",
|
||||
"types": "dist/compiler-sfc.d.ts",
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"buildOptions": {
|
||||
"name": "VueCompilerSFC",
|
||||
"formats": [
|
||||
"cjs",
|
||||
"esm-browser"
|
||||
],
|
||||
"prod": false,
|
||||
"enableNonBrowserBranches": true
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/vuejs/core.git",
|
||||
"directory": "packages/compiler-sfc"
|
||||
},
|
||||
"keywords": [
|
||||
"vue"
|
||||
],
|
||||
"author": "Evan You",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/vuejs/core/issues"
|
||||
},
|
||||
"homepage": "https://github.com/vuejs/core/tree/main/packages/compiler-sfc#readme",
|
||||
"dependencies": {
|
||||
"@babel/parser": "^7.20.15",
|
||||
"@vue/compiler-core": "3.3.4",
|
||||
"@vue/compiler-dom": "3.3.4",
|
||||
"@vue/compiler-ssr": "3.3.4",
|
||||
"@vue/reactivity-transform": "3.3.4",
|
||||
"@vue/shared": "3.3.4",
|
||||
"estree-walker": "^2.0.2",
|
||||
"magic-string": "^0.30.0",
|
||||
"postcss": "^8.1.10",
|
||||
"source-map-js": "^1.0.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/types": "^7.21.3",
|
||||
"@types/estree": "^0.0.48",
|
||||
"@types/lru-cache": "^5.1.0",
|
||||
"@vue/consolidate": "^0.17.3",
|
||||
"hash-sum": "^2.0.0",
|
||||
"lru-cache": "^5.1.1",
|
||||
"merge-source-map": "^1.1.0",
|
||||
"minimatch": "^9.0.0",
|
||||
"postcss-modules": "^4.0.0",
|
||||
"postcss-selector-parser": "^6.0.4",
|
||||
"pug": "^3.0.1",
|
||||
"sass": "^1.26.9"
|
||||
}
|
||||
}
|
||||
21
node_modules/@vue/compiler-ssr/LICENSE
generated
vendored
Normal file
21
node_modules/@vue/compiler-ssr/LICENSE
generated
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2018-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.
|
||||
1
node_modules/@vue/compiler-ssr/README.md
generated
vendored
Normal file
1
node_modules/@vue/compiler-ssr/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
# @vue/compiler-ssr
|
||||
1280
node_modules/@vue/compiler-ssr/dist/compiler-ssr.cjs.js
generated
vendored
Normal file
1280
node_modules/@vue/compiler-ssr/dist/compiler-ssr.cjs.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
4
node_modules/@vue/compiler-ssr/dist/compiler-ssr.d.ts
generated
vendored
Normal file
4
node_modules/@vue/compiler-ssr/dist/compiler-ssr.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
import { CompilerOptions, CodegenResult } from '@vue/compiler-dom';
|
||||
|
||||
export declare function compile(template: string, options?: CompilerOptions): CodegenResult;
|
||||
|
||||
34
node_modules/@vue/compiler-ssr/package.json
generated
vendored
Normal file
34
node_modules/@vue/compiler-ssr/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
{
|
||||
"name": "@vue/compiler-ssr",
|
||||
"version": "3.3.4",
|
||||
"description": "@vue/compiler-ssr",
|
||||
"main": "dist/compiler-ssr.cjs.js",
|
||||
"types": "dist/compiler-ssr.d.ts",
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"buildOptions": {
|
||||
"prod": false,
|
||||
"formats": [
|
||||
"cjs"
|
||||
]
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/vuejs/core.git",
|
||||
"directory": "packages/compiler-ssr"
|
||||
},
|
||||
"keywords": [
|
||||
"vue"
|
||||
],
|
||||
"author": "Evan You",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/vuejs/core/issues"
|
||||
},
|
||||
"homepage": "https://github.com/vuejs/core/tree/main/packages/compiler-ssr#readme",
|
||||
"dependencies": {
|
||||
"@vue/shared": "3.3.4",
|
||||
"@vue/compiler-dom": "3.3.4"
|
||||
}
|
||||
}
|
||||
2
node_modules/@vue/devtools-api/lib/cjs/api/api.js
generated
vendored
Normal file
2
node_modules/@vue/devtools-api/lib/cjs/api/api.js
generated
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
2
node_modules/@vue/devtools-api/lib/cjs/api/app.js
generated
vendored
Normal file
2
node_modules/@vue/devtools-api/lib/cjs/api/app.js
generated
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
2
node_modules/@vue/devtools-api/lib/cjs/api/component.js
generated
vendored
Normal file
2
node_modules/@vue/devtools-api/lib/cjs/api/component.js
generated
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
2
node_modules/@vue/devtools-api/lib/cjs/api/context.js
generated
vendored
Normal file
2
node_modules/@vue/devtools-api/lib/cjs/api/context.js
generated
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
2
node_modules/@vue/devtools-api/lib/cjs/api/hooks.js
generated
vendored
Normal file
2
node_modules/@vue/devtools-api/lib/cjs/api/hooks.js
generated
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
22
node_modules/@vue/devtools-api/lib/cjs/api/index.js
generated
vendored
Normal file
22
node_modules/@vue/devtools-api/lib/cjs/api/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
||||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
__exportStar(require("./api.js"), exports);
|
||||
__exportStar(require("./app.js"), exports);
|
||||
__exportStar(require("./component.js"), exports);
|
||||
__exportStar(require("./context.js"), exports);
|
||||
__exportStar(require("./hooks.js"), exports);
|
||||
__exportStar(require("./util.js"), exports);
|
||||
2
node_modules/@vue/devtools-api/lib/cjs/api/util.js
generated
vendored
Normal file
2
node_modules/@vue/devtools-api/lib/cjs/api/util.js
generated
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
5
node_modules/@vue/devtools-api/lib/cjs/const.js
generated
vendored
Normal file
5
node_modules/@vue/devtools-api/lib/cjs/const.js
generated
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.HOOK_PLUGIN_SETTINGS_SET = exports.HOOK_SETUP = void 0;
|
||||
exports.HOOK_SETUP = 'devtools-plugin:setup';
|
||||
exports.HOOK_PLUGIN_SETTINGS_SET = 'plugin:settings:set';
|
||||
17
node_modules/@vue/devtools-api/lib/cjs/env.js
generated
vendored
Normal file
17
node_modules/@vue/devtools-api/lib/cjs/env.js
generated
vendored
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.isProxyAvailable = exports.getTarget = exports.getDevtoolsGlobalHook = void 0;
|
||||
function getDevtoolsGlobalHook() {
|
||||
return getTarget().__VUE_DEVTOOLS_GLOBAL_HOOK__;
|
||||
}
|
||||
exports.getDevtoolsGlobalHook = getDevtoolsGlobalHook;
|
||||
function getTarget() {
|
||||
// @ts-ignore
|
||||
return (typeof navigator !== 'undefined' && typeof window !== 'undefined')
|
||||
? window
|
||||
: typeof global !== 'undefined'
|
||||
? global
|
||||
: {};
|
||||
}
|
||||
exports.getTarget = getTarget;
|
||||
exports.isProxyAvailable = typeof Proxy === 'function';
|
||||
44
node_modules/@vue/devtools-api/lib/cjs/index.js
generated
vendored
Normal file
44
node_modules/@vue/devtools-api/lib/cjs/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
||||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.setupDevtoolsPlugin = void 0;
|
||||
const env_js_1 = require("./env.js");
|
||||
const const_js_1 = require("./const.js");
|
||||
const proxy_js_1 = require("./proxy.js");
|
||||
__exportStar(require("./api/index.js"), exports);
|
||||
__exportStar(require("./plugin.js"), exports);
|
||||
__exportStar(require("./time.js"), exports);
|
||||
function setupDevtoolsPlugin(pluginDescriptor, setupFn) {
|
||||
const descriptor = pluginDescriptor;
|
||||
const target = (0, env_js_1.getTarget)();
|
||||
const hook = (0, env_js_1.getDevtoolsGlobalHook)();
|
||||
const enableProxy = env_js_1.isProxyAvailable && descriptor.enableEarlyProxy;
|
||||
if (hook && (target.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__ || !enableProxy)) {
|
||||
hook.emit(const_js_1.HOOK_SETUP, pluginDescriptor, setupFn);
|
||||
}
|
||||
else {
|
||||
const proxy = enableProxy ? new proxy_js_1.ApiProxy(descriptor, hook) : null;
|
||||
const list = target.__VUE_DEVTOOLS_PLUGINS__ = target.__VUE_DEVTOOLS_PLUGINS__ || [];
|
||||
list.push({
|
||||
pluginDescriptor: descriptor,
|
||||
setupFn,
|
||||
proxy,
|
||||
});
|
||||
if (proxy)
|
||||
setupFn(proxy.proxiedTarget);
|
||||
}
|
||||
}
|
||||
exports.setupDevtoolsPlugin = setupDevtoolsPlugin;
|
||||
2
node_modules/@vue/devtools-api/lib/cjs/plugin.js
generated
vendored
Normal file
2
node_modules/@vue/devtools-api/lib/cjs/plugin.js
generated
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
111
node_modules/@vue/devtools-api/lib/cjs/proxy.js
generated
vendored
Normal file
111
node_modules/@vue/devtools-api/lib/cjs/proxy.js
generated
vendored
Normal file
|
|
@ -0,0 +1,111 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ApiProxy = void 0;
|
||||
const const_js_1 = require("./const.js");
|
||||
const time_js_1 = require("./time.js");
|
||||
class ApiProxy {
|
||||
constructor(plugin, hook) {
|
||||
this.target = null;
|
||||
this.targetQueue = [];
|
||||
this.onQueue = [];
|
||||
this.plugin = plugin;
|
||||
this.hook = hook;
|
||||
const defaultSettings = {};
|
||||
if (plugin.settings) {
|
||||
for (const id in plugin.settings) {
|
||||
const item = plugin.settings[id];
|
||||
defaultSettings[id] = item.defaultValue;
|
||||
}
|
||||
}
|
||||
const localSettingsSaveId = `__vue-devtools-plugin-settings__${plugin.id}`;
|
||||
let currentSettings = Object.assign({}, defaultSettings);
|
||||
try {
|
||||
const raw = localStorage.getItem(localSettingsSaveId);
|
||||
const data = JSON.parse(raw);
|
||||
Object.assign(currentSettings, data);
|
||||
}
|
||||
catch (e) {
|
||||
// noop
|
||||
}
|
||||
this.fallbacks = {
|
||||
getSettings() {
|
||||
return currentSettings;
|
||||
},
|
||||
setSettings(value) {
|
||||
try {
|
||||
localStorage.setItem(localSettingsSaveId, JSON.stringify(value));
|
||||
}
|
||||
catch (e) {
|
||||
// noop
|
||||
}
|
||||
currentSettings = value;
|
||||
},
|
||||
now() {
|
||||
return (0, time_js_1.now)();
|
||||
},
|
||||
};
|
||||
if (hook) {
|
||||
hook.on(const_js_1.HOOK_PLUGIN_SETTINGS_SET, (pluginId, value) => {
|
||||
if (pluginId === this.plugin.id) {
|
||||
this.fallbacks.setSettings(value);
|
||||
}
|
||||
});
|
||||
}
|
||||
this.proxiedOn = new Proxy({}, {
|
||||
get: (_target, prop) => {
|
||||
if (this.target) {
|
||||
return this.target.on[prop];
|
||||
}
|
||||
else {
|
||||
return (...args) => {
|
||||
this.onQueue.push({
|
||||
method: prop,
|
||||
args,
|
||||
});
|
||||
};
|
||||
}
|
||||
},
|
||||
});
|
||||
this.proxiedTarget = new Proxy({}, {
|
||||
get: (_target, prop) => {
|
||||
if (this.target) {
|
||||
return this.target[prop];
|
||||
}
|
||||
else if (prop === 'on') {
|
||||
return this.proxiedOn;
|
||||
}
|
||||
else if (Object.keys(this.fallbacks).includes(prop)) {
|
||||
return (...args) => {
|
||||
this.targetQueue.push({
|
||||
method: prop,
|
||||
args,
|
||||
resolve: () => { },
|
||||
});
|
||||
return this.fallbacks[prop](...args);
|
||||
};
|
||||
}
|
||||
else {
|
||||
return (...args) => {
|
||||
return new Promise(resolve => {
|
||||
this.targetQueue.push({
|
||||
method: prop,
|
||||
args,
|
||||
resolve,
|
||||
});
|
||||
});
|
||||
};
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
async setRealTarget(target) {
|
||||
this.target = target;
|
||||
for (const item of this.onQueue) {
|
||||
this.target.on[item.method](...item.args);
|
||||
}
|
||||
for (const item of this.targetQueue) {
|
||||
item.resolve(await this.target[item.method](...item.args));
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.ApiProxy = ApiProxy;
|
||||
28
node_modules/@vue/devtools-api/lib/cjs/time.js
generated
vendored
Normal file
28
node_modules/@vue/devtools-api/lib/cjs/time.js
generated
vendored
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.now = exports.isPerformanceSupported = void 0;
|
||||
let supported;
|
||||
let perf;
|
||||
function isPerformanceSupported() {
|
||||
var _a;
|
||||
if (supported !== undefined) {
|
||||
return supported;
|
||||
}
|
||||
if (typeof window !== 'undefined' && window.performance) {
|
||||
supported = true;
|
||||
perf = window.performance;
|
||||
}
|
||||
else if (typeof global !== 'undefined' && ((_a = global.perf_hooks) === null || _a === void 0 ? void 0 : _a.performance)) {
|
||||
supported = true;
|
||||
perf = global.perf_hooks.performance;
|
||||
}
|
||||
else {
|
||||
supported = false;
|
||||
}
|
||||
return supported;
|
||||
}
|
||||
exports.isPerformanceSupported = isPerformanceSupported;
|
||||
function now() {
|
||||
return isPerformanceSupported() ? perf.now() : Date.now();
|
||||
}
|
||||
exports.now = now;
|
||||
108
node_modules/@vue/devtools-api/lib/esm/api/api.d.ts
generated
vendored
Normal file
108
node_modules/@vue/devtools-api/lib/esm/api/api.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,108 @@
|
|||
import type { ComponentBounds, Hookable } from './hooks.js';
|
||||
import type { Context } from './context.js';
|
||||
import type { ComponentInstance, ComponentState, StateBase } from './component.js';
|
||||
import type { App } from './app.js';
|
||||
import type { ID } from './util.js';
|
||||
export interface DevtoolsPluginApi<TSettings> {
|
||||
on: Hookable<Context>;
|
||||
notifyComponentUpdate(instance?: ComponentInstance): void;
|
||||
addTimelineLayer(options: TimelineLayerOptions): void;
|
||||
addTimelineEvent(options: TimelineEventOptions): void;
|
||||
addInspector(options: CustomInspectorOptions): void;
|
||||
sendInspectorTree(inspectorId: string): void;
|
||||
sendInspectorState(inspectorId: string): void;
|
||||
selectInspectorNode(inspectorId: string, nodeId: string): void;
|
||||
getComponentBounds(instance: ComponentInstance): Promise<ComponentBounds>;
|
||||
getComponentName(instance: ComponentInstance): Promise<string>;
|
||||
getComponentInstances(app: App): Promise<ComponentInstance[]>;
|
||||
highlightElement(instance: ComponentInstance): void;
|
||||
unhighlightElement(): void;
|
||||
getSettings(pluginId?: string): TSettings;
|
||||
now(): number;
|
||||
/**
|
||||
* @private Not implemented yet
|
||||
*/
|
||||
setSettings(values: TSettings): void;
|
||||
}
|
||||
export interface AppRecord {
|
||||
id: string;
|
||||
name: string;
|
||||
instanceMap: Map<string, ComponentInstance>;
|
||||
rootInstance: ComponentInstance;
|
||||
}
|
||||
export interface TimelineLayerOptions<TData = any, TMeta = any> {
|
||||
id: string;
|
||||
label: string;
|
||||
color: number;
|
||||
skipScreenshots?: boolean;
|
||||
groupsOnly?: boolean;
|
||||
ignoreNoDurationGroups?: boolean;
|
||||
screenshotOverlayRender?: (event: TimelineEvent<TData, TMeta> & ScreenshotOverlayEvent, ctx: ScreenshotOverlayRenderContext) => ScreenshotOverlayRenderResult | Promise<ScreenshotOverlayRenderResult>;
|
||||
}
|
||||
export interface ScreenshotOverlayEvent {
|
||||
layerId: string;
|
||||
renderMeta: any;
|
||||
}
|
||||
export interface ScreenshotOverlayRenderContext<TData = any, TMeta = any> {
|
||||
screenshot: ScreenshotData;
|
||||
events: (TimelineEvent<TData, TMeta> & ScreenshotOverlayEvent)[];
|
||||
index: number;
|
||||
}
|
||||
export declare type ScreenshotOverlayRenderResult = HTMLElement | string | false;
|
||||
export interface ScreenshotData {
|
||||
time: number;
|
||||
}
|
||||
export interface TimelineEventOptions {
|
||||
layerId: string;
|
||||
event: TimelineEvent;
|
||||
all?: boolean;
|
||||
}
|
||||
export interface TimelineEvent<TData = any, TMeta = any> {
|
||||
time: number;
|
||||
data: TData;
|
||||
logType?: 'default' | 'warning' | 'error';
|
||||
meta?: TMeta;
|
||||
groupId?: ID;
|
||||
title?: string;
|
||||
subtitle?: string;
|
||||
}
|
||||
export interface TimelineMarkerOptions {
|
||||
id: string;
|
||||
time: number;
|
||||
color: number;
|
||||
label: string;
|
||||
all?: boolean;
|
||||
}
|
||||
export interface CustomInspectorOptions {
|
||||
id: string;
|
||||
label: string;
|
||||
icon?: string;
|
||||
treeFilterPlaceholder?: string;
|
||||
stateFilterPlaceholder?: string;
|
||||
noSelectionText?: string;
|
||||
actions?: {
|
||||
icon: string;
|
||||
tooltip?: string;
|
||||
action: () => void | Promise<void>;
|
||||
}[];
|
||||
nodeActions?: {
|
||||
icon: string;
|
||||
tooltip?: string;
|
||||
action: (nodeId: string) => void | Promise<void>;
|
||||
}[];
|
||||
}
|
||||
export interface CustomInspectorNode {
|
||||
id: string;
|
||||
label: string;
|
||||
children?: CustomInspectorNode[];
|
||||
tags?: InspectorNodeTag[];
|
||||
}
|
||||
export interface InspectorNodeTag {
|
||||
label: string;
|
||||
textColor: number;
|
||||
backgroundColor: number;
|
||||
tooltip?: string;
|
||||
}
|
||||
export interface CustomInspectorState {
|
||||
[key: string]: (StateBase | Omit<ComponentState, 'type'>)[];
|
||||
}
|
||||
1
node_modules/@vue/devtools-api/lib/esm/api/api.js
generated
vendored
Normal file
1
node_modules/@vue/devtools-api/lib/esm/api/api.js
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
export {};
|
||||
1
node_modules/@vue/devtools-api/lib/esm/api/app.d.ts
generated
vendored
Normal file
1
node_modules/@vue/devtools-api/lib/esm/api/app.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
export declare type App = any;
|
||||
1
node_modules/@vue/devtools-api/lib/esm/api/app.js
generated
vendored
Normal file
1
node_modules/@vue/devtools-api/lib/esm/api/app.js
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
export {};
|
||||
78
node_modules/@vue/devtools-api/lib/esm/api/component.d.ts
generated
vendored
Normal file
78
node_modules/@vue/devtools-api/lib/esm/api/component.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,78 @@
|
|||
import type { InspectorNodeTag } from './api.js';
|
||||
import type { ID } from './util.js';
|
||||
export declare type ComponentInstance = any;
|
||||
export interface ComponentTreeNode {
|
||||
uid: ID;
|
||||
id: string;
|
||||
name: string;
|
||||
renderKey: string | number;
|
||||
inactive: boolean;
|
||||
isFragment: boolean;
|
||||
hasChildren: boolean;
|
||||
children: ComponentTreeNode[];
|
||||
domOrder?: number[];
|
||||
consoleId?: string;
|
||||
isRouterView?: boolean;
|
||||
macthedRouteSegment?: string;
|
||||
tags: InspectorNodeTag[];
|
||||
autoOpen: boolean;
|
||||
meta?: any;
|
||||
}
|
||||
export interface InspectedComponentData {
|
||||
id: string;
|
||||
name: string;
|
||||
file: string;
|
||||
state: ComponentState[];
|
||||
functional?: boolean;
|
||||
}
|
||||
export interface StateBase {
|
||||
key: string;
|
||||
value: any;
|
||||
editable?: boolean;
|
||||
objectType?: 'ref' | 'reactive' | 'computed' | 'other';
|
||||
raw?: string;
|
||||
}
|
||||
export interface ComponentStateBase extends StateBase {
|
||||
type: string;
|
||||
}
|
||||
export interface ComponentPropState extends ComponentStateBase {
|
||||
meta?: {
|
||||
type: string;
|
||||
required: boolean;
|
||||
/** Vue 1 only */
|
||||
mode?: 'default' | 'sync' | 'once';
|
||||
};
|
||||
}
|
||||
export declare type ComponentBuiltinCustomStateTypes = 'function' | 'map' | 'set' | 'reference' | 'component' | 'component-definition' | 'router' | 'store';
|
||||
export interface ComponentCustomState extends ComponentStateBase {
|
||||
value: CustomState;
|
||||
}
|
||||
export declare type CustomState = {
|
||||
_custom: {
|
||||
type: ComponentBuiltinCustomStateTypes | string;
|
||||
objectType?: string;
|
||||
display?: string;
|
||||
tooltip?: string;
|
||||
value?: any;
|
||||
abstract?: boolean;
|
||||
file?: string;
|
||||
uid?: number;
|
||||
readOnly?: boolean;
|
||||
/** Configure immediate child fields */
|
||||
fields?: {
|
||||
abstract?: boolean;
|
||||
};
|
||||
id?: any;
|
||||
actions?: {
|
||||
icon: string;
|
||||
tooltip?: string;
|
||||
action: () => void | Promise<void>;
|
||||
}[];
|
||||
/** internal */
|
||||
_reviveId?: number;
|
||||
};
|
||||
};
|
||||
export declare type ComponentState = ComponentStateBase | ComponentPropState | ComponentCustomState;
|
||||
export interface ComponentDevtoolsOptions {
|
||||
hide?: boolean;
|
||||
}
|
||||
1
node_modules/@vue/devtools-api/lib/esm/api/component.js
generated
vendored
Normal file
1
node_modules/@vue/devtools-api/lib/esm/api/component.js
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
export {};
|
||||
5
node_modules/@vue/devtools-api/lib/esm/api/context.d.ts
generated
vendored
Normal file
5
node_modules/@vue/devtools-api/lib/esm/api/context.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
import type { AppRecord } from './api.js';
|
||||
export interface Context {
|
||||
currentTab: string;
|
||||
currentAppRecord: AppRecord;
|
||||
}
|
||||
1
node_modules/@vue/devtools-api/lib/esm/api/context.js
generated
vendored
Normal file
1
node_modules/@vue/devtools-api/lib/esm/api/context.js
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
export {};
|
||||
180
node_modules/@vue/devtools-api/lib/esm/api/hooks.d.ts
generated
vendored
Normal file
180
node_modules/@vue/devtools-api/lib/esm/api/hooks.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,180 @@
|
|||
import type { ComponentTreeNode, InspectedComponentData, ComponentInstance, ComponentDevtoolsOptions } from './component.js';
|
||||
import type { App } from './app.js';
|
||||
import type { CustomInspectorNode, CustomInspectorState, TimelineEvent } from './api.js';
|
||||
export declare const enum Hooks {
|
||||
TRANSFORM_CALL = "transformCall",
|
||||
GET_APP_RECORD_NAME = "getAppRecordName",
|
||||
GET_APP_ROOT_INSTANCE = "getAppRootInstance",
|
||||
REGISTER_APPLICATION = "registerApplication",
|
||||
WALK_COMPONENT_TREE = "walkComponentTree",
|
||||
VISIT_COMPONENT_TREE = "visitComponentTree",
|
||||
WALK_COMPONENT_PARENTS = "walkComponentParents",
|
||||
INSPECT_COMPONENT = "inspectComponent",
|
||||
GET_COMPONENT_BOUNDS = "getComponentBounds",
|
||||
GET_COMPONENT_NAME = "getComponentName",
|
||||
GET_COMPONENT_INSTANCES = "getComponentInstances",
|
||||
GET_ELEMENT_COMPONENT = "getElementComponent",
|
||||
GET_COMPONENT_ROOT_ELEMENTS = "getComponentRootElements",
|
||||
EDIT_COMPONENT_STATE = "editComponentState",
|
||||
GET_COMPONENT_DEVTOOLS_OPTIONS = "getAppDevtoolsOptions",
|
||||
GET_COMPONENT_RENDER_CODE = "getComponentRenderCode",
|
||||
INSPECT_TIMELINE_EVENT = "inspectTimelineEvent",
|
||||
TIMELINE_CLEARED = "timelineCleared",
|
||||
GET_INSPECTOR_TREE = "getInspectorTree",
|
||||
GET_INSPECTOR_STATE = "getInspectorState",
|
||||
EDIT_INSPECTOR_STATE = "editInspectorState",
|
||||
SET_PLUGIN_SETTINGS = "setPluginSettings"
|
||||
}
|
||||
export interface ComponentBounds {
|
||||
left: number;
|
||||
top: number;
|
||||
width: number;
|
||||
height: number;
|
||||
}
|
||||
export declare type HookPayloads = {
|
||||
[Hooks.TRANSFORM_CALL]: {
|
||||
callName: string;
|
||||
inArgs: any[];
|
||||
outArgs: any[];
|
||||
};
|
||||
[Hooks.GET_APP_RECORD_NAME]: {
|
||||
app: App;
|
||||
name: string;
|
||||
};
|
||||
[Hooks.GET_APP_ROOT_INSTANCE]: {
|
||||
app: App;
|
||||
root: ComponentInstance;
|
||||
};
|
||||
[Hooks.REGISTER_APPLICATION]: {
|
||||
app: App;
|
||||
};
|
||||
[Hooks.WALK_COMPONENT_TREE]: {
|
||||
componentInstance: ComponentInstance;
|
||||
componentTreeData: ComponentTreeNode[];
|
||||
maxDepth: number;
|
||||
filter: string;
|
||||
recursively: boolean;
|
||||
};
|
||||
[Hooks.VISIT_COMPONENT_TREE]: {
|
||||
app: App;
|
||||
componentInstance: ComponentInstance;
|
||||
treeNode: ComponentTreeNode;
|
||||
filter: string;
|
||||
};
|
||||
[Hooks.WALK_COMPONENT_PARENTS]: {
|
||||
componentInstance: ComponentInstance;
|
||||
parentInstances: ComponentInstance[];
|
||||
};
|
||||
[Hooks.INSPECT_COMPONENT]: {
|
||||
app: App;
|
||||
componentInstance: ComponentInstance;
|
||||
instanceData: InspectedComponentData;
|
||||
};
|
||||
[Hooks.GET_COMPONENT_BOUNDS]: {
|
||||
componentInstance: ComponentInstance;
|
||||
bounds: ComponentBounds;
|
||||
};
|
||||
[Hooks.GET_COMPONENT_NAME]: {
|
||||
componentInstance: ComponentInstance;
|
||||
name: string;
|
||||
};
|
||||
[Hooks.GET_COMPONENT_INSTANCES]: {
|
||||
app: App;
|
||||
componentInstances: ComponentInstance[];
|
||||
};
|
||||
[Hooks.GET_ELEMENT_COMPONENT]: {
|
||||
element: HTMLElement | any;
|
||||
componentInstance: ComponentInstance;
|
||||
};
|
||||
[Hooks.GET_COMPONENT_ROOT_ELEMENTS]: {
|
||||
componentInstance: ComponentInstance;
|
||||
rootElements: (HTMLElement | any)[];
|
||||
};
|
||||
[Hooks.EDIT_COMPONENT_STATE]: {
|
||||
app: App;
|
||||
componentInstance: ComponentInstance;
|
||||
path: string[];
|
||||
type: string;
|
||||
state: EditStatePayload;
|
||||
set: (object: any, path?: string | (string[]), value?: any, cb?: (object: any, field: string, value: any) => void) => void;
|
||||
};
|
||||
[Hooks.GET_COMPONENT_DEVTOOLS_OPTIONS]: {
|
||||
componentInstance: ComponentInstance;
|
||||
options: ComponentDevtoolsOptions;
|
||||
};
|
||||
[Hooks.GET_COMPONENT_RENDER_CODE]: {
|
||||
componentInstance: ComponentInstance;
|
||||
code: string;
|
||||
};
|
||||
[Hooks.INSPECT_TIMELINE_EVENT]: {
|
||||
app: App;
|
||||
layerId: string;
|
||||
event: TimelineEvent;
|
||||
all?: boolean;
|
||||
data: any;
|
||||
};
|
||||
[Hooks.TIMELINE_CLEARED]: Record<string, never>;
|
||||
[Hooks.GET_INSPECTOR_TREE]: {
|
||||
app: App;
|
||||
inspectorId: string;
|
||||
filter: string;
|
||||
rootNodes: CustomInspectorNode[];
|
||||
};
|
||||
[Hooks.GET_INSPECTOR_STATE]: {
|
||||
app: App;
|
||||
inspectorId: string;
|
||||
nodeId: string;
|
||||
state: CustomInspectorState;
|
||||
};
|
||||
[Hooks.EDIT_INSPECTOR_STATE]: {
|
||||
app: App;
|
||||
inspectorId: string;
|
||||
nodeId: string;
|
||||
path: string[];
|
||||
type: string;
|
||||
state: EditStatePayload;
|
||||
set: (object: any, path?: string | (string[]), value?: any, cb?: (object: any, field: string, value: any) => void) => void;
|
||||
};
|
||||
[Hooks.SET_PLUGIN_SETTINGS]: {
|
||||
app: App;
|
||||
pluginId: string;
|
||||
key: string;
|
||||
newValue: any;
|
||||
oldValue: any;
|
||||
settings: any;
|
||||
};
|
||||
};
|
||||
export declare type EditStatePayload = {
|
||||
value: any;
|
||||
newKey?: string | null;
|
||||
remove?: undefined | false;
|
||||
} | {
|
||||
value?: undefined;
|
||||
newKey?: undefined;
|
||||
remove: true;
|
||||
};
|
||||
export declare type HookHandler<TPayload, TContext> = (payload: TPayload, ctx: TContext) => void | Promise<void>;
|
||||
export interface Hookable<TContext> {
|
||||
transformCall(handler: HookHandler<HookPayloads[Hooks.TRANSFORM_CALL], TContext>): any;
|
||||
getAppRecordName(handler: HookHandler<HookPayloads[Hooks.GET_APP_RECORD_NAME], TContext>): any;
|
||||
getAppRootInstance(handler: HookHandler<HookPayloads[Hooks.GET_APP_ROOT_INSTANCE], TContext>): any;
|
||||
registerApplication(handler: HookHandler<HookPayloads[Hooks.REGISTER_APPLICATION], TContext>): any;
|
||||
walkComponentTree(handler: HookHandler<HookPayloads[Hooks.WALK_COMPONENT_TREE], TContext>): any;
|
||||
visitComponentTree(handler: HookHandler<HookPayloads[Hooks.VISIT_COMPONENT_TREE], TContext>): any;
|
||||
walkComponentParents(handler: HookHandler<HookPayloads[Hooks.WALK_COMPONENT_PARENTS], TContext>): any;
|
||||
inspectComponent(handler: HookHandler<HookPayloads[Hooks.INSPECT_COMPONENT], TContext>): any;
|
||||
getComponentBounds(handler: HookHandler<HookPayloads[Hooks.GET_COMPONENT_BOUNDS], TContext>): any;
|
||||
getComponentName(handler: HookHandler<HookPayloads[Hooks.GET_COMPONENT_NAME], TContext>): any;
|
||||
getComponentInstances(handler: HookHandler<HookPayloads[Hooks.GET_COMPONENT_INSTANCES], TContext>): any;
|
||||
getElementComponent(handler: HookHandler<HookPayloads[Hooks.GET_ELEMENT_COMPONENT], TContext>): any;
|
||||
getComponentRootElements(handler: HookHandler<HookPayloads[Hooks.GET_COMPONENT_ROOT_ELEMENTS], TContext>): any;
|
||||
editComponentState(handler: HookHandler<HookPayloads[Hooks.EDIT_COMPONENT_STATE], TContext>): any;
|
||||
getComponentDevtoolsOptions(handler: HookHandler<HookPayloads[Hooks.GET_COMPONENT_DEVTOOLS_OPTIONS], TContext>): any;
|
||||
getComponentRenderCode(handler: HookHandler<HookPayloads[Hooks.GET_COMPONENT_RENDER_CODE], TContext>): any;
|
||||
inspectTimelineEvent(handler: HookHandler<HookPayloads[Hooks.INSPECT_TIMELINE_EVENT], TContext>): any;
|
||||
timelineCleared(handler: HookHandler<HookPayloads[Hooks.TIMELINE_CLEARED], TContext>): any;
|
||||
getInspectorTree(handler: HookHandler<HookPayloads[Hooks.GET_INSPECTOR_TREE], TContext>): any;
|
||||
getInspectorState(handler: HookHandler<HookPayloads[Hooks.GET_INSPECTOR_STATE], TContext>): any;
|
||||
editInspectorState(handler: HookHandler<HookPayloads[Hooks.EDIT_INSPECTOR_STATE], TContext>): any;
|
||||
setPluginSettings(handler: HookHandler<HookPayloads[Hooks.SET_PLUGIN_SETTINGS], TContext>): any;
|
||||
}
|
||||
1
node_modules/@vue/devtools-api/lib/esm/api/hooks.js
generated
vendored
Normal file
1
node_modules/@vue/devtools-api/lib/esm/api/hooks.js
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
export {};
|
||||
6
node_modules/@vue/devtools-api/lib/esm/api/index.d.ts
generated
vendored
Normal file
6
node_modules/@vue/devtools-api/lib/esm/api/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
export * from './api.js';
|
||||
export * from './app.js';
|
||||
export * from './component.js';
|
||||
export * from './context.js';
|
||||
export * from './hooks.js';
|
||||
export * from './util.js';
|
||||
6
node_modules/@vue/devtools-api/lib/esm/api/index.js
generated
vendored
Normal file
6
node_modules/@vue/devtools-api/lib/esm/api/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
export * from './api.js';
|
||||
export * from './app.js';
|
||||
export * from './component.js';
|
||||
export * from './context.js';
|
||||
export * from './hooks.js';
|
||||
export * from './util.js';
|
||||
4
node_modules/@vue/devtools-api/lib/esm/api/util.d.ts
generated
vendored
Normal file
4
node_modules/@vue/devtools-api/lib/esm/api/util.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
export declare type ID = number | string;
|
||||
export interface WithId {
|
||||
id: ID;
|
||||
}
|
||||
1
node_modules/@vue/devtools-api/lib/esm/api/util.js
generated
vendored
Normal file
1
node_modules/@vue/devtools-api/lib/esm/api/util.js
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
export {};
|
||||
2
node_modules/@vue/devtools-api/lib/esm/const.d.ts
generated
vendored
Normal file
2
node_modules/@vue/devtools-api/lib/esm/const.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
export declare const HOOK_SETUP = "devtools-plugin:setup";
|
||||
export declare const HOOK_PLUGIN_SETTINGS_SET = "plugin:settings:set";
|
||||
2
node_modules/@vue/devtools-api/lib/esm/const.js
generated
vendored
Normal file
2
node_modules/@vue/devtools-api/lib/esm/const.js
generated
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
export const HOOK_SETUP = 'devtools-plugin:setup';
|
||||
export const HOOK_PLUGIN_SETTINGS_SET = 'plugin:settings:set';
|
||||
15
node_modules/@vue/devtools-api/lib/esm/env.d.ts
generated
vendored
Normal file
15
node_modules/@vue/devtools-api/lib/esm/env.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
import type { PluginDescriptor, SetupFunction } from './index.js';
|
||||
import type { ApiProxy } from './proxy.js';
|
||||
export interface PluginQueueItem {
|
||||
pluginDescriptor: PluginDescriptor;
|
||||
setupFn: SetupFunction;
|
||||
proxy?: ApiProxy;
|
||||
}
|
||||
interface GlobalTarget {
|
||||
__VUE_DEVTOOLS_PLUGINS__?: PluginQueueItem[];
|
||||
__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__?: boolean;
|
||||
}
|
||||
export declare function getDevtoolsGlobalHook(): any;
|
||||
export declare function getTarget(): GlobalTarget;
|
||||
export declare const isProxyAvailable: boolean;
|
||||
export {};
|
||||
12
node_modules/@vue/devtools-api/lib/esm/env.js
generated
vendored
Normal file
12
node_modules/@vue/devtools-api/lib/esm/env.js
generated
vendored
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
export function getDevtoolsGlobalHook() {
|
||||
return getTarget().__VUE_DEVTOOLS_GLOBAL_HOOK__;
|
||||
}
|
||||
export function getTarget() {
|
||||
// @ts-ignore
|
||||
return (typeof navigator !== 'undefined' && typeof window !== 'undefined')
|
||||
? window
|
||||
: typeof global !== 'undefined'
|
||||
? global
|
||||
: {};
|
||||
}
|
||||
export const isProxyAvailable = typeof Proxy === 'function';
|
||||
18
node_modules/@vue/devtools-api/lib/esm/index.d.ts
generated
vendored
Normal file
18
node_modules/@vue/devtools-api/lib/esm/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
import type { DevtoolsPluginApi } from './api/index.js';
|
||||
import type { PluginDescriptor, ExtractSettingsTypes, PluginSettingsItem } from './plugin.js';
|
||||
export * from './api/index.js';
|
||||
export * from './plugin.js';
|
||||
export * from './time.js';
|
||||
export { PluginQueueItem } from './env.js';
|
||||
declare type Cast<A, B> = A extends B ? A : B;
|
||||
declare type Narrowable = string | number | bigint | boolean;
|
||||
declare type Narrow<A> = Cast<A, [] | (A extends Narrowable ? A : never) | ({
|
||||
[K in keyof A]: Narrow<A[K]>;
|
||||
})>;
|
||||
declare type Exact<C, T> = {
|
||||
[K in keyof C]: K extends keyof T ? T[K] : never;
|
||||
};
|
||||
export declare type SetupFunction<TSettings = any> = (api: DevtoolsPluginApi<TSettings>) => void;
|
||||
export declare function setupDevtoolsPlugin<TDescriptor extends Exact<TDescriptor, PluginDescriptor>, TSettings = ExtractSettingsTypes<TDescriptor extends {
|
||||
settings: infer S;
|
||||
} ? S extends Record<string, PluginSettingsItem> ? S : Record<string, PluginSettingsItem> : Record<string, PluginSettingsItem>>>(pluginDescriptor: Narrow<TDescriptor>, setupFn: SetupFunction<TSettings>): void;
|
||||
26
node_modules/@vue/devtools-api/lib/esm/index.js
generated
vendored
Normal file
26
node_modules/@vue/devtools-api/lib/esm/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
import { getTarget, getDevtoolsGlobalHook, isProxyAvailable } from './env.js';
|
||||
import { HOOK_SETUP } from './const.js';
|
||||
import { ApiProxy } from './proxy.js';
|
||||
export * from './api/index.js';
|
||||
export * from './plugin.js';
|
||||
export * from './time.js';
|
||||
export function setupDevtoolsPlugin(pluginDescriptor, setupFn) {
|
||||
const descriptor = pluginDescriptor;
|
||||
const target = getTarget();
|
||||
const hook = getDevtoolsGlobalHook();
|
||||
const enableProxy = isProxyAvailable && descriptor.enableEarlyProxy;
|
||||
if (hook && (target.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__ || !enableProxy)) {
|
||||
hook.emit(HOOK_SETUP, pluginDescriptor, setupFn);
|
||||
}
|
||||
else {
|
||||
const proxy = enableProxy ? new ApiProxy(descriptor, hook) : null;
|
||||
const list = target.__VUE_DEVTOOLS_PLUGINS__ = target.__VUE_DEVTOOLS_PLUGINS__ || [];
|
||||
list.push({
|
||||
pluginDescriptor: descriptor,
|
||||
setupFn,
|
||||
proxy,
|
||||
});
|
||||
if (proxy)
|
||||
setupFn(proxy.proxiedTarget);
|
||||
}
|
||||
}
|
||||
47
node_modules/@vue/devtools-api/lib/esm/plugin.d.ts
generated
vendored
Normal file
47
node_modules/@vue/devtools-api/lib/esm/plugin.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
import type { App } from './api/index.js';
|
||||
export interface PluginDescriptor {
|
||||
id: string;
|
||||
label: string;
|
||||
app: App;
|
||||
packageName?: string;
|
||||
homepage?: string;
|
||||
componentStateTypes?: string[];
|
||||
logo?: string;
|
||||
disableAppScope?: boolean;
|
||||
disablePluginScope?: boolean;
|
||||
/**
|
||||
* Run the plugin setup and expose the api even if the devtools is not opened yet.
|
||||
* Useful to record timeline events early.
|
||||
*/
|
||||
enableEarlyProxy?: boolean;
|
||||
settings?: Record<string, PluginSettingsItem>;
|
||||
}
|
||||
export declare type PluginSettingsItem = {
|
||||
label: string;
|
||||
description?: string;
|
||||
} & ({
|
||||
type: 'boolean';
|
||||
defaultValue: boolean;
|
||||
} | {
|
||||
type: 'choice';
|
||||
defaultValue: string | number;
|
||||
options: {
|
||||
value: string | number;
|
||||
label: string;
|
||||
}[];
|
||||
component?: 'select' | 'button-group';
|
||||
} | {
|
||||
type: 'text';
|
||||
defaultValue: string;
|
||||
});
|
||||
declare type InferSettingsType<T extends PluginSettingsItem> = [T] extends [{
|
||||
type: 'boolean';
|
||||
}] ? boolean : [T] extends [{
|
||||
type: 'choice';
|
||||
}] ? T['options'][number]['value'] : [T] extends [{
|
||||
type: 'text';
|
||||
}] ? string : unknown;
|
||||
export declare type ExtractSettingsTypes<O extends Record<string, PluginSettingsItem>> = {
|
||||
[K in keyof O]: InferSettingsType<O[K]>;
|
||||
};
|
||||
export {};
|
||||
1
node_modules/@vue/devtools-api/lib/esm/plugin.js
generated
vendored
Normal file
1
node_modules/@vue/devtools-api/lib/esm/plugin.js
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
export {};
|
||||
20
node_modules/@vue/devtools-api/lib/esm/proxy.d.ts
generated
vendored
Normal file
20
node_modules/@vue/devtools-api/lib/esm/proxy.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
import type { Context, DevtoolsPluginApi, Hookable } from './api/index.js';
|
||||
import type { PluginDescriptor } from './plugin.js';
|
||||
interface QueueItem {
|
||||
method: string;
|
||||
args: any[];
|
||||
resolve?: (value?: any) => void;
|
||||
}
|
||||
export declare class ApiProxy<TTarget extends DevtoolsPluginApi<any> = DevtoolsPluginApi<any>> {
|
||||
target: TTarget | null;
|
||||
targetQueue: QueueItem[];
|
||||
proxiedTarget: TTarget;
|
||||
onQueue: QueueItem[];
|
||||
proxiedOn: Hookable<Context>;
|
||||
plugin: PluginDescriptor;
|
||||
hook: any;
|
||||
fallbacks: Record<string, any>;
|
||||
constructor(plugin: PluginDescriptor, hook: any);
|
||||
setRealTarget(target: TTarget): Promise<void>;
|
||||
}
|
||||
export {};
|
||||
107
node_modules/@vue/devtools-api/lib/esm/proxy.js
generated
vendored
Normal file
107
node_modules/@vue/devtools-api/lib/esm/proxy.js
generated
vendored
Normal file
|
|
@ -0,0 +1,107 @@
|
|||
import { HOOK_PLUGIN_SETTINGS_SET } from './const.js';
|
||||
import { now } from './time.js';
|
||||
export class ApiProxy {
|
||||
constructor(plugin, hook) {
|
||||
this.target = null;
|
||||
this.targetQueue = [];
|
||||
this.onQueue = [];
|
||||
this.plugin = plugin;
|
||||
this.hook = hook;
|
||||
const defaultSettings = {};
|
||||
if (plugin.settings) {
|
||||
for (const id in plugin.settings) {
|
||||
const item = plugin.settings[id];
|
||||
defaultSettings[id] = item.defaultValue;
|
||||
}
|
||||
}
|
||||
const localSettingsSaveId = `__vue-devtools-plugin-settings__${plugin.id}`;
|
||||
let currentSettings = Object.assign({}, defaultSettings);
|
||||
try {
|
||||
const raw = localStorage.getItem(localSettingsSaveId);
|
||||
const data = JSON.parse(raw);
|
||||
Object.assign(currentSettings, data);
|
||||
}
|
||||
catch (e) {
|
||||
// noop
|
||||
}
|
||||
this.fallbacks = {
|
||||
getSettings() {
|
||||
return currentSettings;
|
||||
},
|
||||
setSettings(value) {
|
||||
try {
|
||||
localStorage.setItem(localSettingsSaveId, JSON.stringify(value));
|
||||
}
|
||||
catch (e) {
|
||||
// noop
|
||||
}
|
||||
currentSettings = value;
|
||||
},
|
||||
now() {
|
||||
return now();
|
||||
},
|
||||
};
|
||||
if (hook) {
|
||||
hook.on(HOOK_PLUGIN_SETTINGS_SET, (pluginId, value) => {
|
||||
if (pluginId === this.plugin.id) {
|
||||
this.fallbacks.setSettings(value);
|
||||
}
|
||||
});
|
||||
}
|
||||
this.proxiedOn = new Proxy({}, {
|
||||
get: (_target, prop) => {
|
||||
if (this.target) {
|
||||
return this.target.on[prop];
|
||||
}
|
||||
else {
|
||||
return (...args) => {
|
||||
this.onQueue.push({
|
||||
method: prop,
|
||||
args,
|
||||
});
|
||||
};
|
||||
}
|
||||
},
|
||||
});
|
||||
this.proxiedTarget = new Proxy({}, {
|
||||
get: (_target, prop) => {
|
||||
if (this.target) {
|
||||
return this.target[prop];
|
||||
}
|
||||
else if (prop === 'on') {
|
||||
return this.proxiedOn;
|
||||
}
|
||||
else if (Object.keys(this.fallbacks).includes(prop)) {
|
||||
return (...args) => {
|
||||
this.targetQueue.push({
|
||||
method: prop,
|
||||
args,
|
||||
resolve: () => { },
|
||||
});
|
||||
return this.fallbacks[prop](...args);
|
||||
};
|
||||
}
|
||||
else {
|
||||
return (...args) => {
|
||||
return new Promise(resolve => {
|
||||
this.targetQueue.push({
|
||||
method: prop,
|
||||
args,
|
||||
resolve,
|
||||
});
|
||||
});
|
||||
};
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
async setRealTarget(target) {
|
||||
this.target = target;
|
||||
for (const item of this.onQueue) {
|
||||
this.target.on[item.method](...item.args);
|
||||
}
|
||||
for (const item of this.targetQueue) {
|
||||
item.resolve(await this.target[item.method](...item.args));
|
||||
}
|
||||
}
|
||||
}
|
||||
2
node_modules/@vue/devtools-api/lib/esm/time.d.ts
generated
vendored
Normal file
2
node_modules/@vue/devtools-api/lib/esm/time.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
export declare function isPerformanceSupported(): boolean;
|
||||
export declare function now(): number;
|
||||
23
node_modules/@vue/devtools-api/lib/esm/time.js
generated
vendored
Normal file
23
node_modules/@vue/devtools-api/lib/esm/time.js
generated
vendored
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
let supported;
|
||||
let perf;
|
||||
export function isPerformanceSupported() {
|
||||
var _a;
|
||||
if (supported !== undefined) {
|
||||
return supported;
|
||||
}
|
||||
if (typeof window !== 'undefined' && window.performance) {
|
||||
supported = true;
|
||||
perf = window.performance;
|
||||
}
|
||||
else if (typeof global !== 'undefined' && ((_a = global.perf_hooks) === null || _a === void 0 ? void 0 : _a.performance)) {
|
||||
supported = true;
|
||||
perf = global.perf_hooks.performance;
|
||||
}
|
||||
else {
|
||||
supported = false;
|
||||
}
|
||||
return supported;
|
||||
}
|
||||
export function now() {
|
||||
return isPerformanceSupported() ? perf.now() : Date.now();
|
||||
}
|
||||
37
node_modules/@vue/devtools-api/package.json
generated
vendored
Normal file
37
node_modules/@vue/devtools-api/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
{
|
||||
"name": "@vue/devtools-api",
|
||||
"version": "6.5.0",
|
||||
"description": "Interact with the Vue devtools from the page",
|
||||
"main": "lib/cjs/index.js",
|
||||
"browser": "lib/esm/index.js",
|
||||
"module": "lib/esm/index.js",
|
||||
"types": "lib/esm/index.d.ts",
|
||||
"sideEffects": false,
|
||||
"author": {
|
||||
"name": "Guillaume Chau"
|
||||
},
|
||||
"files": [
|
||||
"lib/esm",
|
||||
"lib/cjs"
|
||||
],
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"url": "https://github.com/vuejs/vue-devtools.git",
|
||||
"type": "git",
|
||||
"directory": "packages/api"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "rimraf lib && yarn build:esm && yarn build:cjs",
|
||||
"build:esm": "tsc --module es2015 --outDir lib/esm -d",
|
||||
"build:cjs": "tsc --module commonjs --outDir lib/cjs",
|
||||
"build:watch": "yarn tsc --module es2015 --outDir lib/esm -d -w --sourceMap"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^13.9.1",
|
||||
"@types/webpack-env": "^1.15.1",
|
||||
"typescript": "^4.5.2"
|
||||
}
|
||||
}
|
||||
21
node_modules/@vue/eslint-config-prettier/LICENSE
generated
vendored
Normal file
21
node_modules/@vue/eslint-config-prettier/LICENSE
generated
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2018-present 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.
|
||||
70
node_modules/@vue/eslint-config-prettier/README.md
generated
vendored
Normal file
70
node_modules/@vue/eslint-config-prettier/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
# @vue/eslint-config-prettier
|
||||
|
||||
> eslint-config-prettier for Vue
|
||||
|
||||
This config is specifically designed to be used by `@vue/cli` & `create-vue` setups
|
||||
and is not meant for outside use (it can be used but some adaptations
|
||||
on the user side might be needed - for details see the config file).
|
||||
|
||||
A part of its design is that this config may implicitly depend on
|
||||
other parts of `@vue/cli`/`create-vue` setups.
|
||||
|
||||
## Installation
|
||||
|
||||
Before [ESLint Flat Config](https://eslint.org/docs/latest/use/configure/configuration-files-new) becomes stable, in order to work around [a known limitation in ESLint](https://github.com/eslint/eslint/issues/3458), we recommend you to use this package alongside `@rushstack/eslint-patch`, so that you don't have to install too many dependencies:
|
||||
|
||||
```sh
|
||||
npm add --dev @vue/eslint-config-prettier @rushstack/eslint-patch
|
||||
```
|
||||
|
||||
Please also make sure that you have `prettier` and `eslint` installed.
|
||||
|
||||
## Usage
|
||||
|
||||
Add `"@vue/eslint-config-prettier"` to the `"extends"` array in your `.eslintrc.cjs` file. Make sure to put it **last**, so it gets the chance to override other configs.
|
||||
|
||||
```js
|
||||
require("@rushstack/eslint-patch/modern-module-resolution")
|
||||
|
||||
module.exports = {
|
||||
extends: [
|
||||
// ... other configs
|
||||
"@vue/eslint-config-prettier"
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
This configuration is the most straightward way to use ESLint with Prettier.
|
||||
|
||||
It disables all rules that are unnecessary or might conflict with Prettier.
|
||||
It also enables the `eslint-plugin-prettier` plugin, which runs Prettier as an ESLint rule and reports differences as individual ESLint issues.
|
||||
|
||||
By default all formatting issues are reported as warnings, and will be automatically fixed during `eslint --fix`.
|
||||
|
||||
## Use Separate Commands for Linting and Formatting
|
||||
|
||||
While the above setup is very straightforward, it is not necessarily the best way.
|
||||
|
||||
Running prettier inside the linter slows down the linting process, might clutter the editor with annoying warnings, and adds one layer of indirection where things may break.
|
||||
[Prettier's official documentation](https://prettier.io/docs/en/integrating-with-linters.html) recommends using separate commands for linting and formatting, i.e., Prettier for code formatting concerns and ESLint for code-quality concerns.
|
||||
|
||||
So we offered an additional ruleset to support this workflow:
|
||||
|
||||
```js
|
||||
require("@rushstack/eslint-patch/modern-module-resolution")
|
||||
|
||||
module.exports = {
|
||||
extends: [
|
||||
// ... other configs
|
||||
"@vue/eslint-config-prettier/skip-formatting"
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
Formatting issues won't be reported with this config.
|
||||
|
||||
You can run `prettier --check .` separately to check for formatting issues, or `prettier --write .` to fix them.
|
||||
|
||||
## Further Reading
|
||||
|
||||
The default config is based on the recommended configuration of [`eslint-plugin-prettier`](https://github.com/prettier/eslint-plugin-prettier/#recommended-configuration), which also depends on [`eslint-config-prettier`](https://github.com/prettier/eslint-config-prettier). Please refer to their corresponding documentations for more implementation details.
|
||||
7
node_modules/@vue/eslint-config-prettier/index.js
generated
vendored
Normal file
7
node_modules/@vue/eslint-config-prettier/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
module.exports = {
|
||||
plugins: ["prettier"],
|
||||
extends: ["plugin:prettier/recommended"],
|
||||
rules: {
|
||||
"prettier/prettier": "warn",
|
||||
},
|
||||
};
|
||||
49
node_modules/@vue/eslint-config-prettier/package.json
generated
vendored
Normal file
49
node_modules/@vue/eslint-config-prettier/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
{
|
||||
"name": "@vue/eslint-config-prettier",
|
||||
"version": "7.1.0",
|
||||
"description": "eslint-config-prettier for Vue",
|
||||
"main": "index.js",
|
||||
"files": [
|
||||
"index.js",
|
||||
"skip-formatting.js"
|
||||
],
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/vuejs/eslint-config-prettier.git"
|
||||
},
|
||||
"keywords": [
|
||||
"vue",
|
||||
"cli",
|
||||
"eslint",
|
||||
"prettier"
|
||||
],
|
||||
"author": "Evan You",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/vuejs/eslint-config-prettier/issues"
|
||||
},
|
||||
"homepage": "https://github.com/vuejs/eslint-config-prettier#readme",
|
||||
"dependencies": {
|
||||
"eslint-config-prettier": "^8.3.0",
|
||||
"eslint-plugin-prettier": "^4.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"eslint": "^8.5.0",
|
||||
"prettier": "^2.5.1"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"eslint": ">= 7.28.0",
|
||||
"prettier": ">= 2.0.0"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"extends": [
|
||||
"./index.js"
|
||||
]
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "eslint *.js --fix"
|
||||
}
|
||||
}
|
||||
6
node_modules/@vue/eslint-config-prettier/skip-formatting.js
generated
vendored
Normal file
6
node_modules/@vue/eslint-config-prettier/skip-formatting.js
generated
vendored
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
module.exports = {
|
||||
extends: [require.resolve("./index.js")],
|
||||
rules: {
|
||||
"prettier/prettier": "off",
|
||||
},
|
||||
};
|
||||
21
node_modules/@vue/eslint-config-typescript/LICENSE
generated
vendored
Normal file
21
node_modules/@vue/eslint-config-typescript/LICENSE
generated
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2018-present 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.
|
||||
75
node_modules/@vue/eslint-config-typescript/README.md
generated
vendored
Normal file
75
node_modules/@vue/eslint-config-typescript/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
# @vue/eslint-config-typescript
|
||||
|
||||
> eslint-config-typescript for Vue
|
||||
|
||||
See [@typescript-eslint/eslint-plugin](https://typescript-eslint.io/rules/) for available rules.
|
||||
|
||||
This config is specifically designed to be used by `@vue/cli` & `create-vue` setups
|
||||
and is not meant for outside use (it can be used but some adaptations
|
||||
on the user side might be needed - for details see the config file).
|
||||
|
||||
A part of its design is that this config may implicitly depend on
|
||||
other parts of `@vue/cli`/`create-vue` setups, such as `eslint-plugin-vue` being
|
||||
extended in the same resulting config.
|
||||
|
||||
## Installation
|
||||
|
||||
In order to work around [a known limitation in ESLint](https://github.com/eslint/eslint/issues/3458), we recommend you to use this package alongside `@rushstack/eslint-patch`, so that you don't have to install too many dependencies:
|
||||
|
||||
```sh
|
||||
npm add --dev @vue/eslint-config-typescript @rushstack/eslint-patch
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
This package comes with 2 rulesets.
|
||||
|
||||
### `@vue/eslint-config-typescript`
|
||||
|
||||
This ruleset is the base configuration for Vue-TypeScript projects.
|
||||
Besides setting the parser and plugin options, it also turns off several conflicting rules in the `eslint:recommended` ruleset.
|
||||
So when used alongside other sharable configs, this config should be placed at the end of the `extends` array.
|
||||
|
||||
An example `.eslintrc.cjs`:
|
||||
|
||||
```js
|
||||
/* eslint-env node */
|
||||
require("@rushstack/eslint-patch/modern-module-resolution")
|
||||
|
||||
module.exports = {
|
||||
extends: [
|
||||
'eslint:recommended',
|
||||
'plugin:vue/vue3-essential',
|
||||
'@vue/eslint-config-typescript'
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### `@vue/eslint-config-typescript/recommended`
|
||||
|
||||
This is extended from the `@typescript-eslint/recommended` ruleset, which is an **_opinionated_** ruleset.
|
||||
See the [original documentation](https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/eslint-plugin/src/configs#recommended) for more information.
|
||||
|
||||
Some of its rules, however, might conflict with `prettier`.
|
||||
So when used alongside other sharable configs, this config should be placed after all other configs except for the one from `@vue/eslint-config-prettier` or `eslint-plugin-prettier` in the `extends` array.
|
||||
|
||||
An example `.eslintrc.cjs`:
|
||||
|
||||
```js
|
||||
/* eslint-env node */
|
||||
require("@rushstack/eslint-patch/modern-module-resolution")
|
||||
|
||||
module.exports = {
|
||||
extends: [
|
||||
'plugin:vue/vue3-essential',
|
||||
'@vue/eslint-config-typescript/recommended',
|
||||
'@vue/eslint-config-prettier'
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### With Other Community Configs
|
||||
|
||||
Work-In-Progress.
|
||||
|
||||
~~If you are following the [`standard`](https://standardjs.com/) or [`airbnb`](https://github.com/airbnb/javascript/) style guides, don't manually extend from this package. Please use `@vue/eslint-config-standard-with-typescript` or `@vue/eslint-config-airbnb-with-typescript` instead.~~
|
||||
42
node_modules/@vue/eslint-config-typescript/index.js
generated
vendored
Normal file
42
node_modules/@vue/eslint-config-typescript/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
module.exports = {
|
||||
plugins: ['@typescript-eslint'],
|
||||
|
||||
// Prerequisite `eslint-plugin-vue`, being extended, sets
|
||||
// root property `parser` to `'vue-eslint-parser'`, which, for code parsing,
|
||||
// in turn delegates to the parser, specified in `parserOptions.parser`:
|
||||
// https://github.com/vuejs/eslint-plugin-vue#what-is-the-use-the-latest-vue-eslint-parser-error
|
||||
parserOptions: {
|
||||
parser: {
|
||||
'js': 'espree',
|
||||
'jsx': 'espree',
|
||||
|
||||
'ts': require.resolve('@typescript-eslint/parser'),
|
||||
'tsx': require.resolve('@typescript-eslint/parser'),
|
||||
|
||||
// Leave the template parser unspecified, so that it could be determined by `<script lang="...">`
|
||||
},
|
||||
extraFileExtensions: ['.vue'],
|
||||
ecmaFeatures: {
|
||||
jsx: true
|
||||
}
|
||||
},
|
||||
|
||||
extends: [
|
||||
'plugin:@typescript-eslint/eslint-recommended'
|
||||
],
|
||||
|
||||
overrides: [
|
||||
{
|
||||
files: ['*.ts', '*.tsx', '*.vue'],
|
||||
rules: {
|
||||
// The core 'no-unused-vars' rules (in the eslint:recommeded ruleset)
|
||||
// does not work with type definitions
|
||||
'no-unused-vars': 'off',
|
||||
// TS already checks for that, and Typescript-Eslint recommends to disable it
|
||||
// https://typescript-eslint.io/linting/troubleshooting#i-get-errors-from-the-no-undef-rule-about-global-variables-not-being-defined-even-though-there-are-no-typescript-errors
|
||||
'no-undef': 'off',
|
||||
'@typescript-eslint/no-unused-vars': 'warn'
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
60
node_modules/@vue/eslint-config-typescript/package.json
generated
vendored
Normal file
60
node_modules/@vue/eslint-config-typescript/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
{
|
||||
"name": "@vue/eslint-config-typescript",
|
||||
"version": "11.0.3",
|
||||
"description": "eslint-config-typescript for vue-cli",
|
||||
"main": "index.js",
|
||||
"files": [
|
||||
"index.js",
|
||||
"recommended.js"
|
||||
],
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/vuejs/eslint-config-typescript.git"
|
||||
},
|
||||
"keywords": [
|
||||
"vue",
|
||||
"cli",
|
||||
"eslint",
|
||||
"typescript"
|
||||
],
|
||||
"author": "Evan You",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/vuejs/eslint-config-typescript/issues"
|
||||
},
|
||||
"homepage": "https://github.com/vuejs/eslint-config-typescript#readme",
|
||||
"devDependencies": {
|
||||
"eslint": "^8.39.0",
|
||||
"eslint-plugin-vue": "^9.11.0",
|
||||
"execa": "^4.1.0",
|
||||
"jest": "^26.6.3",
|
||||
"typescript": "^4.9.5",
|
||||
"vue": "^2.7.14",
|
||||
"vue-class-component": "^7.2.6",
|
||||
"vue-property-decorator": "^9.1.2"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"eslint": "^6.2.0 || ^7.0.0 || ^8.0.0",
|
||||
"eslint-plugin-vue": "^9.0.0",
|
||||
"typescript": "*"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"typescript": {
|
||||
"optional": true
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"@typescript-eslint/eslint-plugin": "^5.59.1",
|
||||
"@typescript-eslint/parser": "^5.59.1",
|
||||
"vue-eslint-parser": "^9.1.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^14.17.0 || >=16.0.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "jest"
|
||||
}
|
||||
}
|
||||
48
node_modules/@vue/eslint-config-typescript/recommended.js
generated
vendored
Normal file
48
node_modules/@vue/eslint-config-typescript/recommended.js
generated
vendored
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
module.exports = {
|
||||
extends: [
|
||||
require.resolve('./index'),
|
||||
'plugin:@typescript-eslint/recommended'
|
||||
],
|
||||
|
||||
// the ts-eslint recommended ruleset sets the parser so we need to set it back
|
||||
parser: require.resolve('vue-eslint-parser'),
|
||||
|
||||
rules: {
|
||||
// this rule, if on, would require explicit return type on the `render` function
|
||||
'@typescript-eslint/explicit-function-return-type': 'off',
|
||||
|
||||
// The following rules are enabled in an `overrides` field in the
|
||||
// `@typescript-eslint/recommended` ruleset, only turned on for TypeScript source modules
|
||||
// <https://github.com/typescript-eslint/typescript-eslint/blob/cb2d44650d27d8b917e8ce19423245b834db29d2/packages/eslint-plugin/src/configs/eslint-recommended.ts#L27-L30>
|
||||
|
||||
// But as ESLint cannot precisely target `<script lang="ts">` blocks and skip normal `<script>`s,
|
||||
// no TypeScript code in `.vue` files would be checked against these rules.
|
||||
|
||||
// So we now enable them globally.
|
||||
// That would also check plain JavaScript files, which diverges a little from
|
||||
// the original intention of the `@typescript-eslint/recommended` rulset.
|
||||
// But it should be mostly fine.
|
||||
'no-var': 'error', // ts transpiles let/const to var, so no need for vars any more
|
||||
'prefer-const': 'error', // ts provides better types with const
|
||||
'prefer-rest-params': 'error', // ts provides better types with rest args over arguments
|
||||
'prefer-spread': 'error', // ts transpiles spread to apply, so no need for manual apply
|
||||
},
|
||||
|
||||
overrides: [
|
||||
{
|
||||
files: ['shims-tsx.d.ts'],
|
||||
rules: {
|
||||
'@typescript-eslint/no-empty-interface': 'off',
|
||||
'@typescript-eslint/no-explicit-any': 'off',
|
||||
'@typescript-eslint/no-unused-vars': 'off'
|
||||
}
|
||||
},
|
||||
{
|
||||
files: ['*.js', '*.cjs'],
|
||||
rules: {
|
||||
// in plain CommonJS modules, you can't use `import foo = require('foo')` to pass this rule, so it has to be disabled
|
||||
'@typescript-eslint/no-var-requires': 'off'
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
21
node_modules/@vue/language-core/LICENSE
generated
vendored
Normal file
21
node_modules/@vue/language-core/LICENSE
generated
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2021-present Johnson Chu
|
||||
|
||||
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.
|
||||
2
node_modules/@vue/language-core/node_modules/brace-expansion/.github/FUNDING.yml
generated
vendored
Normal file
2
node_modules/@vue/language-core/node_modules/brace-expansion/.github/FUNDING.yml
generated
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
tidelift: "npm/brace-expansion"
|
||||
patreon: juliangruber
|
||||
21
node_modules/@vue/language-core/node_modules/brace-expansion/LICENSE
generated
vendored
Normal file
21
node_modules/@vue/language-core/node_modules/brace-expansion/LICENSE
generated
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2013 Julian Gruber <julian@juliangruber.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.
|
||||
135
node_modules/@vue/language-core/node_modules/brace-expansion/README.md
generated
vendored
Normal file
135
node_modules/@vue/language-core/node_modules/brace-expansion/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,135 @@
|
|||
# brace-expansion
|
||||
|
||||
[Brace expansion](https://www.gnu.org/software/bash/manual/html_node/Brace-Expansion.html),
|
||||
as known from sh/bash, in JavaScript.
|
||||
|
||||
[](http://travis-ci.org/juliangruber/brace-expansion)
|
||||
[](https://www.npmjs.org/package/brace-expansion)
|
||||
[](https://greenkeeper.io/)
|
||||
|
||||
[](https://ci.testling.com/juliangruber/brace-expansion)
|
||||
|
||||
## Example
|
||||
|
||||
```js
|
||||
var expand = require('brace-expansion');
|
||||
|
||||
expand('file-{a,b,c}.jpg')
|
||||
// => ['file-a.jpg', 'file-b.jpg', 'file-c.jpg']
|
||||
|
||||
expand('-v{,,}')
|
||||
// => ['-v', '-v', '-v']
|
||||
|
||||
expand('file{0..2}.jpg')
|
||||
// => ['file0.jpg', 'file1.jpg', 'file2.jpg']
|
||||
|
||||
expand('file-{a..c}.jpg')
|
||||
// => ['file-a.jpg', 'file-b.jpg', 'file-c.jpg']
|
||||
|
||||
expand('file{2..0}.jpg')
|
||||
// => ['file2.jpg', 'file1.jpg', 'file0.jpg']
|
||||
|
||||
expand('file{0..4..2}.jpg')
|
||||
// => ['file0.jpg', 'file2.jpg', 'file4.jpg']
|
||||
|
||||
expand('file-{a..e..2}.jpg')
|
||||
// => ['file-a.jpg', 'file-c.jpg', 'file-e.jpg']
|
||||
|
||||
expand('file{00..10..5}.jpg')
|
||||
// => ['file00.jpg', 'file05.jpg', 'file10.jpg']
|
||||
|
||||
expand('{{A..C},{a..c}}')
|
||||
// => ['A', 'B', 'C', 'a', 'b', 'c']
|
||||
|
||||
expand('ppp{,config,oe{,conf}}')
|
||||
// => ['ppp', 'pppconfig', 'pppoe', 'pppoeconf']
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
```js
|
||||
var expand = require('brace-expansion');
|
||||
```
|
||||
|
||||
### var expanded = expand(str)
|
||||
|
||||
Return an array of all possible and valid expansions of `str`. If none are
|
||||
found, `[str]` is returned.
|
||||
|
||||
Valid expansions are:
|
||||
|
||||
```js
|
||||
/^(.*,)+(.+)?$/
|
||||
// {a,b,...}
|
||||
```
|
||||
|
||||
A comma separated list of options, like `{a,b}` or `{a,{b,c}}` or `{,a,}`.
|
||||
|
||||
```js
|
||||
/^-?\d+\.\.-?\d+(\.\.-?\d+)?$/
|
||||
// {x..y[..incr]}
|
||||
```
|
||||
|
||||
A numeric sequence from `x` to `y` inclusive, with optional increment.
|
||||
If `x` or `y` start with a leading `0`, all the numbers will be padded
|
||||
to have equal length. Negative numbers and backwards iteration work too.
|
||||
|
||||
```js
|
||||
/^-?\d+\.\.-?\d+(\.\.-?\d+)?$/
|
||||
// {x..y[..incr]}
|
||||
```
|
||||
|
||||
An alphabetic sequence from `x` to `y` inclusive, with optional increment.
|
||||
`x` and `y` must be exactly one character, and if given, `incr` must be a
|
||||
number.
|
||||
|
||||
For compatibility reasons, the string `${` is not eligible for brace expansion.
|
||||
|
||||
## Installation
|
||||
|
||||
With [npm](https://npmjs.org) do:
|
||||
|
||||
```bash
|
||||
npm install brace-expansion
|
||||
```
|
||||
|
||||
## Contributors
|
||||
|
||||
- [Julian Gruber](https://github.com/juliangruber)
|
||||
- [Isaac Z. Schlueter](https://github.com/isaacs)
|
||||
|
||||
## Sponsors
|
||||
|
||||
This module is proudly supported by my [Sponsors](https://github.com/juliangruber/sponsors)!
|
||||
|
||||
Do you want to support modules like this to improve their quality, stability and weigh in on new features? Then please consider donating to my [Patreon](https://www.patreon.com/juliangruber). Not sure how much of my modules you're using? Try [feross/thanks](https://github.com/feross/thanks)!
|
||||
|
||||
## Security contact information
|
||||
|
||||
To report a security vulnerability, please use the
|
||||
[Tidelift security contact](https://tidelift.com/security).
|
||||
Tidelift will coordinate the fix and disclosure.
|
||||
|
||||
## License
|
||||
|
||||
(MIT)
|
||||
|
||||
Copyright (c) 2013 Julian Gruber <julian@juliangruber.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.
|
||||
203
node_modules/@vue/language-core/node_modules/brace-expansion/index.js
generated
vendored
Normal file
203
node_modules/@vue/language-core/node_modules/brace-expansion/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,203 @@
|
|||
var balanced = require('balanced-match');
|
||||
|
||||
module.exports = expandTop;
|
||||
|
||||
var escSlash = '\0SLASH'+Math.random()+'\0';
|
||||
var escOpen = '\0OPEN'+Math.random()+'\0';
|
||||
var escClose = '\0CLOSE'+Math.random()+'\0';
|
||||
var escComma = '\0COMMA'+Math.random()+'\0';
|
||||
var escPeriod = '\0PERIOD'+Math.random()+'\0';
|
||||
|
||||
function numeric(str) {
|
||||
return parseInt(str, 10) == str
|
||||
? parseInt(str, 10)
|
||||
: str.charCodeAt(0);
|
||||
}
|
||||
|
||||
function escapeBraces(str) {
|
||||
return str.split('\\\\').join(escSlash)
|
||||
.split('\\{').join(escOpen)
|
||||
.split('\\}').join(escClose)
|
||||
.split('\\,').join(escComma)
|
||||
.split('\\.').join(escPeriod);
|
||||
}
|
||||
|
||||
function unescapeBraces(str) {
|
||||
return str.split(escSlash).join('\\')
|
||||
.split(escOpen).join('{')
|
||||
.split(escClose).join('}')
|
||||
.split(escComma).join(',')
|
||||
.split(escPeriod).join('.');
|
||||
}
|
||||
|
||||
|
||||
// Basically just str.split(","), but handling cases
|
||||
// where we have nested braced sections, which should be
|
||||
// treated as individual members, like {a,{b,c},d}
|
||||
function parseCommaParts(str) {
|
||||
if (!str)
|
||||
return [''];
|
||||
|
||||
var parts = [];
|
||||
var m = balanced('{', '}', str);
|
||||
|
||||
if (!m)
|
||||
return str.split(',');
|
||||
|
||||
var pre = m.pre;
|
||||
var body = m.body;
|
||||
var post = m.post;
|
||||
var p = pre.split(',');
|
||||
|
||||
p[p.length-1] += '{' + body + '}';
|
||||
var postParts = parseCommaParts(post);
|
||||
if (post.length) {
|
||||
p[p.length-1] += postParts.shift();
|
||||
p.push.apply(p, postParts);
|
||||
}
|
||||
|
||||
parts.push.apply(parts, p);
|
||||
|
||||
return parts;
|
||||
}
|
||||
|
||||
function expandTop(str) {
|
||||
if (!str)
|
||||
return [];
|
||||
|
||||
// I don't know why Bash 4.3 does this, but it does.
|
||||
// Anything starting with {} will have the first two bytes preserved
|
||||
// but *only* at the top level, so {},a}b will not expand to anything,
|
||||
// but a{},b}c will be expanded to [a}c,abc].
|
||||
// One could argue that this is a bug in Bash, but since the goal of
|
||||
// this module is to match Bash's rules, we escape a leading {}
|
||||
if (str.substr(0, 2) === '{}') {
|
||||
str = '\\{\\}' + str.substr(2);
|
||||
}
|
||||
|
||||
return expand(escapeBraces(str), true).map(unescapeBraces);
|
||||
}
|
||||
|
||||
function embrace(str) {
|
||||
return '{' + str + '}';
|
||||
}
|
||||
function isPadded(el) {
|
||||
return /^-?0\d/.test(el);
|
||||
}
|
||||
|
||||
function lte(i, y) {
|
||||
return i <= y;
|
||||
}
|
||||
function gte(i, y) {
|
||||
return i >= y;
|
||||
}
|
||||
|
||||
function expand(str, isTop) {
|
||||
var expansions = [];
|
||||
|
||||
var m = balanced('{', '}', str);
|
||||
if (!m) return [str];
|
||||
|
||||
// no need to expand pre, since it is guaranteed to be free of brace-sets
|
||||
var pre = m.pre;
|
||||
var post = m.post.length
|
||||
? expand(m.post, false)
|
||||
: [''];
|
||||
|
||||
if (/\$$/.test(m.pre)) {
|
||||
for (var k = 0; k < post.length; k++) {
|
||||
var expansion = pre+ '{' + m.body + '}' + post[k];
|
||||
expansions.push(expansion);
|
||||
}
|
||||
} else {
|
||||
var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
|
||||
var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
|
||||
var isSequence = isNumericSequence || isAlphaSequence;
|
||||
var isOptions = m.body.indexOf(',') >= 0;
|
||||
if (!isSequence && !isOptions) {
|
||||
// {a},b}
|
||||
if (m.post.match(/,.*\}/)) {
|
||||
str = m.pre + '{' + m.body + escClose + m.post;
|
||||
return expand(str);
|
||||
}
|
||||
return [str];
|
||||
}
|
||||
|
||||
var n;
|
||||
if (isSequence) {
|
||||
n = m.body.split(/\.\./);
|
||||
} else {
|
||||
n = parseCommaParts(m.body);
|
||||
if (n.length === 1) {
|
||||
// x{{a,b}}y ==> x{a}y x{b}y
|
||||
n = expand(n[0], false).map(embrace);
|
||||
if (n.length === 1) {
|
||||
return post.map(function(p) {
|
||||
return m.pre + n[0] + p;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// at this point, n is the parts, and we know it's not a comma set
|
||||
// with a single entry.
|
||||
var N;
|
||||
|
||||
if (isSequence) {
|
||||
var x = numeric(n[0]);
|
||||
var y = numeric(n[1]);
|
||||
var width = Math.max(n[0].length, n[1].length)
|
||||
var incr = n.length == 3
|
||||
? Math.abs(numeric(n[2]))
|
||||
: 1;
|
||||
var test = lte;
|
||||
var reverse = y < x;
|
||||
if (reverse) {
|
||||
incr *= -1;
|
||||
test = gte;
|
||||
}
|
||||
var pad = n.some(isPadded);
|
||||
|
||||
N = [];
|
||||
|
||||
for (var i = x; test(i, y); i += incr) {
|
||||
var c;
|
||||
if (isAlphaSequence) {
|
||||
c = String.fromCharCode(i);
|
||||
if (c === '\\')
|
||||
c = '';
|
||||
} else {
|
||||
c = String(i);
|
||||
if (pad) {
|
||||
var need = width - c.length;
|
||||
if (need > 0) {
|
||||
var z = new Array(need + 1).join('0');
|
||||
if (i < 0)
|
||||
c = '-' + z + c.slice(1);
|
||||
else
|
||||
c = z + c;
|
||||
}
|
||||
}
|
||||
}
|
||||
N.push(c);
|
||||
}
|
||||
} else {
|
||||
N = [];
|
||||
|
||||
for (var j = 0; j < n.length; j++) {
|
||||
N.push.apply(N, expand(n[j], false));
|
||||
}
|
||||
}
|
||||
|
||||
for (var j = 0; j < N.length; j++) {
|
||||
for (var k = 0; k < post.length; k++) {
|
||||
var expansion = pre + N[j] + post[k];
|
||||
if (!isTop || isSequence || expansion)
|
||||
expansions.push(expansion);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return expansions;
|
||||
}
|
||||
|
||||
46
node_modules/@vue/language-core/node_modules/brace-expansion/package.json
generated
vendored
Normal file
46
node_modules/@vue/language-core/node_modules/brace-expansion/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
{
|
||||
"name": "brace-expansion",
|
||||
"description": "Brace expansion as known from sh/bash",
|
||||
"version": "2.0.1",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/juliangruber/brace-expansion.git"
|
||||
},
|
||||
"homepage": "https://github.com/juliangruber/brace-expansion",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "tape test/*.js",
|
||||
"gentest": "bash test/generate.sh",
|
||||
"bench": "matcha test/perf/bench.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"balanced-match": "^1.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@c4312/matcha": "^1.3.1",
|
||||
"tape": "^4.6.0"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": {
|
||||
"name": "Julian Gruber",
|
||||
"email": "mail@juliangruber.com",
|
||||
"url": "http://juliangruber.com"
|
||||
},
|
||||
"license": "MIT",
|
||||
"testling": {
|
||||
"files": "test/*.js",
|
||||
"browsers": [
|
||||
"ie/8..latest",
|
||||
"firefox/20..latest",
|
||||
"firefox/nightly",
|
||||
"chrome/25..latest",
|
||||
"chrome/canary",
|
||||
"opera/12..latest",
|
||||
"opera/next",
|
||||
"safari/5.1..latest",
|
||||
"ipad/6.0..latest",
|
||||
"iphone/6.0..latest",
|
||||
"android-browser/4.2..latest"
|
||||
]
|
||||
}
|
||||
}
|
||||
15
node_modules/@vue/language-core/node_modules/minimatch/LICENSE
generated
vendored
Normal file
15
node_modules/@vue/language-core/node_modules/minimatch/LICENSE
generated
vendored
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
The ISC License
|
||||
|
||||
Copyright (c) 2011-2023 Isaac Z. Schlueter and Contributors
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue