mirror of https://github.com/vuejs/vue.git
workflow: remove eslint, apply prettier
This commit is contained in:
parent
6f8fb220e2
commit
72aed6a149
13
.babelrc.js
13
.babelrc.js
|
@ -1,13 +0,0 @@
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
presets: [
|
|
||||||
"@babel/preset-env",
|
|
||||||
"@babel/preset-typescript"
|
|
||||||
],
|
|
||||||
plugins: [
|
|
||||||
require("babel-plugin-transform-vue-jsx"),
|
|
||||||
require("@babel/plugin-syntax-dynamic-import")
|
|
||||||
],
|
|
||||||
|
|
||||||
ignore: ["dist/*.js", "packages/**/*.js"],
|
|
||||||
};
|
|
|
@ -1,3 +0,0 @@
|
||||||
flow
|
|
||||||
dist
|
|
||||||
packages
|
|
39
.eslintrc.js
39
.eslintrc.js
|
@ -1,39 +0,0 @@
|
||||||
module.exports = {
|
|
||||||
root: true,
|
|
||||||
parser: "@typescript-eslint/parser",
|
|
||||||
|
|
||||||
parserOptions: {
|
|
||||||
// parser: "@typescript-eslint/parser",
|
|
||||||
// ecmaVersion: 2018,
|
|
||||||
sourceType: "module",
|
|
||||||
},
|
|
||||||
env: {
|
|
||||||
es6: true,
|
|
||||||
node: true,
|
|
||||||
browser: true,
|
|
||||||
},
|
|
||||||
// plugins: ["flowtype"],
|
|
||||||
extends: [
|
|
||||||
"eslint:recommended",
|
|
||||||
"plugin:@typescript-eslint/eslint-recommended",
|
|
||||||
],
|
|
||||||
globals: {
|
|
||||||
__TEST__: true,
|
|
||||||
WXEnvironment: true,
|
|
||||||
},
|
|
||||||
rules: {
|
|
||||||
'no-unused-vars': [
|
|
||||||
'error',
|
|
||||||
// we are only using this rule to check for unused arguments since TS
|
|
||||||
// catches unused variables but not args.
|
|
||||||
{ varsIgnorePattern: '.*', args: 'none' }
|
|
||||||
],
|
|
||||||
'prefer-spread': 0,
|
|
||||||
'prefer-rest-params': 0,
|
|
||||||
'no-prototype-builtins': 0,
|
|
||||||
"no-console": process.env.NODE_ENV !== "production" ? 0 : 2,
|
|
||||||
"no-useless-escape": 0,
|
|
||||||
"no-empty": 0,
|
|
||||||
"no-extra-semi": 0
|
|
||||||
},
|
|
||||||
};
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
semi: false
|
||||||
|
singleQuote: true
|
||||||
|
printWidth: 80
|
||||||
|
trailingComma: 'none'
|
||||||
|
arrowParens: 'avoid'
|
|
@ -1,6 +0,0 @@
|
||||||
{
|
|
||||||
"globals": {
|
|
||||||
"Vue": true,
|
|
||||||
"firebase": true
|
|
||||||
}
|
|
||||||
}
|
|
11
package.json
11
package.json
|
@ -28,7 +28,7 @@
|
||||||
"test:e2e": "npm run build -- web-full-prod,web-server-renderer-basic && vitest run test/e2e",
|
"test:e2e": "npm run build -- web-full-prod,web-server-renderer-basic && vitest run test/e2e",
|
||||||
"test:transition": "karma start test/transition/karma.conf.js",
|
"test:transition": "karma start test/transition/karma.conf.js",
|
||||||
"test:types": "tsc -p ./types/tsconfig.json",
|
"test:types": "tsc -p ./types/tsconfig.json",
|
||||||
"lint": "eslint src scripts test",
|
"format": "prettier --write --parser typescript \"(src|test|packages)/**/*.ts\"",
|
||||||
"ts-check": "tsc -p tsconfig.json --noEmit",
|
"ts-check": "tsc -p tsconfig.json --noEmit",
|
||||||
"ts-check:test": "tsc -p test/tsconfig.json --noEmit",
|
"ts-check:test": "tsc -p test/tsconfig.json --noEmit",
|
||||||
"bench:ssr": "npm run build:ssr && node benchmarks/ssr/renderToString.js && node benchmarks/ssr/renderToStream.js",
|
"bench:ssr": "npm run build:ssr && node benchmarks/ssr/renderToString.js && node benchmarks/ssr/renderToStream.js",
|
||||||
|
@ -42,7 +42,10 @@
|
||||||
},
|
},
|
||||||
"lint-staged": {
|
"lint-staged": {
|
||||||
"*.js": [
|
"*.js": [
|
||||||
"eslint --fix"
|
"prettier --write"
|
||||||
|
],
|
||||||
|
"*.ts": [
|
||||||
|
"prettier --parser=typescript --write"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
|
@ -65,8 +68,6 @@
|
||||||
"@rollup/plugin-replace": "^4.0.0",
|
"@rollup/plugin-replace": "^4.0.0",
|
||||||
"@types/he": "^1.1.2",
|
"@types/he": "^1.1.2",
|
||||||
"@types/node": "^17.0.30",
|
"@types/node": "^17.0.30",
|
||||||
"@typescript-eslint/eslint-plugin": "^5.21.0",
|
|
||||||
"@typescript-eslint/parser": "^5.21.0",
|
|
||||||
"acorn": "^8.7.1",
|
"acorn": "^8.7.1",
|
||||||
"acorn-walk": "^8.2.0",
|
"acorn-walk": "^8.2.0",
|
||||||
"chalk": "^4.0.0",
|
"chalk": "^4.0.0",
|
||||||
|
@ -77,7 +78,6 @@
|
||||||
"de-indent": "^1.0.2",
|
"de-indent": "^1.0.2",
|
||||||
"esbuild": "^0.14.39",
|
"esbuild": "^0.14.39",
|
||||||
"escodegen": "^2.0.0",
|
"escodegen": "^2.0.0",
|
||||||
"eslint": "^8.14.0",
|
|
||||||
"file-loader": "^3.0.1",
|
"file-loader": "^3.0.1",
|
||||||
"hash-sum": "^2.0.0",
|
"hash-sum": "^2.0.0",
|
||||||
"he": "^1.2.0",
|
"he": "^1.2.0",
|
||||||
|
@ -95,6 +95,7 @@
|
||||||
"lru-cache": "^7.8.1",
|
"lru-cache": "^7.8.1",
|
||||||
"marked": "^3.0.8",
|
"marked": "^3.0.8",
|
||||||
"memory-fs": "^0.5.0",
|
"memory-fs": "^0.5.0",
|
||||||
|
"prettier": "^2.6.2",
|
||||||
"puppeteer": "^14.1.1",
|
"puppeteer": "^14.1.1",
|
||||||
"resolve": "^1.22.0",
|
"resolve": "^1.22.0",
|
||||||
"rollup": "^2.70.2",
|
"rollup": "^2.70.2",
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
import { WebpackPlugin } from './types/plugin';
|
import { WebpackPlugin } from './types/plugin'
|
||||||
declare const Plugin: WebpackPlugin;
|
declare const Plugin: WebpackPlugin
|
||||||
export = Plugin;
|
export = Plugin
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
import { WebpackPlugin } from './types/plugin';
|
import { WebpackPlugin } from './types/plugin'
|
||||||
declare const Plugin: WebpackPlugin;
|
declare const Plugin: WebpackPlugin
|
||||||
export = Plugin;
|
export = Plugin
|
||||||
|
|
|
@ -1,50 +1,53 @@
|
||||||
import Vue, { VNode, VNodeDirective } from 'vue';
|
import Vue, { VNode, VNodeDirective } from 'vue'
|
||||||
import { Readable } from 'stream';
|
import { Readable } from 'stream'
|
||||||
|
|
||||||
export declare function createRenderer(options?: RendererOptions): Renderer;
|
export declare function createRenderer(options?: RendererOptions): Renderer
|
||||||
|
|
||||||
export declare function createBundleRenderer(bundle: string | object, options?: BundleRendererOptions): BundleRenderer;
|
export declare function createBundleRenderer(
|
||||||
|
bundle: string | object,
|
||||||
|
options?: BundleRendererOptions
|
||||||
|
): BundleRenderer
|
||||||
|
|
||||||
type RenderCallback = (err: Error | null, html: string) => void;
|
type RenderCallback = (err: Error | null, html: string) => void
|
||||||
|
|
||||||
interface Renderer {
|
interface Renderer {
|
||||||
renderToString(vm: Vue, callback: RenderCallback): void;
|
renderToString(vm: Vue, callback: RenderCallback): void
|
||||||
renderToString(vm: Vue, context: object, callback: RenderCallback): void;
|
renderToString(vm: Vue, context: object, callback: RenderCallback): void
|
||||||
renderToString(vm: Vue): Promise<string>;
|
renderToString(vm: Vue): Promise<string>
|
||||||
renderToString(vm: Vue, context: object): Promise<string>;
|
renderToString(vm: Vue, context: object): Promise<string>
|
||||||
|
|
||||||
renderToStream(vm: Vue, context?: object): Readable;
|
renderToStream(vm: Vue, context?: object): Readable
|
||||||
}
|
}
|
||||||
|
|
||||||
interface BundleRenderer {
|
interface BundleRenderer {
|
||||||
renderToString(callback: RenderCallback): void;
|
renderToString(callback: RenderCallback): void
|
||||||
renderToString(context: object, callback: RenderCallback): void;
|
renderToString(context: object, callback: RenderCallback): void
|
||||||
renderToString(): Promise<string>;
|
renderToString(): Promise<string>
|
||||||
renderToString(context: object): Promise<string>;
|
renderToString(context: object): Promise<string>
|
||||||
|
|
||||||
renderToStream(context?: object): Readable;
|
renderToStream(context?: object): Readable
|
||||||
}
|
}
|
||||||
|
|
||||||
interface RendererOptions {
|
interface RendererOptions {
|
||||||
template?: string;
|
template?: string
|
||||||
inject?: boolean;
|
inject?: boolean
|
||||||
shouldPreload?: (file: string, type: string) => boolean;
|
shouldPreload?: (file: string, type: string) => boolean
|
||||||
shouldPrefetch?: (file: string, type: string) => boolean;
|
shouldPrefetch?: (file: string, type: string) => boolean
|
||||||
cache?: RenderCache;
|
cache?: RenderCache
|
||||||
directives?: {
|
directives?: {
|
||||||
[key: string]: (vnode: VNode, dir: VNodeDirective) => void
|
[key: string]: (vnode: VNode, dir: VNodeDirective) => void
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
interface BundleRendererOptions extends RendererOptions {
|
interface BundleRendererOptions extends RendererOptions {
|
||||||
clientManifest?: object;
|
clientManifest?: object
|
||||||
serializer?: (state: object) => string;
|
serializer?: (state: object) => string
|
||||||
runInNewContext?: boolean | 'once';
|
runInNewContext?: boolean | 'once'
|
||||||
basedir?: string;
|
basedir?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
interface RenderCache {
|
interface RenderCache {
|
||||||
get: (key: string, cb?: (res: string) => void) => string | void;
|
get: (key: string, cb?: (res: string) => void) => string | void
|
||||||
set: (key: string, val: string) => void;
|
set: (key: string, val: string) => void
|
||||||
has?: (key: string, cb?: (hit: boolean) => void) => boolean | void;
|
has?: (key: string, cb?: (hit: boolean) => void) => boolean | void
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
import { DefinePlugin } from 'webpack';
|
import { DefinePlugin } from 'webpack'
|
||||||
|
|
||||||
interface WebpackPluginOptions {
|
interface WebpackPluginOptions {
|
||||||
filename?: string;
|
filename?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface WebpackPlugin {
|
export interface WebpackPlugin {
|
||||||
// NOTE NOT SURE ABOUT THIS
|
// NOTE NOT SURE ABOUT THIS
|
||||||
// TODO DOUBLE CHECK HERE
|
// TODO DOUBLE CHECK HERE
|
||||||
new (options?: WebpackPluginOptions): DefinePlugin;
|
new (options?: WebpackPluginOptions): DefinePlugin
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
import Vue, { VNode } from "vue"
|
import Vue, { VNode } from 'vue'
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Template compilation options / results
|
* Template compilation options / results
|
||||||
*/
|
*/
|
||||||
interface CompilerOptions {
|
interface CompilerOptions {
|
||||||
modules?: ModuleOptions[];
|
modules?: ModuleOptions[]
|
||||||
directives?: Record<string, DirectiveFunction>;
|
directives?: Record<string, DirectiveFunction>
|
||||||
preserveWhitespace?: boolean;
|
preserveWhitespace?: boolean
|
||||||
whitespace?: 'preserve' | 'condense';
|
whitespace?: 'preserve' | 'condense'
|
||||||
outputSourceRange?: any
|
outputSourceRange?: any
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,34 +16,34 @@ interface CompilerOptionsWithSourceRange extends CompilerOptions {
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ErrorWithRange {
|
interface ErrorWithRange {
|
||||||
msg: string;
|
msg: string
|
||||||
start: number;
|
start: number
|
||||||
end: number;
|
end: number
|
||||||
}
|
}
|
||||||
|
|
||||||
interface CompiledResult<ErrorType> {
|
interface CompiledResult<ErrorType> {
|
||||||
ast: ASTElement | undefined;
|
ast: ASTElement | undefined
|
||||||
render: string;
|
render: string
|
||||||
staticRenderFns: string[];
|
staticRenderFns: string[]
|
||||||
errors: ErrorType[];
|
errors: ErrorType[]
|
||||||
tips: ErrorType[];
|
tips: ErrorType[]
|
||||||
}
|
}
|
||||||
|
|
||||||
interface CompiledResultFunctions {
|
interface CompiledResultFunctions {
|
||||||
render: () => VNode;
|
render: () => VNode
|
||||||
staticRenderFns: (() => VNode)[];
|
staticRenderFns: (() => VNode)[]
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ModuleOptions {
|
interface ModuleOptions {
|
||||||
preTransformNode: (el: ASTElement) => ASTElement | undefined;
|
preTransformNode: (el: ASTElement) => ASTElement | undefined
|
||||||
transformNode: (el: ASTElement) => ASTElement | undefined;
|
transformNode: (el: ASTElement) => ASTElement | undefined
|
||||||
postTransformNode: (el: ASTElement) => void;
|
postTransformNode: (el: ASTElement) => void
|
||||||
genData: (el: ASTElement) => string;
|
genData: (el: ASTElement) => string
|
||||||
transformCode?: (el: ASTElement, code: string) => string;
|
transformCode?: (el: ASTElement, code: string) => string
|
||||||
staticKeys?: string[];
|
staticKeys?: string[]
|
||||||
}
|
}
|
||||||
|
|
||||||
type DirectiveFunction = (node: ASTElement, directiveMeta: ASTDirective) => void;
|
type DirectiveFunction = (node: ASTElement, directiveMeta: ASTDirective) => void
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* AST Types
|
* AST Types
|
||||||
|
@ -59,153 +59,153 @@ type DirectiveFunction = (node: ASTElement, directiveMeta: ASTDirective) => void
|
||||||
export type SSROptimizability = 0 | 1 | 2 | 3 | 4
|
export type SSROptimizability = 0 | 1 | 2 | 3 | 4
|
||||||
|
|
||||||
export interface ASTModifiers {
|
export interface ASTModifiers {
|
||||||
[key: string]: boolean;
|
[key: string]: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ASTIfCondition {
|
export interface ASTIfCondition {
|
||||||
exp: string | undefined;
|
exp: string | undefined
|
||||||
block: ASTElement;
|
block: ASTElement
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ASTElementHandler {
|
export interface ASTElementHandler {
|
||||||
value: string;
|
value: string
|
||||||
params?: any[];
|
params?: any[]
|
||||||
modifiers: ASTModifiers | undefined;
|
modifiers: ASTModifiers | undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ASTElementHandlers {
|
export interface ASTElementHandlers {
|
||||||
[key: string]: ASTElementHandler | ASTElementHandler[];
|
[key: string]: ASTElementHandler | ASTElementHandler[]
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ASTDirective {
|
export interface ASTDirective {
|
||||||
name: string;
|
name: string
|
||||||
rawName: string;
|
rawName: string
|
||||||
value: string;
|
value: string
|
||||||
arg: string | undefined;
|
arg: string | undefined
|
||||||
modifiers: ASTModifiers | undefined;
|
modifiers: ASTModifiers | undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
export type ASTNode = ASTElement | ASTText | ASTExpression;
|
export type ASTNode = ASTElement | ASTText | ASTExpression
|
||||||
|
|
||||||
export interface ASTElement {
|
export interface ASTElement {
|
||||||
type: 1;
|
type: 1
|
||||||
tag: string;
|
tag: string
|
||||||
attrsList: { name: string; value: any }[];
|
attrsList: { name: string; value: any }[]
|
||||||
attrsMap: Record<string, any>;
|
attrsMap: Record<string, any>
|
||||||
parent: ASTElement | undefined;
|
parent: ASTElement | undefined
|
||||||
children: ASTNode[];
|
children: ASTNode[]
|
||||||
|
|
||||||
processed?: true;
|
processed?: true
|
||||||
|
|
||||||
static?: boolean;
|
static?: boolean
|
||||||
staticRoot?: boolean;
|
staticRoot?: boolean
|
||||||
staticInFor?: boolean;
|
staticInFor?: boolean
|
||||||
staticProcessed?: boolean;
|
staticProcessed?: boolean
|
||||||
hasBindings?: boolean;
|
hasBindings?: boolean
|
||||||
|
|
||||||
text?: string;
|
text?: string
|
||||||
attrs?: { name: string; value: any }[];
|
attrs?: { name: string; value: any }[]
|
||||||
props?: { name: string; value: string }[];
|
props?: { name: string; value: string }[]
|
||||||
plain?: boolean;
|
plain?: boolean
|
||||||
pre?: true;
|
pre?: true
|
||||||
ns?: string;
|
ns?: string
|
||||||
|
|
||||||
component?: string;
|
component?: string
|
||||||
inlineTemplate?: true;
|
inlineTemplate?: true
|
||||||
transitionMode?: string | null;
|
transitionMode?: string | null
|
||||||
slotName?: string;
|
slotName?: string
|
||||||
slotTarget?: string;
|
slotTarget?: string
|
||||||
slotScope?: string;
|
slotScope?: string
|
||||||
scopedSlots?: Record<string, ASTElement>;
|
scopedSlots?: Record<string, ASTElement>
|
||||||
|
|
||||||
ref?: string;
|
ref?: string
|
||||||
refInFor?: boolean;
|
refInFor?: boolean
|
||||||
|
|
||||||
if?: string;
|
if?: string
|
||||||
ifProcessed?: boolean;
|
ifProcessed?: boolean
|
||||||
elseif?: string;
|
elseif?: string
|
||||||
else?: true;
|
else?: true
|
||||||
ifConditions?: ASTIfCondition[];
|
ifConditions?: ASTIfCondition[]
|
||||||
|
|
||||||
for?: string;
|
for?: string
|
||||||
forProcessed?: boolean;
|
forProcessed?: boolean
|
||||||
key?: string;
|
key?: string
|
||||||
alias?: string;
|
alias?: string
|
||||||
iterator1?: string;
|
iterator1?: string
|
||||||
iterator2?: string;
|
iterator2?: string
|
||||||
|
|
||||||
staticClass?: string;
|
staticClass?: string
|
||||||
classBinding?: string;
|
classBinding?: string
|
||||||
staticStyle?: string;
|
staticStyle?: string
|
||||||
styleBinding?: string;
|
styleBinding?: string
|
||||||
events?: ASTElementHandlers;
|
events?: ASTElementHandlers
|
||||||
nativeEvents?: ASTElementHandlers;
|
nativeEvents?: ASTElementHandlers
|
||||||
|
|
||||||
transition?: string | true;
|
transition?: string | true
|
||||||
transitionOnAppear?: boolean;
|
transitionOnAppear?: boolean
|
||||||
|
|
||||||
model?: {
|
model?: {
|
||||||
value: string;
|
value: string
|
||||||
callback: string;
|
callback: string
|
||||||
expression: string;
|
expression: string
|
||||||
};
|
}
|
||||||
|
|
||||||
directives?: ASTDirective[];
|
directives?: ASTDirective[]
|
||||||
|
|
||||||
forbidden?: true;
|
forbidden?: true
|
||||||
once?: true;
|
once?: true
|
||||||
onceProcessed?: boolean;
|
onceProcessed?: boolean
|
||||||
wrapData?: (code: string) => string;
|
wrapData?: (code: string) => string
|
||||||
wrapListeners?: (code: string) => string;
|
wrapListeners?: (code: string) => string
|
||||||
|
|
||||||
// 2.4 ssr optimization
|
// 2.4 ssr optimization
|
||||||
ssrOptimizability?: SSROptimizability;
|
ssrOptimizability?: SSROptimizability
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ASTExpression {
|
export interface ASTExpression {
|
||||||
type: 2;
|
type: 2
|
||||||
expression: string;
|
expression: string
|
||||||
text: string;
|
text: string
|
||||||
tokens: (string | Record<string, any>)[];
|
tokens: (string | Record<string, any>)[]
|
||||||
static?: boolean;
|
static?: boolean
|
||||||
// 2.4 ssr optimization
|
// 2.4 ssr optimization
|
||||||
ssrOptimizability?: SSROptimizability;
|
ssrOptimizability?: SSROptimizability
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ASTText {
|
export interface ASTText {
|
||||||
type: 3;
|
type: 3
|
||||||
text: string;
|
text: string
|
||||||
static?: boolean;
|
static?: boolean
|
||||||
isComment?: boolean;
|
isComment?: boolean
|
||||||
// 2.4 ssr optimization
|
// 2.4 ssr optimization
|
||||||
ssrOptimizability?: SSROptimizability;
|
ssrOptimizability?: SSROptimizability
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* SFC parser related types
|
* SFC parser related types
|
||||||
*/
|
*/
|
||||||
interface SFCParserOptions {
|
interface SFCParserOptions {
|
||||||
pad?: true | 'line' | 'space';
|
pad?: true | 'line' | 'space'
|
||||||
deindent?: boolean
|
deindent?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface SFCBlock {
|
export interface SFCBlock {
|
||||||
type: string;
|
type: string
|
||||||
content: string;
|
content: string
|
||||||
attrs: Record<string, string>;
|
attrs: Record<string, string>
|
||||||
start?: number;
|
start?: number
|
||||||
end?: number;
|
end?: number
|
||||||
lang?: string;
|
lang?: string
|
||||||
src?: string;
|
src?: string
|
||||||
scoped?: boolean;
|
scoped?: boolean
|
||||||
module?: string | boolean;
|
module?: string | boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface SFCDescriptor {
|
export interface SFCDescriptor {
|
||||||
template: SFCBlock | undefined;
|
template: SFCBlock | undefined
|
||||||
script: SFCBlock | undefined;
|
script: SFCBlock | undefined
|
||||||
styles: SFCBlock[];
|
styles: SFCBlock[]
|
||||||
customBlocks: SFCBlock[];
|
customBlocks: SFCBlock[]
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -219,29 +219,29 @@ export function compile(
|
||||||
export function compile(
|
export function compile(
|
||||||
template: string,
|
template: string,
|
||||||
options?: CompilerOptions
|
options?: CompilerOptions
|
||||||
): CompiledResult<string>;
|
): CompiledResult<string>
|
||||||
|
|
||||||
export function compileToFunctions(template: string): CompiledResultFunctions;
|
export function compileToFunctions(template: string): CompiledResultFunctions
|
||||||
|
|
||||||
export function ssrCompile(
|
export function ssrCompile(
|
||||||
template: string,
|
template: string,
|
||||||
options: CompilerOptionsWithSourceRange
|
options: CompilerOptionsWithSourceRange
|
||||||
): CompiledResult<ErrorWithRange>;
|
): CompiledResult<ErrorWithRange>
|
||||||
|
|
||||||
export function ssrCompile(
|
export function ssrCompile(
|
||||||
template: string,
|
template: string,
|
||||||
options?: CompilerOptions
|
options?: CompilerOptions
|
||||||
): CompiledResult<string>;
|
): CompiledResult<string>
|
||||||
|
|
||||||
export function ssrCompileToFunctions(template: string): CompiledResultFunctions;
|
export function ssrCompileToFunctions(template: string): CompiledResultFunctions
|
||||||
|
|
||||||
export function parseComponent(
|
export function parseComponent(
|
||||||
file: string,
|
file: string,
|
||||||
options?: SFCParserOptions
|
options?: SFCParserOptions
|
||||||
): SFCDescriptor;
|
): SFCDescriptor
|
||||||
|
|
||||||
export function generateCodeFrame(
|
export function generateCodeFrame(
|
||||||
template: string,
|
template: string,
|
||||||
start: number,
|
start: number,
|
||||||
end: number
|
end: number
|
||||||
): string;
|
): string
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import Vue, { VNode } from "vue";
|
import Vue, { VNode } from 'vue'
|
||||||
import {
|
import {
|
||||||
compile,
|
compile,
|
||||||
compileToFunctions,
|
compileToFunctions,
|
||||||
|
@ -6,10 +6,10 @@ import {
|
||||||
ssrCompileToFunctions,
|
ssrCompileToFunctions,
|
||||||
parseComponent,
|
parseComponent,
|
||||||
generateCodeFrame
|
generateCodeFrame
|
||||||
} from "./";
|
} from './'
|
||||||
|
|
||||||
// check compile options
|
// check compile options
|
||||||
const compiled = compile("<div>hi</div>", {
|
const compiled = compile('<div>hi</div>', {
|
||||||
outputSourceRange: true,
|
outputSourceRange: true,
|
||||||
preserveWhitespace: false,
|
preserveWhitespace: false,
|
||||||
whitespace: 'condense',
|
whitespace: 'condense',
|
||||||
|
@ -18,24 +18,24 @@ const compiled = compile("<div>hi</div>", {
|
||||||
preTransformNode: el => el,
|
preTransformNode: el => el,
|
||||||
transformNode: el => el,
|
transformNode: el => el,
|
||||||
postTransformNode: el => {
|
postTransformNode: el => {
|
||||||
el.tag = "p";
|
el.tag = 'p'
|
||||||
},
|
},
|
||||||
genData: el => el.tag,
|
genData: el => el.tag,
|
||||||
transformCode: (el, code) => code,
|
transformCode: (el, code) => code,
|
||||||
staticKeys: ["test"]
|
staticKeys: ['test']
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
directives: {
|
directives: {
|
||||||
test: (node, directiveMeta) => {
|
test: (node, directiveMeta) => {
|
||||||
node.tag;
|
node.tag
|
||||||
directiveMeta.value;
|
directiveMeta.value
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
|
|
||||||
// can be passed to function constructor
|
// can be passed to function constructor
|
||||||
new Function(compiled.render);
|
new Function(compiled.render)
|
||||||
compiled.staticRenderFns.map(fn => new Function(fn));
|
compiled.staticRenderFns.map(fn => new Function(fn))
|
||||||
|
|
||||||
// with outputSourceRange: true
|
// with outputSourceRange: true
|
||||||
// errors should be objects with range
|
// errors should be objects with range
|
||||||
|
@ -61,30 +61,30 @@ errors3.forEach(e => {
|
||||||
console.log(e.length)
|
console.log(e.length)
|
||||||
})
|
})
|
||||||
|
|
||||||
const compiledFns = compileToFunctions("<div>hi</div>");
|
const compiledFns = compileToFunctions('<div>hi</div>')
|
||||||
|
|
||||||
// can be passed to component render / staticRenderFns options
|
// can be passed to component render / staticRenderFns options
|
||||||
const vm = new Vue({
|
const vm = new Vue({
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
test: "Test"
|
test: 'Test'
|
||||||
};
|
}
|
||||||
},
|
},
|
||||||
render: compiledFns.render,
|
render: compiledFns.render,
|
||||||
staticRenderFns: compiledFns.staticRenderFns
|
staticRenderFns: compiledFns.staticRenderFns
|
||||||
});
|
})
|
||||||
|
|
||||||
// can be called with component instance
|
// can be called with component instance
|
||||||
const vnode: VNode = compiledFns.render.call(vm);
|
const vnode: VNode = compiledFns.render.call(vm)
|
||||||
|
|
||||||
// check SFC parser
|
// check SFC parser
|
||||||
const desc = parseComponent("<template></template>", {
|
const desc = parseComponent('<template></template>', {
|
||||||
pad: "space",
|
pad: 'space',
|
||||||
deindent: false
|
deindent: false
|
||||||
});
|
})
|
||||||
|
|
||||||
const templateContent: string = desc.template!.content;
|
const templateContent: string = desc.template!.content
|
||||||
const scriptContent: string = desc.script!.content;
|
const scriptContent: string = desc.script!.content
|
||||||
const styleContent: string = desc.styles.map(s => s.content).join("\n");
|
const styleContent: string = desc.styles.map(s => s.content).join('\n')
|
||||||
|
|
||||||
const codeframe: string = generateCodeFrame(`foobar`, 0, 4)
|
const codeframe: string = generateCodeFrame(`foobar`, 0, 4)
|
||||||
|
|
501
pnpm-lock.yaml
501
pnpm-lock.yaml
|
@ -7,8 +7,6 @@ specifiers:
|
||||||
'@rollup/plugin-replace': ^4.0.0
|
'@rollup/plugin-replace': ^4.0.0
|
||||||
'@types/he': ^1.1.2
|
'@types/he': ^1.1.2
|
||||||
'@types/node': ^17.0.30
|
'@types/node': ^17.0.30
|
||||||
'@typescript-eslint/eslint-plugin': ^5.21.0
|
|
||||||
'@typescript-eslint/parser': ^5.21.0
|
|
||||||
acorn: ^8.7.1
|
acorn: ^8.7.1
|
||||||
acorn-walk: ^8.2.0
|
acorn-walk: ^8.2.0
|
||||||
chalk: ^4.0.0
|
chalk: ^4.0.0
|
||||||
|
@ -19,7 +17,6 @@ specifiers:
|
||||||
de-indent: ^1.0.2
|
de-indent: ^1.0.2
|
||||||
esbuild: ^0.14.39
|
esbuild: ^0.14.39
|
||||||
escodegen: ^2.0.0
|
escodegen: ^2.0.0
|
||||||
eslint: ^8.14.0
|
|
||||||
file-loader: ^3.0.1
|
file-loader: ^3.0.1
|
||||||
hash-sum: ^2.0.0
|
hash-sum: ^2.0.0
|
||||||
he: ^1.2.0
|
he: ^1.2.0
|
||||||
|
@ -37,6 +34,7 @@ specifiers:
|
||||||
lru-cache: ^7.8.1
|
lru-cache: ^7.8.1
|
||||||
marked: ^3.0.8
|
marked: ^3.0.8
|
||||||
memory-fs: ^0.5.0
|
memory-fs: ^0.5.0
|
||||||
|
prettier: ^2.6.2
|
||||||
puppeteer: ^14.1.1
|
puppeteer: ^14.1.1
|
||||||
resolve: ^1.22.0
|
resolve: ^1.22.0
|
||||||
rollup: ^2.70.2
|
rollup: ^2.70.2
|
||||||
|
@ -60,8 +58,6 @@ devDependencies:
|
||||||
'@rollup/plugin-replace': 4.0.0_rollup@2.74.0
|
'@rollup/plugin-replace': 4.0.0_rollup@2.74.0
|
||||||
'@types/he': 1.1.2
|
'@types/he': 1.1.2
|
||||||
'@types/node': 17.0.34
|
'@types/node': 17.0.34
|
||||||
'@typescript-eslint/eslint-plugin': 5.25.0_qo2hgs5jt7x2a3p77h2rutcdae
|
|
||||||
'@typescript-eslint/parser': 5.25.0_hcfsmds2fshutdssjqluwm76uu
|
|
||||||
acorn: 8.7.1
|
acorn: 8.7.1
|
||||||
acorn-walk: 8.2.0
|
acorn-walk: 8.2.0
|
||||||
chalk: 4.1.2
|
chalk: 4.1.2
|
||||||
|
@ -72,7 +68,6 @@ devDependencies:
|
||||||
de-indent: 1.0.2
|
de-indent: 1.0.2
|
||||||
esbuild: 0.14.39
|
esbuild: 0.14.39
|
||||||
escodegen: 2.0.0
|
escodegen: 2.0.0
|
||||||
eslint: 8.15.0
|
|
||||||
file-loader: 3.0.1_webpack@4.46.0
|
file-loader: 3.0.1_webpack@4.46.0
|
||||||
hash-sum: 2.0.0
|
hash-sum: 2.0.0
|
||||||
he: 1.2.0
|
he: 1.2.0
|
||||||
|
@ -90,6 +85,7 @@ devDependencies:
|
||||||
lru-cache: 7.10.1
|
lru-cache: 7.10.1
|
||||||
marked: 3.0.8
|
marked: 3.0.8
|
||||||
memory-fs: 0.5.0
|
memory-fs: 0.5.0
|
||||||
|
prettier: 2.6.2
|
||||||
puppeteer: 14.1.1
|
puppeteer: 14.1.1
|
||||||
resolve: 1.22.0
|
resolve: 1.22.0
|
||||||
rollup: 2.74.0
|
rollup: 2.74.0
|
||||||
|
@ -204,64 +200,11 @@ packages:
|
||||||
'@cspotcode/source-map-consumer': 0.8.0
|
'@cspotcode/source-map-consumer': 0.8.0
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/@eslint/eslintrc/1.2.3:
|
|
||||||
resolution: {integrity: sha512-uGo44hIwoLGNyduRpjdEpovcbMdd+Nv7amtmJxnKmI8xj6yd5LncmSwDa5NgX/41lIFJtkjD6YdVfgEzPfJ5UA==}
|
|
||||||
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
|
|
||||||
dependencies:
|
|
||||||
ajv: 6.12.6
|
|
||||||
debug: 4.3.4
|
|
||||||
espree: 9.3.2
|
|
||||||
globals: 13.15.0
|
|
||||||
ignore: 5.2.0
|
|
||||||
import-fresh: 3.3.0
|
|
||||||
js-yaml: 4.1.0
|
|
||||||
minimatch: 3.1.2
|
|
||||||
strip-json-comments: 3.1.1
|
|
||||||
transitivePeerDependencies:
|
|
||||||
- supports-color
|
|
||||||
dev: true
|
|
||||||
|
|
||||||
/@humanwhocodes/config-array/0.9.5:
|
|
||||||
resolution: {integrity: sha512-ObyMyWxZiCu/yTisA7uzx81s40xR2fD5Cg/2Kq7G02ajkNubJf6BopgDTmDyc3U7sXpNKM8cYOw7s7Tyr+DnCw==}
|
|
||||||
engines: {node: '>=10.10.0'}
|
|
||||||
dependencies:
|
|
||||||
'@humanwhocodes/object-schema': 1.2.1
|
|
||||||
debug: 4.3.4
|
|
||||||
minimatch: 3.1.2
|
|
||||||
transitivePeerDependencies:
|
|
||||||
- supports-color
|
|
||||||
dev: true
|
|
||||||
|
|
||||||
/@humanwhocodes/object-schema/1.2.1:
|
|
||||||
resolution: {integrity: sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==}
|
|
||||||
dev: true
|
|
||||||
|
|
||||||
/@hutson/parse-repository-url/3.0.2:
|
/@hutson/parse-repository-url/3.0.2:
|
||||||
resolution: {integrity: sha512-H9XAx3hc0BQHY6l+IFSWHDySypcXsvsuLhgYLUGywmJ5pswRVQJUHpOsobnLYp2ZUaUlKiKDrgWWhosOwAEM8Q==}
|
resolution: {integrity: sha512-H9XAx3hc0BQHY6l+IFSWHDySypcXsvsuLhgYLUGywmJ5pswRVQJUHpOsobnLYp2ZUaUlKiKDrgWWhosOwAEM8Q==}
|
||||||
engines: {node: '>=6.9.0'}
|
engines: {node: '>=6.9.0'}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/@nodelib/fs.scandir/2.1.5:
|
|
||||||
resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==}
|
|
||||||
engines: {node: '>= 8'}
|
|
||||||
dependencies:
|
|
||||||
'@nodelib/fs.stat': 2.0.5
|
|
||||||
run-parallel: 1.2.0
|
|
||||||
dev: true
|
|
||||||
|
|
||||||
/@nodelib/fs.stat/2.0.5:
|
|
||||||
resolution: {integrity: sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==}
|
|
||||||
engines: {node: '>= 8'}
|
|
||||||
dev: true
|
|
||||||
|
|
||||||
/@nodelib/fs.walk/1.2.8:
|
|
||||||
resolution: {integrity: sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==}
|
|
||||||
engines: {node: '>= 8'}
|
|
||||||
dependencies:
|
|
||||||
'@nodelib/fs.scandir': 2.1.5
|
|
||||||
fastq: 1.13.0
|
|
||||||
dev: true
|
|
||||||
|
|
||||||
/@rollup/plugin-alias/3.1.9_rollup@2.74.0:
|
/@rollup/plugin-alias/3.1.9_rollup@2.74.0:
|
||||||
resolution: {integrity: sha512-QI5fsEvm9bDzt32k39wpOwZhVzRcL5ydcffUHMyLVaVaLeC70I8TJZ17F1z1eMoLu4E/UOcH9BWVkKpIKdrfiw==}
|
resolution: {integrity: sha512-QI5fsEvm9bDzt32k39wpOwZhVzRcL5ydcffUHMyLVaVaLeC70I8TJZ17F1z1eMoLu4E/UOcH9BWVkKpIKdrfiw==}
|
||||||
engines: {node: '>=8.0.0'}
|
engines: {node: '>=8.0.0'}
|
||||||
|
@ -388,10 +331,6 @@ packages:
|
||||||
resolution: {integrity: sha512-kSJPcLO1x+oolc0R89pUl2kozldQ/fVQ1C1p5mp8fPoLdF/ZcBvckaTC2M8xXh3GYendXvCpy5m/a2eSbfgNgw==}
|
resolution: {integrity: sha512-kSJPcLO1x+oolc0R89pUl2kozldQ/fVQ1C1p5mp8fPoLdF/ZcBvckaTC2M8xXh3GYendXvCpy5m/a2eSbfgNgw==}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/@types/json-schema/7.0.11:
|
|
||||||
resolution: {integrity: sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==}
|
|
||||||
dev: true
|
|
||||||
|
|
||||||
/@types/minimist/1.2.2:
|
/@types/minimist/1.2.2:
|
||||||
resolution: {integrity: sha512-jhuKLIRrhvCPLqwPcx6INqmKeiA5EWrsCOPhrlFSrbrmU4ZMPjj5Ul/oLCMDO98XRUIwVm78xICz4EPCektzeQ==}
|
resolution: {integrity: sha512-jhuKLIRrhvCPLqwPcx6INqmKeiA5EWrsCOPhrlFSrbrmU4ZMPjj5Ul/oLCMDO98XRUIwVm78xICz4EPCektzeQ==}
|
||||||
dev: true
|
dev: true
|
||||||
|
@ -423,132 +362,6 @@ packages:
|
||||||
dev: true
|
dev: true
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
/@typescript-eslint/eslint-plugin/5.25.0_qo2hgs5jt7x2a3p77h2rutcdae:
|
|
||||||
resolution: {integrity: sha512-icYrFnUzvm+LhW0QeJNKkezBu6tJs9p/53dpPLFH8zoM9w1tfaKzVurkPotEpAqQ8Vf8uaFyL5jHd0Vs6Z0ZQg==}
|
|
||||||
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
|
|
||||||
peerDependencies:
|
|
||||||
'@typescript-eslint/parser': ^5.0.0
|
|
||||||
eslint: ^6.0.0 || ^7.0.0 || ^8.0.0
|
|
||||||
typescript: '*'
|
|
||||||
peerDependenciesMeta:
|
|
||||||
typescript:
|
|
||||||
optional: true
|
|
||||||
dependencies:
|
|
||||||
'@typescript-eslint/parser': 5.25.0_hcfsmds2fshutdssjqluwm76uu
|
|
||||||
'@typescript-eslint/scope-manager': 5.25.0
|
|
||||||
'@typescript-eslint/type-utils': 5.25.0_hcfsmds2fshutdssjqluwm76uu
|
|
||||||
'@typescript-eslint/utils': 5.25.0_hcfsmds2fshutdssjqluwm76uu
|
|
||||||
debug: 4.3.4
|
|
||||||
eslint: 8.15.0
|
|
||||||
functional-red-black-tree: 1.0.1
|
|
||||||
ignore: 5.2.0
|
|
||||||
regexpp: 3.2.0
|
|
||||||
semver: 7.3.7
|
|
||||||
tsutils: 3.21.0_typescript@4.6.4
|
|
||||||
typescript: 4.6.4
|
|
||||||
transitivePeerDependencies:
|
|
||||||
- supports-color
|
|
||||||
dev: true
|
|
||||||
|
|
||||||
/@typescript-eslint/parser/5.25.0_hcfsmds2fshutdssjqluwm76uu:
|
|
||||||
resolution: {integrity: sha512-r3hwrOWYbNKP1nTcIw/aZoH+8bBnh/Lh1iDHoFpyG4DnCpvEdctrSl6LOo19fZbzypjQMHdajolxs6VpYoChgA==}
|
|
||||||
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
|
|
||||||
peerDependencies:
|
|
||||||
eslint: ^6.0.0 || ^7.0.0 || ^8.0.0
|
|
||||||
typescript: '*'
|
|
||||||
peerDependenciesMeta:
|
|
||||||
typescript:
|
|
||||||
optional: true
|
|
||||||
dependencies:
|
|
||||||
'@typescript-eslint/scope-manager': 5.25.0
|
|
||||||
'@typescript-eslint/types': 5.25.0
|
|
||||||
'@typescript-eslint/typescript-estree': 5.25.0_typescript@4.6.4
|
|
||||||
debug: 4.3.4
|
|
||||||
eslint: 8.15.0
|
|
||||||
typescript: 4.6.4
|
|
||||||
transitivePeerDependencies:
|
|
||||||
- supports-color
|
|
||||||
dev: true
|
|
||||||
|
|
||||||
/@typescript-eslint/scope-manager/5.25.0:
|
|
||||||
resolution: {integrity: sha512-p4SKTFWj+2VpreUZ5xMQsBMDdQ9XdRvODKXN4EksyBjFp2YvQdLkyHqOffakYZPuWJUDNu3jVXtHALDyTv3cww==}
|
|
||||||
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
|
|
||||||
dependencies:
|
|
||||||
'@typescript-eslint/types': 5.25.0
|
|
||||||
'@typescript-eslint/visitor-keys': 5.25.0
|
|
||||||
dev: true
|
|
||||||
|
|
||||||
/@typescript-eslint/type-utils/5.25.0_hcfsmds2fshutdssjqluwm76uu:
|
|
||||||
resolution: {integrity: sha512-B6nb3GK3Gv1Rsb2pqalebe/RyQoyG/WDy9yhj8EE0Ikds4Xa8RR28nHz+wlt4tMZk5bnAr0f3oC8TuDAd5CPrw==}
|
|
||||||
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
|
|
||||||
peerDependencies:
|
|
||||||
eslint: '*'
|
|
||||||
typescript: '*'
|
|
||||||
peerDependenciesMeta:
|
|
||||||
typescript:
|
|
||||||
optional: true
|
|
||||||
dependencies:
|
|
||||||
'@typescript-eslint/utils': 5.25.0_hcfsmds2fshutdssjqluwm76uu
|
|
||||||
debug: 4.3.4
|
|
||||||
eslint: 8.15.0
|
|
||||||
tsutils: 3.21.0_typescript@4.6.4
|
|
||||||
typescript: 4.6.4
|
|
||||||
transitivePeerDependencies:
|
|
||||||
- supports-color
|
|
||||||
dev: true
|
|
||||||
|
|
||||||
/@typescript-eslint/types/5.25.0:
|
|
||||||
resolution: {integrity: sha512-7fWqfxr0KNHj75PFqlGX24gWjdV/FDBABXL5dyvBOWHpACGyveok8Uj4ipPX/1fGU63fBkzSIycEje4XsOxUFA==}
|
|
||||||
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
|
|
||||||
dev: true
|
|
||||||
|
|
||||||
/@typescript-eslint/typescript-estree/5.25.0_typescript@4.6.4:
|
|
||||||
resolution: {integrity: sha512-MrPODKDych/oWs/71LCnuO7NyR681HuBly2uLnX3r5i4ME7q/yBqC4hW33kmxtuauLTM0OuBOhhkFaxCCOjEEw==}
|
|
||||||
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
|
|
||||||
peerDependencies:
|
|
||||||
typescript: '*'
|
|
||||||
peerDependenciesMeta:
|
|
||||||
typescript:
|
|
||||||
optional: true
|
|
||||||
dependencies:
|
|
||||||
'@typescript-eslint/types': 5.25.0
|
|
||||||
'@typescript-eslint/visitor-keys': 5.25.0
|
|
||||||
debug: 4.3.4
|
|
||||||
globby: 11.1.0
|
|
||||||
is-glob: 4.0.3
|
|
||||||
semver: 7.3.7
|
|
||||||
tsutils: 3.21.0_typescript@4.6.4
|
|
||||||
typescript: 4.6.4
|
|
||||||
transitivePeerDependencies:
|
|
||||||
- supports-color
|
|
||||||
dev: true
|
|
||||||
|
|
||||||
/@typescript-eslint/utils/5.25.0_hcfsmds2fshutdssjqluwm76uu:
|
|
||||||
resolution: {integrity: sha512-qNC9bhnz/n9Kba3yI6HQgQdBLuxDoMgdjzdhSInZh6NaDnFpTUlwNGxplUFWfY260Ya0TRPvkg9dd57qxrJI9g==}
|
|
||||||
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
|
|
||||||
peerDependencies:
|
|
||||||
eslint: ^6.0.0 || ^7.0.0 || ^8.0.0
|
|
||||||
dependencies:
|
|
||||||
'@types/json-schema': 7.0.11
|
|
||||||
'@typescript-eslint/scope-manager': 5.25.0
|
|
||||||
'@typescript-eslint/types': 5.25.0
|
|
||||||
'@typescript-eslint/typescript-estree': 5.25.0_typescript@4.6.4
|
|
||||||
eslint: 8.15.0
|
|
||||||
eslint-scope: 5.1.1
|
|
||||||
eslint-utils: 3.0.0_eslint@8.15.0
|
|
||||||
transitivePeerDependencies:
|
|
||||||
- supports-color
|
|
||||||
- typescript
|
|
||||||
dev: true
|
|
||||||
|
|
||||||
/@typescript-eslint/visitor-keys/5.25.0:
|
|
||||||
resolution: {integrity: sha512-yd26vFgMsC4h2dgX4+LR+GeicSKIfUvZREFLf3DDjZPtqgLx5AJZr6TetMNwFP9hcKreTTeztQYBTNbNoOycwA==}
|
|
||||||
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
|
|
||||||
dependencies:
|
|
||||||
'@typescript-eslint/types': 5.25.0
|
|
||||||
eslint-visitor-keys: 3.3.0
|
|
||||||
dev: true
|
|
||||||
|
|
||||||
/@webassemblyjs/ast/1.9.0:
|
/@webassemblyjs/ast/1.9.0:
|
||||||
resolution: {integrity: sha512-C6wW5L+b7ogSDVqymbkkvuW9kruN//YisMED04xzeBBqjHa2FYnmvOlS6Xj68xWQRgWvI9cIglsjFowH/RJyEA==}
|
resolution: {integrity: sha512-C6wW5L+b7ogSDVqymbkkvuW9kruN//YisMED04xzeBBqjHa2FYnmvOlS6Xj68xWQRgWvI9cIglsjFowH/RJyEA==}
|
||||||
dependencies:
|
dependencies:
|
||||||
|
@ -719,14 +532,6 @@ packages:
|
||||||
acorn-walk: 7.2.0
|
acorn-walk: 7.2.0
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/acorn-jsx/5.3.2_acorn@8.7.1:
|
|
||||||
resolution: {integrity: sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==}
|
|
||||||
peerDependencies:
|
|
||||||
acorn: ^6.0.0 || ^7.0.0 || ^8.0.0
|
|
||||||
dependencies:
|
|
||||||
acorn: 8.7.1
|
|
||||||
dev: true
|
|
||||||
|
|
||||||
/acorn-walk/7.2.0:
|
/acorn-walk/7.2.0:
|
||||||
resolution: {integrity: sha512-OPdCF6GsMIP+Az+aWfAAOEt2/+iVDKE7oy6lJ098aoe59oAmK76qV6Gw60SbZ8jHuG2wH058GF4pLFbYamYrVA==}
|
resolution: {integrity: sha512-OPdCF6GsMIP+Az+aWfAAOEt2/+iVDKE7oy6lJ098aoe59oAmK76qV6Gw60SbZ8jHuG2wH058GF4pLFbYamYrVA==}
|
||||||
engines: {node: '>=0.4.0'}
|
engines: {node: '>=0.4.0'}
|
||||||
|
@ -878,10 +683,6 @@ packages:
|
||||||
resolution: {integrity: sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==}
|
resolution: {integrity: sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/argparse/2.0.1:
|
|
||||||
resolution: {integrity: sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==}
|
|
||||||
dev: true
|
|
||||||
|
|
||||||
/arr-diff/4.0.0:
|
/arr-diff/4.0.0:
|
||||||
resolution: {integrity: sha512-YVIQ82gZPGBebQV/a8dar4AitzCQs0jjXwMPZllpXMaGjXPYVUawSxQrRsjhjupyVxEvbHgUmIhKVlND+j02kA==}
|
resolution: {integrity: sha512-YVIQ82gZPGBebQV/a8dar4AitzCQs0jjXwMPZllpXMaGjXPYVUawSxQrRsjhjupyVxEvbHgUmIhKVlND+j02kA==}
|
||||||
engines: {node: '>=0.10.0'}
|
engines: {node: '>=0.10.0'}
|
||||||
|
@ -901,11 +702,6 @@ packages:
|
||||||
resolution: {integrity: sha512-c5AMf34bKdvPhQ7tBGhqkgKNUzMr4WUs+WDtC2ZUGOUncbxKMTvqxYctiseW3+L4bA8ec+GcZ6/A/FW4m8ukng==}
|
resolution: {integrity: sha512-c5AMf34bKdvPhQ7tBGhqkgKNUzMr4WUs+WDtC2ZUGOUncbxKMTvqxYctiseW3+L4bA8ec+GcZ6/A/FW4m8ukng==}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/array-union/2.1.0:
|
|
||||||
resolution: {integrity: sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==}
|
|
||||||
engines: {node: '>=8'}
|
|
||||||
dev: true
|
|
||||||
|
|
||||||
/array-unique/0.3.2:
|
/array-unique/0.3.2:
|
||||||
resolution: {integrity: sha512-SleRWjh9JUud2wH1hPs9rZBZ33H6T9HOiL0uwGnGx9FpE6wKGyfWugmbkEOIs6qWrZhg0LWeLziLrEwQJhs5mQ==}
|
resolution: {integrity: sha512-SleRWjh9JUud2wH1hPs9rZBZ33H6T9HOiL0uwGnGx9FpE6wKGyfWugmbkEOIs6qWrZhg0LWeLziLrEwQJhs5mQ==}
|
||||||
engines: {node: '>=0.10.0'}
|
engines: {node: '>=0.10.0'}
|
||||||
|
@ -1236,6 +1032,7 @@ packages:
|
||||||
resolution: {integrity: sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==}
|
resolution: {integrity: sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==}
|
||||||
engines: {node: '>=6'}
|
engines: {node: '>=6'}
|
||||||
dev: true
|
dev: true
|
||||||
|
optional: true
|
||||||
|
|
||||||
/camelcase-keys/6.2.2:
|
/camelcase-keys/6.2.2:
|
||||||
resolution: {integrity: sha512-YrwaA0vEKazPBkn0ipTiMpSajYDSe+KjQfrjhcBMxJt/znbvlHd8Pw/Vamaz5EB4Wfhs3SUR3Z9mwRu/P3s3Yg==}
|
resolution: {integrity: sha512-YrwaA0vEKazPBkn0ipTiMpSajYDSe+KjQfrjhcBMxJt/znbvlHd8Pw/Vamaz5EB4Wfhs3SUR3Z9mwRu/P3s3Yg==}
|
||||||
|
@ -2053,20 +1850,6 @@ packages:
|
||||||
randombytes: 2.1.0
|
randombytes: 2.1.0
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/dir-glob/3.0.1:
|
|
||||||
resolution: {integrity: sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==}
|
|
||||||
engines: {node: '>=8'}
|
|
||||||
dependencies:
|
|
||||||
path-type: 4.0.0
|
|
||||||
dev: true
|
|
||||||
|
|
||||||
/doctrine/3.0.0:
|
|
||||||
resolution: {integrity: sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==}
|
|
||||||
engines: {node: '>=6.0.0'}
|
|
||||||
dependencies:
|
|
||||||
esutils: 2.0.3
|
|
||||||
dev: true
|
|
||||||
|
|
||||||
/dom-serialize/2.2.1:
|
/dom-serialize/2.2.1:
|
||||||
resolution: {integrity: sha1-ViromZ9Evl6jB29UGdzVnrQ6yVs=}
|
resolution: {integrity: sha1-ViromZ9Evl6jB29UGdzVnrQ6yVs=}
|
||||||
dependencies:
|
dependencies:
|
||||||
|
@ -2421,11 +2204,6 @@ packages:
|
||||||
engines: {node: '>=0.8.0'}
|
engines: {node: '>=0.8.0'}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/escape-string-regexp/4.0.0:
|
|
||||||
resolution: {integrity: sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==}
|
|
||||||
engines: {node: '>=10'}
|
|
||||||
dev: true
|
|
||||||
|
|
||||||
/escodegen/2.0.0:
|
/escodegen/2.0.0:
|
||||||
resolution: {integrity: sha512-mmHKys/C8BFUGI+MAWNcSYoORYLMdPzjrknd2Vc+bUsjN5bXcr8EhrNB+UTqfL1y3I9c4fw2ihgtMPQLBRiQxw==}
|
resolution: {integrity: sha512-mmHKys/C8BFUGI+MAWNcSYoORYLMdPzjrknd2Vc+bUsjN5bXcr8EhrNB+UTqfL1y3I9c4fw2ihgtMPQLBRiQxw==}
|
||||||
engines: {node: '>=6.0'}
|
engines: {node: '>=6.0'}
|
||||||
|
@ -2447,108 +2225,12 @@ packages:
|
||||||
estraverse: 4.3.0
|
estraverse: 4.3.0
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/eslint-scope/5.1.1:
|
|
||||||
resolution: {integrity: sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==}
|
|
||||||
engines: {node: '>=8.0.0'}
|
|
||||||
dependencies:
|
|
||||||
esrecurse: 4.3.0
|
|
||||||
estraverse: 4.3.0
|
|
||||||
dev: true
|
|
||||||
|
|
||||||
/eslint-scope/7.1.1:
|
|
||||||
resolution: {integrity: sha512-QKQM/UXpIiHcLqJ5AOyIW7XZmzjkzQXYE54n1++wb0u9V/abW3l9uQnxX8Z5Xd18xyKIMTUAyQ0k1e8pz6LUrw==}
|
|
||||||
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
|
|
||||||
dependencies:
|
|
||||||
esrecurse: 4.3.0
|
|
||||||
estraverse: 5.3.0
|
|
||||||
dev: true
|
|
||||||
|
|
||||||
/eslint-utils/3.0.0_eslint@8.15.0:
|
|
||||||
resolution: {integrity: sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==}
|
|
||||||
engines: {node: ^10.0.0 || ^12.0.0 || >= 14.0.0}
|
|
||||||
peerDependencies:
|
|
||||||
eslint: '>=5'
|
|
||||||
dependencies:
|
|
||||||
eslint: 8.15.0
|
|
||||||
eslint-visitor-keys: 2.1.0
|
|
||||||
dev: true
|
|
||||||
|
|
||||||
/eslint-visitor-keys/2.1.0:
|
|
||||||
resolution: {integrity: sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==}
|
|
||||||
engines: {node: '>=10'}
|
|
||||||
dev: true
|
|
||||||
|
|
||||||
/eslint-visitor-keys/3.3.0:
|
|
||||||
resolution: {integrity: sha512-mQ+suqKJVyeuwGYHAdjMFqjCyfl8+Ldnxuyp3ldiMBFKkvytrXUZWaiPCEav8qDHKty44bD+qV1IP4T+w+xXRA==}
|
|
||||||
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
|
|
||||||
dev: true
|
|
||||||
|
|
||||||
/eslint/8.15.0:
|
|
||||||
resolution: {integrity: sha512-GG5USZ1jhCu8HJkzGgeK8/+RGnHaNYZGrGDzUtigK3BsGESW/rs2az23XqE0WVwDxy1VRvvjSSGu5nB0Bu+6SA==}
|
|
||||||
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
|
|
||||||
hasBin: true
|
|
||||||
dependencies:
|
|
||||||
'@eslint/eslintrc': 1.2.3
|
|
||||||
'@humanwhocodes/config-array': 0.9.5
|
|
||||||
ajv: 6.12.6
|
|
||||||
chalk: 4.1.2
|
|
||||||
cross-spawn: 7.0.3
|
|
||||||
debug: 4.3.4
|
|
||||||
doctrine: 3.0.0
|
|
||||||
escape-string-regexp: 4.0.0
|
|
||||||
eslint-scope: 7.1.1
|
|
||||||
eslint-utils: 3.0.0_eslint@8.15.0
|
|
||||||
eslint-visitor-keys: 3.3.0
|
|
||||||
espree: 9.3.2
|
|
||||||
esquery: 1.4.0
|
|
||||||
esutils: 2.0.3
|
|
||||||
fast-deep-equal: 3.1.3
|
|
||||||
file-entry-cache: 6.0.1
|
|
||||||
functional-red-black-tree: 1.0.1
|
|
||||||
glob-parent: 6.0.2
|
|
||||||
globals: 13.15.0
|
|
||||||
ignore: 5.2.0
|
|
||||||
import-fresh: 3.3.0
|
|
||||||
imurmurhash: 0.1.4
|
|
||||||
is-glob: 4.0.3
|
|
||||||
js-yaml: 4.1.0
|
|
||||||
json-stable-stringify-without-jsonify: 1.0.1
|
|
||||||
levn: 0.4.1
|
|
||||||
lodash.merge: 4.6.2
|
|
||||||
minimatch: 3.1.2
|
|
||||||
natural-compare: 1.4.0
|
|
||||||
optionator: 0.9.1
|
|
||||||
regexpp: 3.2.0
|
|
||||||
strip-ansi: 6.0.1
|
|
||||||
strip-json-comments: 3.1.1
|
|
||||||
text-table: 0.2.0
|
|
||||||
v8-compile-cache: 2.3.0
|
|
||||||
transitivePeerDependencies:
|
|
||||||
- supports-color
|
|
||||||
dev: true
|
|
||||||
|
|
||||||
/espree/9.3.2:
|
|
||||||
resolution: {integrity: sha512-D211tC7ZwouTIuY5x9XnS0E9sWNChB7IYKX/Xp5eQj3nFXhqmiUDB9q27y76oFl8jTg3pXcQx/bpxMfs3CIZbA==}
|
|
||||||
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
|
|
||||||
dependencies:
|
|
||||||
acorn: 8.7.1
|
|
||||||
acorn-jsx: 5.3.2_acorn@8.7.1
|
|
||||||
eslint-visitor-keys: 3.3.0
|
|
||||||
dev: true
|
|
||||||
|
|
||||||
/esprima/4.0.1:
|
/esprima/4.0.1:
|
||||||
resolution: {integrity: sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==}
|
resolution: {integrity: sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==}
|
||||||
engines: {node: '>=4'}
|
engines: {node: '>=4'}
|
||||||
hasBin: true
|
hasBin: true
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/esquery/1.4.0:
|
|
||||||
resolution: {integrity: sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w==}
|
|
||||||
engines: {node: '>=0.10'}
|
|
||||||
dependencies:
|
|
||||||
estraverse: 5.3.0
|
|
||||||
dev: true
|
|
||||||
|
|
||||||
/esrecurse/4.3.0:
|
/esrecurse/4.3.0:
|
||||||
resolution: {integrity: sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==}
|
resolution: {integrity: sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==}
|
||||||
engines: {node: '>=4.0'}
|
engines: {node: '>=4.0'}
|
||||||
|
@ -2707,17 +2389,6 @@ packages:
|
||||||
resolution: {integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==}
|
resolution: {integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/fast-glob/3.2.11:
|
|
||||||
resolution: {integrity: sha512-xrO3+1bxSo3ZVHAnqzyuewYT6aMFHRAd4Kcs92MAonjwQZLsK9d0SF1IyQ3k5PoirxTW0Oe/RqFgMQ6TcNE5Ew==}
|
|
||||||
engines: {node: '>=8.6.0'}
|
|
||||||
dependencies:
|
|
||||||
'@nodelib/fs.stat': 2.0.5
|
|
||||||
'@nodelib/fs.walk': 1.2.8
|
|
||||||
glob-parent: 5.1.2
|
|
||||||
merge2: 1.4.1
|
|
||||||
micromatch: 4.0.5
|
|
||||||
dev: true
|
|
||||||
|
|
||||||
/fast-json-stable-stringify/2.1.0:
|
/fast-json-stable-stringify/2.1.0:
|
||||||
resolution: {integrity: sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==}
|
resolution: {integrity: sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==}
|
||||||
dev: true
|
dev: true
|
||||||
|
@ -2726,12 +2397,6 @@ packages:
|
||||||
resolution: {integrity: sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=}
|
resolution: {integrity: sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/fastq/1.13.0:
|
|
||||||
resolution: {integrity: sha512-YpkpUnK8od0o1hmeSc7UUs/eB/vIPWJYjKck2QKIzAf71Vm1AAQ3EbuZB3g2JIy+pg+ERD0vqI79KyZiB2e2Nw==}
|
|
||||||
dependencies:
|
|
||||||
reusify: 1.0.4
|
|
||||||
dev: true
|
|
||||||
|
|
||||||
/fd-slicer/1.1.0:
|
/fd-slicer/1.1.0:
|
||||||
resolution: {integrity: sha1-JcfInLH5B3+IkbvmHY85Dq4lbx4=}
|
resolution: {integrity: sha1-JcfInLH5B3+IkbvmHY85Dq4lbx4=}
|
||||||
dependencies:
|
dependencies:
|
||||||
|
@ -2749,13 +2414,6 @@ packages:
|
||||||
escape-string-regexp: 1.0.5
|
escape-string-regexp: 1.0.5
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/file-entry-cache/6.0.1:
|
|
||||||
resolution: {integrity: sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==}
|
|
||||||
engines: {node: ^10.12.0 || >=12.0.0}
|
|
||||||
dependencies:
|
|
||||||
flat-cache: 3.0.4
|
|
||||||
dev: true
|
|
||||||
|
|
||||||
/file-loader/3.0.1_webpack@4.46.0:
|
/file-loader/3.0.1_webpack@4.46.0:
|
||||||
resolution: {integrity: sha512-4sNIOXgtH/9WZq4NvlfU3Opn5ynUsqBwSLyM+I7UOwdGigTBYfVVQEwe/msZNX/j4pCJTIM14Fsw66Svo1oVrw==}
|
resolution: {integrity: sha512-4sNIOXgtH/9WZq4NvlfU3Opn5ynUsqBwSLyM+I7UOwdGigTBYfVVQEwe/msZNX/j4pCJTIM14Fsw66Svo1oVrw==}
|
||||||
engines: {node: '>= 6.9.0'}
|
engines: {node: '>= 6.9.0'}
|
||||||
|
@ -2873,14 +2531,6 @@ packages:
|
||||||
resolve-dir: 1.0.1
|
resolve-dir: 1.0.1
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/flat-cache/3.0.4:
|
|
||||||
resolution: {integrity: sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg==}
|
|
||||||
engines: {node: ^10.12.0 || >=12.0.0}
|
|
||||||
dependencies:
|
|
||||||
flatted: 3.2.5
|
|
||||||
rimraf: 3.0.2
|
|
||||||
dev: true
|
|
||||||
|
|
||||||
/flatted/3.2.5:
|
/flatted/3.2.5:
|
||||||
resolution: {integrity: sha512-WIWGi2L3DyTUvUrwRKgGi9TwxQMUEqPOPQBVi71R96jZXJdFskXEmf54BoZaS1kknGODoIGASGEzBUYdyMCBJg==}
|
resolution: {integrity: sha512-WIWGi2L3DyTUvUrwRKgGi9TwxQMUEqPOPQBVi71R96jZXJdFskXEmf54BoZaS1kknGODoIGASGEzBUYdyMCBJg==}
|
||||||
dev: true
|
dev: true
|
||||||
|
@ -2988,10 +2638,6 @@ packages:
|
||||||
resolution: {integrity: sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==}
|
resolution: {integrity: sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/functional-red-black-tree/1.0.1:
|
|
||||||
resolution: {integrity: sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=}
|
|
||||||
dev: true
|
|
||||||
|
|
||||||
/get-caller-file/2.0.5:
|
/get-caller-file/2.0.5:
|
||||||
resolution: {integrity: sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==}
|
resolution: {integrity: sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==}
|
||||||
engines: {node: 6.* || 8.* || >= 10.*}
|
engines: {node: 6.* || 8.* || >= 10.*}
|
||||||
|
@ -3092,13 +2738,6 @@ packages:
|
||||||
is-glob: 4.0.3
|
is-glob: 4.0.3
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/glob-parent/6.0.2:
|
|
||||||
resolution: {integrity: sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==}
|
|
||||||
engines: {node: '>=10.13.0'}
|
|
||||||
dependencies:
|
|
||||||
is-glob: 4.0.3
|
|
||||||
dev: true
|
|
||||||
|
|
||||||
/glob/7.1.4:
|
/glob/7.1.4:
|
||||||
resolution: {integrity: sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A==}
|
resolution: {integrity: sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A==}
|
||||||
dependencies:
|
dependencies:
|
||||||
|
@ -3149,25 +2788,6 @@ packages:
|
||||||
which: 1.3.1
|
which: 1.3.1
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/globals/13.15.0:
|
|
||||||
resolution: {integrity: sha512-bpzcOlgDhMG070Av0Vy5Owklpv1I6+j96GhUI7Rh7IzDCKLzboflLrrfqMu8NquDbiR4EOQk7XzJwqVJxicxog==}
|
|
||||||
engines: {node: '>=8'}
|
|
||||||
dependencies:
|
|
||||||
type-fest: 0.20.2
|
|
||||||
dev: true
|
|
||||||
|
|
||||||
/globby/11.1.0:
|
|
||||||
resolution: {integrity: sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==}
|
|
||||||
engines: {node: '>=10'}
|
|
||||||
dependencies:
|
|
||||||
array-union: 2.1.0
|
|
||||||
dir-glob: 3.0.1
|
|
||||||
fast-glob: 3.2.11
|
|
||||||
ignore: 5.2.0
|
|
||||||
merge2: 1.4.1
|
|
||||||
slash: 3.0.0
|
|
||||||
dev: true
|
|
||||||
|
|
||||||
/graceful-fs/4.2.10:
|
/graceful-fs/4.2.10:
|
||||||
resolution: {integrity: sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==}
|
resolution: {integrity: sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==}
|
||||||
dev: true
|
dev: true
|
||||||
|
@ -3375,11 +2995,6 @@ packages:
|
||||||
resolution: {integrity: sha1-xg7taebY/bazEEofy8ocGS3FtQE=}
|
resolution: {integrity: sha1-xg7taebY/bazEEofy8ocGS3FtQE=}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/ignore/5.2.0:
|
|
||||||
resolution: {integrity: sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==}
|
|
||||||
engines: {node: '>= 4'}
|
|
||||||
dev: true
|
|
||||||
|
|
||||||
/import-fresh/3.3.0:
|
/import-fresh/3.3.0:
|
||||||
resolution: {integrity: sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==}
|
resolution: {integrity: sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==}
|
||||||
engines: {node: '>=6'}
|
engines: {node: '>=6'}
|
||||||
|
@ -3387,6 +3002,7 @@ packages:
|
||||||
parent-module: 1.0.1
|
parent-module: 1.0.1
|
||||||
resolve-from: 4.0.0
|
resolve-from: 4.0.0
|
||||||
dev: true
|
dev: true
|
||||||
|
optional: true
|
||||||
|
|
||||||
/imurmurhash/0.1.4:
|
/imurmurhash/0.1.4:
|
||||||
resolution: {integrity: sha1-khi5srkoojixPcT7a21XbyMUU+o=}
|
resolution: {integrity: sha1-khi5srkoojixPcT7a21XbyMUU+o=}
|
||||||
|
@ -3692,13 +3308,6 @@ packages:
|
||||||
resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==}
|
resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/js-yaml/4.1.0:
|
|
||||||
resolution: {integrity: sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==}
|
|
||||||
hasBin: true
|
|
||||||
dependencies:
|
|
||||||
argparse: 2.0.1
|
|
||||||
dev: true
|
|
||||||
|
|
||||||
/jsdom/19.0.0:
|
/jsdom/19.0.0:
|
||||||
resolution: {integrity: sha512-RYAyjCbxy/vri/CfnjUWJQQtZ3LKlLnDqj+9XLNnJPgEGeirZs3hllKR20re8LUZ6o1b1X4Jat+Qd26zmP41+A==}
|
resolution: {integrity: sha512-RYAyjCbxy/vri/CfnjUWJQQtZ3LKlLnDqj+9XLNnJPgEGeirZs3hllKR20re8LUZ6o1b1X4Jat+Qd26zmP41+A==}
|
||||||
engines: {node: '>=12'}
|
engines: {node: '>=12'}
|
||||||
|
@ -3753,10 +3362,6 @@ packages:
|
||||||
resolution: {integrity: sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==}
|
resolution: {integrity: sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/json-stable-stringify-without-jsonify/1.0.1:
|
|
||||||
resolution: {integrity: sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=}
|
|
||||||
dev: true
|
|
||||||
|
|
||||||
/json-stringify-safe/5.0.1:
|
/json-stringify-safe/5.0.1:
|
||||||
resolution: {integrity: sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=}
|
resolution: {integrity: sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=}
|
||||||
dev: true
|
dev: true
|
||||||
|
@ -3889,14 +3494,6 @@ packages:
|
||||||
type-check: 0.3.2
|
type-check: 0.3.2
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/levn/0.4.1:
|
|
||||||
resolution: {integrity: sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==}
|
|
||||||
engines: {node: '>= 0.8.0'}
|
|
||||||
dependencies:
|
|
||||||
prelude-ls: 1.2.1
|
|
||||||
type-check: 0.4.0
|
|
||||||
dev: true
|
|
||||||
|
|
||||||
/lilconfig/2.0.4:
|
/lilconfig/2.0.4:
|
||||||
resolution: {integrity: sha512-bfTIN7lEsiooCocSISTWXkiWJkRqtL9wYtYy+8EK3Y41qh3mpwPU0ycTOgjdY9ErwXCc8QyrQp82bdL0Xkm9yA==}
|
resolution: {integrity: sha512-bfTIN7lEsiooCocSISTWXkiWJkRqtL9wYtYy+8EK3Y41qh3mpwPU0ycTOgjdY9ErwXCc8QyrQp82bdL0Xkm9yA==}
|
||||||
engines: {node: '>=10'}
|
engines: {node: '>=10'}
|
||||||
|
@ -4019,10 +3616,6 @@ packages:
|
||||||
resolution: {integrity: sha1-dx7Hg540c9nEzeKLGTlMNWL09tM=}
|
resolution: {integrity: sha1-dx7Hg540c9nEzeKLGTlMNWL09tM=}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/lodash.merge/4.6.2:
|
|
||||||
resolution: {integrity: sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==}
|
|
||||||
dev: true
|
|
||||||
|
|
||||||
/lodash.sortby/4.7.0:
|
/lodash.sortby/4.7.0:
|
||||||
resolution: {integrity: sha1-7dFMgk4sycHgsKG0K7UhBRakJDg=}
|
resolution: {integrity: sha1-7dFMgk4sycHgsKG0K7UhBRakJDg=}
|
||||||
dev: true
|
dev: true
|
||||||
|
@ -4213,11 +3806,6 @@ packages:
|
||||||
resolution: {integrity: sha512-jz+Cfrg9GWOZbQAnDQ4hlVnQky+341Yk5ru8bZSe6sIDTCIg8n9i/u7hSQGSVOF3C7lH6mGtqjkiT9G4wFLL0w==}
|
resolution: {integrity: sha512-jz+Cfrg9GWOZbQAnDQ4hlVnQky+341Yk5ru8bZSe6sIDTCIg8n9i/u7hSQGSVOF3C7lH6mGtqjkiT9G4wFLL0w==}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/merge2/1.4.1:
|
|
||||||
resolution: {integrity: sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==}
|
|
||||||
engines: {node: '>= 8'}
|
|
||||||
dev: true
|
|
||||||
|
|
||||||
/micromatch/3.1.10:
|
/micromatch/3.1.10:
|
||||||
resolution: {integrity: sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==}
|
resolution: {integrity: sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==}
|
||||||
engines: {node: '>=0.10.0'}
|
engines: {node: '>=0.10.0'}
|
||||||
|
@ -4412,10 +4000,6 @@ packages:
|
||||||
- supports-color
|
- supports-color
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/natural-compare/1.4.0:
|
|
||||||
resolution: {integrity: sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=}
|
|
||||||
dev: true
|
|
||||||
|
|
||||||
/negotiator/0.6.3:
|
/negotiator/0.6.3:
|
||||||
resolution: {integrity: sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==}
|
resolution: {integrity: sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==}
|
||||||
engines: {node: '>= 0.6'}
|
engines: {node: '>= 0.6'}
|
||||||
|
@ -4598,18 +4182,6 @@ packages:
|
||||||
word-wrap: 1.2.3
|
word-wrap: 1.2.3
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/optionator/0.9.1:
|
|
||||||
resolution: {integrity: sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw==}
|
|
||||||
engines: {node: '>= 0.8.0'}
|
|
||||||
dependencies:
|
|
||||||
deep-is: 0.1.4
|
|
||||||
fast-levenshtein: 2.0.6
|
|
||||||
levn: 0.4.1
|
|
||||||
prelude-ls: 1.2.1
|
|
||||||
type-check: 0.4.0
|
|
||||||
word-wrap: 1.2.3
|
|
||||||
dev: true
|
|
||||||
|
|
||||||
/os-browserify/0.3.0:
|
/os-browserify/0.3.0:
|
||||||
resolution: {integrity: sha1-hUNzx/XCMVkU/Jv8a9gjj92h7Cc=}
|
resolution: {integrity: sha1-hUNzx/XCMVkU/Jv8a9gjj92h7Cc=}
|
||||||
dev: true
|
dev: true
|
||||||
|
@ -4708,6 +4280,7 @@ packages:
|
||||||
dependencies:
|
dependencies:
|
||||||
callsites: 3.1.0
|
callsites: 3.1.0
|
||||||
dev: true
|
dev: true
|
||||||
|
optional: true
|
||||||
|
|
||||||
/parse-asn1/5.1.6:
|
/parse-asn1/5.1.6:
|
||||||
resolution: {integrity: sha512-RnZRo1EPU6JBnra2vGHj0yhp6ebyjBZpmUCLHWiFhxlzvBCCpAuZ7elsBp1PVAbQN0/04VD/19rfzlBSwLstMw==}
|
resolution: {integrity: sha512-RnZRo1EPU6JBnra2vGHj0yhp6ebyjBZpmUCLHWiFhxlzvBCCpAuZ7elsBp1PVAbQN0/04VD/19rfzlBSwLstMw==}
|
||||||
|
@ -4817,6 +4390,7 @@ packages:
|
||||||
resolution: {integrity: sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==}
|
resolution: {integrity: sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==}
|
||||||
engines: {node: '>=8'}
|
engines: {node: '>=8'}
|
||||||
dev: true
|
dev: true
|
||||||
|
optional: true
|
||||||
|
|
||||||
/pathval/1.1.1:
|
/pathval/1.1.1:
|
||||||
resolution: {integrity: sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==}
|
resolution: {integrity: sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==}
|
||||||
|
@ -4907,9 +4481,10 @@ packages:
|
||||||
engines: {node: '>= 0.8.0'}
|
engines: {node: '>= 0.8.0'}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/prelude-ls/1.2.1:
|
/prettier/2.6.2:
|
||||||
resolution: {integrity: sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==}
|
resolution: {integrity: sha512-PkUpF+qoXTqhOeWL9fu7As8LXsIUZ1WYaJiY/a7McAQzxjk82OF0tibkFXVCDImZtWxbvojFjerkiLb0/q8mew==}
|
||||||
engines: {node: '>= 0.8.0'}
|
engines: {node: '>=10.13.0'}
|
||||||
|
hasBin: true
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/process-nextick-args/2.0.1:
|
/process-nextick-args/2.0.1:
|
||||||
|
@ -5051,10 +4626,6 @@ packages:
|
||||||
deprecated: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
|
deprecated: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/queue-microtask/1.2.3:
|
|
||||||
resolution: {integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==}
|
|
||||||
dev: true
|
|
||||||
|
|
||||||
/quick-lru/4.0.1:
|
/quick-lru/4.0.1:
|
||||||
resolution: {integrity: sha512-ARhCpm70fzdcvNQfPoy49IaanKkTlRWF2JMzqhcJbhSFRZv7nPTvZJdcY7301IPmvW+/p0RgIWnQDLJxifsQ7g==}
|
resolution: {integrity: sha512-ARhCpm70fzdcvNQfPoy49IaanKkTlRWF2JMzqhcJbhSFRZv7nPTvZJdcY7301IPmvW+/p0RgIWnQDLJxifsQ7g==}
|
||||||
engines: {node: '>=8'}
|
engines: {node: '>=8'}
|
||||||
|
@ -5187,11 +4758,6 @@ packages:
|
||||||
safe-regex: 1.1.0
|
safe-regex: 1.1.0
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/regexpp/3.2.0:
|
|
||||||
resolution: {integrity: sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==}
|
|
||||||
engines: {node: '>=8'}
|
|
||||||
dev: true
|
|
||||||
|
|
||||||
/remove-trailing-separator/1.1.0:
|
/remove-trailing-separator/1.1.0:
|
||||||
resolution: {integrity: sha1-wkvOKig62tW8P1jg1IJJuSN52O8=}
|
resolution: {integrity: sha1-wkvOKig62tW8P1jg1IJJuSN52O8=}
|
||||||
dev: true
|
dev: true
|
||||||
|
@ -5228,6 +4794,7 @@ packages:
|
||||||
resolution: {integrity: sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==}
|
resolution: {integrity: sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==}
|
||||||
engines: {node: '>=4'}
|
engines: {node: '>=4'}
|
||||||
dev: true
|
dev: true
|
||||||
|
optional: true
|
||||||
|
|
||||||
/resolve-from/5.0.0:
|
/resolve-from/5.0.0:
|
||||||
resolution: {integrity: sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==}
|
resolution: {integrity: sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==}
|
||||||
|
@ -5278,11 +4845,6 @@ packages:
|
||||||
engines: {node: '>=0.12'}
|
engines: {node: '>=0.12'}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/reusify/1.0.4:
|
|
||||||
resolution: {integrity: sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==}
|
|
||||||
engines: {iojs: '>=1.0.0', node: '>=0.10.0'}
|
|
||||||
dev: true
|
|
||||||
|
|
||||||
/rfdc/1.3.0:
|
/rfdc/1.3.0:
|
||||||
resolution: {integrity: sha512-V2hovdzFbOi77/WajaSMXk2OLm+xNIeQdMMuB7icj7bk6zi2F8GGAxigcnDFpJHbNyNcgyJDiP+8nOrY5cZGrA==}
|
resolution: {integrity: sha512-V2hovdzFbOi77/WajaSMXk2OLm+xNIeQdMMuB7icj7bk6zi2F8GGAxigcnDFpJHbNyNcgyJDiP+8nOrY5cZGrA==}
|
||||||
dev: true
|
dev: true
|
||||||
|
@ -5337,12 +4899,6 @@ packages:
|
||||||
engines: {node: '>=0.12.0'}
|
engines: {node: '>=0.12.0'}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/run-parallel/1.2.0:
|
|
||||||
resolution: {integrity: sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==}
|
|
||||||
dependencies:
|
|
||||||
queue-microtask: 1.2.3
|
|
||||||
dev: true
|
|
||||||
|
|
||||||
/run-queue/1.0.3:
|
/run-queue/1.0.3:
|
||||||
resolution: {integrity: sha1-6Eg5bwV9Ij8kOGkkYY4laUFh7Ec=}
|
resolution: {integrity: sha1-6Eg5bwV9Ij8kOGkkYY4laUFh7Ec=}
|
||||||
dependencies:
|
dependencies:
|
||||||
|
@ -5857,11 +5413,6 @@ packages:
|
||||||
engines: {node: '>=8'}
|
engines: {node: '>=8'}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/strip-json-comments/3.1.1:
|
|
||||||
resolution: {integrity: sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==}
|
|
||||||
engines: {node: '>=8'}
|
|
||||||
dev: true
|
|
||||||
|
|
||||||
/supports-color/5.5.0:
|
/supports-color/5.5.0:
|
||||||
resolution: {integrity: sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==}
|
resolution: {integrity: sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==}
|
||||||
engines: {node: '>=4'}
|
engines: {node: '>=4'}
|
||||||
|
@ -5960,10 +5511,6 @@ packages:
|
||||||
engines: {node: '>=0.10'}
|
engines: {node: '>=0.10'}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/text-table/0.2.0:
|
|
||||||
resolution: {integrity: sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=}
|
|
||||||
dev: true
|
|
||||||
|
|
||||||
/through/2.3.8:
|
/through/2.3.8:
|
||||||
resolution: {integrity: sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=}
|
resolution: {integrity: sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=}
|
||||||
dev: true
|
dev: true
|
||||||
|
@ -6127,16 +5674,6 @@ packages:
|
||||||
resolution: {integrity: sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==}
|
resolution: {integrity: sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/tsutils/3.21.0_typescript@4.6.4:
|
|
||||||
resolution: {integrity: sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==}
|
|
||||||
engines: {node: '>= 6'}
|
|
||||||
peerDependencies:
|
|
||||||
typescript: '>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta'
|
|
||||||
dependencies:
|
|
||||||
tslib: 1.14.1
|
|
||||||
typescript: 4.6.4
|
|
||||||
dev: true
|
|
||||||
|
|
||||||
/tty-browserify/0.0.0:
|
/tty-browserify/0.0.0:
|
||||||
resolution: {integrity: sha1-oVe6QC2iTpv5V/mqadUk7tQpAaY=}
|
resolution: {integrity: sha1-oVe6QC2iTpv5V/mqadUk7tQpAaY=}
|
||||||
dev: true
|
dev: true
|
||||||
|
@ -6148,13 +5685,6 @@ packages:
|
||||||
prelude-ls: 1.1.2
|
prelude-ls: 1.1.2
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/type-check/0.4.0:
|
|
||||||
resolution: {integrity: sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==}
|
|
||||||
engines: {node: '>= 0.8.0'}
|
|
||||||
dependencies:
|
|
||||||
prelude-ls: 1.2.1
|
|
||||||
dev: true
|
|
||||||
|
|
||||||
/type-detect/4.0.8:
|
/type-detect/4.0.8:
|
||||||
resolution: {integrity: sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==}
|
resolution: {integrity: sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==}
|
||||||
engines: {node: '>=4'}
|
engines: {node: '>=4'}
|
||||||
|
@ -6165,11 +5695,6 @@ packages:
|
||||||
engines: {node: '>=10'}
|
engines: {node: '>=10'}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/type-fest/0.20.2:
|
|
||||||
resolution: {integrity: sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==}
|
|
||||||
engines: {node: '>=10'}
|
|
||||||
dev: true
|
|
||||||
|
|
||||||
/type-fest/0.21.3:
|
/type-fest/0.21.3:
|
||||||
resolution: {integrity: sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==}
|
resolution: {integrity: sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==}
|
||||||
engines: {node: '>=10'}
|
engines: {node: '>=10'}
|
||||||
|
@ -6330,10 +5855,6 @@ packages:
|
||||||
resolution: {integrity: sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==}
|
resolution: {integrity: sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/v8-compile-cache/2.3.0:
|
|
||||||
resolution: {integrity: sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA==}
|
|
||||||
dev: true
|
|
||||||
|
|
||||||
/validate-npm-package-license/3.0.4:
|
/validate-npm-package-license/3.0.4:
|
||||||
resolution: {integrity: sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==}
|
resolution: {integrity: sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==}
|
||||||
dependencies:
|
dependencies:
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
const range = 2
|
const range = 2
|
||||||
|
|
||||||
export function generateCodeFrame(
|
export function generateCodeFrame(
|
||||||
|
|
|
@ -36,7 +36,7 @@ const keyNames: { [key: string]: string | Array<string> } = {
|
||||||
// #4868: modifiers that prevent the execution of the listener
|
// #4868: modifiers that prevent the execution of the listener
|
||||||
// need to explicitly return null so that we can determine whether to remove
|
// need to explicitly return null so that we can determine whether to remove
|
||||||
// the listener for .once
|
// the listener for .once
|
||||||
const genGuard = (condition) => `if(${condition})return null;`
|
const genGuard = condition => `if(${condition})return null;`
|
||||||
|
|
||||||
const modifierCode: { [key: string]: string } = {
|
const modifierCode: { [key: string]: string } = {
|
||||||
stop: '$event.stopPropagation();',
|
stop: '$event.stopPropagation();',
|
||||||
|
@ -83,7 +83,7 @@ function genHandler(
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Array.isArray(handler)) {
|
if (Array.isArray(handler)) {
|
||||||
return `[${handler.map((handler) => genHandler(handler)).join(',')}]`
|
return `[${handler.map(handler => genHandler(handler)).join(',')}]`
|
||||||
}
|
}
|
||||||
|
|
||||||
const isMethodPath = simplePathRE.test(handler.value)
|
const isMethodPath = simplePathRE.test(handler.value)
|
||||||
|
@ -114,8 +114,8 @@ function genHandler(
|
||||||
const modifiers = handler.modifiers
|
const modifiers = handler.modifiers
|
||||||
genModifierCode += genGuard(
|
genModifierCode += genGuard(
|
||||||
['ctrl', 'shift', 'alt', 'meta']
|
['ctrl', 'shift', 'alt', 'meta']
|
||||||
.filter((keyModifier) => !modifiers[keyModifier])
|
.filter(keyModifier => !modifiers[keyModifier])
|
||||||
.map((keyModifier) => `$event.${keyModifier}Key`)
|
.map(keyModifier => `$event.${keyModifier}Key`)
|
||||||
.join('||')
|
.join('||')
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -359,7 +359,7 @@ function genInlineTemplate(
|
||||||
return `inlineTemplate:{render:function(){${
|
return `inlineTemplate:{render:function(){${
|
||||||
inlineRenderFns.render
|
inlineRenderFns.render
|
||||||
}},staticRenderFns:[${inlineRenderFns.staticRenderFns
|
}},staticRenderFns:[${inlineRenderFns.staticRenderFns
|
||||||
.map((code) => `function(){${code}}`)
|
.map(code => `function(){${code}}`)
|
||||||
.join(',')}]}`
|
.join(',')}]}`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -375,7 +375,7 @@ function genScopedSlots(
|
||||||
// for example if the slot contains dynamic names, has v-if or v-for on them...
|
// for example if the slot contains dynamic names, has v-if or v-for on them...
|
||||||
let needsForceUpdate =
|
let needsForceUpdate =
|
||||||
el.for ||
|
el.for ||
|
||||||
Object.keys(slots).some((key) => {
|
Object.keys(slots).some(key => {
|
||||||
const slot = slots[key]
|
const slot = slots[key]
|
||||||
return (
|
return (
|
||||||
slot.slotTargetDynamic || slot.if || slot.for || containsSlotChild(slot) // is passing down slot from parent which may be dynamic
|
slot.slotTargetDynamic || slot.if || slot.for || containsSlotChild(slot) // is passing down slot from parent which may be dynamic
|
||||||
|
@ -411,7 +411,7 @@ function genScopedSlots(
|
||||||
}
|
}
|
||||||
|
|
||||||
const generatedSlots = Object.keys(slots)
|
const generatedSlots = Object.keys(slots)
|
||||||
.map((key) => genScopedSlot(slots[key], state))
|
.map(key => genScopedSlot(slots[key], state))
|
||||||
.join(',')
|
.join(',')
|
||||||
|
|
||||||
return `scopedSlots:_u([${generatedSlots}]${
|
return `scopedSlots:_u([${generatedSlots}]${
|
||||||
|
@ -492,7 +492,7 @@ export function genChildren(
|
||||||
? getNormalizationType(children, state.maybeComponent)
|
? getNormalizationType(children, state.maybeComponent)
|
||||||
: 0
|
: 0
|
||||||
const gen = altGenNode || genNode
|
const gen = altGenNode || genNode
|
||||||
return `[${children.map((c) => gen(c, state)).join(',')}]${
|
return `[${children.map(c => gen(c, state)).join(',')}]${
|
||||||
normalizationType ? `,${normalizationType}` : ''
|
normalizationType ? `,${normalizationType}` : ''
|
||||||
}`
|
}`
|
||||||
}
|
}
|
||||||
|
@ -515,14 +515,14 @@ function getNormalizationType(
|
||||||
if (
|
if (
|
||||||
needsNormalization(el) ||
|
needsNormalization(el) ||
|
||||||
(el.ifConditions &&
|
(el.ifConditions &&
|
||||||
el.ifConditions.some((c) => needsNormalization(c.block)))
|
el.ifConditions.some(c => needsNormalization(c.block)))
|
||||||
) {
|
) {
|
||||||
res = 2
|
res = 2
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
maybeComponent(el) ||
|
maybeComponent(el) ||
|
||||||
(el.ifConditions && el.ifConditions.some((c) => maybeComponent(c.block)))
|
(el.ifConditions && el.ifConditions.some(c => maybeComponent(c.block)))
|
||||||
) {
|
) {
|
||||||
res = 1
|
res = 1
|
||||||
}
|
}
|
||||||
|
@ -563,7 +563,7 @@ function genSlot(el: ASTElement, state: CodegenState): string {
|
||||||
const attrs =
|
const attrs =
|
||||||
el.attrs || el.dynamicAttrs
|
el.attrs || el.dynamicAttrs
|
||||||
? genProps(
|
? genProps(
|
||||||
(el.attrs || []).concat(el.dynamicAttrs || []).map((attr) => ({
|
(el.attrs || []).concat(el.dynamicAttrs || []).map(attr => ({
|
||||||
// slot props are camelized
|
// slot props are camelized
|
||||||
name: camelize(attr.name),
|
name: camelize(attr.name),
|
||||||
value: attr.value,
|
value: attr.value,
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
import { extend } from 'shared/util'
|
import { extend } from 'shared/util'
|
||||||
import { detectErrors } from './error-detector'
|
import { detectErrors } from './error-detector'
|
||||||
import { createCompileToFunctionFn } from './to-function'
|
import { createCompileToFunctionFn } from './to-function'
|
||||||
|
@ -13,8 +12,12 @@ export function createCompilerCreator(baseCompile: Function): Function {
|
||||||
const errors: WarningMessage[] = []
|
const errors: WarningMessage[] = []
|
||||||
const tips: WarningMessage[] = []
|
const tips: WarningMessage[] = []
|
||||||
|
|
||||||
let warn = (msg: WarningMessage, range: { start: number, end: number }, tip: string) => {
|
let warn = (
|
||||||
(tip ? tips : errors).push(msg)
|
msg: WarningMessage,
|
||||||
|
range: { start: number; end: number },
|
||||||
|
tip: string
|
||||||
|
) => {
|
||||||
|
;(tip ? tips : errors).push(msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options) {
|
if (options) {
|
||||||
|
@ -25,8 +28,12 @@ export function createCompilerCreator(baseCompile: Function): Function {
|
||||||
// $flow-disable-line
|
// $flow-disable-line
|
||||||
const leadingSpaceLength = template.match(/^\s*/)![0].length
|
const leadingSpaceLength = template.match(/^\s*/)![0].length
|
||||||
|
|
||||||
warn = (msg: WarningMessage | string, range: { start: number, end: number }, tip: string) => {
|
warn = (
|
||||||
const data: WarningMessage = typeof(msg) === 'string' ? { msg } : msg
|
msg: WarningMessage | string,
|
||||||
|
range: { start: number; end: number },
|
||||||
|
tip: string
|
||||||
|
) => {
|
||||||
|
const data: WarningMessage = typeof msg === 'string' ? { msg } : msg
|
||||||
if (range) {
|
if (range) {
|
||||||
if (range.start != null) {
|
if (range.start != null) {
|
||||||
data.start = range.start + leadingSpaceLength
|
data.start = range.start + leadingSpaceLength
|
||||||
|
@ -35,7 +42,7 @@ export function createCompilerCreator(baseCompile: Function): Function {
|
||||||
data.end = range.end + leadingSpaceLength
|
data.end = range.end + leadingSpaceLength
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
(tip ? tips : errors).push(data)
|
;(tip ? tips : errors).push(data)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// merge custom modules
|
// merge custom modules
|
||||||
|
@ -72,7 +79,7 @@ export function createCompilerCreator(baseCompile: Function): Function {
|
||||||
|
|
||||||
return {
|
return {
|
||||||
compile,
|
compile,
|
||||||
compileToFunctions: createCompileToFunctionFn(compile),
|
compileToFunctions: createCompileToFunctionFn(compile)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
export default function bind(el: ASTElement, dir: ASTDirective) {
|
export default function bind(el: ASTElement, dir: ASTDirective) {
|
||||||
el.wrapData = (code: string) => {
|
el.wrapData = (code: string) => {
|
||||||
return `_b(${code},'${el.tag}',${dir.value},${
|
return `_b(${code},'${el.tag}',${dir.value},${
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
import on from './on'
|
import on from './on'
|
||||||
import bind from './bind'
|
import bind from './bind'
|
||||||
import { noop } from 'shared/util'
|
import { noop } from 'shared/util'
|
||||||
|
@ -6,5 +5,5 @@ import { noop } from 'shared/util'
|
||||||
export default {
|
export default {
|
||||||
on,
|
on,
|
||||||
bind,
|
bind,
|
||||||
cloak: noop,
|
cloak: noop
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cross-platform code generation for component v-model
|
* Cross-platform code generation for component v-model
|
||||||
*/
|
*/
|
||||||
|
@ -25,7 +24,7 @@ export function genComponentModel(
|
||||||
el.model = {
|
el.model = {
|
||||||
value: `(${value})`,
|
value: `(${value})`,
|
||||||
expression: JSON.stringify(value),
|
expression: JSON.stringify(value),
|
||||||
callback: `function (${baseValueExpression}) {${assignment}}`,
|
callback: `function (${baseValueExpression}) {${assignment}}`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,12 +73,12 @@ export function parseModel(val: string): ModelParseResult {
|
||||||
if (index > -1) {
|
if (index > -1) {
|
||||||
return {
|
return {
|
||||||
exp: val.slice(0, index),
|
exp: val.slice(0, index),
|
||||||
key: '"' + val.slice(index + 1) + '"',
|
key: '"' + val.slice(index + 1) + '"'
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
exp: val,
|
exp: val,
|
||||||
key: null,
|
key: null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -99,7 +98,7 @@ export function parseModel(val: string): ModelParseResult {
|
||||||
|
|
||||||
return {
|
return {
|
||||||
exp: val.slice(0, expressionPos),
|
exp: val.slice(0, expressionPos),
|
||||||
key: val.slice(expressionPos + 1, expressionEndPos),
|
key: val.slice(expressionPos + 1, expressionEndPos)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
import { warn } from 'core/util/index'
|
import { warn } from 'core/util/index'
|
||||||
|
|
||||||
export default function on(el: ASTElement, dir: ASTDirective) {
|
export default function on(el: ASTElement, dir: ASTDirective) {
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
import { dirRE, onRE } from './parser/index'
|
import { dirRE, onRE } from './parser/index'
|
||||||
|
|
||||||
type Range = { start?: number; end?: number }
|
type Range = { start?: number; end?: number }
|
||||||
|
@ -25,7 +24,8 @@ const unaryOperatorsRE = new RegExp(
|
||||||
)
|
)
|
||||||
|
|
||||||
// strip strings in expressions
|
// strip strings in expressions
|
||||||
const stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g
|
const stripStringRE =
|
||||||
|
/'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g
|
||||||
|
|
||||||
// detect problematic expressions in a template
|
// detect problematic expressions in a template
|
||||||
export function detectErrors(ast: ASTNode | undefined, warn: Function) {
|
export function detectErrors(ast: ASTNode | undefined, warn: Function) {
|
||||||
|
@ -117,7 +117,7 @@ function checkExpression(
|
||||||
) {
|
) {
|
||||||
try {
|
try {
|
||||||
new Function(`return ${exp}`)
|
new Function(`return ${exp}`)
|
||||||
} catch (e:any) {
|
} catch (e: any) {
|
||||||
const keywordMatch = exp
|
const keywordMatch = exp
|
||||||
.replace(stripStringRE, '')
|
.replace(stripStringRE, '')
|
||||||
.match(prohibitedKeywordRE)
|
.match(prohibitedKeywordRE)
|
||||||
|
@ -146,7 +146,7 @@ function checkFunctionParameterExpression(
|
||||||
) {
|
) {
|
||||||
try {
|
try {
|
||||||
new Function(exp, '')
|
new Function(exp, '')
|
||||||
} catch (e:any) {
|
} catch (e: any) {
|
||||||
warn(
|
warn(
|
||||||
`invalid function parameter expression: ${e.message} in\n\n` +
|
`invalid function parameter expression: ${e.message} in\n\n` +
|
||||||
` ${exp}\n\n` +
|
` ${exp}\n\n` +
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
import { emptyObject } from 'shared/util'
|
import { emptyObject } from 'shared/util'
|
||||||
import { parseFilters } from './parser/filter-parser'
|
import { parseFilters } from './parser/filter-parser'
|
||||||
|
|
||||||
|
@ -14,7 +13,7 @@ export function pluckModuleFunction<T, K extends keyof T>(
|
||||||
modules: Array<T> | undefined,
|
modules: Array<T> | undefined,
|
||||||
key: K
|
key: K
|
||||||
): Array<T[K]> {
|
): Array<T[K]> {
|
||||||
return modules ? modules.map((m) => m[key]).filter((_) => _) : []
|
return modules ? modules.map(m => m[key]).filter(_ => _) : []
|
||||||
}
|
}
|
||||||
|
|
||||||
export function addProp(
|
export function addProp(
|
||||||
|
@ -24,7 +23,7 @@ export function addProp(
|
||||||
range?: Range,
|
range?: Range,
|
||||||
dynamic?: boolean
|
dynamic?: boolean
|
||||||
) {
|
) {
|
||||||
(el.props || (el.props = [])).push(
|
;(el.props || (el.props = [])).push(
|
||||||
rangeSetItem({ name, value, dynamic }, range)
|
rangeSetItem({ name, value, dynamic }, range)
|
||||||
)
|
)
|
||||||
el.plain = false
|
el.plain = false
|
||||||
|
@ -65,7 +64,7 @@ export function addDirective(
|
||||||
modifiers?: ASTModifiers,
|
modifiers?: ASTModifiers,
|
||||||
range?: Range
|
range?: Range
|
||||||
) {
|
) {
|
||||||
(el.directives || (el.directives = [])).push(
|
;(el.directives || (el.directives = [])).push(
|
||||||
rangeSetItem(
|
rangeSetItem(
|
||||||
{
|
{
|
||||||
name,
|
name,
|
||||||
|
@ -73,7 +72,7 @@ export function addDirective(
|
||||||
value,
|
value,
|
||||||
arg,
|
arg,
|
||||||
isDynamicArg,
|
isDynamicArg,
|
||||||
modifiers,
|
modifiers
|
||||||
},
|
},
|
||||||
range
|
range
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
import { parse } from './parser/index'
|
import { parse } from './parser/index'
|
||||||
import { optimize } from './optimizer'
|
import { optimize } from './optimizer'
|
||||||
import { generate } from './codegen/index'
|
import { generate } from './codegen/index'
|
||||||
|
@ -19,6 +18,6 @@ export const createCompiler = createCompilerCreator(function baseCompile(
|
||||||
return {
|
return {
|
||||||
ast,
|
ast,
|
||||||
render: code.render,
|
render: code.render,
|
||||||
staticRenderFns: code.staticRenderFns,
|
staticRenderFns: code.staticRenderFns
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
import { makeMap, isBuiltInTag, cached, no } from 'shared/util'
|
import { makeMap, isBuiltInTag, cached, no } from 'shared/util'
|
||||||
|
|
||||||
let isStaticKey
|
let isStaticKey
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
let decoder
|
let decoder
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
@ -6,5 +5,5 @@ export default {
|
||||||
decoder = decoder || document.createElement('div')
|
decoder = decoder || document.createElement('div')
|
||||||
decoder.innerHTML = html
|
decoder.innerHTML = html
|
||||||
return decoder.textContent
|
return decoder.textContent
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
const validDivisionCharRE = /[\w).+\-_$\]]/
|
const validDivisionCharRE = /[\w).+\-_$\]]/
|
||||||
|
|
||||||
export function parseFilters(exp: string): string {
|
export function parseFilters(exp: string): string {
|
||||||
|
@ -91,7 +90,7 @@ export function parseFilters(exp: string): string {
|
||||||
}
|
}
|
||||||
|
|
||||||
function pushFilter() {
|
function pushFilter() {
|
||||||
(filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim())
|
;(filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim())
|
||||||
lastFilterIndex = i + 1
|
lastFilterIndex = i + 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,8 +14,10 @@ import { isNonPhrasingTag } from 'web/compiler/util'
|
||||||
import { unicodeRegExp } from 'core/util/lang'
|
import { unicodeRegExp } from 'core/util/lang'
|
||||||
|
|
||||||
// Regular Expressions for parsing tags and attributes
|
// Regular Expressions for parsing tags and attributes
|
||||||
const attribute = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/
|
const attribute =
|
||||||
const dynamicArgAttribute = /^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+?\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/
|
/^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/
|
||||||
|
const dynamicArgAttribute =
|
||||||
|
/^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+?\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/
|
||||||
const ncname = `[a-zA-Z_][\\-\\.0-9_a-zA-Z${unicodeRegExp.source}]*`
|
const ncname = `[a-zA-Z_][\\-\\.0-9_a-zA-Z${unicodeRegExp.source}]*`
|
||||||
const qnameCapture = `((?:${ncname}\\:)?${ncname})`
|
const qnameCapture = `((?:${ncname}\\:)?${ncname})`
|
||||||
const startTagOpen = new RegExp(`^<${qnameCapture}`)
|
const startTagOpen = new RegExp(`^<${qnameCapture}`)
|
||||||
|
@ -37,7 +39,7 @@ const decodingMap = {
|
||||||
'&': '&',
|
'&': '&',
|
||||||
' ': '\n',
|
' ': '\n',
|
||||||
'	': '\t',
|
'	': '\t',
|
||||||
''': "'",
|
''': "'"
|
||||||
}
|
}
|
||||||
const encodedAttr = /&(?:lt|gt|quot|amp|#39);/g
|
const encodedAttr = /&(?:lt|gt|quot|amp|#39);/g
|
||||||
const encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#39|#10|#9);/g
|
const encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#39|#10|#9);/g
|
||||||
|
@ -49,7 +51,7 @@ const shouldIgnoreFirstNewline = (tag, html) =>
|
||||||
|
|
||||||
function decodeAttr(value, shouldDecodeNewlines) {
|
function decodeAttr(value, shouldDecodeNewlines) {
|
||||||
const re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr
|
const re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr
|
||||||
return value.replace(re, (match) => decodingMap[match])
|
return value.replace(re, match => decodingMap[match])
|
||||||
}
|
}
|
||||||
|
|
||||||
export function parseHTML(html, options) {
|
export function parseHTML(html, options) {
|
||||||
|
@ -185,7 +187,7 @@ export function parseHTML(html, options) {
|
||||||
options.warn
|
options.warn
|
||||||
) {
|
) {
|
||||||
options.warn(`Mal-formatted tag at end of template: "${html}"`, {
|
options.warn(`Mal-formatted tag at end of template: "${html}"`, {
|
||||||
start: index + html.length,
|
start: index + html.length
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
|
@ -206,7 +208,7 @@ export function parseHTML(html, options) {
|
||||||
const match: any = {
|
const match: any = {
|
||||||
tagName: start[1],
|
tagName: start[1],
|
||||||
attrs: [],
|
attrs: [],
|
||||||
start: index,
|
start: index
|
||||||
}
|
}
|
||||||
advance(start[0].length)
|
advance(start[0].length)
|
||||||
let end, attr
|
let end, attr
|
||||||
|
@ -254,7 +256,7 @@ export function parseHTML(html, options) {
|
||||||
: options.shouldDecodeNewlines
|
: options.shouldDecodeNewlines
|
||||||
attrs[i] = {
|
attrs[i] = {
|
||||||
name: args[1],
|
name: args[1],
|
||||||
value: decodeAttr(value, shouldDecodeNewlines),
|
value: decodeAttr(value, shouldDecodeNewlines)
|
||||||
}
|
}
|
||||||
if (process.env.NODE_ENV !== 'production' && options.outputSourceRange) {
|
if (process.env.NODE_ENV !== 'production' && options.outputSourceRange) {
|
||||||
attrs[i].start = args.start + args[0].match(/^\s*/).length
|
attrs[i].start = args.start + args[0].match(/^\s*/).length
|
||||||
|
@ -268,7 +270,7 @@ export function parseHTML(html, options) {
|
||||||
lowerCasedTag: tagName.toLowerCase(),
|
lowerCasedTag: tagName.toLowerCase(),
|
||||||
attrs: attrs,
|
attrs: attrs,
|
||||||
start: match.start,
|
start: match.start,
|
||||||
end: match.end,
|
end: match.end
|
||||||
})
|
})
|
||||||
lastTag = tagName
|
lastTag = tagName
|
||||||
}
|
}
|
||||||
|
@ -306,7 +308,7 @@ export function parseHTML(html, options) {
|
||||||
) {
|
) {
|
||||||
options.warn(`tag <${stack[i].tag}> has no matching end tag.`, {
|
options.warn(`tag <${stack[i].tag}> has no matching end tag.`, {
|
||||||
start: stack[i].start,
|
start: stack[i].start,
|
||||||
end: stack[i].end,
|
end: stack[i].end
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
if (options.end) {
|
if (options.end) {
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
import he from 'he'
|
import he from 'he'
|
||||||
import { parseHTML } from './html-parser'
|
import { parseHTML } from './html-parser'
|
||||||
import { parseText } from './text-parser'
|
import { parseText } from './text-parser'
|
||||||
|
@ -17,7 +16,7 @@ import {
|
||||||
getAndRemoveAttr,
|
getAndRemoveAttr,
|
||||||
getRawBindingAttr,
|
getRawBindingAttr,
|
||||||
pluckModuleFunction,
|
pluckModuleFunction,
|
||||||
getAndRemoveAttrByRegex,
|
getAndRemoveAttrByRegex
|
||||||
} from '../helpers'
|
} from '../helpers'
|
||||||
|
|
||||||
export const onRE = /^@|^v-on:/
|
export const onRE = /^@|^v-on:/
|
||||||
|
@ -68,7 +67,7 @@ export function createASTElement(
|
||||||
attrsMap: makeAttrsMap(attrs),
|
attrsMap: makeAttrsMap(attrs),
|
||||||
rawAttrsMap: {},
|
rawAttrsMap: {},
|
||||||
parent,
|
parent,
|
||||||
children: [],
|
children: []
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,7 +81,8 @@ export function parse(template: string, options: CompilerOptions): ASTElement {
|
||||||
platformMustUseProp = options.mustUseProp || no
|
platformMustUseProp = options.mustUseProp || no
|
||||||
platformGetTagNamespace = options.getTagNamespace || no
|
platformGetTagNamespace = options.getTagNamespace || no
|
||||||
const isReservedTag = options.isReservedTag || no
|
const isReservedTag = options.isReservedTag || no
|
||||||
maybeComponent = (el: ASTElement) => !!(
|
maybeComponent = (el: ASTElement) =>
|
||||||
|
!!(
|
||||||
el.component ||
|
el.component ||
|
||||||
el.attrsMap[':is'] ||
|
el.attrsMap[':is'] ||
|
||||||
el.attrsMap['v-bind:is'] ||
|
el.attrsMap['v-bind:is'] ||
|
||||||
|
@ -124,7 +124,7 @@ export function parse(template: string, options: CompilerOptions): ASTElement {
|
||||||
}
|
}
|
||||||
addIfCondition(root, {
|
addIfCondition(root, {
|
||||||
exp: element.elseif,
|
exp: element.elseif,
|
||||||
block: element,
|
block: element
|
||||||
})
|
})
|
||||||
} else if (process.env.NODE_ENV !== 'production') {
|
} else if (process.env.NODE_ENV !== 'production') {
|
||||||
warnOnce(
|
warnOnce(
|
||||||
|
@ -155,7 +155,7 @@ export function parse(template: string, options: CompilerOptions): ASTElement {
|
||||||
|
|
||||||
// final children cleanup
|
// final children cleanup
|
||||||
// filter out scoped slots
|
// filter out scoped slots
|
||||||
element.children = element.children.filter((c) => !c.slotScope)
|
element.children = element.children.filter(c => !c.slotScope)
|
||||||
// remove trailing whitespace node again
|
// remove trailing whitespace node again
|
||||||
trimEndingWhitespace(element)
|
trimEndingWhitespace(element)
|
||||||
|
|
||||||
|
@ -238,14 +238,14 @@ export function parse(template: string, options: CompilerOptions): ASTElement {
|
||||||
return cumulated
|
return cumulated
|
||||||
}, {})
|
}, {})
|
||||||
}
|
}
|
||||||
attrs.forEach((attr) => {
|
attrs.forEach(attr => {
|
||||||
if (invalidAttributeRE.test(attr.name)) {
|
if (invalidAttributeRE.test(attr.name)) {
|
||||||
warn(
|
warn(
|
||||||
`Invalid dynamic argument expression: attribute names cannot contain ` +
|
`Invalid dynamic argument expression: attribute names cannot contain ` +
|
||||||
`spaces, quotes, <, >, / or =.`,
|
`spaces, quotes, <, >, / or =.`,
|
||||||
{
|
{
|
||||||
start: attr.start + attr.name.indexOf(`[`),
|
start: attr.start + attr.name.indexOf(`[`),
|
||||||
end: attr.start + attr.name.length,
|
end: attr.start + attr.name.length
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -323,7 +323,7 @@ export function parse(template: string, options: CompilerOptions): ASTElement {
|
||||||
)
|
)
|
||||||
} else if ((text = text.trim())) {
|
} else if ((text = text.trim())) {
|
||||||
warnOnce(`text "${text}" outside root element will be ignored.`, {
|
warnOnce(`text "${text}" outside root element will be ignored.`, {
|
||||||
start,
|
start
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -340,7 +340,9 @@ export function parse(template: string, options: CompilerOptions): ASTElement {
|
||||||
}
|
}
|
||||||
const children = currentParent.children
|
const children = currentParent.children
|
||||||
if (inPre || text.trim()) {
|
if (inPre || text.trim()) {
|
||||||
text = isTextTag(currentParent) ? text : decodeHTMLCached(text) as string
|
text = isTextTag(currentParent)
|
||||||
|
? text
|
||||||
|
: (decodeHTMLCached(text) as string)
|
||||||
} else if (!children.length) {
|
} else if (!children.length) {
|
||||||
// remove the whitespace-only node right after an opening tag
|
// remove the whitespace-only node right after an opening tag
|
||||||
text = ''
|
text = ''
|
||||||
|
@ -367,7 +369,7 @@ export function parse(template: string, options: CompilerOptions): ASTElement {
|
||||||
type: 2,
|
type: 2,
|
||||||
expression: res.expression,
|
expression: res.expression,
|
||||||
tokens: res.tokens,
|
tokens: res.tokens,
|
||||||
text,
|
text
|
||||||
}
|
}
|
||||||
} else if (
|
} else if (
|
||||||
text !== ' ' ||
|
text !== ' ' ||
|
||||||
|
@ -376,7 +378,7 @@ export function parse(template: string, options: CompilerOptions): ASTElement {
|
||||||
) {
|
) {
|
||||||
child = {
|
child = {
|
||||||
type: 3,
|
type: 3,
|
||||||
text,
|
text
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (child) {
|
if (child) {
|
||||||
|
@ -398,7 +400,7 @@ export function parse(template: string, options: CompilerOptions): ASTElement {
|
||||||
const child: ASTText = {
|
const child: ASTText = {
|
||||||
type: 3,
|
type: 3,
|
||||||
text,
|
text,
|
||||||
isComment: true,
|
isComment: true
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
process.env.NODE_ENV !== 'production' &&
|
process.env.NODE_ENV !== 'production' &&
|
||||||
|
@ -409,7 +411,7 @@ export function parse(template: string, options: CompilerOptions): ASTElement {
|
||||||
}
|
}
|
||||||
currentParent.children.push(child)
|
currentParent.children.push(child)
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
})
|
})
|
||||||
return root
|
return root
|
||||||
}
|
}
|
||||||
|
@ -428,7 +430,7 @@ function processRawAttrs(el) {
|
||||||
for (let i = 0; i < len; i++) {
|
for (let i = 0; i < len; i++) {
|
||||||
attrs[i] = {
|
attrs[i] = {
|
||||||
name: list[i].name,
|
name: list[i].name,
|
||||||
value: JSON.stringify(list[i].value),
|
value: JSON.stringify(list[i].value)
|
||||||
}
|
}
|
||||||
if (list[i].start != null) {
|
if (list[i].start != null) {
|
||||||
attrs[i].start = list[i].start
|
attrs[i].start = list[i].start
|
||||||
|
@ -544,7 +546,7 @@ function processIf(el) {
|
||||||
el.if = exp
|
el.if = exp
|
||||||
addIfCondition(el, {
|
addIfCondition(el, {
|
||||||
exp: exp,
|
exp: exp,
|
||||||
block: el,
|
block: el
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
if (getAndRemoveAttr(el, 'v-else') != null) {
|
if (getAndRemoveAttr(el, 'v-else') != null) {
|
||||||
|
@ -562,7 +564,7 @@ function processIfConditions(el, parent) {
|
||||||
if (prev && prev.if) {
|
if (prev && prev.if) {
|
||||||
addIfCondition(prev, {
|
addIfCondition(prev, {
|
||||||
exp: el.elseif,
|
exp: el.elseif,
|
||||||
block: el,
|
block: el
|
||||||
})
|
})
|
||||||
} else if (process.env.NODE_ENV !== 'production') {
|
} else if (process.env.NODE_ENV !== 'production') {
|
||||||
warn(
|
warn(
|
||||||
|
@ -776,7 +778,7 @@ function processAttrs(el) {
|
||||||
modifiers = parseModifiers(name.replace(dirRE, ''))
|
modifiers = parseModifiers(name.replace(dirRE, ''))
|
||||||
// support .foo shorthand syntax for the .prop modifier
|
// support .foo shorthand syntax for the .prop modifier
|
||||||
if (process.env.VBIND_PROP_SHORTHAND && propBindRE.test(name)) {
|
if (process.env.VBIND_PROP_SHORTHAND && propBindRE.test(name)) {
|
||||||
(modifiers || (modifiers = {})).prop = true
|
;(modifiers || (modifiers = {})).prop = true
|
||||||
name = `.` + name.slice(1).replace(modifierRE, '')
|
name = `.` + name.slice(1).replace(modifierRE, '')
|
||||||
} else if (modifiers) {
|
} else if (modifiers) {
|
||||||
name = name.replace(modifierRE, '')
|
name = name.replace(modifierRE, '')
|
||||||
|
@ -930,7 +932,7 @@ function parseModifiers(name: string): Object | void {
|
||||||
const match = name.match(modifierRE)
|
const match = name.match(modifierRE)
|
||||||
if (match) {
|
if (match) {
|
||||||
const ret = {}
|
const ret = {}
|
||||||
match.forEach((m) => {
|
match.forEach(m => {
|
||||||
ret[m.slice(1)] = true
|
ret[m.slice(1)] = true
|
||||||
})
|
})
|
||||||
return ret
|
return ret
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
|
|
||||||
import { cached } from 'shared/util'
|
import { cached } from 'shared/util'
|
||||||
import { parseFilters } from './filter-parser'
|
import { parseFilters } from './filter-parser'
|
||||||
|
|
||||||
const defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g
|
const defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g
|
||||||
const regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g
|
const regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g
|
||||||
|
|
||||||
const buildRegex = cached((delimiters) => {
|
const buildRegex = cached(delimiters => {
|
||||||
const open = delimiters[0].replace(regexEscapeRE, '\\$&')
|
const open = delimiters[0].replace(regexEscapeRE, '\\$&')
|
||||||
const close = delimiters[1].replace(regexEscapeRE, '\\$&')
|
const close = delimiters[1].replace(regexEscapeRE, '\\$&')
|
||||||
return new RegExp(open + '((?:.|\\n)+?)' + close, 'g')
|
return new RegExp(open + '((?:.|\\n)+?)' + close, 'g')
|
||||||
|
@ -48,6 +47,6 @@ export function parseText(
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
expression: tokens.join('+'),
|
expression: tokens.join('+'),
|
||||||
tokens: rawTokens,
|
tokens: rawTokens
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
import { noop, extend } from 'shared/util'
|
import { noop, extend } from 'shared/util'
|
||||||
import { warn as baseWarn, tip } from 'core/util/debug'
|
import { warn as baseWarn, tip } from 'core/util/debug'
|
||||||
import { generateCodeFrame } from './codeframe'
|
import { generateCodeFrame } from './codeframe'
|
||||||
|
@ -35,7 +34,7 @@ export function createCompileToFunctionFn(compile: Function): Function {
|
||||||
// detect possible CSP restriction
|
// detect possible CSP restriction
|
||||||
try {
|
try {
|
||||||
new Function('return 1')
|
new Function('return 1')
|
||||||
} catch (e:any) {
|
} catch (e: any) {
|
||||||
if (e.toString().match(/unsafe-eval|CSP/)) {
|
if (e.toString().match(/unsafe-eval|CSP/)) {
|
||||||
warn(
|
warn(
|
||||||
'It seems you are using the standalone build of Vue.js in an ' +
|
'It seems you are using the standalone build of Vue.js in an ' +
|
||||||
|
@ -63,7 +62,7 @@ export function createCompileToFunctionFn(compile: Function): Function {
|
||||||
if (process.env.NODE_ENV !== 'production') {
|
if (process.env.NODE_ENV !== 'production') {
|
||||||
if (compiled.errors && compiled.errors.length) {
|
if (compiled.errors && compiled.errors.length) {
|
||||||
if (options.outputSourceRange) {
|
if (options.outputSourceRange) {
|
||||||
compiled.errors.forEach((e) => {
|
compiled.errors.forEach(e => {
|
||||||
warn(
|
warn(
|
||||||
`Error compiling template:\n\n${e.msg}\n\n` +
|
`Error compiling template:\n\n${e.msg}\n\n` +
|
||||||
generateCodeFrame(template, e.start, e.end),
|
generateCodeFrame(template, e.start, e.end),
|
||||||
|
@ -73,7 +72,7 @@ export function createCompileToFunctionFn(compile: Function): Function {
|
||||||
} else {
|
} else {
|
||||||
warn(
|
warn(
|
||||||
`Error compiling template:\n\n${template}\n\n` +
|
`Error compiling template:\n\n${template}\n\n` +
|
||||||
compiled.errors.map((e) => `- ${e}`).join('\n') +
|
compiled.errors.map(e => `- ${e}`).join('\n') +
|
||||||
'\n',
|
'\n',
|
||||||
vm
|
vm
|
||||||
)
|
)
|
||||||
|
@ -81,9 +80,9 @@ export function createCompileToFunctionFn(compile: Function): Function {
|
||||||
}
|
}
|
||||||
if (compiled.tips && compiled.tips.length) {
|
if (compiled.tips && compiled.tips.length) {
|
||||||
if (options.outputSourceRange) {
|
if (options.outputSourceRange) {
|
||||||
compiled.tips.forEach((e) => tip(e.msg, vm))
|
compiled.tips.forEach(e => tip(e.msg, vm))
|
||||||
} else {
|
} else {
|
||||||
compiled.tips.forEach((msg) => tip(msg, vm))
|
compiled.tips.forEach(msg => tip(msg, vm))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -92,7 +91,7 @@ export function createCompileToFunctionFn(compile: Function): Function {
|
||||||
const res: any = {}
|
const res: any = {}
|
||||||
const fnGenErrors: any[] = []
|
const fnGenErrors: any[] = []
|
||||||
res.render = createFunction(compiled.render, fnGenErrors)
|
res.render = createFunction(compiled.render, fnGenErrors)
|
||||||
res.staticRenderFns = compiled.staticRenderFns.map((code) => {
|
res.staticRenderFns = compiled.staticRenderFns.map(code => {
|
||||||
return createFunction(code, fnGenErrors)
|
return createFunction(code, fnGenErrors)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import KeepAlive from './keep-alive'
|
import KeepAlive from './keep-alive'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
KeepAlive,
|
KeepAlive
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,19 +1,19 @@
|
||||||
import { isRegExp, remove } from "shared/util";
|
import { isRegExp, remove } from 'shared/util'
|
||||||
import { getFirstComponentChild } from "core/vdom/helpers/index";
|
import { getFirstComponentChild } from 'core/vdom/helpers/index'
|
||||||
import type VNode from "core/vdom/vnode";
|
import type VNode from 'core/vdom/vnode'
|
||||||
import type { VNodeComponentOptions } from "typescript/vnode";
|
import type { VNodeComponentOptions } from 'typescript/vnode'
|
||||||
import type { Component } from "typescript/component";
|
import type { Component } from 'typescript/component'
|
||||||
|
|
||||||
type CacheEntry = {
|
type CacheEntry = {
|
||||||
name?: string;
|
name?: string
|
||||||
tag?: string;
|
tag?: string
|
||||||
componentInstance?: Component;
|
componentInstance?: Component
|
||||||
};
|
}
|
||||||
|
|
||||||
type CacheEntryMap = Record<string, CacheEntry | null>;
|
type CacheEntryMap = Record<string, CacheEntry | null>
|
||||||
|
|
||||||
function getComponentName(opts?: VNodeComponentOptions): string | null {
|
function getComponentName(opts?: VNodeComponentOptions): string | null {
|
||||||
return opts && (opts.Ctor.options.name || opts.tag);
|
return opts && (opts.Ctor.options.name || opts.tag)
|
||||||
}
|
}
|
||||||
|
|
||||||
function matches(
|
function matches(
|
||||||
|
@ -21,27 +21,27 @@ function matches(
|
||||||
name: string
|
name: string
|
||||||
): boolean {
|
): boolean {
|
||||||
if (Array.isArray(pattern)) {
|
if (Array.isArray(pattern)) {
|
||||||
return pattern.indexOf(name) > -1;
|
return pattern.indexOf(name) > -1
|
||||||
} else if (typeof pattern === "string") {
|
} else if (typeof pattern === 'string') {
|
||||||
return pattern.split(",").indexOf(name) > -1;
|
return pattern.split(',').indexOf(name) > -1
|
||||||
} else if (isRegExp(pattern)) {
|
} else if (isRegExp(pattern)) {
|
||||||
return pattern.test(name);
|
return pattern.test(name)
|
||||||
}
|
}
|
||||||
/* istanbul ignore next */
|
/* istanbul ignore next */
|
||||||
return false;
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
function pruneCache(
|
function pruneCache(
|
||||||
keepAliveInstance: { cache: CacheEntryMap; keys: string[]; _vnode: VNode },
|
keepAliveInstance: { cache: CacheEntryMap; keys: string[]; _vnode: VNode },
|
||||||
filter: Function
|
filter: Function
|
||||||
) {
|
) {
|
||||||
const { cache, keys, _vnode } = keepAliveInstance;
|
const { cache, keys, _vnode } = keepAliveInstance
|
||||||
for (const key in cache) {
|
for (const key in cache) {
|
||||||
const entry = cache[key];
|
const entry = cache[key]
|
||||||
if (entry) {
|
if (entry) {
|
||||||
const name = entry.name;
|
const name = entry.name
|
||||||
if (name && !filter(name)) {
|
if (name && !filter(name)) {
|
||||||
pruneCacheEntry(cache, key, keys, _vnode);
|
pruneCacheEntry(cache, key, keys, _vnode)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -53,112 +53,112 @@ function pruneCacheEntry(
|
||||||
keys: Array<string>,
|
keys: Array<string>,
|
||||||
current?: VNode
|
current?: VNode
|
||||||
) {
|
) {
|
||||||
const entry = cache[key];
|
const entry = cache[key]
|
||||||
if (entry && (!current || entry.tag !== current.tag)) {
|
if (entry && (!current || entry.tag !== current.tag)) {
|
||||||
// @ts-expect-error can be undefined
|
// @ts-expect-error can be undefined
|
||||||
entry.componentInstance.$destroy();
|
entry.componentInstance.$destroy()
|
||||||
}
|
}
|
||||||
cache[key] = null;
|
cache[key] = null
|
||||||
remove(keys, key);
|
remove(keys, key)
|
||||||
}
|
}
|
||||||
|
|
||||||
const patternTypes: Array<Function> = [String, RegExp, Array];
|
const patternTypes: Array<Function> = [String, RegExp, Array]
|
||||||
|
|
||||||
// TODO defineComponent
|
// TODO defineComponent
|
||||||
export default {
|
export default {
|
||||||
name: "keep-alive",
|
name: 'keep-alive',
|
||||||
abstract: true,
|
abstract: true,
|
||||||
|
|
||||||
props: {
|
props: {
|
||||||
include: patternTypes,
|
include: patternTypes,
|
||||||
exclude: patternTypes,
|
exclude: patternTypes,
|
||||||
max: [String, Number],
|
max: [String, Number]
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
cacheVNode() {
|
cacheVNode() {
|
||||||
const { cache, keys, vnodeToCache, keyToCache } = this;
|
const { cache, keys, vnodeToCache, keyToCache } = this
|
||||||
if (vnodeToCache) {
|
if (vnodeToCache) {
|
||||||
const { tag, componentInstance, componentOptions } = vnodeToCache;
|
const { tag, componentInstance, componentOptions } = vnodeToCache
|
||||||
cache[keyToCache] = {
|
cache[keyToCache] = {
|
||||||
name: getComponentName(componentOptions),
|
name: getComponentName(componentOptions),
|
||||||
tag,
|
tag,
|
||||||
componentInstance,
|
componentInstance
|
||||||
};
|
}
|
||||||
keys.push(keyToCache);
|
keys.push(keyToCache)
|
||||||
// prune oldest entry
|
// prune oldest entry
|
||||||
if (this.max && keys.length > parseInt(this.max)) {
|
if (this.max && keys.length > parseInt(this.max)) {
|
||||||
pruneCacheEntry(cache, keys[0], keys, this._vnode);
|
pruneCacheEntry(cache, keys[0], keys, this._vnode)
|
||||||
|
}
|
||||||
|
this.vnodeToCache = null
|
||||||
}
|
}
|
||||||
this.vnodeToCache = null;
|
|
||||||
}
|
}
|
||||||
},
|
|
||||||
},
|
},
|
||||||
|
|
||||||
created() {
|
created() {
|
||||||
this.cache = Object.create(null);
|
this.cache = Object.create(null)
|
||||||
this.keys = [];
|
this.keys = []
|
||||||
},
|
},
|
||||||
|
|
||||||
destroyed() {
|
destroyed() {
|
||||||
for (const key in this.cache) {
|
for (const key in this.cache) {
|
||||||
pruneCacheEntry(this.cache, key, this.keys);
|
pruneCacheEntry(this.cache, key, this.keys)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
this.cacheVNode();
|
this.cacheVNode()
|
||||||
this.$watch("include", (val) => {
|
this.$watch('include', val => {
|
||||||
pruneCache(this, (name) => matches(val, name));
|
pruneCache(this, name => matches(val, name))
|
||||||
});
|
})
|
||||||
this.$watch("exclude", (val) => {
|
this.$watch('exclude', val => {
|
||||||
pruneCache(this, (name) => !matches(val, name));
|
pruneCache(this, name => !matches(val, name))
|
||||||
});
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
updated() {
|
updated() {
|
||||||
this.cacheVNode();
|
this.cacheVNode()
|
||||||
},
|
},
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const slot = this.$slots.default;
|
const slot = this.$slots.default
|
||||||
const vnode = getFirstComponentChild(slot);
|
const vnode = getFirstComponentChild(slot)
|
||||||
const componentOptions = vnode && vnode.componentOptions;
|
const componentOptions = vnode && vnode.componentOptions
|
||||||
if (componentOptions) {
|
if (componentOptions) {
|
||||||
// check pattern
|
// check pattern
|
||||||
const name = getComponentName(componentOptions);
|
const name = getComponentName(componentOptions)
|
||||||
const { include, exclude } = this;
|
const { include, exclude } = this
|
||||||
if (
|
if (
|
||||||
// not included
|
// not included
|
||||||
(include && (!name || !matches(include, name))) ||
|
(include && (!name || !matches(include, name))) ||
|
||||||
// excluded
|
// excluded
|
||||||
(exclude && name && matches(exclude, name))
|
(exclude && name && matches(exclude, name))
|
||||||
) {
|
) {
|
||||||
return vnode;
|
return vnode
|
||||||
}
|
}
|
||||||
|
|
||||||
const { cache, keys } = this;
|
const { cache, keys } = this
|
||||||
const key =
|
const key =
|
||||||
vnode.key == null
|
vnode.key == null
|
||||||
? // same constructor may get registered as different local components
|
? // same constructor may get registered as different local components
|
||||||
// so cid alone is not enough (#3269)
|
// so cid alone is not enough (#3269)
|
||||||
componentOptions.Ctor.cid +
|
componentOptions.Ctor.cid +
|
||||||
(componentOptions.tag ? `::${componentOptions.tag}` : "")
|
(componentOptions.tag ? `::${componentOptions.tag}` : '')
|
||||||
: vnode.key;
|
: vnode.key
|
||||||
if (cache[key]) {
|
if (cache[key]) {
|
||||||
vnode.componentInstance = cache[key].componentInstance;
|
vnode.componentInstance = cache[key].componentInstance
|
||||||
// make current key freshest
|
// make current key freshest
|
||||||
remove(keys, key);
|
remove(keys, key)
|
||||||
keys.push(key);
|
keys.push(key)
|
||||||
} else {
|
} else {
|
||||||
// delay setting the cache until update
|
// delay setting the cache until update
|
||||||
this.vnodeToCache = vnode;
|
this.vnodeToCache = vnode
|
||||||
this.keyToCache = key;
|
this.keyToCache = key
|
||||||
}
|
}
|
||||||
|
|
||||||
// @ts-expect-error can vnode.data can be undefined
|
// @ts-expect-error can vnode.data can be undefined
|
||||||
vnode.data.keepAlive = true;
|
vnode.data.keepAlive = true
|
||||||
}
|
}
|
||||||
return vnode || (slot && slot[0]);
|
return vnode || (slot && slot[0])
|
||||||
},
|
}
|
||||||
};
|
}
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
import { no, noop, identity } from 'shared/util'
|
import { no, noop, identity } from 'shared/util'
|
||||||
|
|
||||||
import { LIFECYCLE_HOOKS } from 'shared/constants'
|
import { LIFECYCLE_HOOKS } from 'shared/constants'
|
||||||
|
@ -31,7 +30,7 @@ export interface Config {
|
||||||
_lifecycleHooks: Array<string>
|
_lifecycleHooks: Array<string>
|
||||||
}
|
}
|
||||||
|
|
||||||
export default ({
|
export default {
|
||||||
/**
|
/**
|
||||||
* Option merge strategies (used in core/util/options)
|
* Option merge strategies (used in core/util/options)
|
||||||
*/
|
*/
|
||||||
|
@ -122,5 +121,5 @@ export default ({
|
||||||
/**
|
/**
|
||||||
* Exposed for legacy reasons
|
* Exposed for legacy reasons
|
||||||
*/
|
*/
|
||||||
_lifecycleHooks: LIFECYCLE_HOOKS,
|
_lifecycleHooks: LIFECYCLE_HOOKS
|
||||||
} as unknown) as Config
|
} as unknown as Config
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
import { ASSET_TYPES } from 'shared/constants'
|
import { ASSET_TYPES } from 'shared/constants'
|
||||||
import type { GlobalAPI } from 'typescript/global-api'
|
import type { GlobalAPI } from 'typescript/global-api'
|
||||||
import { isPlainObject, validateComponentName } from '../util/index'
|
import { isPlainObject, validateComponentName } from '../util/index'
|
||||||
|
@ -7,7 +6,7 @@ export function initAssetRegisters(Vue: GlobalAPI) {
|
||||||
/**
|
/**
|
||||||
* Create asset registration methods.
|
* Create asset registration methods.
|
||||||
*/
|
*/
|
||||||
ASSET_TYPES.forEach((type) => {
|
ASSET_TYPES.forEach(type => {
|
||||||
// @ts-expect-error function is not exact same type
|
// @ts-expect-error function is not exact same type
|
||||||
Vue[type] = function (
|
Vue[type] = function (
|
||||||
id: string,
|
id: string,
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
import { ASSET_TYPES } from 'shared/constants'
|
import { ASSET_TYPES } from 'shared/constants'
|
||||||
import type { Component } from 'typescript/component'
|
import type { Component } from 'typescript/component'
|
||||||
import type { GlobalAPI } from 'typescript/global-api'
|
import type { GlobalAPI } from 'typescript/global-api'
|
||||||
|
@ -31,9 +30,9 @@ export function initExtend(Vue: GlobalAPI) {
|
||||||
validateComponentName(name)
|
validateComponentName(name)
|
||||||
}
|
}
|
||||||
|
|
||||||
const Sub = (function VueComponent(this: any, options: any) {
|
const Sub = function VueComponent(this: any, options: any) {
|
||||||
this._init(options)
|
this._init(options)
|
||||||
} as unknown) as typeof Component
|
} as unknown as typeof Component
|
||||||
Sub.prototype = Object.create(Super.prototype)
|
Sub.prototype = Object.create(Super.prototype)
|
||||||
Sub.prototype.constructor = Sub
|
Sub.prototype.constructor = Sub
|
||||||
Sub.cid = cid++
|
Sub.cid = cid++
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
import config from '../config'
|
import config from '../config'
|
||||||
import { initUse } from './use'
|
import { initUse } from './use'
|
||||||
import { initMixin } from './mixin'
|
import { initMixin } from './mixin'
|
||||||
|
@ -14,7 +13,7 @@ import {
|
||||||
extend,
|
extend,
|
||||||
nextTick,
|
nextTick,
|
||||||
mergeOptions,
|
mergeOptions,
|
||||||
defineReactive,
|
defineReactive
|
||||||
} from '../util/index'
|
} from '../util/index'
|
||||||
import type { GlobalAPI } from 'typescript/global-api'
|
import type { GlobalAPI } from 'typescript/global-api'
|
||||||
|
|
||||||
|
@ -38,7 +37,7 @@ export function initGlobalAPI(Vue: GlobalAPI) {
|
||||||
warn,
|
warn,
|
||||||
extend,
|
extend,
|
||||||
mergeOptions,
|
mergeOptions,
|
||||||
defineReactive,
|
defineReactive
|
||||||
}
|
}
|
||||||
|
|
||||||
Vue.set = set
|
Vue.set = set
|
||||||
|
@ -52,7 +51,7 @@ export function initGlobalAPI(Vue: GlobalAPI) {
|
||||||
}
|
}
|
||||||
|
|
||||||
Vue.options = Object.create(null)
|
Vue.options = Object.create(null)
|
||||||
ASSET_TYPES.forEach((type) => {
|
ASSET_TYPES.forEach(type => {
|
||||||
Vue.options[type + 's'] = Object.create(null)
|
Vue.options[type + 's'] = Object.create(null)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
import type { GlobalAPI } from 'typescript/global-api'
|
import type { GlobalAPI } from 'typescript/global-api'
|
||||||
import { mergeOptions } from '../util/index'
|
import { mergeOptions } from '../util/index'
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
import type { GlobalAPI } from 'typescript/global-api'
|
import type { GlobalAPI } from 'typescript/global-api'
|
||||||
import { toArray } from '../util/index'
|
import { toArray } from '../util/index'
|
||||||
|
|
||||||
|
|
|
@ -6,19 +6,19 @@ import { FunctionalRenderContext } from 'core/vdom/create-functional-component'
|
||||||
initGlobalAPI(Vue)
|
initGlobalAPI(Vue)
|
||||||
|
|
||||||
Object.defineProperty(Vue.prototype, '$isServer', {
|
Object.defineProperty(Vue.prototype, '$isServer', {
|
||||||
get: isServerRendering,
|
get: isServerRendering
|
||||||
})
|
})
|
||||||
|
|
||||||
Object.defineProperty(Vue.prototype, '$ssrContext', {
|
Object.defineProperty(Vue.prototype, '$ssrContext', {
|
||||||
get() {
|
get() {
|
||||||
/* istanbul ignore next */
|
/* istanbul ignore next */
|
||||||
return this.$vnode && this.$vnode.ssrContext
|
return this.$vnode && this.$vnode.ssrContext
|
||||||
},
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
// expose FunctionalRenderContext for ssr runtime helper installation
|
// expose FunctionalRenderContext for ssr runtime helper installation
|
||||||
Object.defineProperty(Vue, 'FunctionalRenderContext', {
|
Object.defineProperty(Vue, 'FunctionalRenderContext', {
|
||||||
value: FunctionalRenderContext,
|
value: FunctionalRenderContext
|
||||||
})
|
})
|
||||||
|
|
||||||
Vue.version = '__VERSION__'
|
Vue.version = '__VERSION__'
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
|
|
||||||
import type { Component } from 'typescript/component'
|
import type { Component } from 'typescript/component'
|
||||||
import {
|
import {
|
||||||
tip,
|
tip,
|
||||||
toArray,
|
toArray,
|
||||||
hyphenate,
|
hyphenate,
|
||||||
formatComponentName,
|
formatComponentName,
|
||||||
invokeWithErrorHandling,
|
invokeWithErrorHandling
|
||||||
} from '../util/index'
|
} from '../util/index'
|
||||||
import { updateListeners } from '../vdom/helpers/index'
|
import { updateListeners } from '../vdom/helpers/index'
|
||||||
|
|
||||||
|
@ -68,7 +67,7 @@ export function eventsMixin(Vue: Component) {
|
||||||
vm.$on(event[i], fn)
|
vm.$on(event[i], fn)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
(vm._events[event] || (vm._events[event] = [])).push(fn)
|
;(vm._events[event] || (vm._events[event] = [])).push(fn)
|
||||||
// optimize hook:event cost by using a boolean flag marked at registration
|
// optimize hook:event cost by using a boolean flag marked at registration
|
||||||
// instead of a hash lookup
|
// instead of a hash lookup
|
||||||
if (hookRE.test(event)) {
|
if (hookRE.test(event)) {
|
||||||
|
|
|
@ -1,27 +1,27 @@
|
||||||
import { initMixin } from "./init";
|
import { initMixin } from './init'
|
||||||
import { stateMixin } from "./state";
|
import { stateMixin } from './state'
|
||||||
import { renderMixin } from "./render";
|
import { renderMixin } from './render'
|
||||||
import { eventsMixin } from "./events";
|
import { eventsMixin } from './events'
|
||||||
import { lifecycleMixin } from "./lifecycle";
|
import { lifecycleMixin } from './lifecycle'
|
||||||
import { warn } from "../util/index";
|
import { warn } from '../util/index'
|
||||||
import type { GlobalAPI } from "typescript/global-api";
|
import type { GlobalAPI } from 'typescript/global-api'
|
||||||
|
|
||||||
function Vue(options) {
|
function Vue(options) {
|
||||||
if (process.env.NODE_ENV !== "production" && !(this instanceof Vue)) {
|
if (process.env.NODE_ENV !== 'production' && !(this instanceof Vue)) {
|
||||||
warn("Vue is a constructor and should be called with the `new` keyword");
|
warn('Vue is a constructor and should be called with the `new` keyword')
|
||||||
}
|
}
|
||||||
this._init(options);
|
this._init(options)
|
||||||
}
|
}
|
||||||
|
|
||||||
//@ts-expect-error Vue has function type
|
//@ts-expect-error Vue has function type
|
||||||
initMixin(Vue);
|
initMixin(Vue)
|
||||||
//@ts-expect-error Vue has function type
|
//@ts-expect-error Vue has function type
|
||||||
stateMixin(Vue);
|
stateMixin(Vue)
|
||||||
//@ts-expect-error Vue has function type
|
//@ts-expect-error Vue has function type
|
||||||
eventsMixin(Vue);
|
eventsMixin(Vue)
|
||||||
//@ts-expect-error Vue has function type
|
//@ts-expect-error Vue has function type
|
||||||
lifecycleMixin(Vue);
|
lifecycleMixin(Vue)
|
||||||
//@ts-expect-error Vue has function type
|
//@ts-expect-error Vue has function type
|
||||||
renderMixin(Vue);
|
renderMixin(Vue)
|
||||||
|
|
||||||
export default (Vue as unknown) as GlobalAPI;
|
export default Vue as unknown as GlobalAPI
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
import config from '../config'
|
import config from '../config'
|
||||||
import { initProxy } from './proxy'
|
import { initProxy } from './proxy'
|
||||||
import { initState } from './state'
|
import { initState } from './state'
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
import { hasOwn } from 'shared/util'
|
import { hasOwn } from 'shared/util'
|
||||||
import { warn, hasSymbol } from '../util/index'
|
import { warn, hasSymbol } from '../util/index'
|
||||||
import { defineReactive, toggleObserving } from '../observer/index'
|
import { defineReactive, toggleObserving } from '../observer/index'
|
||||||
|
@ -19,7 +18,7 @@ export function initInjections(vm: Component) {
|
||||||
const result = resolveInject(vm.$options.inject, vm)
|
const result = resolveInject(vm.$options.inject, vm)
|
||||||
if (result) {
|
if (result) {
|
||||||
toggleObserving(false)
|
toggleObserving(false)
|
||||||
Object.keys(result).forEach((key) => {
|
Object.keys(result).forEach(key => {
|
||||||
/* istanbul ignore else */
|
/* istanbul ignore else */
|
||||||
if (process.env.NODE_ENV !== 'production') {
|
if (process.env.NODE_ENV !== 'production') {
|
||||||
defineReactive(vm, key, result[key], () => {
|
defineReactive(vm, key, result[key], () => {
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
import config from "../config";
|
import config from '../config'
|
||||||
import Watcher from "../observer/watcher";
|
import Watcher from '../observer/watcher'
|
||||||
import { mark, measure } from "../util/perf";
|
import { mark, measure } from '../util/perf'
|
||||||
import VNode, { createEmptyVNode } from "../vdom/vnode";
|
import VNode, { createEmptyVNode } from '../vdom/vnode'
|
||||||
import { updateComponentListeners } from "./events";
|
import { updateComponentListeners } from './events'
|
||||||
import { resolveSlots } from "./render-helpers/resolve-slots";
|
import { resolveSlots } from './render-helpers/resolve-slots'
|
||||||
import { toggleObserving } from "../observer/index";
|
import { toggleObserving } from '../observer/index'
|
||||||
import { pushTarget, popTarget } from "../observer/dep";
|
import { pushTarget, popTarget } from '../observer/dep'
|
||||||
import type { Component } from "../../../typescript/component";
|
import type { Component } from '../../../typescript/component'
|
||||||
import type { MountedComponentVNode } from "../../../typescript/vnode";
|
import type { MountedComponentVNode } from '../../../typescript/vnode'
|
||||||
|
|
||||||
import {
|
import {
|
||||||
warn,
|
warn,
|
||||||
|
@ -15,127 +15,127 @@ import {
|
||||||
remove,
|
remove,
|
||||||
emptyObject,
|
emptyObject,
|
||||||
validateProp,
|
validateProp,
|
||||||
invokeWithErrorHandling,
|
invokeWithErrorHandling
|
||||||
} from "../util/index";
|
} from '../util/index'
|
||||||
|
|
||||||
export let activeInstance: any = null;
|
export let activeInstance: any = null
|
||||||
export let isUpdatingChildComponent: boolean = false;
|
export let isUpdatingChildComponent: boolean = false
|
||||||
|
|
||||||
export function setActiveInstance(vm: Component) {
|
export function setActiveInstance(vm: Component) {
|
||||||
const prevActiveInstance = activeInstance;
|
const prevActiveInstance = activeInstance
|
||||||
activeInstance = vm;
|
activeInstance = vm
|
||||||
return () => {
|
return () => {
|
||||||
activeInstance = prevActiveInstance;
|
activeInstance = prevActiveInstance
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function initLifecycle(vm: Component) {
|
export function initLifecycle(vm: Component) {
|
||||||
const options = vm.$options;
|
const options = vm.$options
|
||||||
|
|
||||||
// locate first non-abstract parent
|
// locate first non-abstract parent
|
||||||
let parent = options.parent;
|
let parent = options.parent
|
||||||
if (parent && !options.abstract) {
|
if (parent && !options.abstract) {
|
||||||
while (parent.$options.abstract && parent.$parent) {
|
while (parent.$options.abstract && parent.$parent) {
|
||||||
parent = parent.$parent;
|
parent = parent.$parent
|
||||||
}
|
}
|
||||||
parent.$children.push(vm);
|
parent.$children.push(vm)
|
||||||
}
|
}
|
||||||
|
|
||||||
vm.$parent = parent;
|
vm.$parent = parent
|
||||||
vm.$root = parent ? parent.$root : vm;
|
vm.$root = parent ? parent.$root : vm
|
||||||
|
|
||||||
vm.$children = [];
|
vm.$children = []
|
||||||
vm.$refs = {};
|
vm.$refs = {}
|
||||||
|
|
||||||
vm._watcher = null;
|
vm._watcher = null
|
||||||
vm._inactive = null;
|
vm._inactive = null
|
||||||
vm._directInactive = false;
|
vm._directInactive = false
|
||||||
vm._isMounted = false;
|
vm._isMounted = false
|
||||||
vm._isDestroyed = false;
|
vm._isDestroyed = false
|
||||||
vm._isBeingDestroyed = false;
|
vm._isBeingDestroyed = false
|
||||||
}
|
}
|
||||||
|
|
||||||
export function lifecycleMixin(Vue: Component) {
|
export function lifecycleMixin(Vue: Component) {
|
||||||
Vue.prototype._update = function (vnode: VNode, hydrating?: boolean) {
|
Vue.prototype._update = function (vnode: VNode, hydrating?: boolean) {
|
||||||
const vm: Component = this;
|
const vm: Component = this
|
||||||
const prevEl = vm.$el;
|
const prevEl = vm.$el
|
||||||
const prevVnode = vm._vnode;
|
const prevVnode = vm._vnode
|
||||||
const restoreActiveInstance = setActiveInstance(vm);
|
const restoreActiveInstance = setActiveInstance(vm)
|
||||||
vm._vnode = vnode;
|
vm._vnode = vnode
|
||||||
// Vue.prototype.__patch__ is injected in entry points
|
// Vue.prototype.__patch__ is injected in entry points
|
||||||
// based on the rendering backend used.
|
// based on the rendering backend used.
|
||||||
if (!prevVnode) {
|
if (!prevVnode) {
|
||||||
// initial render
|
// initial render
|
||||||
vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
|
vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */)
|
||||||
} else {
|
} else {
|
||||||
// updates
|
// updates
|
||||||
vm.$el = vm.__patch__(prevVnode, vnode);
|
vm.$el = vm.__patch__(prevVnode, vnode)
|
||||||
}
|
}
|
||||||
restoreActiveInstance();
|
restoreActiveInstance()
|
||||||
// update __vue__ reference
|
// update __vue__ reference
|
||||||
if (prevEl) {
|
if (prevEl) {
|
||||||
prevEl.__vue__ = null;
|
prevEl.__vue__ = null
|
||||||
}
|
}
|
||||||
if (vm.$el) {
|
if (vm.$el) {
|
||||||
vm.$el.__vue__ = vm;
|
vm.$el.__vue__ = vm
|
||||||
}
|
}
|
||||||
// if parent is an HOC, update its $el as well
|
// if parent is an HOC, update its $el as well
|
||||||
if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
|
if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
|
||||||
vm.$parent.$el = vm.$el;
|
vm.$parent.$el = vm.$el
|
||||||
}
|
}
|
||||||
// updated hook is called by the scheduler to ensure that children are
|
// updated hook is called by the scheduler to ensure that children are
|
||||||
// updated in a parent's updated hook.
|
// updated in a parent's updated hook.
|
||||||
};
|
}
|
||||||
|
|
||||||
Vue.prototype.$forceUpdate = function () {
|
Vue.prototype.$forceUpdate = function () {
|
||||||
const vm: Component = this;
|
const vm: Component = this
|
||||||
if (vm._watcher) {
|
if (vm._watcher) {
|
||||||
vm._watcher.update();
|
vm._watcher.update()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
Vue.prototype.$destroy = function () {
|
Vue.prototype.$destroy = function () {
|
||||||
const vm: Component = this;
|
const vm: Component = this
|
||||||
if (vm._isBeingDestroyed) {
|
if (vm._isBeingDestroyed) {
|
||||||
return;
|
return
|
||||||
}
|
}
|
||||||
callHook(vm, "beforeDestroy");
|
callHook(vm, 'beforeDestroy')
|
||||||
vm._isBeingDestroyed = true;
|
vm._isBeingDestroyed = true
|
||||||
// remove self from parent
|
// remove self from parent
|
||||||
const parent = vm.$parent;
|
const parent = vm.$parent
|
||||||
if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
|
if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
|
||||||
remove(parent.$children, vm);
|
remove(parent.$children, vm)
|
||||||
}
|
}
|
||||||
// teardown watchers
|
// teardown watchers
|
||||||
if (vm._watcher) {
|
if (vm._watcher) {
|
||||||
vm._watcher.teardown();
|
vm._watcher.teardown()
|
||||||
}
|
}
|
||||||
let i = vm._watchers.length;
|
let i = vm._watchers.length
|
||||||
while (i--) {
|
while (i--) {
|
||||||
vm._watchers[i].teardown();
|
vm._watchers[i].teardown()
|
||||||
}
|
}
|
||||||
// remove reference from data ob
|
// remove reference from data ob
|
||||||
// frozen object may not have observer.
|
// frozen object may not have observer.
|
||||||
if (vm._data.__ob__) {
|
if (vm._data.__ob__) {
|
||||||
vm._data.__ob__.vmCount--;
|
vm._data.__ob__.vmCount--
|
||||||
}
|
}
|
||||||
// call the last hook...
|
// call the last hook...
|
||||||
vm._isDestroyed = true;
|
vm._isDestroyed = true
|
||||||
// invoke destroy hooks on current rendered tree
|
// invoke destroy hooks on current rendered tree
|
||||||
vm.__patch__(vm._vnode, null);
|
vm.__patch__(vm._vnode, null)
|
||||||
// fire destroyed hook
|
// fire destroyed hook
|
||||||
callHook(vm, "destroyed");
|
callHook(vm, 'destroyed')
|
||||||
// turn off all instance listeners.
|
// turn off all instance listeners.
|
||||||
vm.$off();
|
vm.$off()
|
||||||
// remove __vue__ reference
|
// remove __vue__ reference
|
||||||
if (vm.$el) {
|
if (vm.$el) {
|
||||||
vm.$el.__vue__ = null;
|
vm.$el.__vue__ = null
|
||||||
}
|
}
|
||||||
// release circular reference (#6759)
|
// release circular reference (#6759)
|
||||||
if (vm.$vnode) {
|
if (vm.$vnode) {
|
||||||
vm.$vnode.parent = null;
|
vm.$vnode.parent = null
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function mountComponent(
|
export function mountComponent(
|
||||||
|
@ -143,56 +143,56 @@ export function mountComponent(
|
||||||
el: Element | null | undefined,
|
el: Element | null | undefined,
|
||||||
hydrating?: boolean
|
hydrating?: boolean
|
||||||
): Component {
|
): Component {
|
||||||
vm.$el = el;
|
vm.$el = el
|
||||||
if (!vm.$options.render) {
|
if (!vm.$options.render) {
|
||||||
// @ts-expect-error invalid type
|
// @ts-expect-error invalid type
|
||||||
vm.$options.render = createEmptyVNode;
|
vm.$options.render = createEmptyVNode
|
||||||
if (process.env.NODE_ENV !== "production") {
|
if (process.env.NODE_ENV !== 'production') {
|
||||||
/* istanbul ignore if */
|
/* istanbul ignore if */
|
||||||
if (
|
if (
|
||||||
(vm.$options.template && vm.$options.template.charAt(0) !== "#") ||
|
(vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
|
||||||
vm.$options.el ||
|
vm.$options.el ||
|
||||||
el
|
el
|
||||||
) {
|
) {
|
||||||
warn(
|
warn(
|
||||||
"You are using the runtime-only build of Vue where the template " +
|
'You are using the runtime-only build of Vue where the template ' +
|
||||||
"compiler is not available. Either pre-compile the templates into " +
|
'compiler is not available. Either pre-compile the templates into ' +
|
||||||
"render functions, or use the compiler-included build.",
|
'render functions, or use the compiler-included build.',
|
||||||
vm
|
vm
|
||||||
);
|
)
|
||||||
} else {
|
} else {
|
||||||
warn(
|
warn(
|
||||||
"Failed to mount component: template or render function not defined.",
|
'Failed to mount component: template or render function not defined.',
|
||||||
vm
|
vm
|
||||||
);
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
callHook(vm, "beforeMount");
|
callHook(vm, 'beforeMount')
|
||||||
|
|
||||||
let updateComponent;
|
let updateComponent
|
||||||
/* istanbul ignore if */
|
/* istanbul ignore if */
|
||||||
if (process.env.NODE_ENV !== "production" && config.performance && mark) {
|
if (process.env.NODE_ENV !== 'production' && config.performance && mark) {
|
||||||
updateComponent = () => {
|
updateComponent = () => {
|
||||||
const name = vm._name;
|
const name = vm._name
|
||||||
const id = vm._uid;
|
const id = vm._uid
|
||||||
const startTag = `vue-perf-start:${id}`;
|
const startTag = `vue-perf-start:${id}`
|
||||||
const endTag = `vue-perf-end:${id}`;
|
const endTag = `vue-perf-end:${id}`
|
||||||
|
|
||||||
mark(startTag);
|
mark(startTag)
|
||||||
const vnode = vm._render();
|
const vnode = vm._render()
|
||||||
mark(endTag);
|
mark(endTag)
|
||||||
measure(`vue ${name} render`, startTag, endTag);
|
measure(`vue ${name} render`, startTag, endTag)
|
||||||
|
|
||||||
mark(startTag);
|
mark(startTag)
|
||||||
vm._update(vnode, hydrating);
|
vm._update(vnode, hydrating)
|
||||||
mark(endTag);
|
mark(endTag)
|
||||||
measure(`vue ${name} patch`, startTag, endTag);
|
measure(`vue ${name} patch`, startTag, endTag)
|
||||||
};
|
}
|
||||||
} else {
|
} else {
|
||||||
updateComponent = () => {
|
updateComponent = () => {
|
||||||
vm._update(vm._render(), hydrating);
|
vm._update(vm._render(), hydrating)
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// we set this to vm._watcher inside the watcher's constructor
|
// we set this to vm._watcher inside the watcher's constructor
|
||||||
|
@ -205,21 +205,21 @@ export function mountComponent(
|
||||||
{
|
{
|
||||||
before() {
|
before() {
|
||||||
if (vm._isMounted && !vm._isDestroyed) {
|
if (vm._isMounted && !vm._isDestroyed) {
|
||||||
callHook(vm, "beforeUpdate");
|
callHook(vm, 'beforeUpdate')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
|
||||||
true /* isRenderWatcher */
|
true /* isRenderWatcher */
|
||||||
);
|
)
|
||||||
hydrating = false;
|
hydrating = false
|
||||||
|
|
||||||
// manually mounted instance, call mounted on self
|
// manually mounted instance, call mounted on self
|
||||||
// mounted is called for render-created child components in its inserted hook
|
// mounted is called for render-created child components in its inserted hook
|
||||||
if (vm.$vnode == null) {
|
if (vm.$vnode == null) {
|
||||||
vm._isMounted = true;
|
vm._isMounted = true
|
||||||
callHook(vm, "mounted");
|
callHook(vm, 'mounted')
|
||||||
}
|
}
|
||||||
return vm;
|
return vm
|
||||||
}
|
}
|
||||||
|
|
||||||
export function updateChildComponent(
|
export function updateChildComponent(
|
||||||
|
@ -229,8 +229,8 @@ export function updateChildComponent(
|
||||||
parentVnode: MountedComponentVNode,
|
parentVnode: MountedComponentVNode,
|
||||||
renderChildren?: Array<VNode> | null
|
renderChildren?: Array<VNode> | null
|
||||||
) {
|
) {
|
||||||
if (process.env.NODE_ENV !== "production") {
|
if (process.env.NODE_ENV !== 'production') {
|
||||||
isUpdatingChildComponent = true;
|
isUpdatingChildComponent = true
|
||||||
}
|
}
|
||||||
|
|
||||||
// determine whether component has slot children
|
// determine whether component has slot children
|
||||||
|
@ -239,14 +239,14 @@ export function updateChildComponent(
|
||||||
// check if there are dynamic scopedSlots (hand-written or compiled but with
|
// check if there are dynamic scopedSlots (hand-written or compiled but with
|
||||||
// dynamic slot names). Static scoped slots compiled from template has the
|
// dynamic slot names). Static scoped slots compiled from template has the
|
||||||
// "$stable" marker.
|
// "$stable" marker.
|
||||||
const newScopedSlots = parentVnode.data.scopedSlots;
|
const newScopedSlots = parentVnode.data.scopedSlots
|
||||||
const oldScopedSlots = vm.$scopedSlots;
|
const oldScopedSlots = vm.$scopedSlots
|
||||||
const hasDynamicScopedSlot = !!(
|
const hasDynamicScopedSlot = !!(
|
||||||
(newScopedSlots && !newScopedSlots.$stable) ||
|
(newScopedSlots && !newScopedSlots.$stable) ||
|
||||||
(oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
|
(oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
|
||||||
(newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key) ||
|
(newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key) ||
|
||||||
(!newScopedSlots && vm.$scopedSlots.$key)
|
(!newScopedSlots && vm.$scopedSlots.$key)
|
||||||
);
|
)
|
||||||
|
|
||||||
// Any static slot children from the parent may have changed during parent's
|
// Any static slot children from the parent may have changed during parent's
|
||||||
// update. Dynamic scoped slots may also have changed. In such cases, a forced
|
// update. Dynamic scoped slots may also have changed. In such cases, a forced
|
||||||
|
@ -255,108 +255,108 @@ export function updateChildComponent(
|
||||||
renderChildren || // has new static slots
|
renderChildren || // has new static slots
|
||||||
vm.$options._renderChildren || // has old static slots
|
vm.$options._renderChildren || // has old static slots
|
||||||
hasDynamicScopedSlot
|
hasDynamicScopedSlot
|
||||||
);
|
)
|
||||||
|
|
||||||
vm.$options._parentVnode = parentVnode;
|
vm.$options._parentVnode = parentVnode
|
||||||
vm.$vnode = parentVnode; // update vm's placeholder node without re-render
|
vm.$vnode = parentVnode // update vm's placeholder node without re-render
|
||||||
|
|
||||||
if (vm._vnode) {
|
if (vm._vnode) {
|
||||||
// update child tree's parent
|
// update child tree's parent
|
||||||
vm._vnode.parent = parentVnode;
|
vm._vnode.parent = parentVnode
|
||||||
}
|
}
|
||||||
vm.$options._renderChildren = renderChildren;
|
vm.$options._renderChildren = renderChildren
|
||||||
|
|
||||||
// update $attrs and $listeners hash
|
// update $attrs and $listeners hash
|
||||||
// these are also reactive so they may trigger child update if the child
|
// these are also reactive so they may trigger child update if the child
|
||||||
// used them during render
|
// used them during render
|
||||||
vm.$attrs = parentVnode.data.attrs || emptyObject;
|
vm.$attrs = parentVnode.data.attrs || emptyObject
|
||||||
vm.$listeners = listeners || emptyObject;
|
vm.$listeners = listeners || emptyObject
|
||||||
|
|
||||||
// update props
|
// update props
|
||||||
if (propsData && vm.$options.props) {
|
if (propsData && vm.$options.props) {
|
||||||
toggleObserving(false);
|
toggleObserving(false)
|
||||||
const props = vm._props;
|
const props = vm._props
|
||||||
const propKeys = vm.$options._propKeys || [];
|
const propKeys = vm.$options._propKeys || []
|
||||||
for (let i = 0; i < propKeys.length; i++) {
|
for (let i = 0; i < propKeys.length; i++) {
|
||||||
const key = propKeys[i];
|
const key = propKeys[i]
|
||||||
const propOptions: any = vm.$options.props; // wtf flow?
|
const propOptions: any = vm.$options.props // wtf flow?
|
||||||
props[key] = validateProp(key, propOptions, propsData, vm);
|
props[key] = validateProp(key, propOptions, propsData, vm)
|
||||||
}
|
}
|
||||||
toggleObserving(true);
|
toggleObserving(true)
|
||||||
// keep a copy of raw propsData
|
// keep a copy of raw propsData
|
||||||
vm.$options.propsData = propsData;
|
vm.$options.propsData = propsData
|
||||||
}
|
}
|
||||||
|
|
||||||
// update listeners
|
// update listeners
|
||||||
listeners = listeners || emptyObject;
|
listeners = listeners || emptyObject
|
||||||
const oldListeners = vm.$options._parentListeners;
|
const oldListeners = vm.$options._parentListeners
|
||||||
vm.$options._parentListeners = listeners;
|
vm.$options._parentListeners = listeners
|
||||||
updateComponentListeners(vm, listeners, oldListeners);
|
updateComponentListeners(vm, listeners, oldListeners)
|
||||||
|
|
||||||
// resolve slots + force update if has children
|
// resolve slots + force update if has children
|
||||||
if (needsForceUpdate) {
|
if (needsForceUpdate) {
|
||||||
vm.$slots = resolveSlots(renderChildren, parentVnode.context);
|
vm.$slots = resolveSlots(renderChildren, parentVnode.context)
|
||||||
vm.$forceUpdate();
|
vm.$forceUpdate()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (process.env.NODE_ENV !== "production") {
|
if (process.env.NODE_ENV !== 'production') {
|
||||||
isUpdatingChildComponent = false;
|
isUpdatingChildComponent = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function isInInactiveTree(vm) {
|
function isInInactiveTree(vm) {
|
||||||
while (vm && (vm = vm.$parent)) {
|
while (vm && (vm = vm.$parent)) {
|
||||||
if (vm._inactive) return true;
|
if (vm._inactive) return true
|
||||||
}
|
}
|
||||||
return false;
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
export function activateChildComponent(vm: Component, direct?: boolean) {
|
export function activateChildComponent(vm: Component, direct?: boolean) {
|
||||||
if (direct) {
|
if (direct) {
|
||||||
vm._directInactive = false;
|
vm._directInactive = false
|
||||||
if (isInInactiveTree(vm)) {
|
if (isInInactiveTree(vm)) {
|
||||||
return;
|
return
|
||||||
}
|
}
|
||||||
} else if (vm._directInactive) {
|
} else if (vm._directInactive) {
|
||||||
return;
|
return
|
||||||
}
|
}
|
||||||
if (vm._inactive || vm._inactive === null) {
|
if (vm._inactive || vm._inactive === null) {
|
||||||
vm._inactive = false;
|
vm._inactive = false
|
||||||
for (let i = 0; i < vm.$children.length; i++) {
|
for (let i = 0; i < vm.$children.length; i++) {
|
||||||
activateChildComponent(vm.$children[i]);
|
activateChildComponent(vm.$children[i])
|
||||||
}
|
}
|
||||||
callHook(vm, "activated");
|
callHook(vm, 'activated')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function deactivateChildComponent(vm: Component, direct?: boolean) {
|
export function deactivateChildComponent(vm: Component, direct?: boolean) {
|
||||||
if (direct) {
|
if (direct) {
|
||||||
vm._directInactive = true;
|
vm._directInactive = true
|
||||||
if (isInInactiveTree(vm)) {
|
if (isInInactiveTree(vm)) {
|
||||||
return;
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!vm._inactive) {
|
if (!vm._inactive) {
|
||||||
vm._inactive = true;
|
vm._inactive = true
|
||||||
for (let i = 0; i < vm.$children.length; i++) {
|
for (let i = 0; i < vm.$children.length; i++) {
|
||||||
deactivateChildComponent(vm.$children[i]);
|
deactivateChildComponent(vm.$children[i])
|
||||||
}
|
}
|
||||||
callHook(vm, "deactivated");
|
callHook(vm, 'deactivated')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function callHook(vm: Component, hook: string) {
|
export function callHook(vm: Component, hook: string) {
|
||||||
// #7573 disable dep collection when invoking lifecycle hooks
|
// #7573 disable dep collection when invoking lifecycle hooks
|
||||||
pushTarget();
|
pushTarget()
|
||||||
const handlers = vm.$options[hook];
|
const handlers = vm.$options[hook]
|
||||||
const info = `${hook} hook`;
|
const info = `${hook} hook`
|
||||||
if (handlers) {
|
if (handlers) {
|
||||||
for (let i = 0, j = handlers.length; i < j; i++) {
|
for (let i = 0, j = handlers.length; i < j; i++) {
|
||||||
invokeWithErrorHandling(handlers[i], vm, null, vm, info);
|
invokeWithErrorHandling(handlers[i], vm, null, vm, info)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (vm._hasHookEvent) {
|
if (vm._hasHookEvent) {
|
||||||
vm.$emit("hook:" + hook);
|
vm.$emit('hook:' + hook)
|
||||||
}
|
}
|
||||||
popTarget();
|
popTarget()
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,7 @@ if (process.env.NODE_ENV !== 'production') {
|
||||||
target[key] = value
|
target[key] = value
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ if (process.env.NODE_ENV !== 'production') {
|
||||||
else warnNonPresent(target, key)
|
else warnNonPresent(target, key)
|
||||||
}
|
}
|
||||||
return has || !isAllowed
|
return has || !isAllowed
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const getHandler = {
|
const getHandler = {
|
||||||
|
@ -78,7 +78,7 @@ if (process.env.NODE_ENV !== 'production') {
|
||||||
else warnNonPresent(target, key)
|
else warnNonPresent(target, key)
|
||||||
}
|
}
|
||||||
return target[key]
|
return target[key]
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
initProxy = function initProxy(vm) {
|
initProxy = function initProxy(vm) {
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
// helper to process dynamic keys for dynamic arguments in v-bind and v-on.
|
// helper to process dynamic keys for dynamic arguments in v-bind and v-on.
|
||||||
// For example, the following template:
|
// For example, the following template:
|
||||||
//
|
//
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
import { warn, extend, isPlainObject } from 'core/util/index'
|
import { warn, extend, isPlainObject } from 'core/util/index'
|
||||||
import type { VNodeData } from 'typescript/vnode'
|
import type { VNodeData } from 'typescript/vnode'
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
import config from 'core/config'
|
import config from 'core/config'
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
@ -7,7 +6,7 @@ import {
|
||||||
toObject,
|
toObject,
|
||||||
isReservedAttribute,
|
isReservedAttribute,
|
||||||
camelize,
|
camelize,
|
||||||
hyphenate,
|
hyphenate
|
||||||
} from 'core/util/index'
|
} from 'core/util/index'
|
||||||
import type { VNodeData } from 'typescript/vnode'
|
import type { VNodeData } from 'typescript/vnode'
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
import config from 'core/config'
|
import config from 'core/config'
|
||||||
import { hyphenate } from 'shared/util'
|
import { hyphenate } from 'shared/util'
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
import { toNumber, toString, looseEqual, looseIndexOf } from 'shared/util'
|
import { toNumber, toString, looseEqual, looseIndexOf } from 'shared/util'
|
||||||
import { createTextVNode, createEmptyVNode } from 'core/vdom/vnode'
|
import { createTextVNode, createEmptyVNode } from 'core/vdom/vnode'
|
||||||
import { renderList } from './render-list'
|
import { renderList } from './render-list'
|
||||||
|
|
|
@ -44,6 +44,6 @@ export function renderList(
|
||||||
if (!isDef(ret)) {
|
if (!isDef(ret)) {
|
||||||
ret = []
|
ret = []
|
||||||
}
|
}
|
||||||
(ret as any)._isVList = true
|
;(ret as any)._isVList = true
|
||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { extend, warn, isObject } from "core/util/index";
|
import { extend, warn, isObject } from 'core/util/index'
|
||||||
import VNode from "core/vdom/vnode";
|
import VNode from 'core/vdom/vnode'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Runtime helper for rendering <slot>
|
* Runtime helper for rendering <slot>
|
||||||
|
@ -10,34 +10,30 @@ export function renderSlot(
|
||||||
props: Record<string, any> | null,
|
props: Record<string, any> | null,
|
||||||
bindObject: object | null
|
bindObject: object | null
|
||||||
): Array<VNode> | null {
|
): Array<VNode> | null {
|
||||||
const scopedSlotFn = this.$scopedSlots[name];
|
const scopedSlotFn = this.$scopedSlots[name]
|
||||||
let nodes;
|
let nodes
|
||||||
if (scopedSlotFn) {
|
if (scopedSlotFn) {
|
||||||
// scoped slot
|
// scoped slot
|
||||||
props = props || {};
|
props = props || {}
|
||||||
if (bindObject) {
|
if (bindObject) {
|
||||||
if (process.env.NODE_ENV !== "production" && !isObject(bindObject)) {
|
if (process.env.NODE_ENV !== 'production' && !isObject(bindObject)) {
|
||||||
warn("slot v-bind without argument expects an Object", this);
|
warn('slot v-bind without argument expects an Object', this)
|
||||||
}
|
}
|
||||||
props = extend(extend({}, bindObject), props);
|
props = extend(extend({}, bindObject), props)
|
||||||
}
|
}
|
||||||
nodes =
|
nodes =
|
||||||
scopedSlotFn(props) ||
|
scopedSlotFn(props) ||
|
||||||
(typeof fallbackRender === "function"
|
(typeof fallbackRender === 'function' ? fallbackRender() : fallbackRender)
|
||||||
? fallbackRender()
|
|
||||||
: fallbackRender);
|
|
||||||
} else {
|
} else {
|
||||||
nodes =
|
nodes =
|
||||||
this.$slots[name] ||
|
this.$slots[name] ||
|
||||||
(typeof fallbackRender === "function"
|
(typeof fallbackRender === 'function' ? fallbackRender() : fallbackRender)
|
||||||
? fallbackRender()
|
|
||||||
: fallbackRender);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const target = props && props.slot;
|
const target = props && props.slot
|
||||||
if (target) {
|
if (target) {
|
||||||
return this.$createElement("template", { slot: target }, nodes);
|
return this.$createElement('template', { slot: target }, nodes)
|
||||||
} else {
|
} else {
|
||||||
return nodes;
|
return nodes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ export function resolveScopedSlots(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (contentHashKey) {
|
if (contentHashKey) {
|
||||||
(res as any).$key = contentHashKey
|
;(res as any).$key = contentHashKey
|
||||||
}
|
}
|
||||||
return res as any
|
return res as any
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
import type VNode from 'core/vdom/vnode'
|
import type VNode from 'core/vdom/vnode'
|
||||||
import type { Component } from 'typescript/component'
|
import type { Component } from 'typescript/component'
|
||||||
|
|
||||||
|
@ -35,7 +34,7 @@ export function resolveSlots(
|
||||||
slot.push(child)
|
slot.push(child)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
(slots.default || (slots.default = [])).push(child)
|
;(slots.default || (slots.default = [])).push(child)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ignore slots that contains only whitespace
|
// ignore slots that contains only whitespace
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
|
|
||||||
import {
|
import {
|
||||||
warn,
|
warn,
|
||||||
nextTick,
|
nextTick,
|
||||||
emptyObject,
|
emptyObject,
|
||||||
handleError,
|
handleError,
|
||||||
defineReactive,
|
defineReactive
|
||||||
} from '../util/index'
|
} from '../util/index'
|
||||||
|
|
||||||
import { createElement } from '../vdom/create-element'
|
import { createElement } from '../vdom/create-element'
|
||||||
|
@ -21,7 +20,7 @@ export function initRender(vm: Component) {
|
||||||
vm._staticTrees = null // v-once cached trees
|
vm._staticTrees = null // v-once cached trees
|
||||||
const options = vm.$options
|
const options = vm.$options
|
||||||
const parentVnode = (vm.$vnode = options._parentVnode!) // the placeholder node in parent tree
|
const parentVnode = (vm.$vnode = options._parentVnode!) // the placeholder node in parent tree
|
||||||
const renderContext = parentVnode && parentVnode.context as Component
|
const renderContext = parentVnode && (parentVnode.context as Component)
|
||||||
vm.$slots = resolveSlots(options._renderChildren, renderContext)
|
vm.$slots = resolveSlots(options._renderChildren, renderContext)
|
||||||
vm.$scopedSlots = emptyObject
|
vm.$scopedSlots = emptyObject
|
||||||
// bind the createElement fn to this instance
|
// bind the createElement fn to this instance
|
||||||
|
@ -127,7 +126,7 @@ export function renderMixin(Vue: Component) {
|
||||||
vm.$createElement,
|
vm.$createElement,
|
||||||
e
|
e
|
||||||
)
|
)
|
||||||
} catch (e:any) {
|
} catch (e: any) {
|
||||||
handleError(e, vm, `renderError`)
|
handleError(e, vm, `renderError`)
|
||||||
vnode = vm._vnode
|
vnode = vm._vnode
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
import config from "../config";
|
import config from '../config'
|
||||||
import Watcher from "../observer/watcher";
|
import Watcher from '../observer/watcher'
|
||||||
import Dep, { pushTarget, popTarget } from "../observer/dep";
|
import Dep, { pushTarget, popTarget } from '../observer/dep'
|
||||||
import { isUpdatingChildComponent } from "./lifecycle";
|
import { isUpdatingChildComponent } from './lifecycle'
|
||||||
|
|
||||||
import {
|
import {
|
||||||
set,
|
set,
|
||||||
del,
|
del,
|
||||||
observe,
|
observe,
|
||||||
defineReactive,
|
defineReactive,
|
||||||
toggleObserving,
|
toggleObserving
|
||||||
} from "../observer/index";
|
} from '../observer/index'
|
||||||
|
|
||||||
import {
|
import {
|
||||||
warn,
|
warn,
|
||||||
|
@ -24,60 +24,60 @@ import {
|
||||||
isPlainObject,
|
isPlainObject,
|
||||||
isServerRendering,
|
isServerRendering,
|
||||||
isReservedAttribute,
|
isReservedAttribute,
|
||||||
invokeWithErrorHandling,
|
invokeWithErrorHandling
|
||||||
} from "../util/index";
|
} from '../util/index'
|
||||||
import type { Component } from "../../../typescript/component";
|
import type { Component } from '../../../typescript/component'
|
||||||
|
|
||||||
const sharedPropertyDefinition = {
|
const sharedPropertyDefinition = {
|
||||||
enumerable: true,
|
enumerable: true,
|
||||||
configurable: true,
|
configurable: true,
|
||||||
get: noop,
|
get: noop,
|
||||||
set: noop,
|
set: noop
|
||||||
};
|
}
|
||||||
|
|
||||||
export function proxy(target: Object, sourceKey: string, key: string) {
|
export function proxy(target: Object, sourceKey: string, key: string) {
|
||||||
sharedPropertyDefinition.get = function proxyGetter() {
|
sharedPropertyDefinition.get = function proxyGetter() {
|
||||||
return this[sourceKey][key];
|
return this[sourceKey][key]
|
||||||
};
|
}
|
||||||
sharedPropertyDefinition.set = function proxySetter(val) {
|
sharedPropertyDefinition.set = function proxySetter(val) {
|
||||||
this[sourceKey][key] = val;
|
this[sourceKey][key] = val
|
||||||
};
|
}
|
||||||
Object.defineProperty(target, key, sharedPropertyDefinition);
|
Object.defineProperty(target, key, sharedPropertyDefinition)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function initState(vm: Component) {
|
export function initState(vm: Component) {
|
||||||
vm._watchers = [];
|
vm._watchers = []
|
||||||
const opts = vm.$options;
|
const opts = vm.$options
|
||||||
if (opts.props) initProps(vm, opts.props);
|
if (opts.props) initProps(vm, opts.props)
|
||||||
if (opts.methods) initMethods(vm, opts.methods);
|
if (opts.methods) initMethods(vm, opts.methods)
|
||||||
if (opts.data) {
|
if (opts.data) {
|
||||||
initData(vm);
|
initData(vm)
|
||||||
} else {
|
} else {
|
||||||
observe((vm._data = {}), true /* asRootData */);
|
observe((vm._data = {}), true /* asRootData */)
|
||||||
}
|
}
|
||||||
if (opts.computed) initComputed(vm, opts.computed);
|
if (opts.computed) initComputed(vm, opts.computed)
|
||||||
if (opts.watch && opts.watch !== nativeWatch) {
|
if (opts.watch && opts.watch !== nativeWatch) {
|
||||||
initWatch(vm, opts.watch);
|
initWatch(vm, opts.watch)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function initProps(vm: Component, propsOptions: Object) {
|
function initProps(vm: Component, propsOptions: Object) {
|
||||||
const propsData = vm.$options.propsData || {};
|
const propsData = vm.$options.propsData || {}
|
||||||
const props = (vm._props = {});
|
const props = (vm._props = {})
|
||||||
// cache prop keys so that future props updates can iterate using Array
|
// cache prop keys so that future props updates can iterate using Array
|
||||||
// instead of dynamic object key enumeration.
|
// instead of dynamic object key enumeration.
|
||||||
const keys: string[] = (vm.$options._propKeys = []);
|
const keys: string[] = (vm.$options._propKeys = [])
|
||||||
const isRoot = !vm.$parent;
|
const isRoot = !vm.$parent
|
||||||
// root instance props should be converted
|
// root instance props should be converted
|
||||||
if (!isRoot) {
|
if (!isRoot) {
|
||||||
toggleObserving(false);
|
toggleObserving(false)
|
||||||
}
|
}
|
||||||
for (const key in propsOptions) {
|
for (const key in propsOptions) {
|
||||||
keys.push(key);
|
keys.push(key)
|
||||||
const value = validateProp(key, propsOptions, propsData, vm);
|
const value = validateProp(key, propsOptions, propsData, vm)
|
||||||
/* istanbul ignore else */
|
/* istanbul ignore else */
|
||||||
if (process.env.NODE_ENV !== "production") {
|
if (process.env.NODE_ENV !== 'production') {
|
||||||
const hyphenatedKey = hyphenate(key);
|
const hyphenatedKey = hyphenate(key)
|
||||||
if (
|
if (
|
||||||
isReservedAttribute(hyphenatedKey) ||
|
isReservedAttribute(hyphenatedKey) ||
|
||||||
config.isReservedAttr(hyphenatedKey)
|
config.isReservedAttr(hyphenatedKey)
|
||||||
|
@ -85,7 +85,7 @@ function initProps(vm: Component, propsOptions: Object) {
|
||||||
warn(
|
warn(
|
||||||
`"${hyphenatedKey}" is a reserved attribute and cannot be used as component prop.`,
|
`"${hyphenatedKey}" is a reserved attribute and cannot be used as component prop.`,
|
||||||
vm
|
vm
|
||||||
);
|
)
|
||||||
}
|
}
|
||||||
defineReactive(props, key, value, () => {
|
defineReactive(props, key, value, () => {
|
||||||
if (!isRoot && !isUpdatingChildComponent) {
|
if (!isRoot && !isUpdatingChildComponent) {
|
||||||
|
@ -95,90 +95,87 @@ function initProps(vm: Component, propsOptions: Object) {
|
||||||
`Instead, use a data or computed property based on the prop's ` +
|
`Instead, use a data or computed property based on the prop's ` +
|
||||||
`value. Prop being mutated: "${key}"`,
|
`value. Prop being mutated: "${key}"`,
|
||||||
vm
|
vm
|
||||||
);
|
)
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
} else {
|
} else {
|
||||||
defineReactive(props, key, value);
|
defineReactive(props, key, value)
|
||||||
}
|
}
|
||||||
// static props are already proxied on the component's prototype
|
// static props are already proxied on the component's prototype
|
||||||
// during Vue.extend(). We only need to proxy props defined at
|
// during Vue.extend(). We only need to proxy props defined at
|
||||||
// instantiation here.
|
// instantiation here.
|
||||||
if (!(key in vm)) {
|
if (!(key in vm)) {
|
||||||
proxy(vm, `_props`, key);
|
proxy(vm, `_props`, key)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
toggleObserving(true);
|
toggleObserving(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
function initData(vm: Component) {
|
function initData(vm: Component) {
|
||||||
let data: any = vm.$options.data;
|
let data: any = vm.$options.data
|
||||||
data = vm._data = typeof data === "function" ? getData(data, vm) : data || {};
|
data = vm._data = typeof data === 'function' ? getData(data, vm) : data || {}
|
||||||
if (!isPlainObject(data)) {
|
if (!isPlainObject(data)) {
|
||||||
data = {};
|
data = {}
|
||||||
process.env.NODE_ENV !== "production" &&
|
process.env.NODE_ENV !== 'production' &&
|
||||||
warn(
|
warn(
|
||||||
"data functions should return an object:\n" +
|
'data functions should return an object:\n' +
|
||||||
"https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function",
|
'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
|
||||||
vm
|
vm
|
||||||
);
|
)
|
||||||
}
|
}
|
||||||
// proxy data on instance
|
// proxy data on instance
|
||||||
const keys = Object.keys(data);
|
const keys = Object.keys(data)
|
||||||
const props = vm.$options.props;
|
const props = vm.$options.props
|
||||||
const methods = vm.$options.methods;
|
const methods = vm.$options.methods
|
||||||
let i = keys.length;
|
let i = keys.length
|
||||||
while (i--) {
|
while (i--) {
|
||||||
const key = keys[i];
|
const key = keys[i]
|
||||||
if (process.env.NODE_ENV !== "production") {
|
if (process.env.NODE_ENV !== 'production') {
|
||||||
if (methods && hasOwn(methods, key)) {
|
if (methods && hasOwn(methods, key)) {
|
||||||
warn(
|
warn(`Method "${key}" has already been defined as a data property.`, vm)
|
||||||
`Method "${key}" has already been defined as a data property.`,
|
|
||||||
vm
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (props && hasOwn(props, key)) {
|
if (props && hasOwn(props, key)) {
|
||||||
process.env.NODE_ENV !== "production" &&
|
process.env.NODE_ENV !== 'production' &&
|
||||||
warn(
|
warn(
|
||||||
`The data property "${key}" is already declared as a prop. ` +
|
`The data property "${key}" is already declared as a prop. ` +
|
||||||
`Use prop default value instead.`,
|
`Use prop default value instead.`,
|
||||||
vm
|
vm
|
||||||
);
|
)
|
||||||
} else if (!isReserved(key)) {
|
} else if (!isReserved(key)) {
|
||||||
proxy(vm, `_data`, key);
|
proxy(vm, `_data`, key)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// observe data
|
// observe data
|
||||||
observe(data, true /* asRootData */);
|
observe(data, true /* asRootData */)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getData(data: Function, vm: Component): any {
|
export function getData(data: Function, vm: Component): any {
|
||||||
// #7573 disable dep collection when invoking data getters
|
// #7573 disable dep collection when invoking data getters
|
||||||
pushTarget();
|
pushTarget()
|
||||||
try {
|
try {
|
||||||
return data.call(vm, vm);
|
return data.call(vm, vm)
|
||||||
} catch (e: any) {
|
} catch (e: any) {
|
||||||
handleError(e, vm, `data()`);
|
handleError(e, vm, `data()`)
|
||||||
return {};
|
return {}
|
||||||
} finally {
|
} finally {
|
||||||
popTarget();
|
popTarget()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const computedWatcherOptions = { lazy: true };
|
const computedWatcherOptions = { lazy: true }
|
||||||
|
|
||||||
function initComputed(vm: Component, computed: Object) {
|
function initComputed(vm: Component, computed: Object) {
|
||||||
// $flow-disable-line
|
// $flow-disable-line
|
||||||
const watchers = (vm._computedWatchers = Object.create(null));
|
const watchers = (vm._computedWatchers = Object.create(null))
|
||||||
// computed properties are just getters during SSR
|
// computed properties are just getters during SSR
|
||||||
const isSSR = isServerRendering();
|
const isSSR = isServerRendering()
|
||||||
|
|
||||||
for (const key in computed) {
|
for (const key in computed) {
|
||||||
const userDef = computed[key];
|
const userDef = computed[key]
|
||||||
const getter = typeof userDef === "function" ? userDef : userDef.get;
|
const getter = typeof userDef === 'function' ? userDef : userDef.get
|
||||||
if (process.env.NODE_ENV !== "production" && getter == null) {
|
if (process.env.NODE_ENV !== 'production' && getter == null) {
|
||||||
warn(`Getter is missing for computed property "${key}".`, vm);
|
warn(`Getter is missing for computed property "${key}".`, vm)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isSSR) {
|
if (!isSSR) {
|
||||||
|
@ -188,27 +185,24 @@ function initComputed(vm: Component, computed: Object) {
|
||||||
getter || noop,
|
getter || noop,
|
||||||
noop,
|
noop,
|
||||||
computedWatcherOptions
|
computedWatcherOptions
|
||||||
);
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
// component-defined computed properties are already defined on the
|
// component-defined computed properties are already defined on the
|
||||||
// component prototype. We only need to define computed properties defined
|
// component prototype. We only need to define computed properties defined
|
||||||
// at instantiation here.
|
// at instantiation here.
|
||||||
if (!(key in vm)) {
|
if (!(key in vm)) {
|
||||||
defineComputed(vm, key, userDef);
|
defineComputed(vm, key, userDef)
|
||||||
} else if (process.env.NODE_ENV !== "production") {
|
} else if (process.env.NODE_ENV !== 'production') {
|
||||||
if (key in vm.$data) {
|
if (key in vm.$data) {
|
||||||
warn(`The computed property "${key}" is already defined in data.`, vm);
|
warn(`The computed property "${key}" is already defined in data.`, vm)
|
||||||
} else if (vm.$options.props && key in vm.$options.props) {
|
} else if (vm.$options.props && key in vm.$options.props) {
|
||||||
warn(
|
warn(`The computed property "${key}" is already defined as a prop.`, vm)
|
||||||
`The computed property "${key}" is already defined as a prop.`,
|
|
||||||
vm
|
|
||||||
);
|
|
||||||
} else if (vm.$options.methods && key in vm.$options.methods) {
|
} else if (vm.$options.methods && key in vm.$options.methods) {
|
||||||
warn(
|
warn(
|
||||||
`The computed property "${key}" is already defined as a method.`,
|
`The computed property "${key}" is already defined as a method.`,
|
||||||
vm
|
vm
|
||||||
);
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -219,92 +213,91 @@ export function defineComputed(
|
||||||
key: string,
|
key: string,
|
||||||
userDef: Record<string, any> | Function
|
userDef: Record<string, any> | Function
|
||||||
) {
|
) {
|
||||||
const shouldCache = !isServerRendering();
|
const shouldCache = !isServerRendering()
|
||||||
if (typeof userDef === "function") {
|
if (typeof userDef === 'function') {
|
||||||
sharedPropertyDefinition.get = shouldCache
|
sharedPropertyDefinition.get = shouldCache
|
||||||
? createComputedGetter(key)
|
? createComputedGetter(key)
|
||||||
: createGetterInvoker(userDef);
|
: createGetterInvoker(userDef)
|
||||||
sharedPropertyDefinition.set = noop;
|
sharedPropertyDefinition.set = noop
|
||||||
} else {
|
} else {
|
||||||
sharedPropertyDefinition.get = userDef.get
|
sharedPropertyDefinition.get = userDef.get
|
||||||
? shouldCache && userDef.cache !== false
|
? shouldCache && userDef.cache !== false
|
||||||
? createComputedGetter(key)
|
? createComputedGetter(key)
|
||||||
: createGetterInvoker(userDef.get)
|
: createGetterInvoker(userDef.get)
|
||||||
: noop;
|
: noop
|
||||||
sharedPropertyDefinition.set = userDef.set || noop;
|
sharedPropertyDefinition.set = userDef.set || noop
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
process.env.NODE_ENV !== "production" &&
|
process.env.NODE_ENV !== 'production' &&
|
||||||
sharedPropertyDefinition.set === noop
|
sharedPropertyDefinition.set === noop
|
||||||
) {
|
) {
|
||||||
sharedPropertyDefinition.set = function () {
|
sharedPropertyDefinition.set = function () {
|
||||||
warn(
|
warn(
|
||||||
`Computed property "${key}" was assigned to but it has no setter.`,
|
`Computed property "${key}" was assigned to but it has no setter.`,
|
||||||
this
|
this
|
||||||
);
|
)
|
||||||
};
|
|
||||||
}
|
}
|
||||||
Object.defineProperty(target, key, sharedPropertyDefinition);
|
}
|
||||||
|
Object.defineProperty(target, key, sharedPropertyDefinition)
|
||||||
}
|
}
|
||||||
|
|
||||||
function createComputedGetter(key) {
|
function createComputedGetter(key) {
|
||||||
return function computedGetter() {
|
return function computedGetter() {
|
||||||
const watcher = this._computedWatchers && this._computedWatchers[key];
|
const watcher = this._computedWatchers && this._computedWatchers[key]
|
||||||
if (watcher) {
|
if (watcher) {
|
||||||
if (watcher.dirty) {
|
if (watcher.dirty) {
|
||||||
watcher.evaluate();
|
watcher.evaluate()
|
||||||
}
|
}
|
||||||
if (Dep.target) {
|
if (Dep.target) {
|
||||||
watcher.depend();
|
watcher.depend()
|
||||||
|
}
|
||||||
|
return watcher.value
|
||||||
}
|
}
|
||||||
return watcher.value;
|
|
||||||
}
|
}
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function createGetterInvoker(fn) {
|
function createGetterInvoker(fn) {
|
||||||
return function computedGetter() {
|
return function computedGetter() {
|
||||||
return fn.call(this, this);
|
return fn.call(this, this)
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function initMethods(vm: Component, methods: Object) {
|
function initMethods(vm: Component, methods: Object) {
|
||||||
const props = vm.$options.props;
|
const props = vm.$options.props
|
||||||
for (const key in methods) {
|
for (const key in methods) {
|
||||||
if (process.env.NODE_ENV !== "production") {
|
if (process.env.NODE_ENV !== 'production') {
|
||||||
if (typeof methods[key] !== "function") {
|
if (typeof methods[key] !== 'function') {
|
||||||
warn(
|
warn(
|
||||||
`Method "${key}" has type "${typeof methods[
|
`Method "${key}" has type "${typeof methods[
|
||||||
key
|
key
|
||||||
]}" in the component definition. ` +
|
]}" in the component definition. ` +
|
||||||
`Did you reference the function correctly?`,
|
`Did you reference the function correctly?`,
|
||||||
vm
|
vm
|
||||||
);
|
)
|
||||||
}
|
}
|
||||||
if (props && hasOwn(props, key)) {
|
if (props && hasOwn(props, key)) {
|
||||||
warn(`Method "${key}" has already been defined as a prop.`, vm);
|
warn(`Method "${key}" has already been defined as a prop.`, vm)
|
||||||
}
|
}
|
||||||
if (key in vm && isReserved(key)) {
|
if (key in vm && isReserved(key)) {
|
||||||
warn(
|
warn(
|
||||||
`Method "${key}" conflicts with an existing Vue instance method. ` +
|
`Method "${key}" conflicts with an existing Vue instance method. ` +
|
||||||
`Avoid defining component methods that start with _ or $.`
|
`Avoid defining component methods that start with _ or $.`
|
||||||
);
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
vm[key] =
|
vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm)
|
||||||
typeof methods[key] !== "function" ? noop : bind(methods[key], vm);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function initWatch(vm: Component, watch: Object) {
|
function initWatch(vm: Component, watch: Object) {
|
||||||
for (const key in watch) {
|
for (const key in watch) {
|
||||||
const handler = watch[key];
|
const handler = watch[key]
|
||||||
if (Array.isArray(handler)) {
|
if (Array.isArray(handler)) {
|
||||||
for (let i = 0; i < handler.length; i++) {
|
for (let i = 0; i < handler.length; i++) {
|
||||||
createWatcher(vm, key, handler[i]);
|
createWatcher(vm, key, handler[i])
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
createWatcher(vm, key, handler);
|
createWatcher(vm, key, handler)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -316,65 +309,65 @@ function createWatcher(
|
||||||
options?: Object
|
options?: Object
|
||||||
) {
|
) {
|
||||||
if (isPlainObject(handler)) {
|
if (isPlainObject(handler)) {
|
||||||
options = handler;
|
options = handler
|
||||||
handler = handler.handler;
|
handler = handler.handler
|
||||||
}
|
}
|
||||||
if (typeof handler === "string") {
|
if (typeof handler === 'string') {
|
||||||
handler = vm[handler];
|
handler = vm[handler]
|
||||||
}
|
}
|
||||||
return vm.$watch(expOrFn, handler, options);
|
return vm.$watch(expOrFn, handler, options)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function stateMixin(Vue: Component) {
|
export function stateMixin(Vue: Component) {
|
||||||
// flow somehow has problems with directly declared definition object
|
// flow somehow has problems with directly declared definition object
|
||||||
// when using Object.defineProperty, so we have to procedurally build up
|
// when using Object.defineProperty, so we have to procedurally build up
|
||||||
// the object here.
|
// the object here.
|
||||||
const dataDef: any = {};
|
const dataDef: any = {}
|
||||||
dataDef.get = function () {
|
dataDef.get = function () {
|
||||||
return this._data;
|
return this._data
|
||||||
};
|
}
|
||||||
const propsDef: any = {};
|
const propsDef: any = {}
|
||||||
propsDef.get = function () {
|
propsDef.get = function () {
|
||||||
return this._props;
|
return this._props
|
||||||
};
|
}
|
||||||
if (process.env.NODE_ENV !== "production") {
|
if (process.env.NODE_ENV !== 'production') {
|
||||||
dataDef.set = function () {
|
dataDef.set = function () {
|
||||||
warn(
|
warn(
|
||||||
"Avoid replacing instance root $data. " +
|
'Avoid replacing instance root $data. ' +
|
||||||
"Use nested data properties instead.",
|
'Use nested data properties instead.',
|
||||||
this
|
this
|
||||||
);
|
)
|
||||||
};
|
|
||||||
propsDef.set = function () {
|
|
||||||
warn(`$props is readonly.`, this);
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
Object.defineProperty(Vue.prototype, "$data", dataDef);
|
propsDef.set = function () {
|
||||||
Object.defineProperty(Vue.prototype, "$props", propsDef);
|
warn(`$props is readonly.`, this)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Object.defineProperty(Vue.prototype, '$data', dataDef)
|
||||||
|
Object.defineProperty(Vue.prototype, '$props', propsDef)
|
||||||
|
|
||||||
Vue.prototype.$set = set;
|
Vue.prototype.$set = set
|
||||||
Vue.prototype.$delete = del;
|
Vue.prototype.$delete = del
|
||||||
|
|
||||||
Vue.prototype.$watch = function (
|
Vue.prototype.$watch = function (
|
||||||
expOrFn: string | Function,
|
expOrFn: string | Function,
|
||||||
cb: any,
|
cb: any,
|
||||||
options?: Record<string, any>
|
options?: Record<string, any>
|
||||||
): Function {
|
): Function {
|
||||||
const vm: Component = this;
|
const vm: Component = this
|
||||||
if (isPlainObject(cb)) {
|
if (isPlainObject(cb)) {
|
||||||
return createWatcher(vm, expOrFn, cb, options);
|
return createWatcher(vm, expOrFn, cb, options)
|
||||||
}
|
}
|
||||||
options = options || {};
|
options = options || {}
|
||||||
options.user = true;
|
options.user = true
|
||||||
const watcher = new Watcher(vm, expOrFn, cb, options);
|
const watcher = new Watcher(vm, expOrFn, cb, options)
|
||||||
if (options.immediate) {
|
if (options.immediate) {
|
||||||
const info = `callback for immediate watcher "${watcher.expression}"`;
|
const info = `callback for immediate watcher "${watcher.expression}"`
|
||||||
pushTarget();
|
pushTarget()
|
||||||
invokeWithErrorHandling(cb, vm, [watcher.value], vm, info);
|
invokeWithErrorHandling(cb, vm, [watcher.value], vm, info)
|
||||||
popTarget();
|
popTarget()
|
||||||
}
|
}
|
||||||
return function unwatchFn() {
|
return function unwatchFn() {
|
||||||
watcher.teardown();
|
watcher.teardown()
|
||||||
};
|
}
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ const methodsToPatch = [
|
||||||
'unshift',
|
'unshift',
|
||||||
'splice',
|
'splice',
|
||||||
'sort',
|
'sort',
|
||||||
'reverse',
|
'reverse'
|
||||||
]
|
]
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -11,7 +11,7 @@ import {
|
||||||
isPrimitive,
|
isPrimitive,
|
||||||
isUndef,
|
isUndef,
|
||||||
isValidArrayIndex,
|
isValidArrayIndex,
|
||||||
isServerRendering,
|
isServerRendering
|
||||||
} from '../util/index'
|
} from '../util/index'
|
||||||
|
|
||||||
const arrayKeys = Object.getOwnPropertyNames(arrayMethods)
|
const arrayKeys = Object.getOwnPropertyNames(arrayMethods)
|
||||||
|
@ -187,7 +187,7 @@ export function defineReactive(
|
||||||
}
|
}
|
||||||
childOb = !shallow && observe(newVal)
|
childOb = !shallow && observe(newVal)
|
||||||
dep.notify()
|
dep.notify()
|
||||||
},
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -196,7 +196,11 @@ export function defineReactive(
|
||||||
* triggers change notification if the property doesn't
|
* triggers change notification if the property doesn't
|
||||||
* already exist.
|
* already exist.
|
||||||
*/
|
*/
|
||||||
export function set(target: Array<any> | Record<string,any>, key: any, val: any): any {
|
export function set(
|
||||||
|
target: Array<any> | Record<string, any>,
|
||||||
|
key: any,
|
||||||
|
val: any
|
||||||
|
): any {
|
||||||
if (
|
if (
|
||||||
process.env.NODE_ENV !== 'production' &&
|
process.env.NODE_ENV !== 'production' &&
|
||||||
(isUndef(target) || isPrimitive(target))
|
(isUndef(target) || isPrimitive(target))
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
import type Watcher from './watcher'
|
import type Watcher from './watcher'
|
||||||
import config from '../config'
|
import config from '../config'
|
||||||
import { callHook, activateChildComponent } from '../instance/lifecycle'
|
import { callHook, activateChildComponent } from '../instance/lifecycle'
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
import { _Set as Set, isObject } from '../util/index'
|
import { _Set as Set, isObject } from '../util/index'
|
||||||
import type { SimpleSet } from '../util/index'
|
import type { SimpleSet } from '../util/index'
|
||||||
import VNode from '../vdom/vnode'
|
import VNode from '../vdom/vnode'
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
import {
|
import {
|
||||||
warn,
|
warn,
|
||||||
remove,
|
remove,
|
||||||
|
@ -79,9 +78,8 @@ export default class Watcher {
|
||||||
this.newDeps = []
|
this.newDeps = []
|
||||||
this.depIds = new Set()
|
this.depIds = new Set()
|
||||||
this.newDepIds = new Set()
|
this.newDepIds = new Set()
|
||||||
this.expression = process.env.NODE_ENV !== 'production'
|
this.expression =
|
||||||
? expOrFn.toString()
|
process.env.NODE_ENV !== 'production' ? expOrFn.toString() : ''
|
||||||
: ''
|
|
||||||
// parse expression for getter
|
// parse expression for getter
|
||||||
if (typeof expOrFn === 'function') {
|
if (typeof expOrFn === 'function') {
|
||||||
this.getter = expOrFn
|
this.getter = expOrFn
|
||||||
|
@ -89,7 +87,8 @@ export default class Watcher {
|
||||||
this.getter = parsePath(expOrFn)
|
this.getter = parsePath(expOrFn)
|
||||||
if (!this.getter) {
|
if (!this.getter) {
|
||||||
this.getter = noop
|
this.getter = noop
|
||||||
process.env.NODE_ENV !== 'production' && warn(
|
process.env.NODE_ENV !== 'production' &&
|
||||||
|
warn(
|
||||||
`Failed watching path: "${expOrFn}" ` +
|
`Failed watching path: "${expOrFn}" ` +
|
||||||
'Watcher only accepts simple dot-delimited paths. ' +
|
'Watcher only accepts simple dot-delimited paths. ' +
|
||||||
'For full control, use a function instead.',
|
'For full control, use a function instead.',
|
||||||
|
@ -97,9 +96,7 @@ export default class Watcher {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.value = this.lazy
|
this.value = this.lazy ? undefined : this.get()
|
||||||
? undefined
|
|
||||||
: this.get()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -199,7 +196,13 @@ export default class Watcher {
|
||||||
this.value = value
|
this.value = value
|
||||||
if (this.user) {
|
if (this.user) {
|
||||||
const info = `callback for watcher "${this.expression}"`
|
const info = `callback for watcher "${this.expression}"`
|
||||||
invokeWithErrorHandling(this.cb, this.vm, [value, oldValue], this.vm, info)
|
invokeWithErrorHandling(
|
||||||
|
this.cb,
|
||||||
|
this.vm,
|
||||||
|
[value, oldValue],
|
||||||
|
this.vm,
|
||||||
|
info
|
||||||
|
)
|
||||||
} else {
|
} else {
|
||||||
this.cb.call(this.vm, value, oldValue)
|
this.cb.call(this.vm, value, oldValue)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
import config from '../config'
|
import config from '../config'
|
||||||
import { noop } from 'shared/util'
|
import { noop } from 'shared/util'
|
||||||
import type { Component } from 'typescript/component'
|
import type { Component } from 'typescript/component'
|
||||||
|
@ -11,8 +10,8 @@ export let formatComponentName: (vm: Component, includeFile?: false) => string
|
||||||
if (process.env.NODE_ENV !== 'production') {
|
if (process.env.NODE_ENV !== 'production') {
|
||||||
const hasConsole = typeof console !== 'undefined'
|
const hasConsole = typeof console !== 'undefined'
|
||||||
const classifyRE = /(?:^|[-_])(\w)/g
|
const classifyRE = /(?:^|[-_])(\w)/g
|
||||||
const classify = (str) =>
|
const classify = str =>
|
||||||
str.replace(classifyRE, (c) => c.toUpperCase()).replace(/[-_]/g, '')
|
str.replace(classifyRE, c => c.toUpperCase()).replace(/[-_]/g, '')
|
||||||
|
|
||||||
warn = (msg, vm) => {
|
warn = (msg, vm) => {
|
||||||
const trace = vm ? generateComponentTrace(vm) : ''
|
const trace = vm ? generateComponentTrace(vm) : ''
|
||||||
|
|
|
@ -42,7 +42,7 @@ export function invokeWithErrorHandling(
|
||||||
try {
|
try {
|
||||||
res = args ? handler.apply(context, args) : handler.call(context)
|
res = args ? handler.apply(context, args) : handler.call(context)
|
||||||
if (res && !res._isVue && isPromise(res) && !res._handled) {
|
if (res && !res._isVue && isPromise(res) && !res._handled) {
|
||||||
res.catch((e) => handleError(e, vm, info + ` (Promise/async)`))
|
res.catch(e => handleError(e, vm, info + ` (Promise/async)`))
|
||||||
// issue #9511
|
// issue #9511
|
||||||
// avoid catch triggering multiple times when nested calls
|
// avoid catch triggering multiple times when nested calls
|
||||||
res._handled = true
|
res._handled = true
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
export * from 'shared/util'
|
export * from 'shared/util'
|
||||||
export * from './lang'
|
export * from './lang'
|
||||||
export * from './env'
|
export * from './env'
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* unicode letters used for parsing html tags, component names and property paths.
|
* unicode letters used for parsing html tags, component names and property paths.
|
||||||
* using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
|
* using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
|
||||||
* skipping \u10000-\uEFFFF due to it freezing up PhantomJS
|
* skipping \u10000-\uEFFFF due to it freezing up PhantomJS
|
||||||
*/
|
*/
|
||||||
export const unicodeRegExp = /a-zA-Z\u00B7\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u037D\u037F-\u1FFF\u200C-\u200D\u203F-\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD/
|
export const unicodeRegExp =
|
||||||
|
/a-zA-Z\u00B7\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u037D\u037F-\u1FFF\u200C-\u200D\u203F-\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if a string starts with $ or _
|
* Check if a string starts with $ or _
|
||||||
|
@ -22,7 +22,7 @@ export function def(obj: Object, key: string, val: any, enumerable?: boolean) {
|
||||||
value: val,
|
value: val,
|
||||||
enumerable: !!enumerable,
|
enumerable: !!enumerable,
|
||||||
writable: true,
|
writable: true,
|
||||||
configurable: true,
|
configurable: true
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -64,7 +64,7 @@ if (typeof Promise !== 'undefined' && isNative(Promise)) {
|
||||||
const observer = new MutationObserver(flushCallbacks)
|
const observer = new MutationObserver(flushCallbacks)
|
||||||
const textNode = document.createTextNode(String(counter))
|
const textNode = document.createTextNode(String(counter))
|
||||||
observer.observe(textNode, {
|
observer.observe(textNode, {
|
||||||
characterData: true,
|
characterData: true
|
||||||
})
|
})
|
||||||
timerFunc = () => {
|
timerFunc = () => {
|
||||||
counter = (counter + 1) % 2
|
counter = (counter + 1) % 2
|
||||||
|
@ -104,7 +104,7 @@ export function nextTick(cb?: Function, ctx?: Object) {
|
||||||
}
|
}
|
||||||
// $flow-disable-line
|
// $flow-disable-line
|
||||||
if (!cb && typeof Promise !== 'undefined') {
|
if (!cb && typeof Promise !== 'undefined') {
|
||||||
return new Promise((resolve) => {
|
return new Promise(resolve => {
|
||||||
_resolve = resolve
|
_resolve = resolve
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
import config from '../config'
|
import config from '../config'
|
||||||
import { warn } from './debug'
|
import { warn } from './debug'
|
||||||
import { set } from '../observer/index'
|
import { set } from '../observer/index'
|
||||||
|
@ -14,7 +13,7 @@ import {
|
||||||
toRawType,
|
toRawType,
|
||||||
capitalize,
|
capitalize,
|
||||||
isBuiltInTag,
|
isBuiltInTag,
|
||||||
isPlainObject,
|
isPlainObject
|
||||||
} from 'shared/util'
|
} from 'shared/util'
|
||||||
import type { Component } from 'typescript/component'
|
import type { Component } from 'typescript/component'
|
||||||
import type { ComponentOptions } from 'typescript/options'
|
import type { ComponentOptions } from 'typescript/options'
|
||||||
|
@ -172,7 +171,7 @@ function dedupeHooks(hooks: any) {
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
LIFECYCLE_HOOKS.forEach((hook) => {
|
LIFECYCLE_HOOKS.forEach(hook => {
|
||||||
strats[hook] = mergeHook
|
strats[hook] = mergeHook
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -245,12 +244,16 @@ strats.watch = function (
|
||||||
/**
|
/**
|
||||||
* Other object hashes.
|
* Other object hashes.
|
||||||
*/
|
*/
|
||||||
strats.props = strats.methods = strats.inject = strats.computed = function (
|
strats.props =
|
||||||
|
strats.methods =
|
||||||
|
strats.inject =
|
||||||
|
strats.computed =
|
||||||
|
function (
|
||||||
parentVal: Object | null,
|
parentVal: Object | null,
|
||||||
childVal: Object | null,
|
childVal: Object | null,
|
||||||
vm: Component | null,
|
vm: Component | null,
|
||||||
key: string
|
key: string
|
||||||
): Object | null {
|
): Object | null {
|
||||||
if (childVal && process.env.NODE_ENV !== 'production') {
|
if (childVal && process.env.NODE_ENV !== 'production') {
|
||||||
assertObjectType(key, childVal, vm)
|
assertObjectType(key, childVal, vm)
|
||||||
}
|
}
|
||||||
|
@ -259,7 +262,7 @@ strats.props = strats.methods = strats.inject = strats.computed = function (
|
||||||
extend(ret, parentVal)
|
extend(ret, parentVal)
|
||||||
if (childVal) extend(ret, childVal)
|
if (childVal) extend(ret, childVal)
|
||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
strats.provide = mergeDataOrFn
|
strats.provide = mergeDataOrFn
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -13,7 +13,7 @@ if (process.env.NODE_ENV !== 'production') {
|
||||||
perf.clearMarks &&
|
perf.clearMarks &&
|
||||||
perf.clearMeasures
|
perf.clearMeasures
|
||||||
) {
|
) {
|
||||||
mark = (tag) => perf.mark(tag)
|
mark = tag => perf.mark(tag)
|
||||||
measure = (name, startTag, endTag) => {
|
measure = (name, startTag, endTag) => {
|
||||||
perf.measure(name, startTag, endTag)
|
perf.measure(name, startTag, endTag)
|
||||||
perf.clearMarks(startTag)
|
perf.clearMarks(startTag)
|
||||||
|
|
|
@ -128,7 +128,7 @@ function assertProp(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const haveExpectedTypes = expectedTypes.some((t) => t)
|
const haveExpectedTypes = expectedTypes.some(t => t)
|
||||||
if (!valid && haveExpectedTypes) {
|
if (!valid && haveExpectedTypes) {
|
||||||
warn(getInvalidTypeMessage(name, value, expectedTypes), vm)
|
warn(getInvalidTypeMessage(name, value, expectedTypes), vm)
|
||||||
return
|
return
|
||||||
|
@ -244,9 +244,9 @@ function styleValue(value, type) {
|
||||||
|
|
||||||
const EXPLICABLE_TYPES = ['string', 'number', 'boolean']
|
const EXPLICABLE_TYPES = ['string', 'number', 'boolean']
|
||||||
function isExplicable(value) {
|
function isExplicable(value) {
|
||||||
return EXPLICABLE_TYPES.some((elem) => value.toLowerCase() === elem)
|
return EXPLICABLE_TYPES.some(elem => value.toLowerCase() === elem)
|
||||||
}
|
}
|
||||||
|
|
||||||
function isBoolean(...args) {
|
function isBoolean(...args) {
|
||||||
return args.some((elem) => elem.toLowerCase() === 'boolean')
|
return args.some(elem => elem.toLowerCase() === 'boolean')
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
import VNode from './vnode'
|
import VNode from './vnode'
|
||||||
import { resolveConstructorOptions } from 'core/instance/init'
|
import { resolveConstructorOptions } from 'core/instance/init'
|
||||||
import { queueActivatedComponent } from 'core/observer/scheduler'
|
import { queueActivatedComponent } from 'core/observer/scheduler'
|
||||||
|
@ -9,7 +8,7 @@ import { warn, isDef, isUndef, isTrue, isObject } from '../util/index'
|
||||||
import {
|
import {
|
||||||
resolveAsyncComponent,
|
resolveAsyncComponent,
|
||||||
createAsyncPlaceholder,
|
createAsyncPlaceholder,
|
||||||
extractPropsFromVNodeData,
|
extractPropsFromVNodeData
|
||||||
} from './helpers/index'
|
} from './helpers/index'
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
@ -17,13 +16,13 @@ import {
|
||||||
activeInstance,
|
activeInstance,
|
||||||
updateChildComponent,
|
updateChildComponent,
|
||||||
activateChildComponent,
|
activateChildComponent,
|
||||||
deactivateChildComponent,
|
deactivateChildComponent
|
||||||
} from '../instance/lifecycle'
|
} from '../instance/lifecycle'
|
||||||
|
|
||||||
import type {
|
import type {
|
||||||
MountedComponentVNode,
|
MountedComponentVNode,
|
||||||
VNodeData,
|
VNodeData,
|
||||||
VNodeWithData,
|
VNodeWithData
|
||||||
} from 'typescript/vnode'
|
} from 'typescript/vnode'
|
||||||
import type { Component } from 'typescript/component'
|
import type { Component } from 'typescript/component'
|
||||||
import type { InternalComponentOptions } from 'typescript/options'
|
import type { InternalComponentOptions } from 'typescript/options'
|
||||||
|
@ -89,7 +88,7 @@ const componentVNodeHooks = {
|
||||||
deactivateChildComponent(componentInstance, true /* direct */)
|
deactivateChildComponent(componentInstance, true /* direct */)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const hooksToMerge = Object.keys(componentVNodeHooks)
|
const hooksToMerge = Object.keys(componentVNodeHooks)
|
||||||
|
@ -214,7 +213,7 @@ export function createComponentInstanceForVnode(
|
||||||
const options: InternalComponentOptions = {
|
const options: InternalComponentOptions = {
|
||||||
_isComponent: true,
|
_isComponent: true,
|
||||||
_parentVnode: vnode,
|
_parentVnode: vnode,
|
||||||
parent,
|
parent
|
||||||
}
|
}
|
||||||
// check inline-template render functions
|
// check inline-template render functions
|
||||||
const inlineTemplate = vnode.data.inlineTemplate
|
const inlineTemplate = vnode.data.inlineTemplate
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
import VNode, { cloneVNode } from './vnode'
|
import VNode, { cloneVNode } from './vnode'
|
||||||
import { createElement } from './create-element'
|
import { createElement } from './create-element'
|
||||||
import { resolveInject } from '../instance/inject'
|
import { resolveInject } from '../instance/inject'
|
||||||
|
@ -13,7 +12,7 @@ import {
|
||||||
hasOwn,
|
hasOwn,
|
||||||
camelize,
|
camelize,
|
||||||
emptyObject,
|
emptyObject,
|
||||||
validateProp,
|
validateProp
|
||||||
} from '../util/index'
|
} from '../util/index'
|
||||||
import type { Component } from 'typescript/component'
|
import type { Component } from 'typescript/component'
|
||||||
import type { VNodeData } from 'typescript/vnode'
|
import type { VNodeData } from 'typescript/vnode'
|
||||||
|
@ -64,7 +63,7 @@ export function FunctionalRenderContext(
|
||||||
enumerable: true,
|
enumerable: true,
|
||||||
get() {
|
get() {
|
||||||
return normalizeScopedSlots(data.scopedSlots, this.slots())
|
return normalizeScopedSlots(data.scopedSlots, this.slots())
|
||||||
},
|
}
|
||||||
} as any)
|
} as any)
|
||||||
|
|
||||||
// support for compiled functional template
|
// support for compiled functional template
|
||||||
|
@ -160,10 +159,11 @@ function cloneAndMarkFunctionalResult(
|
||||||
clone.fnContext = contextVm
|
clone.fnContext = contextVm
|
||||||
clone.fnOptions = options
|
clone.fnOptions = options
|
||||||
if (process.env.NODE_ENV !== 'production') {
|
if (process.env.NODE_ENV !== 'production') {
|
||||||
(clone.devtoolsMeta = clone.devtoolsMeta || {} as any).renderContext = renderContext
|
;(clone.devtoolsMeta = clone.devtoolsMeta || ({} as any)).renderContext =
|
||||||
|
renderContext
|
||||||
}
|
}
|
||||||
if (data.slot) {
|
if (data.slot) {
|
||||||
(clone.data || (clone.data = {})).slot = data.slot
|
;(clone.data || (clone.data = {})).slot = data.slot
|
||||||
}
|
}
|
||||||
return clone
|
return clone
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
|
|
||||||
import {
|
import {
|
||||||
tip,
|
tip,
|
||||||
hasOwn,
|
hasOwn,
|
||||||
isDef,
|
isDef,
|
||||||
isUndef,
|
isUndef,
|
||||||
hyphenate,
|
hyphenate,
|
||||||
formatComponentName,
|
formatComponentName
|
||||||
} from 'core/util/index'
|
} from 'core/util/index'
|
||||||
import type { Component } from 'typescript/component'
|
import type { Component } from 'typescript/component'
|
||||||
import type { VNodeData } from 'typescript/vnode'
|
import type { VNodeData } from 'typescript/vnode'
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
import { isDef } from 'shared/util'
|
import { isDef } from 'shared/util'
|
||||||
import VNode from '../vnode'
|
import VNode from '../vnode'
|
||||||
import { isAsyncPlaceholder } from './is-async-placeholder'
|
import { isAsyncPlaceholder } from './is-async-placeholder'
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
export * from './merge-hook'
|
export * from './merge-hook'
|
||||||
export * from './extract-props'
|
export * from './extract-props'
|
||||||
export * from './update-listeners'
|
export * from './update-listeners'
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
import VNode from '../vnode'
|
import VNode from '../vnode'
|
||||||
|
|
||||||
export function isAsyncPlaceholder(node: VNode): boolean {
|
export function isAsyncPlaceholder(node: VNode): boolean {
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
import VNode from '../vnode'
|
import VNode from '../vnode'
|
||||||
import { createFnInvoker } from './update-listeners'
|
import { createFnInvoker } from './update-listeners'
|
||||||
import { remove, isDef, isUndef, isTrue } from 'shared/util'
|
import { remove, isDef, isUndef, isTrue } from 'shared/util'
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
import VNode, { createTextVNode } from 'core/vdom/vnode'
|
import VNode, { createTextVNode } from 'core/vdom/vnode'
|
||||||
import { isFalse, isTrue, isDef, isUndef, isPrimitive } from 'shared/util'
|
import { isFalse, isTrue, isDef, isUndef, isPrimitive } from 'shared/util'
|
||||||
|
|
||||||
|
|
|
@ -1,23 +1,23 @@
|
||||||
import { def } from "core/util/lang";
|
import { def } from 'core/util/lang'
|
||||||
import { normalizeChildren } from "core/vdom/helpers/normalize-children";
|
import { normalizeChildren } from 'core/vdom/helpers/normalize-children'
|
||||||
import { emptyObject } from "shared/util";
|
import { emptyObject } from 'shared/util'
|
||||||
import { isAsyncPlaceholder } from "./is-async-placeholder";
|
import { isAsyncPlaceholder } from './is-async-placeholder'
|
||||||
import type VNode from "../vnode";
|
import type VNode from '../vnode'
|
||||||
|
|
||||||
export function normalizeScopedSlots(
|
export function normalizeScopedSlots(
|
||||||
slots: { [key: string]: Function } | void,
|
slots: { [key: string]: Function } | void,
|
||||||
normalSlots: { [key: string]: Array<VNode> },
|
normalSlots: { [key: string]: Array<VNode> },
|
||||||
prevSlots?: { [key: string]: Function } | void
|
prevSlots?: { [key: string]: Function } | void
|
||||||
): any {
|
): any {
|
||||||
let res;
|
let res
|
||||||
const hasNormalSlots = Object.keys(normalSlots).length > 0;
|
const hasNormalSlots = Object.keys(normalSlots).length > 0
|
||||||
const isStable = slots ? !!slots.$stable : !hasNormalSlots;
|
const isStable = slots ? !!slots.$stable : !hasNormalSlots
|
||||||
const key = slots && slots.$key;
|
const key = slots && slots.$key
|
||||||
if (!slots) {
|
if (!slots) {
|
||||||
res = {};
|
res = {}
|
||||||
} else if (slots._normalized) {
|
} else if (slots._normalized) {
|
||||||
// fast path 1: child component re-render only, parent did not change
|
// fast path 1: child component re-render only, parent did not change
|
||||||
return slots._normalized;
|
return slots._normalized
|
||||||
} else if (
|
} else if (
|
||||||
isStable &&
|
isStable &&
|
||||||
prevSlots &&
|
prevSlots &&
|
||||||
|
@ -28,46 +28,46 @@ export function normalizeScopedSlots(
|
||||||
) {
|
) {
|
||||||
// fast path 2: stable scoped slots w/ no normal slots to proxy,
|
// fast path 2: stable scoped slots w/ no normal slots to proxy,
|
||||||
// only need to normalize once
|
// only need to normalize once
|
||||||
return prevSlots;
|
return prevSlots
|
||||||
} else {
|
} else {
|
||||||
res = {};
|
res = {}
|
||||||
for (const key in slots) {
|
for (const key in slots) {
|
||||||
if (slots[key] && key[0] !== "$") {
|
if (slots[key] && key[0] !== '$') {
|
||||||
res[key] = normalizeScopedSlot(normalSlots, key, slots[key]);
|
res[key] = normalizeScopedSlot(normalSlots, key, slots[key])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// expose normal slots on scopedSlots
|
// expose normal slots on scopedSlots
|
||||||
for (const key in normalSlots) {
|
for (const key in normalSlots) {
|
||||||
if (!(key in res)) {
|
if (!(key in res)) {
|
||||||
res[key] = proxyNormalSlot(normalSlots, key);
|
res[key] = proxyNormalSlot(normalSlots, key)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// avoriaz seems to mock a non-extensible $scopedSlots object
|
// avoriaz seems to mock a non-extensible $scopedSlots object
|
||||||
// and when that is passed down this would cause an error
|
// and when that is passed down this would cause an error
|
||||||
if (slots && Object.isExtensible(slots)) {
|
if (slots && Object.isExtensible(slots)) {
|
||||||
slots._normalized = res;
|
slots._normalized = res
|
||||||
}
|
}
|
||||||
def(res, "$stable", isStable);
|
def(res, '$stable', isStable)
|
||||||
def(res, "$key", key);
|
def(res, '$key', key)
|
||||||
def(res, "$hasNormal", hasNormalSlots);
|
def(res, '$hasNormal', hasNormalSlots)
|
||||||
return res;
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
function normalizeScopedSlot(normalSlots, key, fn) {
|
function normalizeScopedSlot(normalSlots, key, fn) {
|
||||||
const normalized = function () {
|
const normalized = function () {
|
||||||
let res = arguments.length ? fn.apply(null, arguments) : fn({});
|
let res = arguments.length ? fn.apply(null, arguments) : fn({})
|
||||||
res =
|
res =
|
||||||
res && typeof res === "object" && !Array.isArray(res)
|
res && typeof res === 'object' && !Array.isArray(res)
|
||||||
? [res] // single vnode
|
? [res] // single vnode
|
||||||
: normalizeChildren(res);
|
: normalizeChildren(res)
|
||||||
const vnode: VNode | null = res && res[0];
|
const vnode: VNode | null = res && res[0]
|
||||||
return res &&
|
return res &&
|
||||||
(!vnode ||
|
(!vnode ||
|
||||||
(res.length === 1 && vnode.isComment && !isAsyncPlaceholder(vnode))) // #9658, #10391
|
(res.length === 1 && vnode.isComment && !isAsyncPlaceholder(vnode))) // #9658, #10391
|
||||||
? undefined
|
? undefined
|
||||||
: res;
|
: res
|
||||||
};
|
}
|
||||||
// this is a slot using the new v-slot syntax without scope. although it is
|
// this is a slot using the new v-slot syntax without scope. although it is
|
||||||
// compiled as a scoped slot, render fn users would expect it to be present
|
// compiled as a scoped slot, render fn users would expect it to be present
|
||||||
// on this.$slots because the usage is semantically a normal slot.
|
// on this.$slots because the usage is semantically a normal slot.
|
||||||
|
@ -75,12 +75,12 @@ function normalizeScopedSlot(normalSlots, key, fn) {
|
||||||
Object.defineProperty(normalSlots, key, {
|
Object.defineProperty(normalSlots, key, {
|
||||||
get: normalized,
|
get: normalized,
|
||||||
enumerable: true,
|
enumerable: true,
|
||||||
configurable: true,
|
configurable: true
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
return normalized;
|
return normalized
|
||||||
}
|
}
|
||||||
|
|
||||||
function proxyNormalSlot(slots, key) {
|
function proxyNormalSlot(slots, key) {
|
||||||
return () => slots[key];
|
return () => slots[key]
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
import {
|
import {
|
||||||
warn,
|
warn,
|
||||||
once,
|
once,
|
||||||
|
@ -8,7 +7,7 @@ import {
|
||||||
isObject,
|
isObject,
|
||||||
hasSymbol,
|
hasSymbol,
|
||||||
isPromise,
|
isPromise,
|
||||||
remove,
|
remove
|
||||||
} from 'core/util/index'
|
} from 'core/util/index'
|
||||||
|
|
||||||
import VNode, { createEmptyVNode } from 'core/vdom/vnode'
|
import VNode, { createEmptyVNode } from 'core/vdom/vnode'
|
||||||
|
@ -96,7 +95,7 @@ export function resolveAsyncComponent(
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
const reject = once((reason) => {
|
const reject = once(reason => {
|
||||||
process.env.NODE_ENV !== 'production' &&
|
process.env.NODE_ENV !== 'production' &&
|
||||||
warn(
|
warn(
|
||||||
`Failed to resolve async component: ${String(factory)}` +
|
`Failed to resolve async component: ${String(factory)}` +
|
||||||
|
|
|
@ -2,14 +2,17 @@ import { warn, invokeWithErrorHandling } from 'core/util/index'
|
||||||
import { cached, isUndef, isTrue } from 'shared/util'
|
import { cached, isUndef, isTrue } from 'shared/util'
|
||||||
import type { Component } from 'typescript/component'
|
import type { Component } from 'typescript/component'
|
||||||
|
|
||||||
const normalizeEvent = cached((name: string): {
|
const normalizeEvent = cached(
|
||||||
|
(
|
||||||
|
name: string
|
||||||
|
): {
|
||||||
name: string
|
name: string
|
||||||
once: boolean
|
once: boolean
|
||||||
capture: boolean
|
capture: boolean
|
||||||
passive: boolean
|
passive: boolean
|
||||||
handler?: Function
|
handler?: Function
|
||||||
params?: Array<any>
|
params?: Array<any>
|
||||||
} => {
|
} => {
|
||||||
const passive = name.charAt(0) === '&'
|
const passive = name.charAt(0) === '&'
|
||||||
name = passive ? name.slice(1) : name
|
name = passive ? name.slice(1) : name
|
||||||
const once = name.charAt(0) === '~' // Prefixed last, checked first
|
const once = name.charAt(0) === '~' // Prefixed last, checked first
|
||||||
|
@ -20,9 +23,10 @@ const normalizeEvent = cached((name: string): {
|
||||||
name,
|
name,
|
||||||
once,
|
once,
|
||||||
capture,
|
capture,
|
||||||
passive,
|
passive
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
|
)
|
||||||
|
|
||||||
export function createFnInvoker(
|
export function createFnInvoker(
|
||||||
fns: Function | Array<Function>,
|
fns: Function | Array<Function>,
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
import { emptyNode } from 'core/vdom/patch'
|
import { emptyNode } from 'core/vdom/patch'
|
||||||
import { resolveAsset, handleError } from 'core/util/index'
|
import { resolveAsset, handleError } from 'core/util/index'
|
||||||
import { mergeVNodeHook } from 'core/vdom/helpers/index'
|
import { mergeVNodeHook } from 'core/vdom/helpers/index'
|
||||||
|
@ -11,7 +10,7 @@ export default {
|
||||||
destroy: function unbindDirectives(vnode: VNodeWithData) {
|
destroy: function unbindDirectives(vnode: VNodeWithData) {
|
||||||
// @ts-expect-error emptyNode is not VNodeWithData
|
// @ts-expect-error emptyNode is not VNodeWithData
|
||||||
updateDirectives(vnode, emptyNode)
|
updateDirectives(vnode, emptyNode)
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateDirectives(oldVnode: VNodeWithData, vnode: VNodeWithData) {
|
function updateDirectives(oldVnode: VNodeWithData, vnode: VNodeWithData) {
|
||||||
|
|
|
@ -1,44 +1,44 @@
|
||||||
import { remove, isDef } from "shared/util";
|
import { remove, isDef } from 'shared/util'
|
||||||
import type { VNodeWithData } from "typescript/vnode";
|
import type { VNodeWithData } from 'typescript/vnode'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
create(_: any, vnode: VNodeWithData) {
|
create(_: any, vnode: VNodeWithData) {
|
||||||
registerRef(vnode);
|
registerRef(vnode)
|
||||||
},
|
},
|
||||||
update(oldVnode: VNodeWithData, vnode: VNodeWithData) {
|
update(oldVnode: VNodeWithData, vnode: VNodeWithData) {
|
||||||
if (oldVnode.data.ref !== vnode.data.ref) {
|
if (oldVnode.data.ref !== vnode.data.ref) {
|
||||||
registerRef(oldVnode, true);
|
registerRef(oldVnode, true)
|
||||||
registerRef(vnode);
|
registerRef(vnode)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
destroy(vnode: VNodeWithData) {
|
destroy(vnode: VNodeWithData) {
|
||||||
registerRef(vnode, true);
|
registerRef(vnode, true)
|
||||||
},
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
export function registerRef(vnode: VNodeWithData, isRemoval?: boolean) {
|
export function registerRef(vnode: VNodeWithData, isRemoval?: boolean) {
|
||||||
const key = vnode.data.ref;
|
const key = vnode.data.ref
|
||||||
if (!isDef(key)) return;
|
if (!isDef(key)) return
|
||||||
|
|
||||||
const vm = vnode.context;
|
const vm = vnode.context
|
||||||
const ref = vnode.componentInstance || vnode.elm;
|
const ref = vnode.componentInstance || vnode.elm
|
||||||
const refs = vm.$refs;
|
const refs = vm.$refs
|
||||||
const obj = refs[key];
|
const obj = refs[key]
|
||||||
if (isRemoval) {
|
if (isRemoval) {
|
||||||
if (Array.isArray(obj)) {
|
if (Array.isArray(obj)) {
|
||||||
remove(obj, ref);
|
remove(obj, ref)
|
||||||
} else if (obj === ref) {
|
} else if (obj === ref) {
|
||||||
refs[key] = undefined;
|
refs[key] = undefined
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (vnode.data.refInFor) {
|
if (vnode.data.refInFor) {
|
||||||
if (!Array.isArray(obj)) {
|
if (!Array.isArray(obj)) {
|
||||||
refs[key] = [ref];
|
refs[key] = [ref]
|
||||||
} else if (obj.indexOf(ref) < 0) {
|
} else if (obj.indexOf(ref) < 0) {
|
||||||
obj.push(ref);
|
obj.push(ref)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
refs[key] = ref;
|
refs[key] = ref
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ import {
|
||||||
isTrue,
|
isTrue,
|
||||||
makeMap,
|
makeMap,
|
||||||
isRegExp,
|
isRegExp,
|
||||||
isPrimitive,
|
isPrimitive
|
||||||
} from '../util/index'
|
} from '../util/index'
|
||||||
|
|
||||||
export const emptyNode = new VNode('', {}, [])
|
export const emptyNode = new VNode('', {}, [])
|
||||||
|
@ -35,17 +35,12 @@ const hooks = ['create', 'activate', 'update', 'remove', 'destroy']
|
||||||
function sameVnode(a, b) {
|
function sameVnode(a, b) {
|
||||||
return (
|
return (
|
||||||
a.key === b.key &&
|
a.key === b.key &&
|
||||||
a.asyncFactory === b.asyncFactory && (
|
a.asyncFactory === b.asyncFactory &&
|
||||||
(
|
((a.tag === b.tag &&
|
||||||
a.tag === b.tag &&
|
|
||||||
a.isComment === b.isComment &&
|
a.isComment === b.isComment &&
|
||||||
isDef(a.data) === isDef(b.data) &&
|
isDef(a.data) === isDef(b.data) &&
|
||||||
sameInputType(a, b)
|
sameInputType(a, b)) ||
|
||||||
) || (
|
(isTrue(a.isAsyncPlaceholder) && isUndef(b.asyncFactory.error)))
|
||||||
isTrue(a.isAsyncPlaceholder) &&
|
|
||||||
isUndef(b.asyncFactory.error)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,7 +105,7 @@ export function createPatchFunction(backend) {
|
||||||
!vnode.ns &&
|
!vnode.ns &&
|
||||||
!(
|
!(
|
||||||
config.ignoredElements.length &&
|
config.ignoredElements.length &&
|
||||||
config.ignoredElements.some((ignore) => {
|
config.ignoredElements.some(ignore => {
|
||||||
return isRegExp(ignore)
|
return isRegExp(ignore)
|
||||||
? ignore.test(vnode.tag)
|
? ignore.test(vnode.tag)
|
||||||
: ignore === vnode.tag
|
: ignore === vnode.tag
|
||||||
|
|
|
@ -1,35 +1,35 @@
|
||||||
import type { Component } from "typescript/component";
|
import type { Component } from 'typescript/component'
|
||||||
import type { ComponentOptions } from "typescript/options";
|
import type { ComponentOptions } from 'typescript/options'
|
||||||
import type { VNodeComponentOptions, VNodeData } from "typescript/vnode";
|
import type { VNodeComponentOptions, VNodeData } from 'typescript/vnode'
|
||||||
|
|
||||||
export default class VNode {
|
export default class VNode {
|
||||||
tag?: string;
|
tag?: string
|
||||||
data: VNodeData | undefined;
|
data: VNodeData | undefined
|
||||||
children?: Array<VNode> | null;
|
children?: Array<VNode> | null
|
||||||
text?: string;
|
text?: string
|
||||||
elm: Node | undefined;
|
elm: Node | undefined
|
||||||
ns?: string;
|
ns?: string
|
||||||
context?: Component; // rendered in this component's scope
|
context?: Component // rendered in this component's scope
|
||||||
key: string | number | undefined;
|
key: string | number | undefined
|
||||||
componentOptions?: VNodeComponentOptions;
|
componentOptions?: VNodeComponentOptions
|
||||||
componentInstance?: Component; // component instance
|
componentInstance?: Component // component instance
|
||||||
parent: VNode | undefined | null; // component placeholder node
|
parent: VNode | undefined | null // component placeholder node
|
||||||
|
|
||||||
// strictly internal
|
// strictly internal
|
||||||
raw: boolean; // contains raw HTML? (server only)
|
raw: boolean // contains raw HTML? (server only)
|
||||||
isStatic: boolean; // hoisted static node
|
isStatic: boolean // hoisted static node
|
||||||
isRootInsert: boolean; // necessary for enter transition check
|
isRootInsert: boolean // necessary for enter transition check
|
||||||
isComment: boolean; // empty comment placeholder?
|
isComment: boolean // empty comment placeholder?
|
||||||
isCloned: boolean; // is a cloned node?
|
isCloned: boolean // is a cloned node?
|
||||||
isOnce: boolean; // is a v-once node?
|
isOnce: boolean // is a v-once node?
|
||||||
asyncFactory?: Function; // async component factory function
|
asyncFactory?: Function // async component factory function
|
||||||
asyncMeta: Object | void;
|
asyncMeta: Object | void
|
||||||
isAsyncPlaceholder: boolean;
|
isAsyncPlaceholder: boolean
|
||||||
ssrContext?: Object | void;
|
ssrContext?: Object | void
|
||||||
fnContext: Component | void; // real context vm for functional nodes
|
fnContext: Component | void // real context vm for functional nodes
|
||||||
fnOptions?: ComponentOptions | null; // for SSR caching
|
fnOptions?: ComponentOptions | null // for SSR caching
|
||||||
devtoolsMeta?: Object | null; // used to store functional render context for devtools
|
devtoolsMeta?: Object | null // used to store functional render context for devtools
|
||||||
fnScopeId?: string | null; // functional scope id support
|
fnScopeId?: string | null // functional scope id support
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
tag?: string,
|
tag?: string,
|
||||||
|
@ -41,47 +41,47 @@ export default class VNode {
|
||||||
componentOptions?: VNodeComponentOptions,
|
componentOptions?: VNodeComponentOptions,
|
||||||
asyncFactory?: Function
|
asyncFactory?: Function
|
||||||
) {
|
) {
|
||||||
this.tag = tag;
|
this.tag = tag
|
||||||
this.data = data;
|
this.data = data
|
||||||
this.children = children;
|
this.children = children
|
||||||
this.text = text;
|
this.text = text
|
||||||
this.elm = elm;
|
this.elm = elm
|
||||||
this.ns = undefined;
|
this.ns = undefined
|
||||||
this.context = context;
|
this.context = context
|
||||||
this.fnContext = undefined;
|
this.fnContext = undefined
|
||||||
this.fnOptions = undefined;
|
this.fnOptions = undefined
|
||||||
this.fnScopeId = undefined;
|
this.fnScopeId = undefined
|
||||||
this.key = data && data.key;
|
this.key = data && data.key
|
||||||
this.componentOptions = componentOptions;
|
this.componentOptions = componentOptions
|
||||||
this.componentInstance = undefined;
|
this.componentInstance = undefined
|
||||||
this.parent = undefined;
|
this.parent = undefined
|
||||||
this.raw = false;
|
this.raw = false
|
||||||
this.isStatic = false;
|
this.isStatic = false
|
||||||
this.isRootInsert = true;
|
this.isRootInsert = true
|
||||||
this.isComment = false;
|
this.isComment = false
|
||||||
this.isCloned = false;
|
this.isCloned = false
|
||||||
this.isOnce = false;
|
this.isOnce = false
|
||||||
this.asyncFactory = asyncFactory;
|
this.asyncFactory = asyncFactory
|
||||||
this.asyncMeta = undefined;
|
this.asyncMeta = undefined
|
||||||
this.isAsyncPlaceholder = false;
|
this.isAsyncPlaceholder = false
|
||||||
}
|
}
|
||||||
|
|
||||||
// DEPRECATED: alias for componentInstance for backwards compat.
|
// DEPRECATED: alias for componentInstance for backwards compat.
|
||||||
/* istanbul ignore next */
|
/* istanbul ignore next */
|
||||||
get child(): Component | void {
|
get child(): Component | void {
|
||||||
return this.componentInstance;
|
return this.componentInstance
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const createEmptyVNode = (text: string = "") => {
|
export const createEmptyVNode = (text: string = '') => {
|
||||||
const node = new VNode();
|
const node = new VNode()
|
||||||
node.text = text;
|
node.text = text
|
||||||
node.isComment = true;
|
node.isComment = true
|
||||||
return node;
|
return node
|
||||||
};
|
}
|
||||||
|
|
||||||
export function createTextVNode(val: string | number) {
|
export function createTextVNode(val: string | number) {
|
||||||
return new VNode(undefined, undefined, undefined, String(val));
|
return new VNode(undefined, undefined, undefined, String(val))
|
||||||
}
|
}
|
||||||
|
|
||||||
// optimized shallow clone
|
// optimized shallow clone
|
||||||
|
@ -101,15 +101,15 @@ export function cloneVNode(vnode: VNode): VNode {
|
||||||
vnode.context,
|
vnode.context,
|
||||||
vnode.componentOptions,
|
vnode.componentOptions,
|
||||||
vnode.asyncFactory
|
vnode.asyncFactory
|
||||||
);
|
)
|
||||||
cloned.ns = vnode.ns;
|
cloned.ns = vnode.ns
|
||||||
cloned.isStatic = vnode.isStatic;
|
cloned.isStatic = vnode.isStatic
|
||||||
cloned.key = vnode.key;
|
cloned.key = vnode.key
|
||||||
cloned.isComment = vnode.isComment;
|
cloned.isComment = vnode.isComment
|
||||||
cloned.fnContext = vnode.fnContext;
|
cloned.fnContext = vnode.fnContext
|
||||||
cloned.fnOptions = vnode.fnOptions;
|
cloned.fnOptions = vnode.fnOptions
|
||||||
cloned.fnScopeId = vnode.fnScopeId;
|
cloned.fnScopeId = vnode.fnScopeId
|
||||||
cloned.asyncMeta = vnode.asyncMeta;
|
cloned.asyncMeta = vnode.asyncMeta
|
||||||
cloned.isCloned = true;
|
cloned.isCloned = true
|
||||||
return cloned;
|
return cloned
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
interface Window {
|
interface Window {
|
||||||
__VUE_DEVTOOLS_GLOBAL_HOOK__: DevtoolsHook;
|
__VUE_DEVTOOLS_GLOBAL_HOOK__: DevtoolsHook
|
||||||
}
|
}
|
||||||
|
|
||||||
// from https://github.com/vuejs/vue-devtools/blob/bc719c95a744614f5c3693460b64dc21dfa339a8/packages/app-backend-api/src/global-hook.ts#L3
|
// from https://github.com/vuejs/vue-devtools/blob/bc719c95a744614f5c3693460b64dc21dfa339a8/packages/app-backend-api/src/global-hook.ts#L3
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
import { addProp } from 'compiler/helpers'
|
import { addProp } from 'compiler/helpers'
|
||||||
|
|
||||||
export default function html(el: ASTElement, dir: ASTDirective) {
|
export default function html(el: ASTElement, dir: ASTDirective) {
|
||||||
|
|
|
@ -5,5 +5,5 @@ import html from './html'
|
||||||
export default {
|
export default {
|
||||||
model,
|
model,
|
||||||
text,
|
text,
|
||||||
html,
|
html
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
import config from 'core/config'
|
import config from 'core/config'
|
||||||
import { addHandler, addProp, getBindingAttr } from 'compiler/helpers'
|
import { addHandler, addProp, getBindingAttr } from 'compiler/helpers'
|
||||||
import { genComponentModel, genAssignmentCode } from 'compiler/directives/model'
|
import { genComponentModel, genAssignmentCode } from 'compiler/directives/model'
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
import { addProp } from 'compiler/helpers'
|
import { addProp } from 'compiler/helpers'
|
||||||
|
|
||||||
export default function text(el: ASTElement, dir: ASTDirective) {
|
export default function text(el: ASTElement, dir: ASTDirective) {
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
import { baseOptions } from './options'
|
import { baseOptions } from './options'
|
||||||
import { createCompiler } from 'compiler/index'
|
import { createCompiler } from 'compiler/index'
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
import { parseText } from 'compiler/parser/text-parser'
|
import { parseText } from 'compiler/parser/text-parser'
|
||||||
import { getAndRemoveAttr, getBindingAttr, baseWarn } from 'compiler/helpers'
|
import { getAndRemoveAttr, getBindingAttr, baseWarn } from 'compiler/helpers'
|
||||||
|
|
||||||
|
@ -40,5 +39,5 @@ function genData(el: ASTElement): string {
|
||||||
export default {
|
export default {
|
||||||
staticKeys: ['staticClass'],
|
staticKeys: ['staticClass'],
|
||||||
transformNode,
|
transformNode,
|
||||||
genData,
|
genData
|
||||||
} as ModuleOptions
|
} as ModuleOptions
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Expand input[v-model] with dynamic type bindings into v-if-else chains
|
* Expand input[v-model] with dynamic type bindings into v-if-else chains
|
||||||
* Turn this:
|
* Turn this:
|
||||||
|
@ -15,7 +14,7 @@ import {
|
||||||
processFor,
|
processFor,
|
||||||
processElement,
|
processElement,
|
||||||
addIfCondition,
|
addIfCondition,
|
||||||
createASTElement,
|
createASTElement
|
||||||
} from 'compiler/parser/index'
|
} from 'compiler/parser/index'
|
||||||
|
|
||||||
function preTransformNode(el: ASTElement, options: CompilerOptions) {
|
function preTransformNode(el: ASTElement, options: CompilerOptions) {
|
||||||
|
@ -48,7 +47,7 @@ function preTransformNode(el: ASTElement, options: CompilerOptions) {
|
||||||
branch0.if = `(${typeBinding})==='checkbox'` + ifConditionExtra
|
branch0.if = `(${typeBinding})==='checkbox'` + ifConditionExtra
|
||||||
addIfCondition(branch0, {
|
addIfCondition(branch0, {
|
||||||
exp: branch0.if,
|
exp: branch0.if,
|
||||||
block: branch0,
|
block: branch0
|
||||||
})
|
})
|
||||||
// 2. add radio else-if condition
|
// 2. add radio else-if condition
|
||||||
const branch1 = cloneASTElement(el)
|
const branch1 = cloneASTElement(el)
|
||||||
|
@ -57,7 +56,7 @@ function preTransformNode(el: ASTElement, options: CompilerOptions) {
|
||||||
processElement(branch1, options)
|
processElement(branch1, options)
|
||||||
addIfCondition(branch0, {
|
addIfCondition(branch0, {
|
||||||
exp: `(${typeBinding})==='radio'` + ifConditionExtra,
|
exp: `(${typeBinding})==='radio'` + ifConditionExtra,
|
||||||
block: branch1,
|
block: branch1
|
||||||
})
|
})
|
||||||
// 3. other
|
// 3. other
|
||||||
const branch2 = cloneASTElement(el)
|
const branch2 = cloneASTElement(el)
|
||||||
|
@ -66,7 +65,7 @@ function preTransformNode(el: ASTElement, options: CompilerOptions) {
|
||||||
processElement(branch2, options)
|
processElement(branch2, options)
|
||||||
addIfCondition(branch0, {
|
addIfCondition(branch0, {
|
||||||
exp: ifCondition!,
|
exp: ifCondition!,
|
||||||
block: branch2,
|
block: branch2
|
||||||
})
|
})
|
||||||
|
|
||||||
if (hasElse) {
|
if (hasElse) {
|
||||||
|
@ -85,5 +84,5 @@ function cloneASTElement(el) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
preTransformNode,
|
preTransformNode
|
||||||
} as ModuleOptions
|
} as ModuleOptions
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
import { parseText } from 'compiler/parser/text-parser'
|
import { parseText } from 'compiler/parser/text-parser'
|
||||||
import { parseStyleText } from 'web/util/style'
|
import { parseStyleText } from 'web/util/style'
|
||||||
import { getAndRemoveAttr, getBindingAttr, baseWarn } from 'compiler/helpers'
|
import { getAndRemoveAttr, getBindingAttr, baseWarn } from 'compiler/helpers'
|
||||||
|
@ -43,5 +42,5 @@ function genData(el: ASTElement): string {
|
||||||
export default {
|
export default {
|
||||||
staticKeys: ['staticStyle'],
|
staticKeys: ['staticStyle'],
|
||||||
transformNode,
|
transformNode,
|
||||||
genData,
|
genData
|
||||||
} as ModuleOptions
|
} as ModuleOptions
|
||||||
|
|
|
@ -2,13 +2,13 @@ import {
|
||||||
isPreTag,
|
isPreTag,
|
||||||
mustUseProp,
|
mustUseProp,
|
||||||
isReservedTag,
|
isReservedTag,
|
||||||
getTagNamespace,
|
getTagNamespace
|
||||||
} from "../util/index";
|
} from '../util/index'
|
||||||
|
|
||||||
import modules from "./modules/index";
|
import modules from './modules/index'
|
||||||
import directives from "./directives/index";
|
import directives from './directives/index'
|
||||||
import { genStaticKeys } from "shared/util";
|
import { genStaticKeys } from 'shared/util'
|
||||||
import { isUnaryTag, canBeLeftOpenTag } from "./util";
|
import { isUnaryTag, canBeLeftOpenTag } from './util'
|
||||||
|
|
||||||
export const baseOptions: CompilerOptions = {
|
export const baseOptions: CompilerOptions = {
|
||||||
expectHTML: true,
|
expectHTML: true,
|
||||||
|
@ -20,5 +20,5 @@ export const baseOptions: CompilerOptions = {
|
||||||
canBeLeftOpenTag,
|
canBeLeftOpenTag,
|
||||||
isReservedTag,
|
isReservedTag,
|
||||||
getTagNamespace,
|
getTagNamespace,
|
||||||
staticKeys: genStaticKeys(modules),
|
staticKeys: genStaticKeys(modules)
|
||||||
};
|
}
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
import { makeMap } from 'shared/util'
|
import { makeMap } from 'shared/util'
|
||||||
|
|
||||||
export const isUnaryTag = makeMap(
|
export const isUnaryTag = makeMap(
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
export { parseComponent } from 'sfc/parser'
|
export { parseComponent } from 'sfc/parser'
|
||||||
export { compile, compileToFunctions } from './compiler/index'
|
export { compile, compileToFunctions } from './compiler/index'
|
||||||
export { ssrCompile, ssrCompileToFunctions } from './server/compiler'
|
export { ssrCompile, ssrCompileToFunctions } from './server/compiler'
|
||||||
|
|
|
@ -7,12 +7,12 @@ import { query } from './util/index'
|
||||||
import { compileToFunctions } from './compiler/index'
|
import { compileToFunctions } from './compiler/index'
|
||||||
import {
|
import {
|
||||||
shouldDecodeNewlines,
|
shouldDecodeNewlines,
|
||||||
shouldDecodeNewlinesForHref,
|
shouldDecodeNewlinesForHref
|
||||||
} from './util/compat'
|
} from './util/compat'
|
||||||
import type { Component } from 'typescript/component'
|
import type { Component } from 'typescript/component'
|
||||||
import type { GlobalAPI } from 'typescript/global-api'
|
import type { GlobalAPI } from 'typescript/global-api'
|
||||||
|
|
||||||
const idToTemplate = cached((id) => {
|
const idToTemplate = cached(id => {
|
||||||
const el = query(id)
|
const el = query(id)
|
||||||
return el && el.innerHTML
|
return el && el.innerHTML
|
||||||
})
|
})
|
||||||
|
@ -74,7 +74,7 @@ Vue.prototype.$mount = function (
|
||||||
shouldDecodeNewlines,
|
shouldDecodeNewlines,
|
||||||
shouldDecodeNewlinesForHref,
|
shouldDecodeNewlinesForHref,
|
||||||
delimiters: options.delimiters,
|
delimiters: options.delimiters,
|
||||||
comments: options.comments,
|
comments: options.comments
|
||||||
},
|
},
|
||||||
this
|
this
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
import Vue from './runtime/index'
|
import Vue from './runtime/index'
|
||||||
|
|
||||||
export default Vue
|
export default Vue
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
import modules from './server/modules/index'
|
import modules from './server/modules/index'
|
||||||
import directives from './server/directives/index'
|
import directives from './server/directives/index'
|
||||||
import { isUnaryTag, canBeLeftOpenTag } from './compiler/util'
|
import { isUnaryTag, canBeLeftOpenTag } from './compiler/util'
|
||||||
|
@ -9,5 +8,5 @@ export default createBasicRenderer({
|
||||||
modules,
|
modules,
|
||||||
directives,
|
directives,
|
||||||
isUnaryTag,
|
isUnaryTag,
|
||||||
canBeLeftOpenTag,
|
canBeLeftOpenTag
|
||||||
})
|
})
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue