This commit is contained in:
2024-02-07 01:33:07 -05:00
commit c1af19d441
4088 changed files with 1260170 additions and 0 deletions

21
node_modules/vue-template-compiler/LICENSE generated vendored Normal file
View File

@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2013-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.

162
node_modules/vue-template-compiler/README.md generated vendored Normal file
View File

@ -0,0 +1,162 @@
# vue-template-compiler
> This package is auto-generated. For pull requests please see [src/platforms/web/entry-compiler.js](https://github.com/vuejs/vue/tree/dev/src/platforms/web/entry-compiler.js).
This package can be used to pre-compile Vue 2.0 templates into render functions to avoid runtime-compilation overhead and CSP restrictions. In most cases you should be using it with [`vue-loader`](https://github.com/vuejs/vue-loader), you will only need it separately if you are writing build tools with very specific needs.
## Installation
``` bash
npm install vue-template-compiler
```
``` js
const compiler = require('vue-template-compiler')
```
## API
### compiler.compile(template, [options])
Compiles a template string and returns compiled JavaScript code. The returned result is an object of the following format:
``` js
{
ast: ?ASTElement, // parsed template elements to AST
render: string, // main render function code
staticRenderFns: Array<string>, // render code for static sub trees, if any
errors: Array<string> // template syntax errors, if any
}
```
Note the returned function code uses `with` and thus cannot be used in strict mode code.
#### Options
- `outputSourceRange` *new in 2.6*
- Type: `boolean`
- Default: `false`
Set this to true will cause the `errors` returned in the compiled result become objects in the form of `{ msg, start, end }`. The `start` and `end` properties are numbers that mark the code range of the error source in the template. This can be passed on to the `compiler.generateCodeFrame` API to generate a code frame for the error.
- `whitespace`
- Type: `string`
- Valid values: `'preserve' | 'condense'`
- Default: `'preserve'`
The default value `'preserve'` handles whitespaces as follows:
- A whitespace-only text node between element tags is condensed into a single space.
- All other whitespaces are preserved as-is.
If set to `'condense'`:
- A whitespace-only text node between element tags is removed if it contains new lines. Otherwise, it is condensed into a single space.
- Consecutive whitespaces inside a non-whitespace-only text node are condensed into a single space.
Using condense mode will result in smaller compiled code size and slightly improved performance. However, it will produce minor visual layout differences compared to plain HTML in certain cases.
**This option does not affect the `<pre>` tag.**
Example:
``` html
<!-- source -->
<div>
<span>
foo
</span> <span>bar</span>
</div>
<!-- whitespace: 'preserve' -->
<div> <span>
foo
</span> <span>bar</span> </div>
<!-- whitespace: 'condense' -->
<div><span> foo </span> <span>bar</span></div>
```
- `modules`
It's possible to hook into the compilation process to support custom template features. **However, beware that by injecting custom compile-time modules, your templates will not work with other build tools built on standard built-in modules, e.g `vue-loader` and `vueify`.**
An array of compiler modules. For details on compiler modules, refer to the `ModuleOptions` type in [flow declarations](https://github.com/vuejs/vue/blob/dev/flow/compiler.js#L47-L59) and the [built-in modules](https://github.com/vuejs/vue/tree/dev/src/platforms/web/compiler/modules).
- `directives`
An object where the key is the directive name and the value is a function that transforms an template AST node. For example:
``` js
compiler.compile('<div v-test></div>', {
directives: {
test (node, directiveMeta) {
// transform node based on directiveMeta
}
}
})
```
By default, a compile-time directive will extract the directive and the directive will not be present at runtime. If you want the directive to also be handled by a runtime definition, return `true` in the transform function.
Refer to the implementation of some [built-in compile-time directives](https://github.com/vuejs/vue/tree/dev/src/platforms/web/compiler/directives).
- `preserveWhitespace` **Deprecated since 2.6**
- Type: `boolean`
- Default: `true`
By default, the compiled render function preserves all whitespace characters between HTML tags. If set to `false`, whitespace between tags will be ignored. This can result in slightly better performance but may affect layout for inline elements.
---
### compiler.compileToFunctions(template)
Similar to `compiler.compile`, but directly returns instantiated functions:
``` js
{
render: Function,
staticRenderFns: Array<Function>
}
```
This is only useful at runtime with pre-configured builds, so it doesn't accept any compile-time options. In addition, this method uses `new Function()` so it is not CSP-compliant.
---
### compiler.ssrCompile(template, [options])
> 2.4.0+
Same as `compiler.compile` but generates SSR-specific render function code by optimizing parts of the template into string concatenation in order to improve SSR performance.
This is used by default in `vue-loader@>=12` and can be disabled using the [`optimizeSSR`](https://vue-loader.vuejs.org/en/options.html#optimizessr) option.
---
### compiler.ssrCompileToFunctions(template)
> 2.4.0+
Same as `compiler.compileToFunction` but generates SSR-specific render function code by optimizing parts of the template into string concatenation in order to improve SSR performance.
---
### compiler.parseComponent(file, [options])
Parse a SFC (single-file component, or `*.vue` file) into a descriptor (refer to the `SFCDescriptor` type in [flow declarations](https://github.com/vuejs/vue/blob/dev/flow/compiler.js)). This is used in SFC build tools like `vue-loader` and `vueify`.
---
### compiler.generateCodeFrame(template, start, end)
Generate a code frame that highlights the part in `template` defined by `start` and `end`. Useful for error reporting in higher-level tooling.
#### Options
#### `pad`
`pad` is useful when you are piping the extracted content into other pre-processors, as you will get correct line numbers or character indices if there are any syntax errors.
- with `{ pad: "line" }`, the extracted content for each block will be prefixed with one newline for each line in the leading content from the original file to ensure that the line numbers align with the original file.
- with `{ pad: "space" }`, the extracted content for each block will be prefixed with one space for each character in the leading content from the original file to ensure that the character count remains the same as the original file.

7140
node_modules/vue-template-compiler/browser.js generated vendored Normal file

File diff suppressed because one or more lines are too long

6670
node_modules/vue-template-compiler/build.js generated vendored Normal file

File diff suppressed because it is too large Load Diff

32
node_modules/vue-template-compiler/index.js generated vendored Normal file
View File

@ -0,0 +1,32 @@
try {
var vueVersion = require('vue').version
} catch (e) {}
var packageName = require('./package.json').name
var packageVersion = require('./package.json').version
if (vueVersion && vueVersion !== packageVersion) {
var vuePath = require.resolve('vue')
var packagePath = require.resolve('./package.json')
throw new Error(
'\n\nVue packages version mismatch:\n\n' +
'- vue@' +
vueVersion +
' (' +
vuePath +
')\n' +
'- ' +
packageName +
'@' +
packageVersion +
' (' +
packagePath +
')\n\n' +
'This may cause things to work incorrectly. Make sure to use the same version for both.\n' +
'If you are using vue-loader@>=10.0, simply update vue-template-compiler.\n' +
'If you are using vue-loader@<10.0 or vueify, re-installing vue-loader/vueify should bump ' +
packageName +
' to the latest.\n'
)
}
module.exports = require('./build')

35
node_modules/vue-template-compiler/package.json generated vendored Normal file
View File

@ -0,0 +1,35 @@
{
"name": "vue-template-compiler",
"version": "2.7.16",
"description": "template compiler for Vue 2.0",
"main": "index.js",
"unpkg": "browser.js",
"jsdelivr": "browser.js",
"browser": "browser.js",
"types": "types/index.d.ts",
"files": [
"types/*.d.ts",
"*.js"
],
"repository": {
"type": "git",
"url": "git+https://github.com/vuejs/vue.git"
},
"keywords": [
"vue",
"compiler"
],
"author": "Evan You",
"license": "MIT",
"bugs": {
"url": "https://github.com/vuejs/vue/issues"
},
"homepage": "https://github.com/vuejs/vue/tree/dev/packages/vue-template-compiler#readme",
"dependencies": {
"de-indent": "^1.0.2",
"he": "^1.2.0"
},
"devDependencies": {
"vue": "file:../.."
}
}

247
node_modules/vue-template-compiler/types/index.d.ts generated vendored Normal file
View File

@ -0,0 +1,247 @@
import { VNode } from 'vue'
/*
* Template compilation options / results
*/
interface CompilerOptions {
modules?: ModuleOptions[]
directives?: Record<string, DirectiveFunction>
preserveWhitespace?: boolean
whitespace?: 'preserve' | 'condense'
outputSourceRange?: any
}
interface CompilerOptionsWithSourceRange extends CompilerOptions {
outputSourceRange: true
}
interface ErrorWithRange {
msg: string
start: number
end: number
}
interface CompiledResult<ErrorType> {
ast: ASTElement | undefined
render: string
staticRenderFns: string[]
errors: ErrorType[]
tips: ErrorType[]
}
interface CompiledResultFunctions {
render: () => VNode
staticRenderFns: (() => VNode)[]
}
interface ModuleOptions {
preTransformNode: (el: ASTElement) => ASTElement | undefined
transformNode: (el: ASTElement) => ASTElement | undefined
postTransformNode: (el: ASTElement) => void
genData: (el: ASTElement) => string
transformCode?: (el: ASTElement, code: string) => string
staticKeys?: string[]
}
type DirectiveFunction = (node: ASTElement, directiveMeta: ASTDirective) => void
/*
* AST Types
*/
/**
* - 0: FALSE - whole sub tree un-optimizable
* - 1: FULL - whole sub tree optimizable
* - 2: SELF - self optimizable but has some un-optimizable children
* - 3: CHILDREN - self un-optimizable but have fully optimizable children
* - 4: PARTIAL - self un-optimizable with some un-optimizable children
*/
export type SSROptimizability = 0 | 1 | 2 | 3 | 4
export interface ASTModifiers {
[key: string]: boolean
}
export interface ASTIfCondition {
exp: string | undefined
block: ASTElement
}
export interface ASTElementHandler {
value: string
params?: any[]
modifiers: ASTModifiers | undefined
}
export interface ASTElementHandlers {
[key: string]: ASTElementHandler | ASTElementHandler[]
}
export interface ASTDirective {
name: string
rawName: string
value: string
arg: string | undefined
modifiers: ASTModifiers | undefined
}
export type ASTNode = ASTElement | ASTText | ASTExpression
export interface ASTElement {
type: 1
tag: string
attrsList: { name: string; value: any }[]
attrsMap: Record<string, any>
parent: ASTElement | undefined
children: ASTNode[]
processed?: true
static?: boolean
staticRoot?: boolean
staticInFor?: boolean
staticProcessed?: boolean
hasBindings?: boolean
text?: string
attrs?: { name: string; value: any }[]
props?: { name: string; value: string }[]
plain?: boolean
pre?: true
ns?: string
component?: string
inlineTemplate?: true
transitionMode?: string | null
slotName?: string
slotTarget?: string
slotScope?: string
scopedSlots?: Record<string, ASTElement>
ref?: string
refInFor?: boolean
if?: string
ifProcessed?: boolean
elseif?: string
else?: true
ifConditions?: ASTIfCondition[]
for?: string
forProcessed?: boolean
key?: string
alias?: string
iterator1?: string
iterator2?: string
staticClass?: string
classBinding?: string
staticStyle?: string
styleBinding?: string
events?: ASTElementHandlers
nativeEvents?: ASTElementHandlers
transition?: string | true
transitionOnAppear?: boolean
model?: {
value: string
callback: string
expression: string
}
directives?: ASTDirective[]
forbidden?: true
once?: true
onceProcessed?: boolean
wrapData?: (code: string) => string
wrapListeners?: (code: string) => string
// 2.4 ssr optimization
ssrOptimizability?: SSROptimizability
}
export interface ASTExpression {
type: 2
expression: string
text: string
tokens: (string | Record<string, any>)[]
static?: boolean
// 2.4 ssr optimization
ssrOptimizability?: SSROptimizability
}
export interface ASTText {
type: 3
text: string
static?: boolean
isComment?: boolean
// 2.4 ssr optimization
ssrOptimizability?: SSROptimizability
}
/*
* SFC parser related types
*/
interface SFCParserOptions {
pad?: true | 'line' | 'space'
deindent?: boolean
}
export interface SFCBlock {
type: string
content: string
attrs: Record<string, string>
start?: number
end?: number
lang?: string
src?: string
scoped?: boolean
module?: string | boolean
}
export interface SFCDescriptor {
template: SFCBlock | undefined
script: SFCBlock | undefined
styles: SFCBlock[]
customBlocks: SFCBlock[]
}
/*
* Exposed functions
*/
export function compile(
template: string,
options: CompilerOptionsWithSourceRange
): CompiledResult<ErrorWithRange>
export function compile(
template: string,
options?: CompilerOptions
): CompiledResult<string>
export function compileToFunctions(template: string): CompiledResultFunctions
export function ssrCompile(
template: string,
options: CompilerOptionsWithSourceRange
): CompiledResult<ErrorWithRange>
export function ssrCompile(
template: string,
options?: CompilerOptions
): CompiledResult<string>
export function ssrCompileToFunctions(template: string): CompiledResultFunctions
export function parseComponent(
file: string,
options?: SFCParserOptions
): SFCDescriptor
export function generateCodeFrame(
template: string,
start: number,
end: number
): string