mirror of
https://gitee.com/vuejs/vue.git
synced 2024-12-01 19:48:14 +08:00
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
|
||||
},
|
||||
};
|
5
.prettierrc
Normal file
5
.prettierrc
Normal file
@ -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:transition": "karma start test/transition/karma.conf.js",
|
||||
"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:test": "tsc -p test/tsconfig.json --noEmit",
|
||||
"bench:ssr": "npm run build:ssr && node benchmarks/ssr/renderToString.js && node benchmarks/ssr/renderToStream.js",
|
||||
@ -42,7 +42,10 @@
|
||||
},
|
||||
"lint-staged": {
|
||||
"*.js": [
|
||||
"eslint --fix"
|
||||
"prettier --write"
|
||||
],
|
||||
"*.ts": [
|
||||
"prettier --parser=typescript --write"
|
||||
]
|
||||
},
|
||||
"repository": {
|
||||
@ -65,8 +68,6 @@
|
||||
"@rollup/plugin-replace": "^4.0.0",
|
||||
"@types/he": "^1.1.2",
|
||||
"@types/node": "^17.0.30",
|
||||
"@typescript-eslint/eslint-plugin": "^5.21.0",
|
||||
"@typescript-eslint/parser": "^5.21.0",
|
||||
"acorn": "^8.7.1",
|
||||
"acorn-walk": "^8.2.0",
|
||||
"chalk": "^4.0.0",
|
||||
@ -77,7 +78,6 @@
|
||||
"de-indent": "^1.0.2",
|
||||
"esbuild": "^0.14.39",
|
||||
"escodegen": "^2.0.0",
|
||||
"eslint": "^8.14.0",
|
||||
"file-loader": "^3.0.1",
|
||||
"hash-sum": "^2.0.0",
|
||||
"he": "^1.2.0",
|
||||
@ -95,6 +95,7 @@
|
||||
"lru-cache": "^7.8.1",
|
||||
"marked": "^3.0.8",
|
||||
"memory-fs": "^0.5.0",
|
||||
"prettier": "^2.6.2",
|
||||
"puppeteer": "^14.1.1",
|
||||
"resolve": "^1.22.0",
|
||||
"rollup": "^2.70.2",
|
||||
|
@ -1,3 +1,3 @@
|
||||
import { WebpackPlugin } from './types/plugin';
|
||||
declare const Plugin: WebpackPlugin;
|
||||
export = Plugin;
|
||||
import { WebpackPlugin } from './types/plugin'
|
||||
declare const Plugin: WebpackPlugin
|
||||
export = Plugin
|
||||
|
@ -1,3 +1,3 @@
|
||||
import { WebpackPlugin } from './types/plugin';
|
||||
declare const Plugin: WebpackPlugin;
|
||||
export = Plugin;
|
||||
import { WebpackPlugin } from './types/plugin'
|
||||
declare const Plugin: WebpackPlugin
|
||||
export = Plugin
|
||||
|
59
packages/vue-server-renderer/types/index.d.ts
vendored
59
packages/vue-server-renderer/types/index.d.ts
vendored
@ -1,50 +1,53 @@
|
||||
import Vue, { VNode, VNodeDirective } from 'vue';
|
||||
import { Readable } from 'stream';
|
||||
import Vue, { VNode, VNodeDirective } from 'vue'
|
||||
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 {
|
||||
renderToString(vm: Vue, callback: RenderCallback): void;
|
||||
renderToString(vm: Vue, context: object, callback: RenderCallback): void;
|
||||
renderToString(vm: Vue): Promise<string>;
|
||||
renderToString(vm: Vue, context: object): Promise<string>;
|
||||
renderToString(vm: Vue, callback: RenderCallback): void
|
||||
renderToString(vm: Vue, context: object, callback: RenderCallback): void
|
||||
renderToString(vm: Vue): Promise<string>
|
||||
renderToString(vm: Vue, context: object): Promise<string>
|
||||
|
||||
renderToStream(vm: Vue, context?: object): Readable;
|
||||
renderToStream(vm: Vue, context?: object): Readable
|
||||
}
|
||||
|
||||
interface BundleRenderer {
|
||||
renderToString(callback: RenderCallback): void;
|
||||
renderToString(context: object, callback: RenderCallback): void;
|
||||
renderToString(): Promise<string>;
|
||||
renderToString(context: object): Promise<string>;
|
||||
renderToString(callback: RenderCallback): void
|
||||
renderToString(context: object, callback: RenderCallback): void
|
||||
renderToString(): Promise<string>
|
||||
renderToString(context: object): Promise<string>
|
||||
|
||||
renderToStream(context?: object): Readable;
|
||||
renderToStream(context?: object): Readable
|
||||
}
|
||||
|
||||
interface RendererOptions {
|
||||
template?: string;
|
||||
inject?: boolean;
|
||||
shouldPreload?: (file: string, type: string) => boolean;
|
||||
shouldPrefetch?: (file: string, type: string) => boolean;
|
||||
cache?: RenderCache;
|
||||
template?: string
|
||||
inject?: boolean
|
||||
shouldPreload?: (file: string, type: string) => boolean
|
||||
shouldPrefetch?: (file: string, type: string) => boolean
|
||||
cache?: RenderCache
|
||||
directives?: {
|
||||
[key: string]: (vnode: VNode, dir: VNodeDirective) => void
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
interface BundleRendererOptions extends RendererOptions {
|
||||
clientManifest?: object;
|
||||
serializer?: (state: object) => string;
|
||||
runInNewContext?: boolean | 'once';
|
||||
basedir?: string;
|
||||
clientManifest?: object
|
||||
serializer?: (state: object) => string
|
||||
runInNewContext?: boolean | 'once'
|
||||
basedir?: string
|
||||
}
|
||||
|
||||
interface RenderCache {
|
||||
get: (key: string, cb?: (res: string) => void) => string | void;
|
||||
set: (key: string, val: string) => void;
|
||||
has?: (key: string, cb?: (hit: boolean) => void) => boolean | void;
|
||||
get: (key: string, cb?: (res: string) => void) => string | void
|
||||
set: (key: string, val: string) => void
|
||||
has?: (key: string, cb?: (hit: boolean) => void) => boolean | void
|
||||
}
|
||||
|
@ -1,11 +1,11 @@
|
||||
import { DefinePlugin } from 'webpack';
|
||||
import { DefinePlugin } from 'webpack'
|
||||
|
||||
interface WebpackPluginOptions {
|
||||
filename?: string;
|
||||
filename?: string
|
||||
}
|
||||
|
||||
export interface WebpackPlugin {
|
||||
// NOTE NOT SURE ABOUT THIS
|
||||
// TODO DOUBLE CHECK HERE
|
||||
new (options?: WebpackPluginOptions): DefinePlugin;
|
||||
new (options?: WebpackPluginOptions): DefinePlugin
|
||||
}
|
||||
|
248
packages/vue-template-compiler/types/index.d.ts
vendored
248
packages/vue-template-compiler/types/index.d.ts
vendored
@ -1,13 +1,13 @@
|
||||
import Vue, { VNode } from "vue"
|
||||
import Vue, { VNode } from 'vue'
|
||||
|
||||
/*
|
||||
* Template compilation options / results
|
||||
*/
|
||||
interface CompilerOptions {
|
||||
modules?: ModuleOptions[];
|
||||
directives?: Record<string, DirectiveFunction>;
|
||||
preserveWhitespace?: boolean;
|
||||
whitespace?: 'preserve' | 'condense';
|
||||
modules?: ModuleOptions[]
|
||||
directives?: Record<string, DirectiveFunction>
|
||||
preserveWhitespace?: boolean
|
||||
whitespace?: 'preserve' | 'condense'
|
||||
outputSourceRange?: any
|
||||
}
|
||||
|
||||
@ -16,34 +16,34 @@ interface CompilerOptionsWithSourceRange extends CompilerOptions {
|
||||
}
|
||||
|
||||
interface ErrorWithRange {
|
||||
msg: string;
|
||||
start: number;
|
||||
end: number;
|
||||
msg: string
|
||||
start: number
|
||||
end: number
|
||||
}
|
||||
|
||||
interface CompiledResult<ErrorType> {
|
||||
ast: ASTElement | undefined;
|
||||
render: string;
|
||||
staticRenderFns: string[];
|
||||
errors: ErrorType[];
|
||||
tips: ErrorType[];
|
||||
ast: ASTElement | undefined
|
||||
render: string
|
||||
staticRenderFns: string[]
|
||||
errors: ErrorType[]
|
||||
tips: ErrorType[]
|
||||
}
|
||||
|
||||
interface CompiledResultFunctions {
|
||||
render: () => VNode;
|
||||
staticRenderFns: (() => VNode)[];
|
||||
render: () => VNode
|
||||
staticRenderFns: (() => VNode)[]
|
||||
}
|
||||
|
||||
interface ModuleOptions {
|
||||
preTransformNode: (el: ASTElement) => ASTElement | undefined;
|
||||
transformNode: (el: ASTElement) => ASTElement | undefined;
|
||||
postTransformNode: (el: ASTElement) => void;
|
||||
genData: (el: ASTElement) => string;
|
||||
transformCode?: (el: ASTElement, code: string) => string;
|
||||
staticKeys?: string[];
|
||||
preTransformNode: (el: ASTElement) => ASTElement | undefined
|
||||
transformNode: (el: ASTElement) => ASTElement | undefined
|
||||
postTransformNode: (el: ASTElement) => void
|
||||
genData: (el: ASTElement) => string
|
||||
transformCode?: (el: ASTElement, code: string) => string
|
||||
staticKeys?: string[]
|
||||
}
|
||||
|
||||
type DirectiveFunction = (node: ASTElement, directiveMeta: ASTDirective) => void;
|
||||
type DirectiveFunction = (node: ASTElement, directiveMeta: ASTDirective) => void
|
||||
|
||||
/*
|
||||
* AST Types
|
||||
@ -59,153 +59,153 @@ type DirectiveFunction = (node: ASTElement, directiveMeta: ASTDirective) => void
|
||||
export type SSROptimizability = 0 | 1 | 2 | 3 | 4
|
||||
|
||||
export interface ASTModifiers {
|
||||
[key: string]: boolean;
|
||||
[key: string]: boolean
|
||||
}
|
||||
|
||||
export interface ASTIfCondition {
|
||||
exp: string | undefined;
|
||||
block: ASTElement;
|
||||
exp: string | undefined
|
||||
block: ASTElement
|
||||
}
|
||||
|
||||
export interface ASTElementHandler {
|
||||
value: string;
|
||||
params?: any[];
|
||||
modifiers: ASTModifiers | undefined;
|
||||
value: string
|
||||
params?: any[]
|
||||
modifiers: ASTModifiers | undefined
|
||||
}
|
||||
|
||||
export interface ASTElementHandlers {
|
||||
[key: string]: ASTElementHandler | ASTElementHandler[];
|
||||
[key: string]: ASTElementHandler | ASTElementHandler[]
|
||||
}
|
||||
|
||||
export interface ASTDirective {
|
||||
name: string;
|
||||
rawName: string;
|
||||
value: string;
|
||||
arg: string | undefined;
|
||||
modifiers: ASTModifiers | undefined;
|
||||
name: string
|
||||
rawName: string
|
||||
value: string
|
||||
arg: string | undefined
|
||||
modifiers: ASTModifiers | undefined
|
||||
}
|
||||
|
||||
export type ASTNode = ASTElement | ASTText | ASTExpression;
|
||||
export type ASTNode = ASTElement | ASTText | ASTExpression
|
||||
|
||||
export interface ASTElement {
|
||||
type: 1;
|
||||
tag: string;
|
||||
attrsList: { name: string; value: any }[];
|
||||
attrsMap: Record<string, any>;
|
||||
parent: ASTElement | undefined;
|
||||
children: ASTNode[];
|
||||
type: 1
|
||||
tag: string
|
||||
attrsList: { name: string; value: any }[]
|
||||
attrsMap: Record<string, any>
|
||||
parent: ASTElement | undefined
|
||||
children: ASTNode[]
|
||||
|
||||
processed?: true;
|
||||
processed?: true
|
||||
|
||||
static?: boolean;
|
||||
staticRoot?: boolean;
|
||||
staticInFor?: boolean;
|
||||
staticProcessed?: boolean;
|
||||
hasBindings?: boolean;
|
||||
static?: boolean
|
||||
staticRoot?: boolean
|
||||
staticInFor?: boolean
|
||||
staticProcessed?: boolean
|
||||
hasBindings?: boolean
|
||||
|
||||
text?: string;
|
||||
attrs?: { name: string; value: any }[];
|
||||
props?: { name: string; value: string }[];
|
||||
plain?: boolean;
|
||||
pre?: true;
|
||||
ns?: string;
|
||||
text?: string
|
||||
attrs?: { name: string; value: any }[]
|
||||
props?: { name: string; value: string }[]
|
||||
plain?: boolean
|
||||
pre?: true
|
||||
ns?: string
|
||||
|
||||
component?: string;
|
||||
inlineTemplate?: true;
|
||||
transitionMode?: string | null;
|
||||
slotName?: string;
|
||||
slotTarget?: string;
|
||||
slotScope?: string;
|
||||
scopedSlots?: Record<string, ASTElement>;
|
||||
component?: string
|
||||
inlineTemplate?: true
|
||||
transitionMode?: string | null
|
||||
slotName?: string
|
||||
slotTarget?: string
|
||||
slotScope?: string
|
||||
scopedSlots?: Record<string, ASTElement>
|
||||
|
||||
ref?: string;
|
||||
refInFor?: boolean;
|
||||
ref?: string
|
||||
refInFor?: boolean
|
||||
|
||||
if?: string;
|
||||
ifProcessed?: boolean;
|
||||
elseif?: string;
|
||||
else?: true;
|
||||
ifConditions?: ASTIfCondition[];
|
||||
if?: string
|
||||
ifProcessed?: boolean
|
||||
elseif?: string
|
||||
else?: true
|
||||
ifConditions?: ASTIfCondition[]
|
||||
|
||||
for?: string;
|
||||
forProcessed?: boolean;
|
||||
key?: string;
|
||||
alias?: string;
|
||||
iterator1?: string;
|
||||
iterator2?: string;
|
||||
for?: string
|
||||
forProcessed?: boolean
|
||||
key?: string
|
||||
alias?: string
|
||||
iterator1?: string
|
||||
iterator2?: string
|
||||
|
||||
staticClass?: string;
|
||||
classBinding?: string;
|
||||
staticStyle?: string;
|
||||
styleBinding?: string;
|
||||
events?: ASTElementHandlers;
|
||||
nativeEvents?: ASTElementHandlers;
|
||||
staticClass?: string
|
||||
classBinding?: string
|
||||
staticStyle?: string
|
||||
styleBinding?: string
|
||||
events?: ASTElementHandlers
|
||||
nativeEvents?: ASTElementHandlers
|
||||
|
||||
transition?: string | true;
|
||||
transitionOnAppear?: boolean;
|
||||
transition?: string | true
|
||||
transitionOnAppear?: boolean
|
||||
|
||||
model?: {
|
||||
value: string;
|
||||
callback: string;
|
||||
expression: string;
|
||||
};
|
||||
value: string
|
||||
callback: string
|
||||
expression: string
|
||||
}
|
||||
|
||||
directives?: ASTDirective[];
|
||||
directives?: ASTDirective[]
|
||||
|
||||
forbidden?: true;
|
||||
once?: true;
|
||||
onceProcessed?: boolean;
|
||||
wrapData?: (code: string) => string;
|
||||
wrapListeners?: (code: string) => string;
|
||||
forbidden?: true
|
||||
once?: true
|
||||
onceProcessed?: boolean
|
||||
wrapData?: (code: string) => string
|
||||
wrapListeners?: (code: string) => string
|
||||
|
||||
// 2.4 ssr optimization
|
||||
ssrOptimizability?: SSROptimizability;
|
||||
ssrOptimizability?: SSROptimizability
|
||||
}
|
||||
|
||||
export interface ASTExpression {
|
||||
type: 2;
|
||||
expression: string;
|
||||
text: string;
|
||||
tokens: (string | Record<string, any>)[];
|
||||
static?: boolean;
|
||||
type: 2
|
||||
expression: string
|
||||
text: string
|
||||
tokens: (string | Record<string, any>)[]
|
||||
static?: boolean
|
||||
// 2.4 ssr optimization
|
||||
ssrOptimizability?: SSROptimizability;
|
||||
ssrOptimizability?: SSROptimizability
|
||||
}
|
||||
|
||||
export interface ASTText {
|
||||
type: 3;
|
||||
text: string;
|
||||
static?: boolean;
|
||||
isComment?: boolean;
|
||||
type: 3
|
||||
text: string
|
||||
static?: boolean
|
||||
isComment?: boolean
|
||||
// 2.4 ssr optimization
|
||||
ssrOptimizability?: SSROptimizability;
|
||||
ssrOptimizability?: SSROptimizability
|
||||
}
|
||||
|
||||
/*
|
||||
* SFC parser related types
|
||||
*/
|
||||
interface SFCParserOptions {
|
||||
pad?: true | 'line' | 'space';
|
||||
pad?: true | 'line' | 'space'
|
||||
deindent?: boolean
|
||||
}
|
||||
|
||||
export interface SFCBlock {
|
||||
type: string;
|
||||
content: string;
|
||||
attrs: Record<string, string>;
|
||||
start?: number;
|
||||
end?: number;
|
||||
lang?: string;
|
||||
src?: string;
|
||||
scoped?: boolean;
|
||||
module?: string | boolean;
|
||||
type: string
|
||||
content: string
|
||||
attrs: Record<string, string>
|
||||
start?: number
|
||||
end?: number
|
||||
lang?: string
|
||||
src?: string
|
||||
scoped?: boolean
|
||||
module?: string | boolean
|
||||
}
|
||||
|
||||
export interface SFCDescriptor {
|
||||
template: SFCBlock | undefined;
|
||||
script: SFCBlock | undefined;
|
||||
styles: SFCBlock[];
|
||||
customBlocks: SFCBlock[];
|
||||
template: SFCBlock | undefined
|
||||
script: SFCBlock | undefined
|
||||
styles: SFCBlock[]
|
||||
customBlocks: SFCBlock[]
|
||||
}
|
||||
|
||||
/*
|
||||
@ -219,29 +219,29 @@ export function compile(
|
||||
export function compile(
|
||||
template: string,
|
||||
options?: CompilerOptions
|
||||
): CompiledResult<string>;
|
||||
): CompiledResult<string>
|
||||
|
||||
export function compileToFunctions(template: string): CompiledResultFunctions;
|
||||
export function compileToFunctions(template: string): CompiledResultFunctions
|
||||
|
||||
export function ssrCompile(
|
||||
template: string,
|
||||
options: CompilerOptionsWithSourceRange
|
||||
): CompiledResult<ErrorWithRange>;
|
||||
): CompiledResult<ErrorWithRange>
|
||||
|
||||
export function ssrCompile(
|
||||
template: string,
|
||||
options?: CompilerOptions
|
||||
): CompiledResult<string>;
|
||||
): CompiledResult<string>
|
||||
|
||||
export function ssrCompileToFunctions(template: string): CompiledResultFunctions;
|
||||
export function ssrCompileToFunctions(template: string): CompiledResultFunctions
|
||||
|
||||
export function parseComponent(
|
||||
file: string,
|
||||
options?: SFCParserOptions
|
||||
): SFCDescriptor;
|
||||
): SFCDescriptor
|
||||
|
||||
export function generateCodeFrame(
|
||||
template: string,
|
||||
start: number,
|
||||
end: number
|
||||
): string;
|
||||
): string
|
||||
|
@ -1,4 +1,4 @@
|
||||
import Vue, { VNode } from "vue";
|
||||
import Vue, { VNode } from 'vue'
|
||||
import {
|
||||
compile,
|
||||
compileToFunctions,
|
||||
@ -6,10 +6,10 @@ import {
|
||||
ssrCompileToFunctions,
|
||||
parseComponent,
|
||||
generateCodeFrame
|
||||
} from "./";
|
||||
} from './'
|
||||
|
||||
// check compile options
|
||||
const compiled = compile("<div>hi</div>", {
|
||||
const compiled = compile('<div>hi</div>', {
|
||||
outputSourceRange: true,
|
||||
preserveWhitespace: false,
|
||||
whitespace: 'condense',
|
||||
@ -18,24 +18,24 @@ const compiled = compile("<div>hi</div>", {
|
||||
preTransformNode: el => el,
|
||||
transformNode: el => el,
|
||||
postTransformNode: el => {
|
||||
el.tag = "p";
|
||||
el.tag = 'p'
|
||||
},
|
||||
genData: el => el.tag,
|
||||
transformCode: (el, code) => code,
|
||||
staticKeys: ["test"]
|
||||
staticKeys: ['test']
|
||||
}
|
||||
],
|
||||
directives: {
|
||||
test: (node, directiveMeta) => {
|
||||
node.tag;
|
||||
directiveMeta.value;
|
||||
node.tag
|
||||
directiveMeta.value
|
||||
}
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
// can be passed to function constructor
|
||||
new Function(compiled.render);
|
||||
compiled.staticRenderFns.map(fn => new Function(fn));
|
||||
new Function(compiled.render)
|
||||
compiled.staticRenderFns.map(fn => new Function(fn))
|
||||
|
||||
// with outputSourceRange: true
|
||||
// errors should be objects with range
|
||||
@ -61,30 +61,30 @@ errors3.forEach(e => {
|
||||
console.log(e.length)
|
||||
})
|
||||
|
||||
const compiledFns = compileToFunctions("<div>hi</div>");
|
||||
const compiledFns = compileToFunctions('<div>hi</div>')
|
||||
|
||||
// can be passed to component render / staticRenderFns options
|
||||
const vm = new Vue({
|
||||
data() {
|
||||
return {
|
||||
test: "Test"
|
||||
};
|
||||
test: 'Test'
|
||||
}
|
||||
},
|
||||
render: compiledFns.render,
|
||||
staticRenderFns: compiledFns.staticRenderFns
|
||||
});
|
||||
})
|
||||
|
||||
// can be called with component instance
|
||||
const vnode: VNode = compiledFns.render.call(vm);
|
||||
const vnode: VNode = compiledFns.render.call(vm)
|
||||
|
||||
// check SFC parser
|
||||
const desc = parseComponent("<template></template>", {
|
||||
pad: "space",
|
||||
const desc = parseComponent('<template></template>', {
|
||||
pad: 'space',
|
||||
deindent: false
|
||||
});
|
||||
})
|
||||
|
||||
const templateContent: string = desc.template!.content;
|
||||
const scriptContent: string = desc.script!.content;
|
||||
const styleContent: string = desc.styles.map(s => s.content).join("\n");
|
||||
const templateContent: string = desc.template!.content
|
||||
const scriptContent: string = desc.script!.content
|
||||
const styleContent: string = desc.styles.map(s => s.content).join('\n')
|
||||
|
||||
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
|
||||
'@types/he': ^1.1.2
|
||||
'@types/node': ^17.0.30
|
||||
'@typescript-eslint/eslint-plugin': ^5.21.0
|
||||
'@typescript-eslint/parser': ^5.21.0
|
||||
acorn: ^8.7.1
|
||||
acorn-walk: ^8.2.0
|
||||
chalk: ^4.0.0
|
||||
@ -19,7 +17,6 @@ specifiers:
|
||||
de-indent: ^1.0.2
|
||||
esbuild: ^0.14.39
|
||||
escodegen: ^2.0.0
|
||||
eslint: ^8.14.0
|
||||
file-loader: ^3.0.1
|
||||
hash-sum: ^2.0.0
|
||||
he: ^1.2.0
|
||||
@ -37,6 +34,7 @@ specifiers:
|
||||
lru-cache: ^7.8.1
|
||||
marked: ^3.0.8
|
||||
memory-fs: ^0.5.0
|
||||
prettier: ^2.6.2
|
||||
puppeteer: ^14.1.1
|
||||
resolve: ^1.22.0
|
||||
rollup: ^2.70.2
|
||||
@ -60,8 +58,6 @@ devDependencies:
|
||||
'@rollup/plugin-replace': 4.0.0_rollup@2.74.0
|
||||
'@types/he': 1.1.2
|
||||
'@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-walk: 8.2.0
|
||||
chalk: 4.1.2
|
||||
@ -72,7 +68,6 @@ devDependencies:
|
||||
de-indent: 1.0.2
|
||||
esbuild: 0.14.39
|
||||
escodegen: 2.0.0
|
||||
eslint: 8.15.0
|
||||
file-loader: 3.0.1_webpack@4.46.0
|
||||
hash-sum: 2.0.0
|
||||
he: 1.2.0
|
||||
@ -90,6 +85,7 @@ devDependencies:
|
||||
lru-cache: 7.10.1
|
||||
marked: 3.0.8
|
||||
memory-fs: 0.5.0
|
||||
prettier: 2.6.2
|
||||
puppeteer: 14.1.1
|
||||
resolve: 1.22.0
|
||||
rollup: 2.74.0
|
||||
@ -204,64 +200,11 @@ packages:
|
||||
'@cspotcode/source-map-consumer': 0.8.0
|
||||
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:
|
||||
resolution: {integrity: sha512-H9XAx3hc0BQHY6l+IFSWHDySypcXsvsuLhgYLUGywmJ5pswRVQJUHpOsobnLYp2ZUaUlKiKDrgWWhosOwAEM8Q==}
|
||||
engines: {node: '>=6.9.0'}
|
||||
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:
|
||||
resolution: {integrity: sha512-QI5fsEvm9bDzt32k39wpOwZhVzRcL5ydcffUHMyLVaVaLeC70I8TJZ17F1z1eMoLu4E/UOcH9BWVkKpIKdrfiw==}
|
||||
engines: {node: '>=8.0.0'}
|
||||
@ -388,10 +331,6 @@ packages:
|
||||
resolution: {integrity: sha512-kSJPcLO1x+oolc0R89pUl2kozldQ/fVQ1C1p5mp8fPoLdF/ZcBvckaTC2M8xXh3GYendXvCpy5m/a2eSbfgNgw==}
|
||||
dev: true
|
||||
|
||||
/@types/json-schema/7.0.11:
|
||||
resolution: {integrity: sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==}
|
||||
dev: true
|
||||
|
||||
/@types/minimist/1.2.2:
|
||||
resolution: {integrity: sha512-jhuKLIRrhvCPLqwPcx6INqmKeiA5EWrsCOPhrlFSrbrmU4ZMPjj5Ul/oLCMDO98XRUIwVm78xICz4EPCektzeQ==}
|
||||
dev: true
|
||||
@ -423,132 +362,6 @@ packages:
|
||||
dev: 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:
|
||||
resolution: {integrity: sha512-C6wW5L+b7ogSDVqymbkkvuW9kruN//YisMED04xzeBBqjHa2FYnmvOlS6Xj68xWQRgWvI9cIglsjFowH/RJyEA==}
|
||||
dependencies:
|
||||
@ -719,14 +532,6 @@ packages:
|
||||
acorn-walk: 7.2.0
|
||||
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:
|
||||
resolution: {integrity: sha512-OPdCF6GsMIP+Az+aWfAAOEt2/+iVDKE7oy6lJ098aoe59oAmK76qV6Gw60SbZ8jHuG2wH058GF4pLFbYamYrVA==}
|
||||
engines: {node: '>=0.4.0'}
|
||||
@ -878,10 +683,6 @@ packages:
|
||||
resolution: {integrity: sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==}
|
||||
dev: true
|
||||
|
||||
/argparse/2.0.1:
|
||||
resolution: {integrity: sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==}
|
||||
dev: true
|
||||
|
||||
/arr-diff/4.0.0:
|
||||
resolution: {integrity: sha512-YVIQ82gZPGBebQV/a8dar4AitzCQs0jjXwMPZllpXMaGjXPYVUawSxQrRsjhjupyVxEvbHgUmIhKVlND+j02kA==}
|
||||
engines: {node: '>=0.10.0'}
|
||||
@ -901,11 +702,6 @@ packages:
|
||||
resolution: {integrity: sha512-c5AMf34bKdvPhQ7tBGhqkgKNUzMr4WUs+WDtC2ZUGOUncbxKMTvqxYctiseW3+L4bA8ec+GcZ6/A/FW4m8ukng==}
|
||||
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:
|
||||
resolution: {integrity: sha512-SleRWjh9JUud2wH1hPs9rZBZ33H6T9HOiL0uwGnGx9FpE6wKGyfWugmbkEOIs6qWrZhg0LWeLziLrEwQJhs5mQ==}
|
||||
engines: {node: '>=0.10.0'}
|
||||
@ -1236,6 +1032,7 @@ packages:
|
||||
resolution: {integrity: sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==}
|
||||
engines: {node: '>=6'}
|
||||
dev: true
|
||||
optional: true
|
||||
|
||||
/camelcase-keys/6.2.2:
|
||||
resolution: {integrity: sha512-YrwaA0vEKazPBkn0ipTiMpSajYDSe+KjQfrjhcBMxJt/znbvlHd8Pw/Vamaz5EB4Wfhs3SUR3Z9mwRu/P3s3Yg==}
|
||||
@ -2053,20 +1850,6 @@ packages:
|
||||
randombytes: 2.1.0
|
||||
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:
|
||||
resolution: {integrity: sha1-ViromZ9Evl6jB29UGdzVnrQ6yVs=}
|
||||
dependencies:
|
||||
@ -2421,11 +2204,6 @@ packages:
|
||||
engines: {node: '>=0.8.0'}
|
||||
dev: true
|
||||
|
||||
/escape-string-regexp/4.0.0:
|
||||
resolution: {integrity: sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==}
|
||||
engines: {node: '>=10'}
|
||||
dev: true
|
||||
|
||||
/escodegen/2.0.0:
|
||||
resolution: {integrity: sha512-mmHKys/C8BFUGI+MAWNcSYoORYLMdPzjrknd2Vc+bUsjN5bXcr8EhrNB+UTqfL1y3I9c4fw2ihgtMPQLBRiQxw==}
|
||||
engines: {node: '>=6.0'}
|
||||
@ -2447,108 +2225,12 @@ packages:
|
||||
estraverse: 4.3.0
|
||||
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:
|
||||
resolution: {integrity: sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==}
|
||||
engines: {node: '>=4'}
|
||||
hasBin: 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:
|
||||
resolution: {integrity: sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==}
|
||||
engines: {node: '>=4.0'}
|
||||
@ -2707,17 +2389,6 @@ packages:
|
||||
resolution: {integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==}
|
||||
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:
|
||||
resolution: {integrity: sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==}
|
||||
dev: true
|
||||
@ -2726,12 +2397,6 @@ packages:
|
||||
resolution: {integrity: sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=}
|
||||
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:
|
||||
resolution: {integrity: sha1-JcfInLH5B3+IkbvmHY85Dq4lbx4=}
|
||||
dependencies:
|
||||
@ -2749,13 +2414,6 @@ packages:
|
||||
escape-string-regexp: 1.0.5
|
||||
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:
|
||||
resolution: {integrity: sha512-4sNIOXgtH/9WZq4NvlfU3Opn5ynUsqBwSLyM+I7UOwdGigTBYfVVQEwe/msZNX/j4pCJTIM14Fsw66Svo1oVrw==}
|
||||
engines: {node: '>= 6.9.0'}
|
||||
@ -2873,14 +2531,6 @@ packages:
|
||||
resolve-dir: 1.0.1
|
||||
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:
|
||||
resolution: {integrity: sha512-WIWGi2L3DyTUvUrwRKgGi9TwxQMUEqPOPQBVi71R96jZXJdFskXEmf54BoZaS1kknGODoIGASGEzBUYdyMCBJg==}
|
||||
dev: true
|
||||
@ -2988,10 +2638,6 @@ packages:
|
||||
resolution: {integrity: sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==}
|
||||
dev: true
|
||||
|
||||
/functional-red-black-tree/1.0.1:
|
||||
resolution: {integrity: sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=}
|
||||
dev: true
|
||||
|
||||
/get-caller-file/2.0.5:
|
||||
resolution: {integrity: sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==}
|
||||
engines: {node: 6.* || 8.* || >= 10.*}
|
||||
@ -3092,13 +2738,6 @@ packages:
|
||||
is-glob: 4.0.3
|
||||
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:
|
||||
resolution: {integrity: sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A==}
|
||||
dependencies:
|
||||
@ -3149,25 +2788,6 @@ packages:
|
||||
which: 1.3.1
|
||||
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:
|
||||
resolution: {integrity: sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==}
|
||||
dev: true
|
||||
@ -3375,11 +2995,6 @@ packages:
|
||||
resolution: {integrity: sha1-xg7taebY/bazEEofy8ocGS3FtQE=}
|
||||
dev: true
|
||||
|
||||
/ignore/5.2.0:
|
||||
resolution: {integrity: sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==}
|
||||
engines: {node: '>= 4'}
|
||||
dev: true
|
||||
|
||||
/import-fresh/3.3.0:
|
||||
resolution: {integrity: sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==}
|
||||
engines: {node: '>=6'}
|
||||
@ -3387,6 +3002,7 @@ packages:
|
||||
parent-module: 1.0.1
|
||||
resolve-from: 4.0.0
|
||||
dev: true
|
||||
optional: true
|
||||
|
||||
/imurmurhash/0.1.4:
|
||||
resolution: {integrity: sha1-khi5srkoojixPcT7a21XbyMUU+o=}
|
||||
@ -3692,13 +3308,6 @@ packages:
|
||||
resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==}
|
||||
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:
|
||||
resolution: {integrity: sha512-RYAyjCbxy/vri/CfnjUWJQQtZ3LKlLnDqj+9XLNnJPgEGeirZs3hllKR20re8LUZ6o1b1X4Jat+Qd26zmP41+A==}
|
||||
engines: {node: '>=12'}
|
||||
@ -3753,10 +3362,6 @@ packages:
|
||||
resolution: {integrity: sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==}
|
||||
dev: true
|
||||
|
||||
/json-stable-stringify-without-jsonify/1.0.1:
|
||||
resolution: {integrity: sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=}
|
||||
dev: true
|
||||
|
||||
/json-stringify-safe/5.0.1:
|
||||
resolution: {integrity: sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=}
|
||||
dev: true
|
||||
@ -3889,14 +3494,6 @@ packages:
|
||||
type-check: 0.3.2
|
||||
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:
|
||||
resolution: {integrity: sha512-bfTIN7lEsiooCocSISTWXkiWJkRqtL9wYtYy+8EK3Y41qh3mpwPU0ycTOgjdY9ErwXCc8QyrQp82bdL0Xkm9yA==}
|
||||
engines: {node: '>=10'}
|
||||
@ -4019,10 +3616,6 @@ packages:
|
||||
resolution: {integrity: sha1-dx7Hg540c9nEzeKLGTlMNWL09tM=}
|
||||
dev: true
|
||||
|
||||
/lodash.merge/4.6.2:
|
||||
resolution: {integrity: sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==}
|
||||
dev: true
|
||||
|
||||
/lodash.sortby/4.7.0:
|
||||
resolution: {integrity: sha1-7dFMgk4sycHgsKG0K7UhBRakJDg=}
|
||||
dev: true
|
||||
@ -4213,11 +3806,6 @@ packages:
|
||||
resolution: {integrity: sha512-jz+Cfrg9GWOZbQAnDQ4hlVnQky+341Yk5ru8bZSe6sIDTCIg8n9i/u7hSQGSVOF3C7lH6mGtqjkiT9G4wFLL0w==}
|
||||
dev: true
|
||||
|
||||
/merge2/1.4.1:
|
||||
resolution: {integrity: sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==}
|
||||
engines: {node: '>= 8'}
|
||||
dev: true
|
||||
|
||||
/micromatch/3.1.10:
|
||||
resolution: {integrity: sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==}
|
||||
engines: {node: '>=0.10.0'}
|
||||
@ -4412,10 +4000,6 @@ packages:
|
||||
- supports-color
|
||||
dev: true
|
||||
|
||||
/natural-compare/1.4.0:
|
||||
resolution: {integrity: sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=}
|
||||
dev: true
|
||||
|
||||
/negotiator/0.6.3:
|
||||
resolution: {integrity: sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==}
|
||||
engines: {node: '>= 0.6'}
|
||||
@ -4598,18 +4182,6 @@ packages:
|
||||
word-wrap: 1.2.3
|
||||
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:
|
||||
resolution: {integrity: sha1-hUNzx/XCMVkU/Jv8a9gjj92h7Cc=}
|
||||
dev: true
|
||||
@ -4708,6 +4280,7 @@ packages:
|
||||
dependencies:
|
||||
callsites: 3.1.0
|
||||
dev: true
|
||||
optional: true
|
||||
|
||||
/parse-asn1/5.1.6:
|
||||
resolution: {integrity: sha512-RnZRo1EPU6JBnra2vGHj0yhp6ebyjBZpmUCLHWiFhxlzvBCCpAuZ7elsBp1PVAbQN0/04VD/19rfzlBSwLstMw==}
|
||||
@ -4817,6 +4390,7 @@ packages:
|
||||
resolution: {integrity: sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==}
|
||||
engines: {node: '>=8'}
|
||||
dev: true
|
||||
optional: true
|
||||
|
||||
/pathval/1.1.1:
|
||||
resolution: {integrity: sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==}
|
||||
@ -4907,9 +4481,10 @@ packages:
|
||||
engines: {node: '>= 0.8.0'}
|
||||
dev: true
|
||||
|
||||
/prelude-ls/1.2.1:
|
||||
resolution: {integrity: sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==}
|
||||
engines: {node: '>= 0.8.0'}
|
||||
/prettier/2.6.2:
|
||||
resolution: {integrity: sha512-PkUpF+qoXTqhOeWL9fu7As8LXsIUZ1WYaJiY/a7McAQzxjk82OF0tibkFXVCDImZtWxbvojFjerkiLb0/q8mew==}
|
||||
engines: {node: '>=10.13.0'}
|
||||
hasBin: true
|
||||
dev: true
|
||||
|
||||
/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.
|
||||
dev: true
|
||||
|
||||
/queue-microtask/1.2.3:
|
||||
resolution: {integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==}
|
||||
dev: true
|
||||
|
||||
/quick-lru/4.0.1:
|
||||
resolution: {integrity: sha512-ARhCpm70fzdcvNQfPoy49IaanKkTlRWF2JMzqhcJbhSFRZv7nPTvZJdcY7301IPmvW+/p0RgIWnQDLJxifsQ7g==}
|
||||
engines: {node: '>=8'}
|
||||
@ -5187,11 +4758,6 @@ packages:
|
||||
safe-regex: 1.1.0
|
||||
dev: true
|
||||
|
||||
/regexpp/3.2.0:
|
||||
resolution: {integrity: sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==}
|
||||
engines: {node: '>=8'}
|
||||
dev: true
|
||||
|
||||
/remove-trailing-separator/1.1.0:
|
||||
resolution: {integrity: sha1-wkvOKig62tW8P1jg1IJJuSN52O8=}
|
||||
dev: true
|
||||
@ -5228,6 +4794,7 @@ packages:
|
||||
resolution: {integrity: sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==}
|
||||
engines: {node: '>=4'}
|
||||
dev: true
|
||||
optional: true
|
||||
|
||||
/resolve-from/5.0.0:
|
||||
resolution: {integrity: sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==}
|
||||
@ -5278,11 +4845,6 @@ packages:
|
||||
engines: {node: '>=0.12'}
|
||||
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:
|
||||
resolution: {integrity: sha512-V2hovdzFbOi77/WajaSMXk2OLm+xNIeQdMMuB7icj7bk6zi2F8GGAxigcnDFpJHbNyNcgyJDiP+8nOrY5cZGrA==}
|
||||
dev: true
|
||||
@ -5337,12 +4899,6 @@ packages:
|
||||
engines: {node: '>=0.12.0'}
|
||||
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:
|
||||
resolution: {integrity: sha1-6Eg5bwV9Ij8kOGkkYY4laUFh7Ec=}
|
||||
dependencies:
|
||||
@ -5857,11 +5413,6 @@ packages:
|
||||
engines: {node: '>=8'}
|
||||
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:
|
||||
resolution: {integrity: sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==}
|
||||
engines: {node: '>=4'}
|
||||
@ -5960,10 +5511,6 @@ packages:
|
||||
engines: {node: '>=0.10'}
|
||||
dev: true
|
||||
|
||||
/text-table/0.2.0:
|
||||
resolution: {integrity: sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=}
|
||||
dev: true
|
||||
|
||||
/through/2.3.8:
|
||||
resolution: {integrity: sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=}
|
||||
dev: true
|
||||
@ -6127,16 +5674,6 @@ packages:
|
||||
resolution: {integrity: sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==}
|
||||
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:
|
||||
resolution: {integrity: sha1-oVe6QC2iTpv5V/mqadUk7tQpAaY=}
|
||||
dev: true
|
||||
@ -6148,13 +5685,6 @@ packages:
|
||||
prelude-ls: 1.1.2
|
||||
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:
|
||||
resolution: {integrity: sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==}
|
||||
engines: {node: '>=4'}
|
||||
@ -6165,11 +5695,6 @@ packages:
|
||||
engines: {node: '>=10'}
|
||||
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:
|
||||
resolution: {integrity: sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==}
|
||||
engines: {node: '>=10'}
|
||||
@ -6330,10 +5855,6 @@ packages:
|
||||
resolution: {integrity: sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==}
|
||||
dev: true
|
||||
|
||||
/v8-compile-cache/2.3.0:
|
||||
resolution: {integrity: sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA==}
|
||||
dev: true
|
||||
|
||||
/validate-npm-package-license/3.0.4:
|
||||
resolution: {integrity: sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==}
|
||||
dependencies:
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
const range = 2
|
||||
|
||||
export function generateCodeFrame(
|
||||
|
@ -36,7 +36,7 @@ const keyNames: { [key: string]: string | Array<string> } = {
|
||||
// #4868: modifiers that prevent the execution of the listener
|
||||
// need to explicitly return null so that we can determine whether to remove
|
||||
// the listener for .once
|
||||
const genGuard = (condition) => `if(${condition})return null;`
|
||||
const genGuard = condition => `if(${condition})return null;`
|
||||
|
||||
const modifierCode: { [key: string]: string } = {
|
||||
stop: '$event.stopPropagation();',
|
||||
@ -83,7 +83,7 @@ function genHandler(
|
||||
}
|
||||
|
||||
if (Array.isArray(handler)) {
|
||||
return `[${handler.map((handler) => genHandler(handler)).join(',')}]`
|
||||
return `[${handler.map(handler => genHandler(handler)).join(',')}]`
|
||||
}
|
||||
|
||||
const isMethodPath = simplePathRE.test(handler.value)
|
||||
@ -114,8 +114,8 @@ function genHandler(
|
||||
const modifiers = handler.modifiers
|
||||
genModifierCode += genGuard(
|
||||
['ctrl', 'shift', 'alt', 'meta']
|
||||
.filter((keyModifier) => !modifiers[keyModifier])
|
||||
.map((keyModifier) => `$event.${keyModifier}Key`)
|
||||
.filter(keyModifier => !modifiers[keyModifier])
|
||||
.map(keyModifier => `$event.${keyModifier}Key`)
|
||||
.join('||')
|
||||
)
|
||||
} else {
|
||||
|
@ -359,7 +359,7 @@ function genInlineTemplate(
|
||||
return `inlineTemplate:{render:function(){${
|
||||
inlineRenderFns.render
|
||||
}},staticRenderFns:[${inlineRenderFns.staticRenderFns
|
||||
.map((code) => `function(){${code}}`)
|
||||
.map(code => `function(){${code}}`)
|
||||
.join(',')}]}`
|
||||
}
|
||||
}
|
||||
@ -375,7 +375,7 @@ function genScopedSlots(
|
||||
// for example if the slot contains dynamic names, has v-if or v-for on them...
|
||||
let needsForceUpdate =
|
||||
el.for ||
|
||||
Object.keys(slots).some((key) => {
|
||||
Object.keys(slots).some(key => {
|
||||
const slot = slots[key]
|
||||
return (
|
||||
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)
|
||||
.map((key) => genScopedSlot(slots[key], state))
|
||||
.map(key => genScopedSlot(slots[key], state))
|
||||
.join(',')
|
||||
|
||||
return `scopedSlots:_u([${generatedSlots}]${
|
||||
@ -492,7 +492,7 @@ export function genChildren(
|
||||
? getNormalizationType(children, state.maybeComponent)
|
||||
: 0
|
||||
const gen = altGenNode || genNode
|
||||
return `[${children.map((c) => gen(c, state)).join(',')}]${
|
||||
return `[${children.map(c => gen(c, state)).join(',')}]${
|
||||
normalizationType ? `,${normalizationType}` : ''
|
||||
}`
|
||||
}
|
||||
@ -515,14 +515,14 @@ function getNormalizationType(
|
||||
if (
|
||||
needsNormalization(el) ||
|
||||
(el.ifConditions &&
|
||||
el.ifConditions.some((c) => needsNormalization(c.block)))
|
||||
el.ifConditions.some(c => needsNormalization(c.block)))
|
||||
) {
|
||||
res = 2
|
||||
break
|
||||
}
|
||||
if (
|
||||
maybeComponent(el) ||
|
||||
(el.ifConditions && el.ifConditions.some((c) => maybeComponent(c.block)))
|
||||
(el.ifConditions && el.ifConditions.some(c => maybeComponent(c.block)))
|
||||
) {
|
||||
res = 1
|
||||
}
|
||||
@ -563,7 +563,7 @@ function genSlot(el: ASTElement, state: CodegenState): string {
|
||||
const attrs =
|
||||
el.attrs || el.dynamicAttrs
|
||||
? genProps(
|
||||
(el.attrs || []).concat(el.dynamicAttrs || []).map((attr) => ({
|
||||
(el.attrs || []).concat(el.dynamicAttrs || []).map(attr => ({
|
||||
// slot props are camelized
|
||||
name: camelize(attr.name),
|
||||
value: attr.value,
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
import { extend } from 'shared/util'
|
||||
import { detectErrors } from './error-detector'
|
||||
import { createCompileToFunctionFn } from './to-function'
|
||||
@ -13,8 +12,12 @@ export function createCompilerCreator(baseCompile: Function): Function {
|
||||
const errors: WarningMessage[] = []
|
||||
const tips: WarningMessage[] = []
|
||||
|
||||
let warn = (msg: WarningMessage, range: { start: number, end: number }, tip: string) => {
|
||||
(tip ? tips : errors).push(msg)
|
||||
let warn = (
|
||||
msg: WarningMessage,
|
||||
range: { start: number; end: number },
|
||||
tip: string
|
||||
) => {
|
||||
;(tip ? tips : errors).push(msg)
|
||||
}
|
||||
|
||||
if (options) {
|
||||
@ -25,8 +28,12 @@ export function createCompilerCreator(baseCompile: Function): Function {
|
||||
// $flow-disable-line
|
||||
const leadingSpaceLength = template.match(/^\s*/)![0].length
|
||||
|
||||
warn = (msg: WarningMessage | string, range: { start: number, end: number }, tip: string) => {
|
||||
const data: WarningMessage = typeof(msg) === 'string' ? { msg } : msg
|
||||
warn = (
|
||||
msg: WarningMessage | string,
|
||||
range: { start: number; end: number },
|
||||
tip: string
|
||||
) => {
|
||||
const data: WarningMessage = typeof msg === 'string' ? { msg } : msg
|
||||
if (range) {
|
||||
if (range.start != null) {
|
||||
data.start = range.start + leadingSpaceLength
|
||||
@ -35,7 +42,7 @@ export function createCompilerCreator(baseCompile: Function): Function {
|
||||
data.end = range.end + leadingSpaceLength
|
||||
}
|
||||
}
|
||||
(tip ? tips : errors).push(data)
|
||||
;(tip ? tips : errors).push(data)
|
||||
}
|
||||
}
|
||||
// merge custom modules
|
||||
@ -72,7 +79,7 @@ export function createCompilerCreator(baseCompile: Function): Function {
|
||||
|
||||
return {
|
||||
compile,
|
||||
compileToFunctions: createCompileToFunctionFn(compile),
|
||||
compileToFunctions: createCompileToFunctionFn(compile)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
export default function bind(el: ASTElement, dir: ASTDirective) {
|
||||
el.wrapData = (code: string) => {
|
||||
return `_b(${code},'${el.tag}',${dir.value},${
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
import on from './on'
|
||||
import bind from './bind'
|
||||
import { noop } from 'shared/util'
|
||||
@ -6,5 +5,5 @@ import { noop } from 'shared/util'
|
||||
export default {
|
||||
on,
|
||||
bind,
|
||||
cloak: noop,
|
||||
cloak: noop
|
||||
}
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
/**
|
||||
* Cross-platform code generation for component v-model
|
||||
*/
|
||||
@ -25,7 +24,7 @@ export function genComponentModel(
|
||||
el.model = {
|
||||
value: `(${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) {
|
||||
return {
|
||||
exp: val.slice(0, index),
|
||||
key: '"' + val.slice(index + 1) + '"',
|
||||
key: '"' + val.slice(index + 1) + '"'
|
||||
}
|
||||
} else {
|
||||
return {
|
||||
exp: val,
|
||||
key: null,
|
||||
key: null
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -99,7 +98,7 @@ export function parseModel(val: string): ModelParseResult {
|
||||
|
||||
return {
|
||||
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'
|
||||
|
||||
export default function on(el: ASTElement, dir: ASTDirective) {
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
import { dirRE, onRE } from './parser/index'
|
||||
|
||||
type Range = { start?: number; end?: number }
|
||||
@ -25,7 +24,8 @@ const unaryOperatorsRE = new RegExp(
|
||||
)
|
||||
|
||||
// strip strings in expressions
|
||||
const stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g
|
||||
const stripStringRE =
|
||||
/'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g
|
||||
|
||||
// detect problematic expressions in a template
|
||||
export function detectErrors(ast: ASTNode | undefined, warn: Function) {
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
import { emptyObject } from 'shared/util'
|
||||
import { parseFilters } from './parser/filter-parser'
|
||||
|
||||
@ -14,7 +13,7 @@ export function pluckModuleFunction<T, K extends keyof T>(
|
||||
modules: Array<T> | undefined,
|
||||
key: K
|
||||
): Array<T[K]> {
|
||||
return modules ? modules.map((m) => m[key]).filter((_) => _) : []
|
||||
return modules ? modules.map(m => m[key]).filter(_ => _) : []
|
||||
}
|
||||
|
||||
export function addProp(
|
||||
@ -24,7 +23,7 @@ export function addProp(
|
||||
range?: Range,
|
||||
dynamic?: boolean
|
||||
) {
|
||||
(el.props || (el.props = [])).push(
|
||||
;(el.props || (el.props = [])).push(
|
||||
rangeSetItem({ name, value, dynamic }, range)
|
||||
)
|
||||
el.plain = false
|
||||
@ -65,7 +64,7 @@ export function addDirective(
|
||||
modifiers?: ASTModifiers,
|
||||
range?: Range
|
||||
) {
|
||||
(el.directives || (el.directives = [])).push(
|
||||
;(el.directives || (el.directives = [])).push(
|
||||
rangeSetItem(
|
||||
{
|
||||
name,
|
||||
@ -73,7 +72,7 @@ export function addDirective(
|
||||
value,
|
||||
arg,
|
||||
isDynamicArg,
|
||||
modifiers,
|
||||
modifiers
|
||||
},
|
||||
range
|
||||
)
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
import { parse } from './parser/index'
|
||||
import { optimize } from './optimizer'
|
||||
import { generate } from './codegen/index'
|
||||
@ -19,6 +18,6 @@ export const createCompiler = createCompilerCreator(function baseCompile(
|
||||
return {
|
||||
ast,
|
||||
render: code.render,
|
||||
staticRenderFns: code.staticRenderFns,
|
||||
staticRenderFns: code.staticRenderFns
|
||||
}
|
||||
})
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
import { makeMap, isBuiltInTag, cached, no } from 'shared/util'
|
||||
|
||||
let isStaticKey
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
let decoder
|
||||
|
||||
export default {
|
||||
@ -6,5 +5,5 @@ export default {
|
||||
decoder = decoder || document.createElement('div')
|
||||
decoder.innerHTML = html
|
||||
return decoder.textContent
|
||||
},
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
const validDivisionCharRE = /[\w).+\-_$\]]/
|
||||
|
||||
export function parseFilters(exp: string): string {
|
||||
@ -91,7 +90,7 @@ export function parseFilters(exp: string): string {
|
||||
}
|
||||
|
||||
function pushFilter() {
|
||||
(filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim())
|
||||
;(filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim())
|
||||
lastFilterIndex = i + 1
|
||||
}
|
||||
|
||||
|
@ -14,8 +14,10 @@ import { isNonPhrasingTag } from 'web/compiler/util'
|
||||
import { unicodeRegExp } from 'core/util/lang'
|
||||
|
||||
// Regular Expressions for parsing tags and attributes
|
||||
const attribute = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/
|
||||
const dynamicArgAttribute = /^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+?\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/
|
||||
const attribute =
|
||||
/^\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 qnameCapture = `((?:${ncname}\\:)?${ncname})`
|
||||
const startTagOpen = new RegExp(`^<${qnameCapture}`)
|
||||
@ -37,7 +39,7 @@ const decodingMap = {
|
||||
'&': '&',
|
||||
' ': '\n',
|
||||
'	': '\t',
|
||||
''': "'",
|
||||
''': "'"
|
||||
}
|
||||
const encodedAttr = /&(?:lt|gt|quot|amp|#39);/g
|
||||
const encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#39|#10|#9);/g
|
||||
@ -49,7 +51,7 @@ const shouldIgnoreFirstNewline = (tag, html) =>
|
||||
|
||||
function decodeAttr(value, shouldDecodeNewlines) {
|
||||
const re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr
|
||||
return value.replace(re, (match) => decodingMap[match])
|
||||
return value.replace(re, match => decodingMap[match])
|
||||
}
|
||||
|
||||
export function parseHTML(html, options) {
|
||||
@ -185,7 +187,7 @@ export function parseHTML(html, options) {
|
||||
options.warn
|
||||
) {
|
||||
options.warn(`Mal-formatted tag at end of template: "${html}"`, {
|
||||
start: index + html.length,
|
||||
start: index + html.length
|
||||
})
|
||||
}
|
||||
break
|
||||
@ -206,7 +208,7 @@ export function parseHTML(html, options) {
|
||||
const match: any = {
|
||||
tagName: start[1],
|
||||
attrs: [],
|
||||
start: index,
|
||||
start: index
|
||||
}
|
||||
advance(start[0].length)
|
||||
let end, attr
|
||||
@ -254,7 +256,7 @@ export function parseHTML(html, options) {
|
||||
: options.shouldDecodeNewlines
|
||||
attrs[i] = {
|
||||
name: args[1],
|
||||
value: decodeAttr(value, shouldDecodeNewlines),
|
||||
value: decodeAttr(value, shouldDecodeNewlines)
|
||||
}
|
||||
if (process.env.NODE_ENV !== 'production' && options.outputSourceRange) {
|
||||
attrs[i].start = args.start + args[0].match(/^\s*/).length
|
||||
@ -268,7 +270,7 @@ export function parseHTML(html, options) {
|
||||
lowerCasedTag: tagName.toLowerCase(),
|
||||
attrs: attrs,
|
||||
start: match.start,
|
||||
end: match.end,
|
||||
end: match.end
|
||||
})
|
||||
lastTag = tagName
|
||||
}
|
||||
@ -306,7 +308,7 @@ export function parseHTML(html, options) {
|
||||
) {
|
||||
options.warn(`tag <${stack[i].tag}> has no matching end tag.`, {
|
||||
start: stack[i].start,
|
||||
end: stack[i].end,
|
||||
end: stack[i].end
|
||||
})
|
||||
}
|
||||
if (options.end) {
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
import he from 'he'
|
||||
import { parseHTML } from './html-parser'
|
||||
import { parseText } from './text-parser'
|
||||
@ -17,7 +16,7 @@ import {
|
||||
getAndRemoveAttr,
|
||||
getRawBindingAttr,
|
||||
pluckModuleFunction,
|
||||
getAndRemoveAttrByRegex,
|
||||
getAndRemoveAttrByRegex
|
||||
} from '../helpers'
|
||||
|
||||
export const onRE = /^@|^v-on:/
|
||||
@ -68,7 +67,7 @@ export function createASTElement(
|
||||
attrsMap: makeAttrsMap(attrs),
|
||||
rawAttrsMap: {},
|
||||
parent,
|
||||
children: [],
|
||||
children: []
|
||||
}
|
||||
}
|
||||
|
||||
@ -82,7 +81,8 @@ export function parse(template: string, options: CompilerOptions): ASTElement {
|
||||
platformMustUseProp = options.mustUseProp || no
|
||||
platformGetTagNamespace = options.getTagNamespace || no
|
||||
const isReservedTag = options.isReservedTag || no
|
||||
maybeComponent = (el: ASTElement) => !!(
|
||||
maybeComponent = (el: ASTElement) =>
|
||||
!!(
|
||||
el.component ||
|
||||
el.attrsMap[':is'] ||
|
||||
el.attrsMap['v-bind:is'] ||
|
||||
@ -124,7 +124,7 @@ export function parse(template: string, options: CompilerOptions): ASTElement {
|
||||
}
|
||||
addIfCondition(root, {
|
||||
exp: element.elseif,
|
||||
block: element,
|
||||
block: element
|
||||
})
|
||||
} else if (process.env.NODE_ENV !== 'production') {
|
||||
warnOnce(
|
||||
@ -155,7 +155,7 @@ export function parse(template: string, options: CompilerOptions): ASTElement {
|
||||
|
||||
// final children cleanup
|
||||
// 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
|
||||
trimEndingWhitespace(element)
|
||||
|
||||
@ -238,14 +238,14 @@ export function parse(template: string, options: CompilerOptions): ASTElement {
|
||||
return cumulated
|
||||
}, {})
|
||||
}
|
||||
attrs.forEach((attr) => {
|
||||
attrs.forEach(attr => {
|
||||
if (invalidAttributeRE.test(attr.name)) {
|
||||
warn(
|
||||
`Invalid dynamic argument expression: attribute names cannot contain ` +
|
||||
`spaces, quotes, <, >, / or =.`,
|
||||
{
|
||||
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())) {
|
||||
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
|
||||
if (inPre || text.trim()) {
|
||||
text = isTextTag(currentParent) ? text : decodeHTMLCached(text) as string
|
||||
text = isTextTag(currentParent)
|
||||
? text
|
||||
: (decodeHTMLCached(text) as string)
|
||||
} else if (!children.length) {
|
||||
// remove the whitespace-only node right after an opening tag
|
||||
text = ''
|
||||
@ -367,7 +369,7 @@ export function parse(template: string, options: CompilerOptions): ASTElement {
|
||||
type: 2,
|
||||
expression: res.expression,
|
||||
tokens: res.tokens,
|
||||
text,
|
||||
text
|
||||
}
|
||||
} else if (
|
||||
text !== ' ' ||
|
||||
@ -376,7 +378,7 @@ export function parse(template: string, options: CompilerOptions): ASTElement {
|
||||
) {
|
||||
child = {
|
||||
type: 3,
|
||||
text,
|
||||
text
|
||||
}
|
||||
}
|
||||
if (child) {
|
||||
@ -398,7 +400,7 @@ export function parse(template: string, options: CompilerOptions): ASTElement {
|
||||
const child: ASTText = {
|
||||
type: 3,
|
||||
text,
|
||||
isComment: true,
|
||||
isComment: true
|
||||
}
|
||||
if (
|
||||
process.env.NODE_ENV !== 'production' &&
|
||||
@ -409,7 +411,7 @@ export function parse(template: string, options: CompilerOptions): ASTElement {
|
||||
}
|
||||
currentParent.children.push(child)
|
||||
}
|
||||
},
|
||||
}
|
||||
})
|
||||
return root
|
||||
}
|
||||
@ -428,7 +430,7 @@ function processRawAttrs(el) {
|
||||
for (let i = 0; i < len; i++) {
|
||||
attrs[i] = {
|
||||
name: list[i].name,
|
||||
value: JSON.stringify(list[i].value),
|
||||
value: JSON.stringify(list[i].value)
|
||||
}
|
||||
if (list[i].start != null) {
|
||||
attrs[i].start = list[i].start
|
||||
@ -544,7 +546,7 @@ function processIf(el) {
|
||||
el.if = exp
|
||||
addIfCondition(el, {
|
||||
exp: exp,
|
||||
block: el,
|
||||
block: el
|
||||
})
|
||||
} else {
|
||||
if (getAndRemoveAttr(el, 'v-else') != null) {
|
||||
@ -562,7 +564,7 @@ function processIfConditions(el, parent) {
|
||||
if (prev && prev.if) {
|
||||
addIfCondition(prev, {
|
||||
exp: el.elseif,
|
||||
block: el,
|
||||
block: el
|
||||
})
|
||||
} else if (process.env.NODE_ENV !== 'production') {
|
||||
warn(
|
||||
@ -776,7 +778,7 @@ function processAttrs(el) {
|
||||
modifiers = parseModifiers(name.replace(dirRE, ''))
|
||||
// support .foo shorthand syntax for the .prop modifier
|
||||
if (process.env.VBIND_PROP_SHORTHAND && propBindRE.test(name)) {
|
||||
(modifiers || (modifiers = {})).prop = true
|
||||
;(modifiers || (modifiers = {})).prop = true
|
||||
name = `.` + name.slice(1).replace(modifierRE, '')
|
||||
} else if (modifiers) {
|
||||
name = name.replace(modifierRE, '')
|
||||
@ -930,7 +932,7 @@ function parseModifiers(name: string): Object | void {
|
||||
const match = name.match(modifierRE)
|
||||
if (match) {
|
||||
const ret = {}
|
||||
match.forEach((m) => {
|
||||
match.forEach(m => {
|
||||
ret[m.slice(1)] = true
|
||||
})
|
||||
return ret
|
||||
|
@ -1,11 +1,10 @@
|
||||
|
||||
import { cached } from 'shared/util'
|
||||
import { parseFilters } from './filter-parser'
|
||||
|
||||
const defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g
|
||||
const regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g
|
||||
|
||||
const buildRegex = cached((delimiters) => {
|
||||
const buildRegex = cached(delimiters => {
|
||||
const open = delimiters[0].replace(regexEscapeRE, '\\$&')
|
||||
const close = delimiters[1].replace(regexEscapeRE, '\\$&')
|
||||
return new RegExp(open + '((?:.|\\n)+?)' + close, 'g')
|
||||
@ -48,6 +47,6 @@ export function parseText(
|
||||
}
|
||||
return {
|
||||
expression: tokens.join('+'),
|
||||
tokens: rawTokens,
|
||||
tokens: rawTokens
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
import { noop, extend } from 'shared/util'
|
||||
import { warn as baseWarn, tip } from 'core/util/debug'
|
||||
import { generateCodeFrame } from './codeframe'
|
||||
@ -63,7 +62,7 @@ export function createCompileToFunctionFn(compile: Function): Function {
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
if (compiled.errors && compiled.errors.length) {
|
||||
if (options.outputSourceRange) {
|
||||
compiled.errors.forEach((e) => {
|
||||
compiled.errors.forEach(e => {
|
||||
warn(
|
||||
`Error compiling template:\n\n${e.msg}\n\n` +
|
||||
generateCodeFrame(template, e.start, e.end),
|
||||
@ -73,7 +72,7 @@ export function createCompileToFunctionFn(compile: Function): Function {
|
||||
} else {
|
||||
warn(
|
||||
`Error compiling template:\n\n${template}\n\n` +
|
||||
compiled.errors.map((e) => `- ${e}`).join('\n') +
|
||||
compiled.errors.map(e => `- ${e}`).join('\n') +
|
||||
'\n',
|
||||
vm
|
||||
)
|
||||
@ -81,9 +80,9 @@ export function createCompileToFunctionFn(compile: Function): Function {
|
||||
}
|
||||
if (compiled.tips && compiled.tips.length) {
|
||||
if (options.outputSourceRange) {
|
||||
compiled.tips.forEach((e) => tip(e.msg, vm))
|
||||
compiled.tips.forEach(e => tip(e.msg, vm))
|
||||
} 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 fnGenErrors: any[] = []
|
||||
res.render = createFunction(compiled.render, fnGenErrors)
|
||||
res.staticRenderFns = compiled.staticRenderFns.map((code) => {
|
||||
res.staticRenderFns = compiled.staticRenderFns.map(code => {
|
||||
return createFunction(code, fnGenErrors)
|
||||
})
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
import KeepAlive from './keep-alive'
|
||||
|
||||
export default {
|
||||
KeepAlive,
|
||||
KeepAlive
|
||||
}
|
||||
|
@ -1,19 +1,19 @@
|
||||
import { isRegExp, remove } from "shared/util";
|
||||
import { getFirstComponentChild } from "core/vdom/helpers/index";
|
||||
import type VNode from "core/vdom/vnode";
|
||||
import type { VNodeComponentOptions } from "typescript/vnode";
|
||||
import type { Component } from "typescript/component";
|
||||
import { isRegExp, remove } from 'shared/util'
|
||||
import { getFirstComponentChild } from 'core/vdom/helpers/index'
|
||||
import type VNode from 'core/vdom/vnode'
|
||||
import type { VNodeComponentOptions } from 'typescript/vnode'
|
||||
import type { Component } from 'typescript/component'
|
||||
|
||||
type CacheEntry = {
|
||||
name?: string;
|
||||
tag?: string;
|
||||
componentInstance?: Component;
|
||||
};
|
||||
name?: string
|
||||
tag?: string
|
||||
componentInstance?: Component
|
||||
}
|
||||
|
||||
type CacheEntryMap = Record<string, CacheEntry | null>;
|
||||
type CacheEntryMap = Record<string, CacheEntry | 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(
|
||||
@ -21,27 +21,27 @@ function matches(
|
||||
name: string
|
||||
): boolean {
|
||||
if (Array.isArray(pattern)) {
|
||||
return pattern.indexOf(name) > -1;
|
||||
} else if (typeof pattern === "string") {
|
||||
return pattern.split(",").indexOf(name) > -1;
|
||||
return pattern.indexOf(name) > -1
|
||||
} else if (typeof pattern === 'string') {
|
||||
return pattern.split(',').indexOf(name) > -1
|
||||
} else if (isRegExp(pattern)) {
|
||||
return pattern.test(name);
|
||||
return pattern.test(name)
|
||||
}
|
||||
/* istanbul ignore next */
|
||||
return false;
|
||||
return false
|
||||
}
|
||||
|
||||
function pruneCache(
|
||||
keepAliveInstance: { cache: CacheEntryMap; keys: string[]; _vnode: VNode },
|
||||
filter: Function
|
||||
) {
|
||||
const { cache, keys, _vnode } = keepAliveInstance;
|
||||
const { cache, keys, _vnode } = keepAliveInstance
|
||||
for (const key in cache) {
|
||||
const entry = cache[key];
|
||||
const entry = cache[key]
|
||||
if (entry) {
|
||||
const name = entry.name;
|
||||
const name = entry.name
|
||||
if (name && !filter(name)) {
|
||||
pruneCacheEntry(cache, key, keys, _vnode);
|
||||
pruneCacheEntry(cache, key, keys, _vnode)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -53,112 +53,112 @@ function pruneCacheEntry(
|
||||
keys: Array<string>,
|
||||
current?: VNode
|
||||
) {
|
||||
const entry = cache[key];
|
||||
const entry = cache[key]
|
||||
if (entry && (!current || entry.tag !== current.tag)) {
|
||||
// @ts-expect-error can be undefined
|
||||
entry.componentInstance.$destroy();
|
||||
entry.componentInstance.$destroy()
|
||||
}
|
||||
cache[key] = null;
|
||||
remove(keys, key);
|
||||
cache[key] = null
|
||||
remove(keys, key)
|
||||
}
|
||||
|
||||
const patternTypes: Array<Function> = [String, RegExp, Array];
|
||||
const patternTypes: Array<Function> = [String, RegExp, Array]
|
||||
|
||||
// TODO defineComponent
|
||||
export default {
|
||||
name: "keep-alive",
|
||||
name: 'keep-alive',
|
||||
abstract: true,
|
||||
|
||||
props: {
|
||||
include: patternTypes,
|
||||
exclude: patternTypes,
|
||||
max: [String, Number],
|
||||
max: [String, Number]
|
||||
},
|
||||
|
||||
methods: {
|
||||
cacheVNode() {
|
||||
const { cache, keys, vnodeToCache, keyToCache } = this;
|
||||
const { cache, keys, vnodeToCache, keyToCache } = this
|
||||
if (vnodeToCache) {
|
||||
const { tag, componentInstance, componentOptions } = vnodeToCache;
|
||||
const { tag, componentInstance, componentOptions } = vnodeToCache
|
||||
cache[keyToCache] = {
|
||||
name: getComponentName(componentOptions),
|
||||
tag,
|
||||
componentInstance,
|
||||
};
|
||||
keys.push(keyToCache);
|
||||
componentInstance
|
||||
}
|
||||
keys.push(keyToCache)
|
||||
// prune oldest entry
|
||||
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() {
|
||||
this.cache = Object.create(null);
|
||||
this.keys = [];
|
||||
this.cache = Object.create(null)
|
||||
this.keys = []
|
||||
},
|
||||
|
||||
destroyed() {
|
||||
for (const key in this.cache) {
|
||||
pruneCacheEntry(this.cache, key, this.keys);
|
||||
pruneCacheEntry(this.cache, key, this.keys)
|
||||
}
|
||||
},
|
||||
|
||||
mounted() {
|
||||
this.cacheVNode();
|
||||
this.$watch("include", (val) => {
|
||||
pruneCache(this, (name) => matches(val, name));
|
||||
});
|
||||
this.$watch("exclude", (val) => {
|
||||
pruneCache(this, (name) => !matches(val, name));
|
||||
});
|
||||
this.cacheVNode()
|
||||
this.$watch('include', val => {
|
||||
pruneCache(this, name => matches(val, name))
|
||||
})
|
||||
this.$watch('exclude', val => {
|
||||
pruneCache(this, name => !matches(val, name))
|
||||
})
|
||||
},
|
||||
|
||||
updated() {
|
||||
this.cacheVNode();
|
||||
this.cacheVNode()
|
||||
},
|
||||
|
||||
render() {
|
||||
const slot = this.$slots.default;
|
||||
const vnode = getFirstComponentChild(slot);
|
||||
const componentOptions = vnode && vnode.componentOptions;
|
||||
const slot = this.$slots.default
|
||||
const vnode = getFirstComponentChild(slot)
|
||||
const componentOptions = vnode && vnode.componentOptions
|
||||
if (componentOptions) {
|
||||
// check pattern
|
||||
const name = getComponentName(componentOptions);
|
||||
const { include, exclude } = this;
|
||||
const name = getComponentName(componentOptions)
|
||||
const { include, exclude } = this
|
||||
if (
|
||||
// not included
|
||||
(include && (!name || !matches(include, name))) ||
|
||||
// excluded
|
||||
(exclude && name && matches(exclude, name))
|
||||
) {
|
||||
return vnode;
|
||||
return vnode
|
||||
}
|
||||
|
||||
const { cache, keys } = this;
|
||||
const { cache, keys } = this
|
||||
const key =
|
||||
vnode.key == null
|
||||
? // same constructor may get registered as different local components
|
||||
// so cid alone is not enough (#3269)
|
||||
componentOptions.Ctor.cid +
|
||||
(componentOptions.tag ? `::${componentOptions.tag}` : "")
|
||||
: vnode.key;
|
||||
(componentOptions.tag ? `::${componentOptions.tag}` : '')
|
||||
: vnode.key
|
||||
if (cache[key]) {
|
||||
vnode.componentInstance = cache[key].componentInstance;
|
||||
vnode.componentInstance = cache[key].componentInstance
|
||||
// make current key freshest
|
||||
remove(keys, key);
|
||||
keys.push(key);
|
||||
remove(keys, key)
|
||||
keys.push(key)
|
||||
} else {
|
||||
// delay setting the cache until update
|
||||
this.vnodeToCache = vnode;
|
||||
this.keyToCache = key;
|
||||
this.vnodeToCache = vnode
|
||||
this.keyToCache = key
|
||||
}
|
||||
|
||||
// @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 { LIFECYCLE_HOOKS } from 'shared/constants'
|
||||
@ -31,7 +30,7 @@ export interface Config {
|
||||
_lifecycleHooks: Array<string>
|
||||
}
|
||||
|
||||
export default ({
|
||||
export default {
|
||||
/**
|
||||
* Option merge strategies (used in core/util/options)
|
||||
*/
|
||||
@ -122,5 +121,5 @@ export default ({
|
||||
/**
|
||||
* Exposed for legacy reasons
|
||||
*/
|
||||
_lifecycleHooks: LIFECYCLE_HOOKS,
|
||||
} as unknown) as Config
|
||||
_lifecycleHooks: LIFECYCLE_HOOKS
|
||||
} as unknown as Config
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
import { ASSET_TYPES } from 'shared/constants'
|
||||
import type { GlobalAPI } from 'typescript/global-api'
|
||||
import { isPlainObject, validateComponentName } from '../util/index'
|
||||
@ -7,7 +6,7 @@ export function initAssetRegisters(Vue: GlobalAPI) {
|
||||
/**
|
||||
* Create asset registration methods.
|
||||
*/
|
||||
ASSET_TYPES.forEach((type) => {
|
||||
ASSET_TYPES.forEach(type => {
|
||||
// @ts-expect-error function is not exact same type
|
||||
Vue[type] = function (
|
||||
id: string,
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
import { ASSET_TYPES } from 'shared/constants'
|
||||
import type { Component } from 'typescript/component'
|
||||
import type { GlobalAPI } from 'typescript/global-api'
|
||||
@ -31,9 +30,9 @@ export function initExtend(Vue: GlobalAPI) {
|
||||
validateComponentName(name)
|
||||
}
|
||||
|
||||
const Sub = (function VueComponent(this: any, options: any) {
|
||||
const Sub = function VueComponent(this: any, options: any) {
|
||||
this._init(options)
|
||||
} as unknown) as typeof Component
|
||||
} as unknown as typeof Component
|
||||
Sub.prototype = Object.create(Super.prototype)
|
||||
Sub.prototype.constructor = Sub
|
||||
Sub.cid = cid++
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
import config from '../config'
|
||||
import { initUse } from './use'
|
||||
import { initMixin } from './mixin'
|
||||
@ -14,7 +13,7 @@ import {
|
||||
extend,
|
||||
nextTick,
|
||||
mergeOptions,
|
||||
defineReactive,
|
||||
defineReactive
|
||||
} from '../util/index'
|
||||
import type { GlobalAPI } from 'typescript/global-api'
|
||||
|
||||
@ -38,7 +37,7 @@ export function initGlobalAPI(Vue: GlobalAPI) {
|
||||
warn,
|
||||
extend,
|
||||
mergeOptions,
|
||||
defineReactive,
|
||||
defineReactive
|
||||
}
|
||||
|
||||
Vue.set = set
|
||||
@ -52,7 +51,7 @@ export function initGlobalAPI(Vue: GlobalAPI) {
|
||||
}
|
||||
|
||||
Vue.options = Object.create(null)
|
||||
ASSET_TYPES.forEach((type) => {
|
||||
ASSET_TYPES.forEach(type => {
|
||||
Vue.options[type + 's'] = Object.create(null)
|
||||
})
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
import type { GlobalAPI } from 'typescript/global-api'
|
||||
import { mergeOptions } from '../util/index'
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
import type { GlobalAPI } from 'typescript/global-api'
|
||||
import { toArray } from '../util/index'
|
||||
|
||||
|
@ -6,19 +6,19 @@ import { FunctionalRenderContext } from 'core/vdom/create-functional-component'
|
||||
initGlobalAPI(Vue)
|
||||
|
||||
Object.defineProperty(Vue.prototype, '$isServer', {
|
||||
get: isServerRendering,
|
||||
get: isServerRendering
|
||||
})
|
||||
|
||||
Object.defineProperty(Vue.prototype, '$ssrContext', {
|
||||
get() {
|
||||
/* istanbul ignore next */
|
||||
return this.$vnode && this.$vnode.ssrContext
|
||||
},
|
||||
}
|
||||
})
|
||||
|
||||
// expose FunctionalRenderContext for ssr runtime helper installation
|
||||
Object.defineProperty(Vue, 'FunctionalRenderContext', {
|
||||
value: FunctionalRenderContext,
|
||||
value: FunctionalRenderContext
|
||||
})
|
||||
|
||||
Vue.version = '__VERSION__'
|
||||
|
@ -1,11 +1,10 @@
|
||||
|
||||
import type { Component } from 'typescript/component'
|
||||
import {
|
||||
tip,
|
||||
toArray,
|
||||
hyphenate,
|
||||
formatComponentName,
|
||||
invokeWithErrorHandling,
|
||||
invokeWithErrorHandling
|
||||
} from '../util/index'
|
||||
import { updateListeners } from '../vdom/helpers/index'
|
||||
|
||||
@ -68,7 +67,7 @@ export function eventsMixin(Vue: Component) {
|
||||
vm.$on(event[i], fn)
|
||||
}
|
||||
} 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
|
||||
// instead of a hash lookup
|
||||
if (hookRE.test(event)) {
|
||||
|
@ -1,27 +1,27 @@
|
||||
import { initMixin } from "./init";
|
||||
import { stateMixin } from "./state";
|
||||
import { renderMixin } from "./render";
|
||||
import { eventsMixin } from "./events";
|
||||
import { lifecycleMixin } from "./lifecycle";
|
||||
import { warn } from "../util/index";
|
||||
import type { GlobalAPI } from "typescript/global-api";
|
||||
import { initMixin } from './init'
|
||||
import { stateMixin } from './state'
|
||||
import { renderMixin } from './render'
|
||||
import { eventsMixin } from './events'
|
||||
import { lifecycleMixin } from './lifecycle'
|
||||
import { warn } from '../util/index'
|
||||
import type { GlobalAPI } from 'typescript/global-api'
|
||||
|
||||
function Vue(options) {
|
||||
if (process.env.NODE_ENV !== "production" && !(this instanceof Vue)) {
|
||||
warn("Vue is a constructor and should be called with the `new` keyword");
|
||||
if (process.env.NODE_ENV !== 'production' && !(this instanceof Vue)) {
|
||||
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
|
||||
initMixin(Vue);
|
||||
initMixin(Vue)
|
||||
//@ts-expect-error Vue has function type
|
||||
stateMixin(Vue);
|
||||
stateMixin(Vue)
|
||||
//@ts-expect-error Vue has function type
|
||||
eventsMixin(Vue);
|
||||
eventsMixin(Vue)
|
||||
//@ts-expect-error Vue has function type
|
||||
lifecycleMixin(Vue);
|
||||
lifecycleMixin(Vue)
|
||||
//@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 { initProxy } from './proxy'
|
||||
import { initState } from './state'
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
import { hasOwn } from 'shared/util'
|
||||
import { warn, hasSymbol } from '../util/index'
|
||||
import { defineReactive, toggleObserving } from '../observer/index'
|
||||
@ -19,7 +18,7 @@ export function initInjections(vm: Component) {
|
||||
const result = resolveInject(vm.$options.inject, vm)
|
||||
if (result) {
|
||||
toggleObserving(false)
|
||||
Object.keys(result).forEach((key) => {
|
||||
Object.keys(result).forEach(key => {
|
||||
/* istanbul ignore else */
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
defineReactive(vm, key, result[key], () => {
|
||||
|
@ -1,13 +1,13 @@
|
||||
import config from "../config";
|
||||
import Watcher from "../observer/watcher";
|
||||
import { mark, measure } from "../util/perf";
|
||||
import VNode, { createEmptyVNode } from "../vdom/vnode";
|
||||
import { updateComponentListeners } from "./events";
|
||||
import { resolveSlots } from "./render-helpers/resolve-slots";
|
||||
import { toggleObserving } from "../observer/index";
|
||||
import { pushTarget, popTarget } from "../observer/dep";
|
||||
import type { Component } from "../../../typescript/component";
|
||||
import type { MountedComponentVNode } from "../../../typescript/vnode";
|
||||
import config from '../config'
|
||||
import Watcher from '../observer/watcher'
|
||||
import { mark, measure } from '../util/perf'
|
||||
import VNode, { createEmptyVNode } from '../vdom/vnode'
|
||||
import { updateComponentListeners } from './events'
|
||||
import { resolveSlots } from './render-helpers/resolve-slots'
|
||||
import { toggleObserving } from '../observer/index'
|
||||
import { pushTarget, popTarget } from '../observer/dep'
|
||||
import type { Component } from '../../../typescript/component'
|
||||
import type { MountedComponentVNode } from '../../../typescript/vnode'
|
||||
|
||||
import {
|
||||
warn,
|
||||
@ -15,127 +15,127 @@ import {
|
||||
remove,
|
||||
emptyObject,
|
||||
validateProp,
|
||||
invokeWithErrorHandling,
|
||||
} from "../util/index";
|
||||
invokeWithErrorHandling
|
||||
} from '../util/index'
|
||||
|
||||
export let activeInstance: any = null;
|
||||
export let isUpdatingChildComponent: boolean = false;
|
||||
export let activeInstance: any = null
|
||||
export let isUpdatingChildComponent: boolean = false
|
||||
|
||||
export function setActiveInstance(vm: Component) {
|
||||
const prevActiveInstance = activeInstance;
|
||||
activeInstance = vm;
|
||||
const prevActiveInstance = activeInstance
|
||||
activeInstance = vm
|
||||
return () => {
|
||||
activeInstance = prevActiveInstance;
|
||||
};
|
||||
activeInstance = prevActiveInstance
|
||||
}
|
||||
}
|
||||
|
||||
export function initLifecycle(vm: Component) {
|
||||
const options = vm.$options;
|
||||
const options = vm.$options
|
||||
|
||||
// locate first non-abstract parent
|
||||
let parent = options.parent;
|
||||
let parent = options.parent
|
||||
if (parent && !options.abstract) {
|
||||
while (parent.$options.abstract && parent.$parent) {
|
||||
parent = parent.$parent;
|
||||
parent = parent.$parent
|
||||
}
|
||||
parent.$children.push(vm);
|
||||
parent.$children.push(vm)
|
||||
}
|
||||
|
||||
vm.$parent = parent;
|
||||
vm.$root = parent ? parent.$root : vm;
|
||||
vm.$parent = parent
|
||||
vm.$root = parent ? parent.$root : vm
|
||||
|
||||
vm.$children = [];
|
||||
vm.$refs = {};
|
||||
vm.$children = []
|
||||
vm.$refs = {}
|
||||
|
||||
vm._watcher = null;
|
||||
vm._inactive = null;
|
||||
vm._directInactive = false;
|
||||
vm._isMounted = false;
|
||||
vm._isDestroyed = false;
|
||||
vm._isBeingDestroyed = false;
|
||||
vm._watcher = null
|
||||
vm._inactive = null
|
||||
vm._directInactive = false
|
||||
vm._isMounted = false
|
||||
vm._isDestroyed = false
|
||||
vm._isBeingDestroyed = false
|
||||
}
|
||||
|
||||
export function lifecycleMixin(Vue: Component) {
|
||||
Vue.prototype._update = function (vnode: VNode, hydrating?: boolean) {
|
||||
const vm: Component = this;
|
||||
const prevEl = vm.$el;
|
||||
const prevVnode = vm._vnode;
|
||||
const restoreActiveInstance = setActiveInstance(vm);
|
||||
vm._vnode = vnode;
|
||||
const vm: Component = this
|
||||
const prevEl = vm.$el
|
||||
const prevVnode = vm._vnode
|
||||
const restoreActiveInstance = setActiveInstance(vm)
|
||||
vm._vnode = vnode
|
||||
// Vue.prototype.__patch__ is injected in entry points
|
||||
// based on the rendering backend used.
|
||||
if (!prevVnode) {
|
||||
// initial render
|
||||
vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
|
||||
vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */)
|
||||
} else {
|
||||
// updates
|
||||
vm.$el = vm.__patch__(prevVnode, vnode);
|
||||
vm.$el = vm.__patch__(prevVnode, vnode)
|
||||
}
|
||||
restoreActiveInstance();
|
||||
restoreActiveInstance()
|
||||
// update __vue__ reference
|
||||
if (prevEl) {
|
||||
prevEl.__vue__ = null;
|
||||
prevEl.__vue__ = null
|
||||
}
|
||||
if (vm.$el) {
|
||||
vm.$el.__vue__ = vm;
|
||||
vm.$el.__vue__ = vm
|
||||
}
|
||||
// if parent is an HOC, update its $el as well
|
||||
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 in a parent's updated hook.
|
||||
};
|
||||
}
|
||||
|
||||
Vue.prototype.$forceUpdate = function () {
|
||||
const vm: Component = this;
|
||||
const vm: Component = this
|
||||
if (vm._watcher) {
|
||||
vm._watcher.update();
|
||||
vm._watcher.update()
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Vue.prototype.$destroy = function () {
|
||||
const vm: Component = this;
|
||||
const vm: Component = this
|
||||
if (vm._isBeingDestroyed) {
|
||||
return;
|
||||
return
|
||||
}
|
||||
callHook(vm, "beforeDestroy");
|
||||
vm._isBeingDestroyed = true;
|
||||
callHook(vm, 'beforeDestroy')
|
||||
vm._isBeingDestroyed = true
|
||||
// remove self from parent
|
||||
const parent = vm.$parent;
|
||||
const parent = vm.$parent
|
||||
if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
|
||||
remove(parent.$children, vm);
|
||||
remove(parent.$children, vm)
|
||||
}
|
||||
// teardown watchers
|
||||
if (vm._watcher) {
|
||||
vm._watcher.teardown();
|
||||
vm._watcher.teardown()
|
||||
}
|
||||
let i = vm._watchers.length;
|
||||
let i = vm._watchers.length
|
||||
while (i--) {
|
||||
vm._watchers[i].teardown();
|
||||
vm._watchers[i].teardown()
|
||||
}
|
||||
// remove reference from data ob
|
||||
// frozen object may not have observer.
|
||||
if (vm._data.__ob__) {
|
||||
vm._data.__ob__.vmCount--;
|
||||
vm._data.__ob__.vmCount--
|
||||
}
|
||||
// call the last hook...
|
||||
vm._isDestroyed = true;
|
||||
vm._isDestroyed = true
|
||||
// invoke destroy hooks on current rendered tree
|
||||
vm.__patch__(vm._vnode, null);
|
||||
vm.__patch__(vm._vnode, null)
|
||||
// fire destroyed hook
|
||||
callHook(vm, "destroyed");
|
||||
callHook(vm, 'destroyed')
|
||||
// turn off all instance listeners.
|
||||
vm.$off();
|
||||
vm.$off()
|
||||
// remove __vue__ reference
|
||||
if (vm.$el) {
|
||||
vm.$el.__vue__ = null;
|
||||
vm.$el.__vue__ = null
|
||||
}
|
||||
// release circular reference (#6759)
|
||||
if (vm.$vnode) {
|
||||
vm.$vnode.parent = null;
|
||||
vm.$vnode.parent = null
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export function mountComponent(
|
||||
@ -143,56 +143,56 @@ export function mountComponent(
|
||||
el: Element | null | undefined,
|
||||
hydrating?: boolean
|
||||
): Component {
|
||||
vm.$el = el;
|
||||
vm.$el = el
|
||||
if (!vm.$options.render) {
|
||||
// @ts-expect-error invalid type
|
||||
vm.$options.render = createEmptyVNode;
|
||||
if (process.env.NODE_ENV !== "production") {
|
||||
vm.$options.render = createEmptyVNode
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
/* istanbul ignore if */
|
||||
if (
|
||||
(vm.$options.template && vm.$options.template.charAt(0) !== "#") ||
|
||||
(vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
|
||||
vm.$options.el ||
|
||||
el
|
||||
) {
|
||||
warn(
|
||||
"You are using the runtime-only build of Vue where the template " +
|
||||
"compiler is not available. Either pre-compile the templates into " +
|
||||
"render functions, or use the compiler-included build.",
|
||||
'You are using the runtime-only build of Vue where the template ' +
|
||||
'compiler is not available. Either pre-compile the templates into ' +
|
||||
'render functions, or use the compiler-included build.',
|
||||
vm
|
||||
);
|
||||
)
|
||||
} else {
|
||||
warn(
|
||||
"Failed to mount component: template or render function not defined.",
|
||||
'Failed to mount component: template or render function not defined.',
|
||||
vm
|
||||
);
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
callHook(vm, "beforeMount");
|
||||
callHook(vm, 'beforeMount')
|
||||
|
||||
let updateComponent;
|
||||
let updateComponent
|
||||
/* istanbul ignore if */
|
||||
if (process.env.NODE_ENV !== "production" && config.performance && mark) {
|
||||
if (process.env.NODE_ENV !== 'production' && config.performance && mark) {
|
||||
updateComponent = () => {
|
||||
const name = vm._name;
|
||||
const id = vm._uid;
|
||||
const startTag = `vue-perf-start:${id}`;
|
||||
const endTag = `vue-perf-end:${id}`;
|
||||
const name = vm._name
|
||||
const id = vm._uid
|
||||
const startTag = `vue-perf-start:${id}`
|
||||
const endTag = `vue-perf-end:${id}`
|
||||
|
||||
mark(startTag);
|
||||
const vnode = vm._render();
|
||||
mark(endTag);
|
||||
measure(`vue ${name} render`, startTag, endTag);
|
||||
mark(startTag)
|
||||
const vnode = vm._render()
|
||||
mark(endTag)
|
||||
measure(`vue ${name} render`, startTag, endTag)
|
||||
|
||||
mark(startTag);
|
||||
vm._update(vnode, hydrating);
|
||||
mark(endTag);
|
||||
measure(`vue ${name} patch`, startTag, endTag);
|
||||
};
|
||||
mark(startTag)
|
||||
vm._update(vnode, hydrating)
|
||||
mark(endTag)
|
||||
measure(`vue ${name} patch`, startTag, endTag)
|
||||
}
|
||||
} else {
|
||||
updateComponent = () => {
|
||||
vm._update(vm._render(), hydrating);
|
||||
};
|
||||
vm._update(vm._render(), hydrating)
|
||||
}
|
||||
}
|
||||
|
||||
// we set this to vm._watcher inside the watcher's constructor
|
||||
@ -205,21 +205,21 @@ export function mountComponent(
|
||||
{
|
||||
before() {
|
||||
if (vm._isMounted && !vm._isDestroyed) {
|
||||
callHook(vm, "beforeUpdate");
|
||||
callHook(vm, 'beforeUpdate')
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
true /* isRenderWatcher */
|
||||
);
|
||||
hydrating = false;
|
||||
)
|
||||
hydrating = false
|
||||
|
||||
// manually mounted instance, call mounted on self
|
||||
// mounted is called for render-created child components in its inserted hook
|
||||
if (vm.$vnode == null) {
|
||||
vm._isMounted = true;
|
||||
callHook(vm, "mounted");
|
||||
vm._isMounted = true
|
||||
callHook(vm, 'mounted')
|
||||
}
|
||||
return vm;
|
||||
return vm
|
||||
}
|
||||
|
||||
export function updateChildComponent(
|
||||
@ -229,8 +229,8 @@ export function updateChildComponent(
|
||||
parentVnode: MountedComponentVNode,
|
||||
renderChildren?: Array<VNode> | null
|
||||
) {
|
||||
if (process.env.NODE_ENV !== "production") {
|
||||
isUpdatingChildComponent = true;
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
isUpdatingChildComponent = true
|
||||
}
|
||||
|
||||
// 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
|
||||
// dynamic slot names). Static scoped slots compiled from template has the
|
||||
// "$stable" marker.
|
||||
const newScopedSlots = parentVnode.data.scopedSlots;
|
||||
const oldScopedSlots = vm.$scopedSlots;
|
||||
const newScopedSlots = parentVnode.data.scopedSlots
|
||||
const oldScopedSlots = vm.$scopedSlots
|
||||
const hasDynamicScopedSlot = !!(
|
||||
(newScopedSlots && !newScopedSlots.$stable) ||
|
||||
(oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
|
||||
(newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key) ||
|
||||
(!newScopedSlots && vm.$scopedSlots.$key)
|
||||
);
|
||||
)
|
||||
|
||||
// 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
|
||||
@ -255,108 +255,108 @@ export function updateChildComponent(
|
||||
renderChildren || // has new static slots
|
||||
vm.$options._renderChildren || // has old static slots
|
||||
hasDynamicScopedSlot
|
||||
);
|
||||
)
|
||||
|
||||
vm.$options._parentVnode = parentVnode;
|
||||
vm.$vnode = parentVnode; // update vm's placeholder node without re-render
|
||||
vm.$options._parentVnode = parentVnode
|
||||
vm.$vnode = parentVnode // update vm's placeholder node without re-render
|
||||
|
||||
if (vm._vnode) {
|
||||
// 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
|
||||
// these are also reactive so they may trigger child update if the child
|
||||
// used them during render
|
||||
vm.$attrs = parentVnode.data.attrs || emptyObject;
|
||||
vm.$listeners = listeners || emptyObject;
|
||||
vm.$attrs = parentVnode.data.attrs || emptyObject
|
||||
vm.$listeners = listeners || emptyObject
|
||||
|
||||
// update props
|
||||
if (propsData && vm.$options.props) {
|
||||
toggleObserving(false);
|
||||
const props = vm._props;
|
||||
const propKeys = vm.$options._propKeys || [];
|
||||
toggleObserving(false)
|
||||
const props = vm._props
|
||||
const propKeys = vm.$options._propKeys || []
|
||||
for (let i = 0; i < propKeys.length; i++) {
|
||||
const key = propKeys[i];
|
||||
const propOptions: any = vm.$options.props; // wtf flow?
|
||||
props[key] = validateProp(key, propOptions, propsData, vm);
|
||||
const key = propKeys[i]
|
||||
const propOptions: any = vm.$options.props // wtf flow?
|
||||
props[key] = validateProp(key, propOptions, propsData, vm)
|
||||
}
|
||||
toggleObserving(true);
|
||||
toggleObserving(true)
|
||||
// keep a copy of raw propsData
|
||||
vm.$options.propsData = propsData;
|
||||
vm.$options.propsData = propsData
|
||||
}
|
||||
|
||||
// update listeners
|
||||
listeners = listeners || emptyObject;
|
||||
const oldListeners = vm.$options._parentListeners;
|
||||
vm.$options._parentListeners = listeners;
|
||||
updateComponentListeners(vm, listeners, oldListeners);
|
||||
listeners = listeners || emptyObject
|
||||
const oldListeners = vm.$options._parentListeners
|
||||
vm.$options._parentListeners = listeners
|
||||
updateComponentListeners(vm, listeners, oldListeners)
|
||||
|
||||
// resolve slots + force update if has children
|
||||
if (needsForceUpdate) {
|
||||
vm.$slots = resolveSlots(renderChildren, parentVnode.context);
|
||||
vm.$forceUpdate();
|
||||
vm.$slots = resolveSlots(renderChildren, parentVnode.context)
|
||||
vm.$forceUpdate()
|
||||
}
|
||||
|
||||
if (process.env.NODE_ENV !== "production") {
|
||||
isUpdatingChildComponent = false;
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
isUpdatingChildComponent = false
|
||||
}
|
||||
}
|
||||
|
||||
function isInInactiveTree(vm) {
|
||||
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) {
|
||||
if (direct) {
|
||||
vm._directInactive = false;
|
||||
vm._directInactive = false
|
||||
if (isInInactiveTree(vm)) {
|
||||
return;
|
||||
return
|
||||
}
|
||||
} else if (vm._directInactive) {
|
||||
return;
|
||||
return
|
||||
}
|
||||
if (vm._inactive || vm._inactive === null) {
|
||||
vm._inactive = false;
|
||||
vm._inactive = false
|
||||
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) {
|
||||
if (direct) {
|
||||
vm._directInactive = true;
|
||||
vm._directInactive = true
|
||||
if (isInInactiveTree(vm)) {
|
||||
return;
|
||||
return
|
||||
}
|
||||
}
|
||||
if (!vm._inactive) {
|
||||
vm._inactive = true;
|
||||
vm._inactive = true
|
||||
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) {
|
||||
// #7573 disable dep collection when invoking lifecycle hooks
|
||||
pushTarget();
|
||||
const handlers = vm.$options[hook];
|
||||
const info = `${hook} hook`;
|
||||
pushTarget()
|
||||
const handlers = vm.$options[hook]
|
||||
const info = `${hook} hook`
|
||||
if (handlers) {
|
||||
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) {
|
||||
vm.$emit("hook:" + hook);
|
||||
vm.$emit('hook:' + hook)
|
||||
}
|
||||
popTarget();
|
||||
popTarget()
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ if (process.env.NODE_ENV !== 'production') {
|
||||
target[key] = value
|
||||
return true
|
||||
}
|
||||
},
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@ -68,7 +68,7 @@ if (process.env.NODE_ENV !== 'production') {
|
||||
else warnNonPresent(target, key)
|
||||
}
|
||||
return has || !isAllowed
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
const getHandler = {
|
||||
@ -78,7 +78,7 @@ if (process.env.NODE_ENV !== 'production') {
|
||||
else warnNonPresent(target, key)
|
||||
}
|
||||
return target[key]
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
initProxy = function initProxy(vm) {
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
// helper to process dynamic keys for dynamic arguments in v-bind and v-on.
|
||||
// For example, the following template:
|
||||
//
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
import { warn, extend, isPlainObject } from 'core/util/index'
|
||||
import type { VNodeData } from 'typescript/vnode'
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
import config from 'core/config'
|
||||
|
||||
import {
|
||||
@ -7,7 +6,7 @@ import {
|
||||
toObject,
|
||||
isReservedAttribute,
|
||||
camelize,
|
||||
hyphenate,
|
||||
hyphenate
|
||||
} from 'core/util/index'
|
||||
import type { VNodeData } from 'typescript/vnode'
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
import config from 'core/config'
|
||||
import { hyphenate } from 'shared/util'
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
import { toNumber, toString, looseEqual, looseIndexOf } from 'shared/util'
|
||||
import { createTextVNode, createEmptyVNode } from 'core/vdom/vnode'
|
||||
import { renderList } from './render-list'
|
||||
|
@ -44,6 +44,6 @@ export function renderList(
|
||||
if (!isDef(ret)) {
|
||||
ret = []
|
||||
}
|
||||
(ret as any)._isVList = true
|
||||
;(ret as any)._isVList = true
|
||||
return ret
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { extend, warn, isObject } from "core/util/index";
|
||||
import VNode from "core/vdom/vnode";
|
||||
import { extend, warn, isObject } from 'core/util/index'
|
||||
import VNode from 'core/vdom/vnode'
|
||||
|
||||
/**
|
||||
* Runtime helper for rendering <slot>
|
||||
@ -10,34 +10,30 @@ export function renderSlot(
|
||||
props: Record<string, any> | null,
|
||||
bindObject: object | null
|
||||
): Array<VNode> | null {
|
||||
const scopedSlotFn = this.$scopedSlots[name];
|
||||
let nodes;
|
||||
const scopedSlotFn = this.$scopedSlots[name]
|
||||
let nodes
|
||||
if (scopedSlotFn) {
|
||||
// scoped slot
|
||||
props = props || {};
|
||||
props = props || {}
|
||||
if (bindObject) {
|
||||
if (process.env.NODE_ENV !== "production" && !isObject(bindObject)) {
|
||||
warn("slot v-bind without argument expects an Object", this);
|
||||
if (process.env.NODE_ENV !== 'production' && !isObject(bindObject)) {
|
||||
warn('slot v-bind without argument expects an Object', this)
|
||||
}
|
||||
props = extend(extend({}, bindObject), props);
|
||||
props = extend(extend({}, bindObject), props)
|
||||
}
|
||||
nodes =
|
||||
scopedSlotFn(props) ||
|
||||
(typeof fallbackRender === "function"
|
||||
? fallbackRender()
|
||||
: fallbackRender);
|
||||
(typeof fallbackRender === 'function' ? fallbackRender() : fallbackRender)
|
||||
} else {
|
||||
nodes =
|
||||
this.$slots[name] ||
|
||||
(typeof fallbackRender === "function"
|
||||
? fallbackRender()
|
||||
: fallbackRender);
|
||||
(typeof fallbackRender === 'function' ? fallbackRender() : fallbackRender)
|
||||
}
|
||||
|
||||
const target = props && props.slot;
|
||||
const target = props && props.slot
|
||||
if (target) {
|
||||
return this.$createElement("template", { slot: target }, nodes);
|
||||
return this.$createElement('template', { slot: target }, nodes)
|
||||
} else {
|
||||
return nodes;
|
||||
return nodes
|
||||
}
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ export function resolveScopedSlots(
|
||||
}
|
||||
}
|
||||
if (contentHashKey) {
|
||||
(res as any).$key = contentHashKey
|
||||
;(res as any).$key = contentHashKey
|
||||
}
|
||||
return res as any
|
||||
}
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
import type VNode from 'core/vdom/vnode'
|
||||
import type { Component } from 'typescript/component'
|
||||
|
||||
@ -35,7 +34,7 @@ export function resolveSlots(
|
||||
slot.push(child)
|
||||
}
|
||||
} else {
|
||||
(slots.default || (slots.default = [])).push(child)
|
||||
;(slots.default || (slots.default = [])).push(child)
|
||||
}
|
||||
}
|
||||
// ignore slots that contains only whitespace
|
||||
|
@ -1,10 +1,9 @@
|
||||
|
||||
import {
|
||||
warn,
|
||||
nextTick,
|
||||
emptyObject,
|
||||
handleError,
|
||||
defineReactive,
|
||||
defineReactive
|
||||
} from '../util/index'
|
||||
|
||||
import { createElement } from '../vdom/create-element'
|
||||
@ -21,7 +20,7 @@ export function initRender(vm: Component) {
|
||||
vm._staticTrees = null // v-once cached trees
|
||||
const options = vm.$options
|
||||
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.$scopedSlots = emptyObject
|
||||
// bind the createElement fn to this instance
|
||||
|
@ -1,15 +1,15 @@
|
||||
import config from "../config";
|
||||
import Watcher from "../observer/watcher";
|
||||
import Dep, { pushTarget, popTarget } from "../observer/dep";
|
||||
import { isUpdatingChildComponent } from "./lifecycle";
|
||||
import config from '../config'
|
||||
import Watcher from '../observer/watcher'
|
||||
import Dep, { pushTarget, popTarget } from '../observer/dep'
|
||||
import { isUpdatingChildComponent } from './lifecycle'
|
||||
|
||||
import {
|
||||
set,
|
||||
del,
|
||||
observe,
|
||||
defineReactive,
|
||||
toggleObserving,
|
||||
} from "../observer/index";
|
||||
toggleObserving
|
||||
} from '../observer/index'
|
||||
|
||||
import {
|
||||
warn,
|
||||
@ -24,60 +24,60 @@ import {
|
||||
isPlainObject,
|
||||
isServerRendering,
|
||||
isReservedAttribute,
|
||||
invokeWithErrorHandling,
|
||||
} from "../util/index";
|
||||
import type { Component } from "../../../typescript/component";
|
||||
invokeWithErrorHandling
|
||||
} from '../util/index'
|
||||
import type { Component } from '../../../typescript/component'
|
||||
|
||||
const sharedPropertyDefinition = {
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
get: noop,
|
||||
set: noop,
|
||||
};
|
||||
set: noop
|
||||
}
|
||||
|
||||
export function proxy(target: Object, sourceKey: string, key: string) {
|
||||
sharedPropertyDefinition.get = function proxyGetter() {
|
||||
return this[sourceKey][key];
|
||||
};
|
||||
return this[sourceKey][key]
|
||||
}
|
||||
sharedPropertyDefinition.set = function proxySetter(val) {
|
||||
this[sourceKey][key] = val;
|
||||
};
|
||||
Object.defineProperty(target, key, sharedPropertyDefinition);
|
||||
this[sourceKey][key] = val
|
||||
}
|
||||
Object.defineProperty(target, key, sharedPropertyDefinition)
|
||||
}
|
||||
|
||||
export function initState(vm: Component) {
|
||||
vm._watchers = [];
|
||||
const opts = vm.$options;
|
||||
if (opts.props) initProps(vm, opts.props);
|
||||
if (opts.methods) initMethods(vm, opts.methods);
|
||||
vm._watchers = []
|
||||
const opts = vm.$options
|
||||
if (opts.props) initProps(vm, opts.props)
|
||||
if (opts.methods) initMethods(vm, opts.methods)
|
||||
if (opts.data) {
|
||||
initData(vm);
|
||||
initData(vm)
|
||||
} 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) {
|
||||
initWatch(vm, opts.watch);
|
||||
initWatch(vm, opts.watch)
|
||||
}
|
||||
}
|
||||
|
||||
function initProps(vm: Component, propsOptions: Object) {
|
||||
const propsData = vm.$options.propsData || {};
|
||||
const props = (vm._props = {});
|
||||
const propsData = vm.$options.propsData || {}
|
||||
const props = (vm._props = {})
|
||||
// cache prop keys so that future props updates can iterate using Array
|
||||
// instead of dynamic object key enumeration.
|
||||
const keys: string[] = (vm.$options._propKeys = []);
|
||||
const isRoot = !vm.$parent;
|
||||
const keys: string[] = (vm.$options._propKeys = [])
|
||||
const isRoot = !vm.$parent
|
||||
// root instance props should be converted
|
||||
if (!isRoot) {
|
||||
toggleObserving(false);
|
||||
toggleObserving(false)
|
||||
}
|
||||
for (const key in propsOptions) {
|
||||
keys.push(key);
|
||||
const value = validateProp(key, propsOptions, propsData, vm);
|
||||
keys.push(key)
|
||||
const value = validateProp(key, propsOptions, propsData, vm)
|
||||
/* istanbul ignore else */
|
||||
if (process.env.NODE_ENV !== "production") {
|
||||
const hyphenatedKey = hyphenate(key);
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
const hyphenatedKey = hyphenate(key)
|
||||
if (
|
||||
isReservedAttribute(hyphenatedKey) ||
|
||||
config.isReservedAttr(hyphenatedKey)
|
||||
@ -85,7 +85,7 @@ function initProps(vm: Component, propsOptions: Object) {
|
||||
warn(
|
||||
`"${hyphenatedKey}" is a reserved attribute and cannot be used as component prop.`,
|
||||
vm
|
||||
);
|
||||
)
|
||||
}
|
||||
defineReactive(props, key, value, () => {
|
||||
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 ` +
|
||||
`value. Prop being mutated: "${key}"`,
|
||||
vm
|
||||
);
|
||||
)
|
||||
}
|
||||
});
|
||||
})
|
||||
} else {
|
||||
defineReactive(props, key, value);
|
||||
defineReactive(props, key, value)
|
||||
}
|
||||
// static props are already proxied on the component's prototype
|
||||
// during Vue.extend(). We only need to proxy props defined at
|
||||
// instantiation here.
|
||||
if (!(key in vm)) {
|
||||
proxy(vm, `_props`, key);
|
||||
proxy(vm, `_props`, key)
|
||||
}
|
||||
}
|
||||
toggleObserving(true);
|
||||
toggleObserving(true)
|
||||
}
|
||||
|
||||
function initData(vm: Component) {
|
||||
let data: any = vm.$options.data;
|
||||
data = vm._data = typeof data === "function" ? getData(data, vm) : data || {};
|
||||
let data: any = vm.$options.data
|
||||
data = vm._data = typeof data === 'function' ? getData(data, vm) : data || {}
|
||||
if (!isPlainObject(data)) {
|
||||
data = {};
|
||||
process.env.NODE_ENV !== "production" &&
|
||||
data = {}
|
||||
process.env.NODE_ENV !== 'production' &&
|
||||
warn(
|
||||
"data functions should return an object:\n" +
|
||||
"https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function",
|
||||
'data functions should return an object:\n' +
|
||||
'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
|
||||
vm
|
||||
);
|
||||
)
|
||||
}
|
||||
// proxy data on instance
|
||||
const keys = Object.keys(data);
|
||||
const props = vm.$options.props;
|
||||
const methods = vm.$options.methods;
|
||||
let i = keys.length;
|
||||
const keys = Object.keys(data)
|
||||
const props = vm.$options.props
|
||||
const methods = vm.$options.methods
|
||||
let i = keys.length
|
||||
while (i--) {
|
||||
const key = keys[i];
|
||||
if (process.env.NODE_ENV !== "production") {
|
||||
const key = keys[i]
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
if (methods && hasOwn(methods, key)) {
|
||||
warn(
|
||||
`Method "${key}" has already been defined as a data property.`,
|
||||
vm
|
||||
);
|
||||
warn(`Method "${key}" has already been defined as a data property.`, vm)
|
||||
}
|
||||
}
|
||||
if (props && hasOwn(props, key)) {
|
||||
process.env.NODE_ENV !== "production" &&
|
||||
process.env.NODE_ENV !== 'production' &&
|
||||
warn(
|
||||
`The data property "${key}" is already declared as a prop. ` +
|
||||
`Use prop default value instead.`,
|
||||
vm
|
||||
);
|
||||
)
|
||||
} else if (!isReserved(key)) {
|
||||
proxy(vm, `_data`, key);
|
||||
proxy(vm, `_data`, key)
|
||||
}
|
||||
}
|
||||
// observe data
|
||||
observe(data, true /* asRootData */);
|
||||
observe(data, true /* asRootData */)
|
||||
}
|
||||
|
||||
export function getData(data: Function, vm: Component): any {
|
||||
// #7573 disable dep collection when invoking data getters
|
||||
pushTarget();
|
||||
pushTarget()
|
||||
try {
|
||||
return data.call(vm, vm);
|
||||
return data.call(vm, vm)
|
||||
} catch (e: any) {
|
||||
handleError(e, vm, `data()`);
|
||||
return {};
|
||||
handleError(e, vm, `data()`)
|
||||
return {}
|
||||
} finally {
|
||||
popTarget();
|
||||
popTarget()
|
||||
}
|
||||
}
|
||||
|
||||
const computedWatcherOptions = { lazy: true };
|
||||
const computedWatcherOptions = { lazy: true }
|
||||
|
||||
function initComputed(vm: Component, computed: Object) {
|
||||
// $flow-disable-line
|
||||
const watchers = (vm._computedWatchers = Object.create(null));
|
||||
const watchers = (vm._computedWatchers = Object.create(null))
|
||||
// computed properties are just getters during SSR
|
||||
const isSSR = isServerRendering();
|
||||
const isSSR = isServerRendering()
|
||||
|
||||
for (const key in computed) {
|
||||
const userDef = computed[key];
|
||||
const getter = typeof userDef === "function" ? userDef : userDef.get;
|
||||
if (process.env.NODE_ENV !== "production" && getter == null) {
|
||||
warn(`Getter is missing for computed property "${key}".`, vm);
|
||||
const userDef = computed[key]
|
||||
const getter = typeof userDef === 'function' ? userDef : userDef.get
|
||||
if (process.env.NODE_ENV !== 'production' && getter == null) {
|
||||
warn(`Getter is missing for computed property "${key}".`, vm)
|
||||
}
|
||||
|
||||
if (!isSSR) {
|
||||
@ -188,27 +185,24 @@ function initComputed(vm: Component, computed: Object) {
|
||||
getter || noop,
|
||||
noop,
|
||||
computedWatcherOptions
|
||||
);
|
||||
)
|
||||
}
|
||||
|
||||
// component-defined computed properties are already defined on the
|
||||
// component prototype. We only need to define computed properties defined
|
||||
// at instantiation here.
|
||||
if (!(key in vm)) {
|
||||
defineComputed(vm, key, userDef);
|
||||
} else if (process.env.NODE_ENV !== "production") {
|
||||
defineComputed(vm, key, userDef)
|
||||
} else if (process.env.NODE_ENV !== 'production') {
|
||||
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) {
|
||||
warn(
|
||||
`The computed property "${key}" is already defined as a prop.`,
|
||||
vm
|
||||
);
|
||||
warn(`The computed property "${key}" is already defined as a prop.`, vm)
|
||||
} else if (vm.$options.methods && key in vm.$options.methods) {
|
||||
warn(
|
||||
`The computed property "${key}" is already defined as a method.`,
|
||||
vm
|
||||
);
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -219,92 +213,91 @@ export function defineComputed(
|
||||
key: string,
|
||||
userDef: Record<string, any> | Function
|
||||
) {
|
||||
const shouldCache = !isServerRendering();
|
||||
if (typeof userDef === "function") {
|
||||
const shouldCache = !isServerRendering()
|
||||
if (typeof userDef === 'function') {
|
||||
sharedPropertyDefinition.get = shouldCache
|
||||
? createComputedGetter(key)
|
||||
: createGetterInvoker(userDef);
|
||||
sharedPropertyDefinition.set = noop;
|
||||
: createGetterInvoker(userDef)
|
||||
sharedPropertyDefinition.set = noop
|
||||
} else {
|
||||
sharedPropertyDefinition.get = userDef.get
|
||||
? shouldCache && userDef.cache !== false
|
||||
? createComputedGetter(key)
|
||||
: createGetterInvoker(userDef.get)
|
||||
: noop;
|
||||
sharedPropertyDefinition.set = userDef.set || noop;
|
||||
: noop
|
||||
sharedPropertyDefinition.set = userDef.set || noop
|
||||
}
|
||||
if (
|
||||
process.env.NODE_ENV !== "production" &&
|
||||
process.env.NODE_ENV !== 'production' &&
|
||||
sharedPropertyDefinition.set === noop
|
||||
) {
|
||||
sharedPropertyDefinition.set = function () {
|
||||
warn(
|
||||
`Computed property "${key}" was assigned to but it has no setter.`,
|
||||
this
|
||||
);
|
||||
};
|
||||
)
|
||||
}
|
||||
Object.defineProperty(target, key, sharedPropertyDefinition);
|
||||
}
|
||||
Object.defineProperty(target, key, sharedPropertyDefinition)
|
||||
}
|
||||
|
||||
function createComputedGetter(key) {
|
||||
return function computedGetter() {
|
||||
const watcher = this._computedWatchers && this._computedWatchers[key];
|
||||
const watcher = this._computedWatchers && this._computedWatchers[key]
|
||||
if (watcher) {
|
||||
if (watcher.dirty) {
|
||||
watcher.evaluate();
|
||||
watcher.evaluate()
|
||||
}
|
||||
if (Dep.target) {
|
||||
watcher.depend();
|
||||
watcher.depend()
|
||||
}
|
||||
return watcher.value
|
||||
}
|
||||
return watcher.value;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function createGetterInvoker(fn) {
|
||||
return function computedGetter() {
|
||||
return fn.call(this, this);
|
||||
};
|
||||
return fn.call(this, this)
|
||||
}
|
||||
}
|
||||
|
||||
function initMethods(vm: Component, methods: Object) {
|
||||
const props = vm.$options.props;
|
||||
const props = vm.$options.props
|
||||
for (const key in methods) {
|
||||
if (process.env.NODE_ENV !== "production") {
|
||||
if (typeof methods[key] !== "function") {
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
if (typeof methods[key] !== 'function') {
|
||||
warn(
|
||||
`Method "${key}" has type "${typeof methods[
|
||||
key
|
||||
]}" in the component definition. ` +
|
||||
`Did you reference the function correctly?`,
|
||||
vm
|
||||
);
|
||||
)
|
||||
}
|
||||
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)) {
|
||||
warn(
|
||||
`Method "${key}" conflicts with an existing Vue instance method. ` +
|
||||
`Avoid defining component methods that start with _ or $.`
|
||||
);
|
||||
)
|
||||
}
|
||||
}
|
||||
vm[key] =
|
||||
typeof methods[key] !== "function" ? noop : bind(methods[key], vm);
|
||||
vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm)
|
||||
}
|
||||
}
|
||||
|
||||
function initWatch(vm: Component, watch: Object) {
|
||||
for (const key in watch) {
|
||||
const handler = watch[key];
|
||||
const handler = watch[key]
|
||||
if (Array.isArray(handler)) {
|
||||
for (let i = 0; i < handler.length; i++) {
|
||||
createWatcher(vm, key, handler[i]);
|
||||
createWatcher(vm, key, handler[i])
|
||||
}
|
||||
} else {
|
||||
createWatcher(vm, key, handler);
|
||||
createWatcher(vm, key, handler)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -316,65 +309,65 @@ function createWatcher(
|
||||
options?: Object
|
||||
) {
|
||||
if (isPlainObject(handler)) {
|
||||
options = handler;
|
||||
handler = handler.handler;
|
||||
options = handler
|
||||
handler = handler.handler
|
||||
}
|
||||
if (typeof handler === "string") {
|
||||
handler = vm[handler];
|
||||
if (typeof handler === 'string') {
|
||||
handler = vm[handler]
|
||||
}
|
||||
return vm.$watch(expOrFn, handler, options);
|
||||
return vm.$watch(expOrFn, handler, options)
|
||||
}
|
||||
|
||||
export function stateMixin(Vue: Component) {
|
||||
// flow somehow has problems with directly declared definition object
|
||||
// when using Object.defineProperty, so we have to procedurally build up
|
||||
// the object here.
|
||||
const dataDef: any = {};
|
||||
const dataDef: any = {}
|
||||
dataDef.get = function () {
|
||||
return this._data;
|
||||
};
|
||||
const propsDef: any = {};
|
||||
return this._data
|
||||
}
|
||||
const propsDef: any = {}
|
||||
propsDef.get = function () {
|
||||
return this._props;
|
||||
};
|
||||
if (process.env.NODE_ENV !== "production") {
|
||||
return this._props
|
||||
}
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
dataDef.set = function () {
|
||||
warn(
|
||||
"Avoid replacing instance root $data. " +
|
||||
"Use nested data properties instead.",
|
||||
'Avoid replacing instance root $data. ' +
|
||||
'Use nested data properties instead.',
|
||||
this
|
||||
);
|
||||
};
|
||||
propsDef.set = function () {
|
||||
warn(`$props is readonly.`, this);
|
||||
};
|
||||
)
|
||||
}
|
||||
Object.defineProperty(Vue.prototype, "$data", dataDef);
|
||||
Object.defineProperty(Vue.prototype, "$props", propsDef);
|
||||
propsDef.set = function () {
|
||||
warn(`$props is readonly.`, this)
|
||||
}
|
||||
}
|
||||
Object.defineProperty(Vue.prototype, '$data', dataDef)
|
||||
Object.defineProperty(Vue.prototype, '$props', propsDef)
|
||||
|
||||
Vue.prototype.$set = set;
|
||||
Vue.prototype.$delete = del;
|
||||
Vue.prototype.$set = set
|
||||
Vue.prototype.$delete = del
|
||||
|
||||
Vue.prototype.$watch = function (
|
||||
expOrFn: string | Function,
|
||||
cb: any,
|
||||
options?: Record<string, any>
|
||||
): Function {
|
||||
const vm: Component = this;
|
||||
const vm: Component = this
|
||||
if (isPlainObject(cb)) {
|
||||
return createWatcher(vm, expOrFn, cb, options);
|
||||
return createWatcher(vm, expOrFn, cb, options)
|
||||
}
|
||||
options = options || {};
|
||||
options.user = true;
|
||||
const watcher = new Watcher(vm, expOrFn, cb, options);
|
||||
options = options || {}
|
||||
options.user = true
|
||||
const watcher = new Watcher(vm, expOrFn, cb, options)
|
||||
if (options.immediate) {
|
||||
const info = `callback for immediate watcher "${watcher.expression}"`;
|
||||
pushTarget();
|
||||
invokeWithErrorHandling(cb, vm, [watcher.value], vm, info);
|
||||
popTarget();
|
||||
const info = `callback for immediate watcher "${watcher.expression}"`
|
||||
pushTarget()
|
||||
invokeWithErrorHandling(cb, vm, [watcher.value], vm, info)
|
||||
popTarget()
|
||||
}
|
||||
return function unwatchFn() {
|
||||
watcher.teardown();
|
||||
};
|
||||
};
|
||||
watcher.teardown()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ const methodsToPatch = [
|
||||
'unshift',
|
||||
'splice',
|
||||
'sort',
|
||||
'reverse',
|
||||
'reverse'
|
||||
]
|
||||
|
||||
/**
|
||||
|
@ -11,7 +11,7 @@ import {
|
||||
isPrimitive,
|
||||
isUndef,
|
||||
isValidArrayIndex,
|
||||
isServerRendering,
|
||||
isServerRendering
|
||||
} from '../util/index'
|
||||
|
||||
const arrayKeys = Object.getOwnPropertyNames(arrayMethods)
|
||||
@ -187,7 +187,7 @@ export function defineReactive(
|
||||
}
|
||||
childOb = !shallow && observe(newVal)
|
||||
dep.notify()
|
||||
},
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@ -196,7 +196,11 @@ export function defineReactive(
|
||||
* triggers change notification if the property doesn't
|
||||
* 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 (
|
||||
process.env.NODE_ENV !== 'production' &&
|
||||
(isUndef(target) || isPrimitive(target))
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
import type Watcher from './watcher'
|
||||
import config from '../config'
|
||||
import { callHook, activateChildComponent } from '../instance/lifecycle'
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
import { _Set as Set, isObject } from '../util/index'
|
||||
import type { SimpleSet } from '../util/index'
|
||||
import VNode from '../vdom/vnode'
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
import {
|
||||
warn,
|
||||
remove,
|
||||
@ -79,9 +78,8 @@ export default class Watcher {
|
||||
this.newDeps = []
|
||||
this.depIds = new Set()
|
||||
this.newDepIds = new Set()
|
||||
this.expression = process.env.NODE_ENV !== 'production'
|
||||
? expOrFn.toString()
|
||||
: ''
|
||||
this.expression =
|
||||
process.env.NODE_ENV !== 'production' ? expOrFn.toString() : ''
|
||||
// parse expression for getter
|
||||
if (typeof expOrFn === 'function') {
|
||||
this.getter = expOrFn
|
||||
@ -89,7 +87,8 @@ export default class Watcher {
|
||||
this.getter = parsePath(expOrFn)
|
||||
if (!this.getter) {
|
||||
this.getter = noop
|
||||
process.env.NODE_ENV !== 'production' && warn(
|
||||
process.env.NODE_ENV !== 'production' &&
|
||||
warn(
|
||||
`Failed watching path: "${expOrFn}" ` +
|
||||
'Watcher only accepts simple dot-delimited paths. ' +
|
||||
'For full control, use a function instead.',
|
||||
@ -97,9 +96,7 @@ export default class Watcher {
|
||||
)
|
||||
}
|
||||
}
|
||||
this.value = this.lazy
|
||||
? undefined
|
||||
: this.get()
|
||||
this.value = this.lazy ? undefined : this.get()
|
||||
}
|
||||
|
||||
/**
|
||||
@ -199,7 +196,13 @@ export default class Watcher {
|
||||
this.value = value
|
||||
if (this.user) {
|
||||
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 {
|
||||
this.cb.call(this.vm, value, oldValue)
|
||||
}
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
import config from '../config'
|
||||
import { noop } from 'shared/util'
|
||||
import type { Component } from 'typescript/component'
|
||||
@ -11,8 +10,8 @@ export let formatComponentName: (vm: Component, includeFile?: false) => string
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
const hasConsole = typeof console !== 'undefined'
|
||||
const classifyRE = /(?:^|[-_])(\w)/g
|
||||
const classify = (str) =>
|
||||
str.replace(classifyRE, (c) => c.toUpperCase()).replace(/[-_]/g, '')
|
||||
const classify = str =>
|
||||
str.replace(classifyRE, c => c.toUpperCase()).replace(/[-_]/g, '')
|
||||
|
||||
warn = (msg, vm) => {
|
||||
const trace = vm ? generateComponentTrace(vm) : ''
|
||||
|
@ -42,7 +42,7 @@ export function invokeWithErrorHandling(
|
||||
try {
|
||||
res = args ? handler.apply(context, args) : handler.call(context)
|
||||
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
|
||||
// avoid catch triggering multiple times when nested calls
|
||||
res._handled = true
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
export * from 'shared/util'
|
||||
export * from './lang'
|
||||
export * from './env'
|
||||
|
@ -1,10 +1,10 @@
|
||||
|
||||
/**
|
||||
* unicode letters used for parsing html tags, component names and property paths.
|
||||
* using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
|
||||
* 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 _
|
||||
@ -22,7 +22,7 @@ export function def(obj: Object, key: string, val: any, enumerable?: boolean) {
|
||||
value: val,
|
||||
enumerable: !!enumerable,
|
||||
writable: true,
|
||||
configurable: true,
|
||||
configurable: true
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,7 @@ if (typeof Promise !== 'undefined' && isNative(Promise)) {
|
||||
const observer = new MutationObserver(flushCallbacks)
|
||||
const textNode = document.createTextNode(String(counter))
|
||||
observer.observe(textNode, {
|
||||
characterData: true,
|
||||
characterData: true
|
||||
})
|
||||
timerFunc = () => {
|
||||
counter = (counter + 1) % 2
|
||||
@ -104,7 +104,7 @@ export function nextTick(cb?: Function, ctx?: Object) {
|
||||
}
|
||||
// $flow-disable-line
|
||||
if (!cb && typeof Promise !== 'undefined') {
|
||||
return new Promise((resolve) => {
|
||||
return new Promise(resolve => {
|
||||
_resolve = resolve
|
||||
})
|
||||
}
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
import config from '../config'
|
||||
import { warn } from './debug'
|
||||
import { set } from '../observer/index'
|
||||
@ -14,7 +13,7 @@ import {
|
||||
toRawType,
|
||||
capitalize,
|
||||
isBuiltInTag,
|
||||
isPlainObject,
|
||||
isPlainObject
|
||||
} from 'shared/util'
|
||||
import type { Component } from 'typescript/component'
|
||||
import type { ComponentOptions } from 'typescript/options'
|
||||
@ -172,7 +171,7 @@ function dedupeHooks(hooks: any) {
|
||||
return res
|
||||
}
|
||||
|
||||
LIFECYCLE_HOOKS.forEach((hook) => {
|
||||
LIFECYCLE_HOOKS.forEach(hook => {
|
||||
strats[hook] = mergeHook
|
||||
})
|
||||
|
||||
@ -245,7 +244,11 @@ strats.watch = function (
|
||||
/**
|
||||
* Other object hashes.
|
||||
*/
|
||||
strats.props = strats.methods = strats.inject = strats.computed = function (
|
||||
strats.props =
|
||||
strats.methods =
|
||||
strats.inject =
|
||||
strats.computed =
|
||||
function (
|
||||
parentVal: Object | null,
|
||||
childVal: Object | null,
|
||||
vm: Component | null,
|
||||
|
@ -13,7 +13,7 @@ if (process.env.NODE_ENV !== 'production') {
|
||||
perf.clearMarks &&
|
||||
perf.clearMeasures
|
||||
) {
|
||||
mark = (tag) => perf.mark(tag)
|
||||
mark = tag => perf.mark(tag)
|
||||
measure = (name, startTag, endTag) => {
|
||||
perf.measure(name, startTag, endTag)
|
||||
perf.clearMarks(startTag)
|
||||
|
@ -128,7 +128,7 @@ function assertProp(
|
||||
}
|
||||
}
|
||||
|
||||
const haveExpectedTypes = expectedTypes.some((t) => t)
|
||||
const haveExpectedTypes = expectedTypes.some(t => t)
|
||||
if (!valid && haveExpectedTypes) {
|
||||
warn(getInvalidTypeMessage(name, value, expectedTypes), vm)
|
||||
return
|
||||
@ -244,9 +244,9 @@ function styleValue(value, type) {
|
||||
|
||||
const EXPLICABLE_TYPES = ['string', 'number', 'boolean']
|
||||
function isExplicable(value) {
|
||||
return EXPLICABLE_TYPES.some((elem) => value.toLowerCase() === elem)
|
||||
return EXPLICABLE_TYPES.some(elem => value.toLowerCase() === elem)
|
||||
}
|
||||
|
||||
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 { resolveConstructorOptions } from 'core/instance/init'
|
||||
import { queueActivatedComponent } from 'core/observer/scheduler'
|
||||
@ -9,7 +8,7 @@ import { warn, isDef, isUndef, isTrue, isObject } from '../util/index'
|
||||
import {
|
||||
resolveAsyncComponent,
|
||||
createAsyncPlaceholder,
|
||||
extractPropsFromVNodeData,
|
||||
extractPropsFromVNodeData
|
||||
} from './helpers/index'
|
||||
|
||||
import {
|
||||
@ -17,13 +16,13 @@ import {
|
||||
activeInstance,
|
||||
updateChildComponent,
|
||||
activateChildComponent,
|
||||
deactivateChildComponent,
|
||||
deactivateChildComponent
|
||||
} from '../instance/lifecycle'
|
||||
|
||||
import type {
|
||||
MountedComponentVNode,
|
||||
VNodeData,
|
||||
VNodeWithData,
|
||||
VNodeWithData
|
||||
} from 'typescript/vnode'
|
||||
import type { Component } from 'typescript/component'
|
||||
import type { InternalComponentOptions } from 'typescript/options'
|
||||
@ -89,7 +88,7 @@ const componentVNodeHooks = {
|
||||
deactivateChildComponent(componentInstance, true /* direct */)
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
const hooksToMerge = Object.keys(componentVNodeHooks)
|
||||
@ -214,7 +213,7 @@ export function createComponentInstanceForVnode(
|
||||
const options: InternalComponentOptions = {
|
||||
_isComponent: true,
|
||||
_parentVnode: vnode,
|
||||
parent,
|
||||
parent
|
||||
}
|
||||
// check inline-template render functions
|
||||
const inlineTemplate = vnode.data.inlineTemplate
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
import VNode, { cloneVNode } from './vnode'
|
||||
import { createElement } from './create-element'
|
||||
import { resolveInject } from '../instance/inject'
|
||||
@ -13,7 +12,7 @@ import {
|
||||
hasOwn,
|
||||
camelize,
|
||||
emptyObject,
|
||||
validateProp,
|
||||
validateProp
|
||||
} from '../util/index'
|
||||
import type { Component } from 'typescript/component'
|
||||
import type { VNodeData } from 'typescript/vnode'
|
||||
@ -64,7 +63,7 @@ export function FunctionalRenderContext(
|
||||
enumerable: true,
|
||||
get() {
|
||||
return normalizeScopedSlots(data.scopedSlots, this.slots())
|
||||
},
|
||||
}
|
||||
} as any)
|
||||
|
||||
// support for compiled functional template
|
||||
@ -160,10 +159,11 @@ function cloneAndMarkFunctionalResult(
|
||||
clone.fnContext = contextVm
|
||||
clone.fnOptions = options
|
||||
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) {
|
||||
(clone.data || (clone.data = {})).slot = data.slot
|
||||
;(clone.data || (clone.data = {})).slot = data.slot
|
||||
}
|
||||
return clone
|
||||
}
|
||||
|
@ -1,11 +1,10 @@
|
||||
|
||||
import {
|
||||
tip,
|
||||
hasOwn,
|
||||
isDef,
|
||||
isUndef,
|
||||
hyphenate,
|
||||
formatComponentName,
|
||||
formatComponentName
|
||||
} from 'core/util/index'
|
||||
import type { Component } from 'typescript/component'
|
||||
import type { VNodeData } from 'typescript/vnode'
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
import { isDef } from 'shared/util'
|
||||
import VNode from '../vnode'
|
||||
import { isAsyncPlaceholder } from './is-async-placeholder'
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
export * from './merge-hook'
|
||||
export * from './extract-props'
|
||||
export * from './update-listeners'
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
import VNode from '../vnode'
|
||||
|
||||
export function isAsyncPlaceholder(node: VNode): boolean {
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
import VNode from '../vnode'
|
||||
import { createFnInvoker } from './update-listeners'
|
||||
import { remove, isDef, isUndef, isTrue } from 'shared/util'
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
import VNode, { createTextVNode } from 'core/vdom/vnode'
|
||||
import { isFalse, isTrue, isDef, isUndef, isPrimitive } from 'shared/util'
|
||||
|
||||
|
@ -1,23 +1,23 @@
|
||||
import { def } from "core/util/lang";
|
||||
import { normalizeChildren } from "core/vdom/helpers/normalize-children";
|
||||
import { emptyObject } from "shared/util";
|
||||
import { isAsyncPlaceholder } from "./is-async-placeholder";
|
||||
import type VNode from "../vnode";
|
||||
import { def } from 'core/util/lang'
|
||||
import { normalizeChildren } from 'core/vdom/helpers/normalize-children'
|
||||
import { emptyObject } from 'shared/util'
|
||||
import { isAsyncPlaceholder } from './is-async-placeholder'
|
||||
import type VNode from '../vnode'
|
||||
|
||||
export function normalizeScopedSlots(
|
||||
slots: { [key: string]: Function } | void,
|
||||
normalSlots: { [key: string]: Array<VNode> },
|
||||
prevSlots?: { [key: string]: Function } | void
|
||||
): any {
|
||||
let res;
|
||||
const hasNormalSlots = Object.keys(normalSlots).length > 0;
|
||||
const isStable = slots ? !!slots.$stable : !hasNormalSlots;
|
||||
const key = slots && slots.$key;
|
||||
let res
|
||||
const hasNormalSlots = Object.keys(normalSlots).length > 0
|
||||
const isStable = slots ? !!slots.$stable : !hasNormalSlots
|
||||
const key = slots && slots.$key
|
||||
if (!slots) {
|
||||
res = {};
|
||||
res = {}
|
||||
} else if (slots._normalized) {
|
||||
// fast path 1: child component re-render only, parent did not change
|
||||
return slots._normalized;
|
||||
return slots._normalized
|
||||
} else if (
|
||||
isStable &&
|
||||
prevSlots &&
|
||||
@ -28,46 +28,46 @@ export function normalizeScopedSlots(
|
||||
) {
|
||||
// fast path 2: stable scoped slots w/ no normal slots to proxy,
|
||||
// only need to normalize once
|
||||
return prevSlots;
|
||||
return prevSlots
|
||||
} else {
|
||||
res = {};
|
||||
res = {}
|
||||
for (const key in slots) {
|
||||
if (slots[key] && key[0] !== "$") {
|
||||
res[key] = normalizeScopedSlot(normalSlots, key, slots[key]);
|
||||
if (slots[key] && key[0] !== '$') {
|
||||
res[key] = normalizeScopedSlot(normalSlots, key, slots[key])
|
||||
}
|
||||
}
|
||||
}
|
||||
// expose normal slots on scopedSlots
|
||||
for (const key in normalSlots) {
|
||||
if (!(key in res)) {
|
||||
res[key] = proxyNormalSlot(normalSlots, key);
|
||||
res[key] = proxyNormalSlot(normalSlots, key)
|
||||
}
|
||||
}
|
||||
// avoriaz seems to mock a non-extensible $scopedSlots object
|
||||
// and when that is passed down this would cause an error
|
||||
if (slots && Object.isExtensible(slots)) {
|
||||
slots._normalized = res;
|
||||
slots._normalized = res
|
||||
}
|
||||
def(res, "$stable", isStable);
|
||||
def(res, "$key", key);
|
||||
def(res, "$hasNormal", hasNormalSlots);
|
||||
return res;
|
||||
def(res, '$stable', isStable)
|
||||
def(res, '$key', key)
|
||||
def(res, '$hasNormal', hasNormalSlots)
|
||||
return res
|
||||
}
|
||||
|
||||
function normalizeScopedSlot(normalSlots, key, fn) {
|
||||
const normalized = function () {
|
||||
let res = arguments.length ? fn.apply(null, arguments) : fn({});
|
||||
let res = arguments.length ? fn.apply(null, arguments) : fn({})
|
||||
res =
|
||||
res && typeof res === "object" && !Array.isArray(res)
|
||||
res && typeof res === 'object' && !Array.isArray(res)
|
||||
? [res] // single vnode
|
||||
: normalizeChildren(res);
|
||||
const vnode: VNode | null = res && res[0];
|
||||
: normalizeChildren(res)
|
||||
const vnode: VNode | null = res && res[0]
|
||||
return res &&
|
||||
(!vnode ||
|
||||
(res.length === 1 && vnode.isComment && !isAsyncPlaceholder(vnode))) // #9658, #10391
|
||||
? undefined
|
||||
: res;
|
||||
};
|
||||
: res
|
||||
}
|
||||
// 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
|
||||
// on this.$slots because the usage is semantically a normal slot.
|
||||
@ -75,12 +75,12 @@ function normalizeScopedSlot(normalSlots, key, fn) {
|
||||
Object.defineProperty(normalSlots, key, {
|
||||
get: normalized,
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
});
|
||||
configurable: true
|
||||
})
|
||||
}
|
||||
return normalized;
|
||||
return normalized
|
||||
}
|
||||
|
||||
function proxyNormalSlot(slots, key) {
|
||||
return () => slots[key];
|
||||
return () => slots[key]
|
||||
}
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
import {
|
||||
warn,
|
||||
once,
|
||||
@ -8,7 +7,7 @@ import {
|
||||
isObject,
|
||||
hasSymbol,
|
||||
isPromise,
|
||||
remove,
|
||||
remove
|
||||
} from 'core/util/index'
|
||||
|
||||
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' &&
|
||||
warn(
|
||||
`Failed to resolve async component: ${String(factory)}` +
|
||||
|
@ -2,7 +2,10 @@ import { warn, invokeWithErrorHandling } from 'core/util/index'
|
||||
import { cached, isUndef, isTrue } from 'shared/util'
|
||||
import type { Component } from 'typescript/component'
|
||||
|
||||
const normalizeEvent = cached((name: string): {
|
||||
const normalizeEvent = cached(
|
||||
(
|
||||
name: string
|
||||
): {
|
||||
name: string
|
||||
once: boolean
|
||||
capture: boolean
|
||||
@ -20,9 +23,10 @@ const normalizeEvent = cached((name: string): {
|
||||
name,
|
||||
once,
|
||||
capture,
|
||||
passive,
|
||||
passive
|
||||
}
|
||||
})
|
||||
}
|
||||
)
|
||||
|
||||
export function createFnInvoker(
|
||||
fns: Function | Array<Function>,
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
import { emptyNode } from 'core/vdom/patch'
|
||||
import { resolveAsset, handleError } from 'core/util/index'
|
||||
import { mergeVNodeHook } from 'core/vdom/helpers/index'
|
||||
@ -11,7 +10,7 @@ export default {
|
||||
destroy: function unbindDirectives(vnode: VNodeWithData) {
|
||||
// @ts-expect-error emptyNode is not VNodeWithData
|
||||
updateDirectives(vnode, emptyNode)
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
function updateDirectives(oldVnode: VNodeWithData, vnode: VNodeWithData) {
|
||||
|
@ -1,44 +1,44 @@
|
||||
import { remove, isDef } from "shared/util";
|
||||
import type { VNodeWithData } from "typescript/vnode";
|
||||
import { remove, isDef } from 'shared/util'
|
||||
import type { VNodeWithData } from 'typescript/vnode'
|
||||
|
||||
export default {
|
||||
create(_: any, vnode: VNodeWithData) {
|
||||
registerRef(vnode);
|
||||
registerRef(vnode)
|
||||
},
|
||||
update(oldVnode: VNodeWithData, vnode: VNodeWithData) {
|
||||
if (oldVnode.data.ref !== vnode.data.ref) {
|
||||
registerRef(oldVnode, true);
|
||||
registerRef(vnode);
|
||||
registerRef(oldVnode, true)
|
||||
registerRef(vnode)
|
||||
}
|
||||
},
|
||||
destroy(vnode: VNodeWithData) {
|
||||
registerRef(vnode, true);
|
||||
},
|
||||
};
|
||||
registerRef(vnode, true)
|
||||
}
|
||||
}
|
||||
|
||||
export function registerRef(vnode: VNodeWithData, isRemoval?: boolean) {
|
||||
const key = vnode.data.ref;
|
||||
if (!isDef(key)) return;
|
||||
const key = vnode.data.ref
|
||||
if (!isDef(key)) return
|
||||
|
||||
const vm = vnode.context;
|
||||
const ref = vnode.componentInstance || vnode.elm;
|
||||
const refs = vm.$refs;
|
||||
const obj = refs[key];
|
||||
const vm = vnode.context
|
||||
const ref = vnode.componentInstance || vnode.elm
|
||||
const refs = vm.$refs
|
||||
const obj = refs[key]
|
||||
if (isRemoval) {
|
||||
if (Array.isArray(obj)) {
|
||||
remove(obj, ref);
|
||||
remove(obj, ref)
|
||||
} else if (obj === ref) {
|
||||
refs[key] = undefined;
|
||||
refs[key] = undefined
|
||||
}
|
||||
} else {
|
||||
if (vnode.data.refInFor) {
|
||||
if (!Array.isArray(obj)) {
|
||||
refs[key] = [ref];
|
||||
refs[key] = [ref]
|
||||
} else if (obj.indexOf(ref) < 0) {
|
||||
obj.push(ref);
|
||||
obj.push(ref)
|
||||
}
|
||||
} else {
|
||||
refs[key] = ref;
|
||||
refs[key] = ref
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ import {
|
||||
isTrue,
|
||||
makeMap,
|
||||
isRegExp,
|
||||
isPrimitive,
|
||||
isPrimitive
|
||||
} from '../util/index'
|
||||
|
||||
export const emptyNode = new VNode('', {}, [])
|
||||
@ -35,17 +35,12 @@ const hooks = ['create', 'activate', 'update', 'remove', 'destroy']
|
||||
function sameVnode(a, b) {
|
||||
return (
|
||||
a.key === b.key &&
|
||||
a.asyncFactory === b.asyncFactory && (
|
||||
(
|
||||
a.tag === b.tag &&
|
||||
a.asyncFactory === b.asyncFactory &&
|
||||
((a.tag === b.tag &&
|
||||
a.isComment === b.isComment &&
|
||||
isDef(a.data) === isDef(b.data) &&
|
||||
sameInputType(a, b)
|
||||
) || (
|
||||
isTrue(a.isAsyncPlaceholder) &&
|
||||
isUndef(b.asyncFactory.error)
|
||||
)
|
||||
)
|
||||
sameInputType(a, b)) ||
|
||||
(isTrue(a.isAsyncPlaceholder) && isUndef(b.asyncFactory.error)))
|
||||
)
|
||||
}
|
||||
|
||||
@ -110,7 +105,7 @@ export function createPatchFunction(backend) {
|
||||
!vnode.ns &&
|
||||
!(
|
||||
config.ignoredElements.length &&
|
||||
config.ignoredElements.some((ignore) => {
|
||||
config.ignoredElements.some(ignore => {
|
||||
return isRegExp(ignore)
|
||||
? ignore.test(vnode.tag)
|
||||
: ignore === vnode.tag
|
||||
|
@ -1,35 +1,35 @@
|
||||
import type { Component } from "typescript/component";
|
||||
import type { ComponentOptions } from "typescript/options";
|
||||
import type { VNodeComponentOptions, VNodeData } from "typescript/vnode";
|
||||
import type { Component } from 'typescript/component'
|
||||
import type { ComponentOptions } from 'typescript/options'
|
||||
import type { VNodeComponentOptions, VNodeData } from 'typescript/vnode'
|
||||
|
||||
export default class VNode {
|
||||
tag?: string;
|
||||
data: VNodeData | undefined;
|
||||
children?: Array<VNode> | null;
|
||||
text?: string;
|
||||
elm: Node | undefined;
|
||||
ns?: string;
|
||||
context?: Component; // rendered in this component's scope
|
||||
key: string | number | undefined;
|
||||
componentOptions?: VNodeComponentOptions;
|
||||
componentInstance?: Component; // component instance
|
||||
parent: VNode | undefined | null; // component placeholder node
|
||||
tag?: string
|
||||
data: VNodeData | undefined
|
||||
children?: Array<VNode> | null
|
||||
text?: string
|
||||
elm: Node | undefined
|
||||
ns?: string
|
||||
context?: Component // rendered in this component's scope
|
||||
key: string | number | undefined
|
||||
componentOptions?: VNodeComponentOptions
|
||||
componentInstance?: Component // component instance
|
||||
parent: VNode | undefined | null // component placeholder node
|
||||
|
||||
// strictly internal
|
||||
raw: boolean; // contains raw HTML? (server only)
|
||||
isStatic: boolean; // hoisted static node
|
||||
isRootInsert: boolean; // necessary for enter transition check
|
||||
isComment: boolean; // empty comment placeholder?
|
||||
isCloned: boolean; // is a cloned node?
|
||||
isOnce: boolean; // is a v-once node?
|
||||
asyncFactory?: Function; // async component factory function
|
||||
asyncMeta: Object | void;
|
||||
isAsyncPlaceholder: boolean;
|
||||
ssrContext?: Object | void;
|
||||
fnContext: Component | void; // real context vm for functional nodes
|
||||
fnOptions?: ComponentOptions | null; // for SSR caching
|
||||
devtoolsMeta?: Object | null; // used to store functional render context for devtools
|
||||
fnScopeId?: string | null; // functional scope id support
|
||||
raw: boolean // contains raw HTML? (server only)
|
||||
isStatic: boolean // hoisted static node
|
||||
isRootInsert: boolean // necessary for enter transition check
|
||||
isComment: boolean // empty comment placeholder?
|
||||
isCloned: boolean // is a cloned node?
|
||||
isOnce: boolean // is a v-once node?
|
||||
asyncFactory?: Function // async component factory function
|
||||
asyncMeta: Object | void
|
||||
isAsyncPlaceholder: boolean
|
||||
ssrContext?: Object | void
|
||||
fnContext: Component | void // real context vm for functional nodes
|
||||
fnOptions?: ComponentOptions | null // for SSR caching
|
||||
devtoolsMeta?: Object | null // used to store functional render context for devtools
|
||||
fnScopeId?: string | null // functional scope id support
|
||||
|
||||
constructor(
|
||||
tag?: string,
|
||||
@ -41,47 +41,47 @@ export default class VNode {
|
||||
componentOptions?: VNodeComponentOptions,
|
||||
asyncFactory?: Function
|
||||
) {
|
||||
this.tag = tag;
|
||||
this.data = data;
|
||||
this.children = children;
|
||||
this.text = text;
|
||||
this.elm = elm;
|
||||
this.ns = undefined;
|
||||
this.context = context;
|
||||
this.fnContext = undefined;
|
||||
this.fnOptions = undefined;
|
||||
this.fnScopeId = undefined;
|
||||
this.key = data && data.key;
|
||||
this.componentOptions = componentOptions;
|
||||
this.componentInstance = undefined;
|
||||
this.parent = undefined;
|
||||
this.raw = false;
|
||||
this.isStatic = false;
|
||||
this.isRootInsert = true;
|
||||
this.isComment = false;
|
||||
this.isCloned = false;
|
||||
this.isOnce = false;
|
||||
this.asyncFactory = asyncFactory;
|
||||
this.asyncMeta = undefined;
|
||||
this.isAsyncPlaceholder = false;
|
||||
this.tag = tag
|
||||
this.data = data
|
||||
this.children = children
|
||||
this.text = text
|
||||
this.elm = elm
|
||||
this.ns = undefined
|
||||
this.context = context
|
||||
this.fnContext = undefined
|
||||
this.fnOptions = undefined
|
||||
this.fnScopeId = undefined
|
||||
this.key = data && data.key
|
||||
this.componentOptions = componentOptions
|
||||
this.componentInstance = undefined
|
||||
this.parent = undefined
|
||||
this.raw = false
|
||||
this.isStatic = false
|
||||
this.isRootInsert = true
|
||||
this.isComment = false
|
||||
this.isCloned = false
|
||||
this.isOnce = false
|
||||
this.asyncFactory = asyncFactory
|
||||
this.asyncMeta = undefined
|
||||
this.isAsyncPlaceholder = false
|
||||
}
|
||||
|
||||
// DEPRECATED: alias for componentInstance for backwards compat.
|
||||
/* istanbul ignore next */
|
||||
get child(): Component | void {
|
||||
return this.componentInstance;
|
||||
return this.componentInstance
|
||||
}
|
||||
}
|
||||
|
||||
export const createEmptyVNode = (text: string = "") => {
|
||||
const node = new VNode();
|
||||
node.text = text;
|
||||
node.isComment = true;
|
||||
return node;
|
||||
};
|
||||
export const createEmptyVNode = (text: string = '') => {
|
||||
const node = new VNode()
|
||||
node.text = text
|
||||
node.isComment = true
|
||||
return node
|
||||
}
|
||||
|
||||
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
|
||||
@ -101,15 +101,15 @@ export function cloneVNode(vnode: VNode): VNode {
|
||||
vnode.context,
|
||||
vnode.componentOptions,
|
||||
vnode.asyncFactory
|
||||
);
|
||||
cloned.ns = vnode.ns;
|
||||
cloned.isStatic = vnode.isStatic;
|
||||
cloned.key = vnode.key;
|
||||
cloned.isComment = vnode.isComment;
|
||||
cloned.fnContext = vnode.fnContext;
|
||||
cloned.fnOptions = vnode.fnOptions;
|
||||
cloned.fnScopeId = vnode.fnScopeId;
|
||||
cloned.asyncMeta = vnode.asyncMeta;
|
||||
cloned.isCloned = true;
|
||||
return cloned;
|
||||
)
|
||||
cloned.ns = vnode.ns
|
||||
cloned.isStatic = vnode.isStatic
|
||||
cloned.key = vnode.key
|
||||
cloned.isComment = vnode.isComment
|
||||
cloned.fnContext = vnode.fnContext
|
||||
cloned.fnOptions = vnode.fnOptions
|
||||
cloned.fnScopeId = vnode.fnScopeId
|
||||
cloned.asyncMeta = vnode.asyncMeta
|
||||
cloned.isCloned = true
|
||||
return cloned
|
||||
}
|
||||
|
2
src/global.d.ts
vendored
2
src/global.d.ts
vendored
@ -1,5 +1,5 @@
|
||||
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
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
import { addProp } from 'compiler/helpers'
|
||||
|
||||
export default function html(el: ASTElement, dir: ASTDirective) {
|
||||
|
@ -5,5 +5,5 @@ import html from './html'
|
||||
export default {
|
||||
model,
|
||||
text,
|
||||
html,
|
||||
html
|
||||
}
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
import config from 'core/config'
|
||||
import { addHandler, addProp, getBindingAttr } from 'compiler/helpers'
|
||||
import { genComponentModel, genAssignmentCode } from 'compiler/directives/model'
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
import { addProp } from 'compiler/helpers'
|
||||
|
||||
export default function text(el: ASTElement, dir: ASTDirective) {
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
import { baseOptions } from './options'
|
||||
import { createCompiler } from 'compiler/index'
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
import { parseText } from 'compiler/parser/text-parser'
|
||||
import { getAndRemoveAttr, getBindingAttr, baseWarn } from 'compiler/helpers'
|
||||
|
||||
@ -40,5 +39,5 @@ function genData(el: ASTElement): string {
|
||||
export default {
|
||||
staticKeys: ['staticClass'],
|
||||
transformNode,
|
||||
genData,
|
||||
genData
|
||||
} as ModuleOptions
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
/**
|
||||
* Expand input[v-model] with dynamic type bindings into v-if-else chains
|
||||
* Turn this:
|
||||
@ -15,7 +14,7 @@ import {
|
||||
processFor,
|
||||
processElement,
|
||||
addIfCondition,
|
||||
createASTElement,
|
||||
createASTElement
|
||||
} from 'compiler/parser/index'
|
||||
|
||||
function preTransformNode(el: ASTElement, options: CompilerOptions) {
|
||||
@ -48,7 +47,7 @@ function preTransformNode(el: ASTElement, options: CompilerOptions) {
|
||||
branch0.if = `(${typeBinding})==='checkbox'` + ifConditionExtra
|
||||
addIfCondition(branch0, {
|
||||
exp: branch0.if,
|
||||
block: branch0,
|
||||
block: branch0
|
||||
})
|
||||
// 2. add radio else-if condition
|
||||
const branch1 = cloneASTElement(el)
|
||||
@ -57,7 +56,7 @@ function preTransformNode(el: ASTElement, options: CompilerOptions) {
|
||||
processElement(branch1, options)
|
||||
addIfCondition(branch0, {
|
||||
exp: `(${typeBinding})==='radio'` + ifConditionExtra,
|
||||
block: branch1,
|
||||
block: branch1
|
||||
})
|
||||
// 3. other
|
||||
const branch2 = cloneASTElement(el)
|
||||
@ -66,7 +65,7 @@ function preTransformNode(el: ASTElement, options: CompilerOptions) {
|
||||
processElement(branch2, options)
|
||||
addIfCondition(branch0, {
|
||||
exp: ifCondition!,
|
||||
block: branch2,
|
||||
block: branch2
|
||||
})
|
||||
|
||||
if (hasElse) {
|
||||
@ -85,5 +84,5 @@ function cloneASTElement(el) {
|
||||
}
|
||||
|
||||
export default {
|
||||
preTransformNode,
|
||||
preTransformNode
|
||||
} as ModuleOptions
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
import { parseText } from 'compiler/parser/text-parser'
|
||||
import { parseStyleText } from 'web/util/style'
|
||||
import { getAndRemoveAttr, getBindingAttr, baseWarn } from 'compiler/helpers'
|
||||
@ -43,5 +42,5 @@ function genData(el: ASTElement): string {
|
||||
export default {
|
||||
staticKeys: ['staticStyle'],
|
||||
transformNode,
|
||||
genData,
|
||||
genData
|
||||
} as ModuleOptions
|
||||
|
@ -2,13 +2,13 @@ import {
|
||||
isPreTag,
|
||||
mustUseProp,
|
||||
isReservedTag,
|
||||
getTagNamespace,
|
||||
} from "../util/index";
|
||||
getTagNamespace
|
||||
} from '../util/index'
|
||||
|
||||
import modules from "./modules/index";
|
||||
import directives from "./directives/index";
|
||||
import { genStaticKeys } from "shared/util";
|
||||
import { isUnaryTag, canBeLeftOpenTag } from "./util";
|
||||
import modules from './modules/index'
|
||||
import directives from './directives/index'
|
||||
import { genStaticKeys } from 'shared/util'
|
||||
import { isUnaryTag, canBeLeftOpenTag } from './util'
|
||||
|
||||
export const baseOptions: CompilerOptions = {
|
||||
expectHTML: true,
|
||||
@ -20,5 +20,5 @@ export const baseOptions: CompilerOptions = {
|
||||
canBeLeftOpenTag,
|
||||
isReservedTag,
|
||||
getTagNamespace,
|
||||
staticKeys: genStaticKeys(modules),
|
||||
};
|
||||
staticKeys: genStaticKeys(modules)
|
||||
}
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
import { makeMap } from 'shared/util'
|
||||
|
||||
export const isUnaryTag = makeMap(
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
export { parseComponent } from 'sfc/parser'
|
||||
export { compile, compileToFunctions } from './compiler/index'
|
||||
export { ssrCompile, ssrCompileToFunctions } from './server/compiler'
|
||||
|
@ -7,12 +7,12 @@ import { query } from './util/index'
|
||||
import { compileToFunctions } from './compiler/index'
|
||||
import {
|
||||
shouldDecodeNewlines,
|
||||
shouldDecodeNewlinesForHref,
|
||||
shouldDecodeNewlinesForHref
|
||||
} from './util/compat'
|
||||
import type { Component } from 'typescript/component'
|
||||
import type { GlobalAPI } from 'typescript/global-api'
|
||||
|
||||
const idToTemplate = cached((id) => {
|
||||
const idToTemplate = cached(id => {
|
||||
const el = query(id)
|
||||
return el && el.innerHTML
|
||||
})
|
||||
@ -74,7 +74,7 @@ Vue.prototype.$mount = function (
|
||||
shouldDecodeNewlines,
|
||||
shouldDecodeNewlinesForHref,
|
||||
delimiters: options.delimiters,
|
||||
comments: options.comments,
|
||||
comments: options.comments
|
||||
},
|
||||
this
|
||||
)
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
import Vue from './runtime/index'
|
||||
|
||||
export default Vue
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
import modules from './server/modules/index'
|
||||
import directives from './server/directives/index'
|
||||
import { isUnaryTag, canBeLeftOpenTag } from './compiler/util'
|
||||
@ -9,5 +8,5 @@ export default createBasicRenderer({
|
||||
modules,
|
||||
directives,
|
||||
isUnaryTag,
|
||||
canBeLeftOpenTag,
|
||||
canBeLeftOpenTag
|
||||
})
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user