🔧
This commit is contained in:
21
node_modules/@vue/compiler-core/LICENSE
generated
vendored
Normal file
21
node_modules/@vue/compiler-core/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2018-present, Yuxi (Evan) You
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
1
node_modules/@vue/compiler-core/README.md
generated
vendored
Normal file
1
node_modules/@vue/compiler-core/README.md
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
# @vue/compiler-core
|
||||
5808
node_modules/@vue/compiler-core/dist/compiler-core.cjs.js
generated
vendored
Normal file
5808
node_modules/@vue/compiler-core/dist/compiler-core.cjs.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
5678
node_modules/@vue/compiler-core/dist/compiler-core.cjs.prod.js
generated
vendored
Normal file
5678
node_modules/@vue/compiler-core/dist/compiler-core.cjs.prod.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1198
node_modules/@vue/compiler-core/dist/compiler-core.d.ts
generated
vendored
Normal file
1198
node_modules/@vue/compiler-core/dist/compiler-core.d.ts
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
4861
node_modules/@vue/compiler-core/dist/compiler-core.esm-bundler.js
generated
vendored
Normal file
4861
node_modules/@vue/compiler-core/dist/compiler-core.esm-bundler.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
7
node_modules/@vue/compiler-core/index.js
generated
vendored
Normal file
7
node_modules/@vue/compiler-core/index.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
'use strict'
|
||||
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
module.exports = require('./dist/compiler-core.cjs.prod.js')
|
||||
} else {
|
||||
module.exports = require('./dist/compiler-core.cjs.js')
|
||||
}
|
||||
43
node_modules/@vue/compiler-core/package.json
generated
vendored
Normal file
43
node_modules/@vue/compiler-core/package.json
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
{
|
||||
"name": "@vue/compiler-core",
|
||||
"version": "3.2.36",
|
||||
"description": "@vue/compiler-core",
|
||||
"main": "index.js",
|
||||
"module": "dist/compiler-core.esm-bundler.js",
|
||||
"types": "dist/compiler-core.d.ts",
|
||||
"files": [
|
||||
"index.js",
|
||||
"dist"
|
||||
],
|
||||
"buildOptions": {
|
||||
"name": "VueCompilerCore",
|
||||
"compat": true,
|
||||
"formats": [
|
||||
"esm-bundler",
|
||||
"cjs"
|
||||
]
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/vuejs/core.git",
|
||||
"directory": "packages/compiler-core"
|
||||
},
|
||||
"keywords": [
|
||||
"vue"
|
||||
],
|
||||
"author": "Evan You",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/vuejs/core/issues"
|
||||
},
|
||||
"homepage": "https://github.com/vuejs/core/tree/main/packages/compiler-core#readme",
|
||||
"dependencies": {
|
||||
"@vue/shared": "3.2.36",
|
||||
"@babel/parser": "^7.16.4",
|
||||
"estree-walker": "^2.0.2",
|
||||
"source-map": "^0.6.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/types": "^7.16.0"
|
||||
}
|
||||
}
|
||||
21
node_modules/@vue/compiler-dom/LICENSE
generated
vendored
Normal file
21
node_modules/@vue/compiler-dom/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2018-present, Yuxi (Evan) You
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
1
node_modules/@vue/compiler-dom/README.md
generated
vendored
Normal file
1
node_modules/@vue/compiler-dom/README.md
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
# @vue/compiler-dom
|
||||
3136
node_modules/@vue/compiler-dom/dist/compiler-dom.cjs.js
generated
vendored
Normal file
3136
node_modules/@vue/compiler-dom/dist/compiler-dom.cjs.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
3074
node_modules/@vue/compiler-dom/dist/compiler-dom.cjs.prod.js
generated
vendored
Normal file
3074
node_modules/@vue/compiler-dom/dist/compiler-dom.cjs.prod.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
66
node_modules/@vue/compiler-dom/dist/compiler-dom.d.ts
generated
vendored
Normal file
66
node_modules/@vue/compiler-dom/dist/compiler-dom.d.ts
generated
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
import { CodegenResult } from '@vue/compiler-core';
|
||||
import { CompilerError } from '@vue/compiler-core';
|
||||
import { CompilerOptions } from '@vue/compiler-core';
|
||||
import { DirectiveTransform } from '@vue/compiler-core';
|
||||
import { NodeTransform } from '@vue/compiler-core';
|
||||
import { ParserOptions } from '@vue/compiler-core';
|
||||
import { RootNode } from '@vue/compiler-core';
|
||||
import { SourceLocation } from '@vue/compiler-core';
|
||||
|
||||
export declare function compile(template: string, options?: CompilerOptions): CodegenResult;
|
||||
|
||||
export declare function createDOMCompilerError(code: DOMErrorCodes, loc?: SourceLocation): DOMCompilerError;
|
||||
|
||||
declare interface DOMCompilerError extends CompilerError {
|
||||
code: DOMErrorCodes;
|
||||
}
|
||||
|
||||
export declare const DOMDirectiveTransforms: Record<string, DirectiveTransform>;
|
||||
|
||||
export declare const enum DOMErrorCodes {
|
||||
X_V_HTML_NO_EXPRESSION = 50,
|
||||
X_V_HTML_WITH_CHILDREN = 51,
|
||||
X_V_TEXT_NO_EXPRESSION = 52,
|
||||
X_V_TEXT_WITH_CHILDREN = 53,
|
||||
X_V_MODEL_ON_INVALID_ELEMENT = 54,
|
||||
X_V_MODEL_ARG_ON_ELEMENT = 55,
|
||||
X_V_MODEL_ON_FILE_INPUT_ELEMENT = 56,
|
||||
X_V_MODEL_UNNECESSARY_VALUE = 57,
|
||||
X_V_SHOW_NO_EXPRESSION = 58,
|
||||
X_TRANSITION_INVALID_CHILDREN = 59,
|
||||
X_IGNORED_SIDE_EFFECT_TAG = 60,
|
||||
__EXTEND_POINT__ = 61
|
||||
}
|
||||
|
||||
export declare const DOMNodeTransforms: NodeTransform[];
|
||||
|
||||
export declare function parse(template: string, options?: ParserOptions): RootNode;
|
||||
|
||||
export declare const parserOptions: ParserOptions;
|
||||
|
||||
export declare const transformStyle: NodeTransform;
|
||||
|
||||
export declare const TRANSITION: unique symbol;
|
||||
|
||||
export declare const TRANSITION_GROUP: unique symbol;
|
||||
|
||||
export declare const V_MODEL_CHECKBOX: unique symbol;
|
||||
|
||||
export declare const V_MODEL_DYNAMIC: unique symbol;
|
||||
|
||||
export declare const V_MODEL_RADIO: unique symbol;
|
||||
|
||||
export declare const V_MODEL_SELECT: unique symbol;
|
||||
|
||||
export declare const V_MODEL_TEXT: unique symbol;
|
||||
|
||||
export declare const V_ON_WITH_KEYS: unique symbol;
|
||||
|
||||
export declare const V_ON_WITH_MODIFIERS: unique symbol;
|
||||
|
||||
export declare const V_SHOW: unique symbol;
|
||||
|
||||
|
||||
export * from "@vue/compiler-core";
|
||||
|
||||
export { }
|
||||
5492
node_modules/@vue/compiler-dom/dist/compiler-dom.esm-browser.js
generated
vendored
Normal file
5492
node_modules/@vue/compiler-dom/dist/compiler-dom.esm-browser.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
node_modules/@vue/compiler-dom/dist/compiler-dom.esm-browser.prod.js
generated
vendored
Normal file
1
node_modules/@vue/compiler-dom/dist/compiler-dom.esm-browser.prod.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
483
node_modules/@vue/compiler-dom/dist/compiler-dom.esm-bundler.js
generated
vendored
Normal file
483
node_modules/@vue/compiler-dom/dist/compiler-dom.esm-bundler.js
generated
vendored
Normal file
@@ -0,0 +1,483 @@
|
||||
import { registerRuntimeHelpers, isBuiltInType, createSimpleExpression, createCompilerError, createObjectProperty, getConstantType, createCallExpression, TO_DISPLAY_STRING, transformModel as transformModel$1, findProp, hasDynamicKeyVBind, transformOn as transformOn$1, createCompoundExpression, isStaticExp, checkCompatEnabled, noopDirectiveTransform, baseCompile, baseParse } from '@vue/compiler-core';
|
||||
export * from '@vue/compiler-core';
|
||||
import { isVoidTag, isHTMLTag, isSVGTag, makeMap, parseStringStyle, capitalize, extend } from '@vue/shared';
|
||||
|
||||
const V_MODEL_RADIO = Symbol((process.env.NODE_ENV !== 'production') ? `vModelRadio` : ``);
|
||||
const V_MODEL_CHECKBOX = Symbol((process.env.NODE_ENV !== 'production') ? `vModelCheckbox` : ``);
|
||||
const V_MODEL_TEXT = Symbol((process.env.NODE_ENV !== 'production') ? `vModelText` : ``);
|
||||
const V_MODEL_SELECT = Symbol((process.env.NODE_ENV !== 'production') ? `vModelSelect` : ``);
|
||||
const V_MODEL_DYNAMIC = Symbol((process.env.NODE_ENV !== 'production') ? `vModelDynamic` : ``);
|
||||
const V_ON_WITH_MODIFIERS = Symbol((process.env.NODE_ENV !== 'production') ? `vOnModifiersGuard` : ``);
|
||||
const V_ON_WITH_KEYS = Symbol((process.env.NODE_ENV !== 'production') ? `vOnKeysGuard` : ``);
|
||||
const V_SHOW = Symbol((process.env.NODE_ENV !== 'production') ? `vShow` : ``);
|
||||
const TRANSITION = Symbol((process.env.NODE_ENV !== 'production') ? `Transition` : ``);
|
||||
const TRANSITION_GROUP = Symbol((process.env.NODE_ENV !== 'production') ? `TransitionGroup` : ``);
|
||||
registerRuntimeHelpers({
|
||||
[V_MODEL_RADIO]: `vModelRadio`,
|
||||
[V_MODEL_CHECKBOX]: `vModelCheckbox`,
|
||||
[V_MODEL_TEXT]: `vModelText`,
|
||||
[V_MODEL_SELECT]: `vModelSelect`,
|
||||
[V_MODEL_DYNAMIC]: `vModelDynamic`,
|
||||
[V_ON_WITH_MODIFIERS]: `withModifiers`,
|
||||
[V_ON_WITH_KEYS]: `withKeys`,
|
||||
[V_SHOW]: `vShow`,
|
||||
[TRANSITION]: `Transition`,
|
||||
[TRANSITION_GROUP]: `TransitionGroup`
|
||||
});
|
||||
|
||||
/* eslint-disable no-restricted-globals */
|
||||
let decoder;
|
||||
function decodeHtmlBrowser(raw, asAttr = false) {
|
||||
if (!decoder) {
|
||||
decoder = document.createElement('div');
|
||||
}
|
||||
if (asAttr) {
|
||||
decoder.innerHTML = `<div foo="${raw.replace(/"/g, '"')}">`;
|
||||
return decoder.children[0].getAttribute('foo');
|
||||
}
|
||||
else {
|
||||
decoder.innerHTML = raw;
|
||||
return decoder.textContent;
|
||||
}
|
||||
}
|
||||
|
||||
const isRawTextContainer = /*#__PURE__*/ makeMap('style,iframe,script,noscript', true);
|
||||
const parserOptions = {
|
||||
isVoidTag,
|
||||
isNativeTag: tag => isHTMLTag(tag) || isSVGTag(tag),
|
||||
isPreTag: tag => tag === 'pre',
|
||||
decodeEntities: decodeHtmlBrowser ,
|
||||
isBuiltInComponent: (tag) => {
|
||||
if (isBuiltInType(tag, `Transition`)) {
|
||||
return TRANSITION;
|
||||
}
|
||||
else if (isBuiltInType(tag, `TransitionGroup`)) {
|
||||
return TRANSITION_GROUP;
|
||||
}
|
||||
},
|
||||
// https://html.spec.whatwg.org/multipage/parsing.html#tree-construction-dispatcher
|
||||
getNamespace(tag, parent) {
|
||||
let ns = parent ? parent.ns : 0 /* HTML */;
|
||||
if (parent && ns === 2 /* MATH_ML */) {
|
||||
if (parent.tag === 'annotation-xml') {
|
||||
if (tag === 'svg') {
|
||||
return 1 /* SVG */;
|
||||
}
|
||||
if (parent.props.some(a => a.type === 6 /* ATTRIBUTE */ &&
|
||||
a.name === 'encoding' &&
|
||||
a.value != null &&
|
||||
(a.value.content === 'text/html' ||
|
||||
a.value.content === 'application/xhtml+xml'))) {
|
||||
ns = 0 /* HTML */;
|
||||
}
|
||||
}
|
||||
else if (/^m(?:[ions]|text)$/.test(parent.tag) &&
|
||||
tag !== 'mglyph' &&
|
||||
tag !== 'malignmark') {
|
||||
ns = 0 /* HTML */;
|
||||
}
|
||||
}
|
||||
else if (parent && ns === 1 /* SVG */) {
|
||||
if (parent.tag === 'foreignObject' ||
|
||||
parent.tag === 'desc' ||
|
||||
parent.tag === 'title') {
|
||||
ns = 0 /* HTML */;
|
||||
}
|
||||
}
|
||||
if (ns === 0 /* HTML */) {
|
||||
if (tag === 'svg') {
|
||||
return 1 /* SVG */;
|
||||
}
|
||||
if (tag === 'math') {
|
||||
return 2 /* MATH_ML */;
|
||||
}
|
||||
}
|
||||
return ns;
|
||||
},
|
||||
// https://html.spec.whatwg.org/multipage/parsing.html#parsing-html-fragments
|
||||
getTextMode({ tag, ns }) {
|
||||
if (ns === 0 /* HTML */) {
|
||||
if (tag === 'textarea' || tag === 'title') {
|
||||
return 1 /* RCDATA */;
|
||||
}
|
||||
if (isRawTextContainer(tag)) {
|
||||
return 2 /* RAWTEXT */;
|
||||
}
|
||||
}
|
||||
return 0 /* DATA */;
|
||||
}
|
||||
};
|
||||
|
||||
// Parse inline CSS strings for static style attributes into an object.
|
||||
// This is a NodeTransform since it works on the static `style` attribute and
|
||||
// converts it into a dynamic equivalent:
|
||||
// style="color: red" -> :style='{ "color": "red" }'
|
||||
// It is then processed by `transformElement` and included in the generated
|
||||
// props.
|
||||
const transformStyle = node => {
|
||||
if (node.type === 1 /* ELEMENT */) {
|
||||
node.props.forEach((p, i) => {
|
||||
if (p.type === 6 /* ATTRIBUTE */ && p.name === 'style' && p.value) {
|
||||
// replace p with an expression node
|
||||
node.props[i] = {
|
||||
type: 7 /* DIRECTIVE */,
|
||||
name: `bind`,
|
||||
arg: createSimpleExpression(`style`, true, p.loc),
|
||||
exp: parseInlineCSS(p.value.content, p.loc),
|
||||
modifiers: [],
|
||||
loc: p.loc
|
||||
};
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
const parseInlineCSS = (cssText, loc) => {
|
||||
const normalized = parseStringStyle(cssText);
|
||||
return createSimpleExpression(JSON.stringify(normalized), false, loc, 3 /* CAN_STRINGIFY */);
|
||||
};
|
||||
|
||||
function createDOMCompilerError(code, loc) {
|
||||
return createCompilerError(code, loc, (process.env.NODE_ENV !== 'production') || !true ? DOMErrorMessages : undefined);
|
||||
}
|
||||
const DOMErrorMessages = {
|
||||
[50 /* X_V_HTML_NO_EXPRESSION */]: `v-html is missing expression.`,
|
||||
[51 /* X_V_HTML_WITH_CHILDREN */]: `v-html will override element children.`,
|
||||
[52 /* X_V_TEXT_NO_EXPRESSION */]: `v-text is missing expression.`,
|
||||
[53 /* X_V_TEXT_WITH_CHILDREN */]: `v-text will override element children.`,
|
||||
[54 /* X_V_MODEL_ON_INVALID_ELEMENT */]: `v-model can only be used on <input>, <textarea> and <select> elements.`,
|
||||
[55 /* X_V_MODEL_ARG_ON_ELEMENT */]: `v-model argument is not supported on plain elements.`,
|
||||
[56 /* X_V_MODEL_ON_FILE_INPUT_ELEMENT */]: `v-model cannot be used on file inputs since they are read-only. Use a v-on:change listener instead.`,
|
||||
[57 /* X_V_MODEL_UNNECESSARY_VALUE */]: `Unnecessary value binding used alongside v-model. It will interfere with v-model's behavior.`,
|
||||
[58 /* X_V_SHOW_NO_EXPRESSION */]: `v-show is missing expression.`,
|
||||
[59 /* X_TRANSITION_INVALID_CHILDREN */]: `<Transition> expects exactly one child element or component.`,
|
||||
[60 /* X_IGNORED_SIDE_EFFECT_TAG */]: `Tags with side effect (<script> and <style>) are ignored in client component templates.`
|
||||
};
|
||||
|
||||
const transformVHtml = (dir, node, context) => {
|
||||
const { exp, loc } = dir;
|
||||
if (!exp) {
|
||||
context.onError(createDOMCompilerError(50 /* X_V_HTML_NO_EXPRESSION */, loc));
|
||||
}
|
||||
if (node.children.length) {
|
||||
context.onError(createDOMCompilerError(51 /* X_V_HTML_WITH_CHILDREN */, loc));
|
||||
node.children.length = 0;
|
||||
}
|
||||
return {
|
||||
props: [
|
||||
createObjectProperty(createSimpleExpression(`innerHTML`, true, loc), exp || createSimpleExpression('', true))
|
||||
]
|
||||
};
|
||||
};
|
||||
|
||||
const transformVText = (dir, node, context) => {
|
||||
const { exp, loc } = dir;
|
||||
if (!exp) {
|
||||
context.onError(createDOMCompilerError(52 /* X_V_TEXT_NO_EXPRESSION */, loc));
|
||||
}
|
||||
if (node.children.length) {
|
||||
context.onError(createDOMCompilerError(53 /* X_V_TEXT_WITH_CHILDREN */, loc));
|
||||
node.children.length = 0;
|
||||
}
|
||||
return {
|
||||
props: [
|
||||
createObjectProperty(createSimpleExpression(`textContent`, true), exp
|
||||
? getConstantType(exp, context) > 0
|
||||
? exp
|
||||
: createCallExpression(context.helperString(TO_DISPLAY_STRING), [exp], loc)
|
||||
: createSimpleExpression('', true))
|
||||
]
|
||||
};
|
||||
};
|
||||
|
||||
const transformModel = (dir, node, context) => {
|
||||
const baseResult = transformModel$1(dir, node, context);
|
||||
// base transform has errors OR component v-model (only need props)
|
||||
if (!baseResult.props.length || node.tagType === 1 /* COMPONENT */) {
|
||||
return baseResult;
|
||||
}
|
||||
if (dir.arg) {
|
||||
context.onError(createDOMCompilerError(55 /* X_V_MODEL_ARG_ON_ELEMENT */, dir.arg.loc));
|
||||
}
|
||||
function checkDuplicatedValue() {
|
||||
const value = findProp(node, 'value');
|
||||
if (value) {
|
||||
context.onError(createDOMCompilerError(57 /* X_V_MODEL_UNNECESSARY_VALUE */, value.loc));
|
||||
}
|
||||
}
|
||||
const { tag } = node;
|
||||
const isCustomElement = context.isCustomElement(tag);
|
||||
if (tag === 'input' ||
|
||||
tag === 'textarea' ||
|
||||
tag === 'select' ||
|
||||
isCustomElement) {
|
||||
let directiveToUse = V_MODEL_TEXT;
|
||||
let isInvalidType = false;
|
||||
if (tag === 'input' || isCustomElement) {
|
||||
const type = findProp(node, `type`);
|
||||
if (type) {
|
||||
if (type.type === 7 /* DIRECTIVE */) {
|
||||
// :type="foo"
|
||||
directiveToUse = V_MODEL_DYNAMIC;
|
||||
}
|
||||
else if (type.value) {
|
||||
switch (type.value.content) {
|
||||
case 'radio':
|
||||
directiveToUse = V_MODEL_RADIO;
|
||||
break;
|
||||
case 'checkbox':
|
||||
directiveToUse = V_MODEL_CHECKBOX;
|
||||
break;
|
||||
case 'file':
|
||||
isInvalidType = true;
|
||||
context.onError(createDOMCompilerError(56 /* X_V_MODEL_ON_FILE_INPUT_ELEMENT */, dir.loc));
|
||||
break;
|
||||
default:
|
||||
// text type
|
||||
(process.env.NODE_ENV !== 'production') && checkDuplicatedValue();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (hasDynamicKeyVBind(node)) {
|
||||
// element has bindings with dynamic keys, which can possibly contain
|
||||
// "type".
|
||||
directiveToUse = V_MODEL_DYNAMIC;
|
||||
}
|
||||
else {
|
||||
// text type
|
||||
(process.env.NODE_ENV !== 'production') && checkDuplicatedValue();
|
||||
}
|
||||
}
|
||||
else if (tag === 'select') {
|
||||
directiveToUse = V_MODEL_SELECT;
|
||||
}
|
||||
else {
|
||||
// textarea
|
||||
(process.env.NODE_ENV !== 'production') && checkDuplicatedValue();
|
||||
}
|
||||
// inject runtime directive
|
||||
// by returning the helper symbol via needRuntime
|
||||
// the import will replaced a resolveDirective call.
|
||||
if (!isInvalidType) {
|
||||
baseResult.needRuntime = context.helper(directiveToUse);
|
||||
}
|
||||
}
|
||||
else {
|
||||
context.onError(createDOMCompilerError(54 /* X_V_MODEL_ON_INVALID_ELEMENT */, dir.loc));
|
||||
}
|
||||
// native vmodel doesn't need the `modelValue` props since they are also
|
||||
// passed to the runtime as `binding.value`. removing it reduces code size.
|
||||
baseResult.props = baseResult.props.filter(p => !(p.key.type === 4 /* SIMPLE_EXPRESSION */ &&
|
||||
p.key.content === 'modelValue'));
|
||||
return baseResult;
|
||||
};
|
||||
|
||||
const isEventOptionModifier = /*#__PURE__*/ makeMap(`passive,once,capture`);
|
||||
const isNonKeyModifier = /*#__PURE__*/ makeMap(
|
||||
// event propagation management
|
||||
`stop,prevent,self,` +
|
||||
// system modifiers + exact
|
||||
`ctrl,shift,alt,meta,exact,` +
|
||||
// mouse
|
||||
`middle`);
|
||||
// left & right could be mouse or key modifiers based on event type
|
||||
const maybeKeyModifier = /*#__PURE__*/ makeMap('left,right');
|
||||
const isKeyboardEvent = /*#__PURE__*/ makeMap(`onkeyup,onkeydown,onkeypress`, true);
|
||||
const resolveModifiers = (key, modifiers, context, loc) => {
|
||||
const keyModifiers = [];
|
||||
const nonKeyModifiers = [];
|
||||
const eventOptionModifiers = [];
|
||||
for (let i = 0; i < modifiers.length; i++) {
|
||||
const modifier = modifiers[i];
|
||||
if (modifier === 'native' &&
|
||||
checkCompatEnabled("COMPILER_V_ON_NATIVE" /* COMPILER_V_ON_NATIVE */, context, loc)) {
|
||||
eventOptionModifiers.push(modifier);
|
||||
}
|
||||
else if (isEventOptionModifier(modifier)) {
|
||||
// eventOptionModifiers: modifiers for addEventListener() options,
|
||||
// e.g. .passive & .capture
|
||||
eventOptionModifiers.push(modifier);
|
||||
}
|
||||
else {
|
||||
// runtimeModifiers: modifiers that needs runtime guards
|
||||
if (maybeKeyModifier(modifier)) {
|
||||
if (isStaticExp(key)) {
|
||||
if (isKeyboardEvent(key.content)) {
|
||||
keyModifiers.push(modifier);
|
||||
}
|
||||
else {
|
||||
nonKeyModifiers.push(modifier);
|
||||
}
|
||||
}
|
||||
else {
|
||||
keyModifiers.push(modifier);
|
||||
nonKeyModifiers.push(modifier);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (isNonKeyModifier(modifier)) {
|
||||
nonKeyModifiers.push(modifier);
|
||||
}
|
||||
else {
|
||||
keyModifiers.push(modifier);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return {
|
||||
keyModifiers,
|
||||
nonKeyModifiers,
|
||||
eventOptionModifiers
|
||||
};
|
||||
};
|
||||
const transformClick = (key, event) => {
|
||||
const isStaticClick = isStaticExp(key) && key.content.toLowerCase() === 'onclick';
|
||||
return isStaticClick
|
||||
? createSimpleExpression(event, true)
|
||||
: key.type !== 4 /* SIMPLE_EXPRESSION */
|
||||
? createCompoundExpression([
|
||||
`(`,
|
||||
key,
|
||||
`) === "onClick" ? "${event}" : (`,
|
||||
key,
|
||||
`)`
|
||||
])
|
||||
: key;
|
||||
};
|
||||
const transformOn = (dir, node, context) => {
|
||||
return transformOn$1(dir, node, context, baseResult => {
|
||||
const { modifiers } = dir;
|
||||
if (!modifiers.length)
|
||||
return baseResult;
|
||||
let { key, value: handlerExp } = baseResult.props[0];
|
||||
const { keyModifiers, nonKeyModifiers, eventOptionModifiers } = resolveModifiers(key, modifiers, context, dir.loc);
|
||||
// normalize click.right and click.middle since they don't actually fire
|
||||
if (nonKeyModifiers.includes('right')) {
|
||||
key = transformClick(key, `onContextmenu`);
|
||||
}
|
||||
if (nonKeyModifiers.includes('middle')) {
|
||||
key = transformClick(key, `onMouseup`);
|
||||
}
|
||||
if (nonKeyModifiers.length) {
|
||||
handlerExp = createCallExpression(context.helper(V_ON_WITH_MODIFIERS), [
|
||||
handlerExp,
|
||||
JSON.stringify(nonKeyModifiers)
|
||||
]);
|
||||
}
|
||||
if (keyModifiers.length &&
|
||||
// if event name is dynamic, always wrap with keys guard
|
||||
(!isStaticExp(key) || isKeyboardEvent(key.content))) {
|
||||
handlerExp = createCallExpression(context.helper(V_ON_WITH_KEYS), [
|
||||
handlerExp,
|
||||
JSON.stringify(keyModifiers)
|
||||
]);
|
||||
}
|
||||
if (eventOptionModifiers.length) {
|
||||
const modifierPostfix = eventOptionModifiers.map(capitalize).join('');
|
||||
key = isStaticExp(key)
|
||||
? createSimpleExpression(`${key.content}${modifierPostfix}`, true)
|
||||
: createCompoundExpression([`(`, key, `) + "${modifierPostfix}"`]);
|
||||
}
|
||||
return {
|
||||
props: [createObjectProperty(key, handlerExp)]
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
const transformShow = (dir, node, context) => {
|
||||
const { exp, loc } = dir;
|
||||
if (!exp) {
|
||||
context.onError(createDOMCompilerError(58 /* X_V_SHOW_NO_EXPRESSION */, loc));
|
||||
}
|
||||
return {
|
||||
props: [],
|
||||
needRuntime: context.helper(V_SHOW)
|
||||
};
|
||||
};
|
||||
|
||||
const transformTransition = (node, context) => {
|
||||
if (node.type === 1 /* ELEMENT */ &&
|
||||
node.tagType === 1 /* COMPONENT */) {
|
||||
const component = context.isBuiltInComponent(node.tag);
|
||||
if (component === TRANSITION) {
|
||||
return () => {
|
||||
if (!node.children.length) {
|
||||
return;
|
||||
}
|
||||
// warn multiple transition children
|
||||
if (hasMultipleChildren(node)) {
|
||||
context.onError(createDOMCompilerError(59 /* X_TRANSITION_INVALID_CHILDREN */, {
|
||||
start: node.children[0].loc.start,
|
||||
end: node.children[node.children.length - 1].loc.end,
|
||||
source: ''
|
||||
}));
|
||||
}
|
||||
// check if it's s single child w/ v-show
|
||||
// if yes, inject "persisted: true" to the transition props
|
||||
const child = node.children[0];
|
||||
if (child.type === 1 /* ELEMENT */) {
|
||||
for (const p of child.props) {
|
||||
if (p.type === 7 /* DIRECTIVE */ && p.name === 'show') {
|
||||
node.props.push({
|
||||
type: 6 /* ATTRIBUTE */,
|
||||
name: 'persisted',
|
||||
value: undefined,
|
||||
loc: node.loc
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
};
|
||||
function hasMultipleChildren(node) {
|
||||
// #1352 filter out potential comment nodes.
|
||||
const children = (node.children = node.children.filter(c => c.type !== 3 /* COMMENT */ &&
|
||||
!(c.type === 2 /* TEXT */ && !c.content.trim())));
|
||||
const child = children[0];
|
||||
return (children.length !== 1 ||
|
||||
child.type === 11 /* FOR */ ||
|
||||
(child.type === 9 /* IF */ && child.branches.some(hasMultipleChildren)));
|
||||
}
|
||||
|
||||
const ignoreSideEffectTags = (node, context) => {
|
||||
if (node.type === 1 /* ELEMENT */ &&
|
||||
node.tagType === 0 /* ELEMENT */ &&
|
||||
(node.tag === 'script' || node.tag === 'style')) {
|
||||
context.onError(createDOMCompilerError(60 /* X_IGNORED_SIDE_EFFECT_TAG */, node.loc));
|
||||
context.removeNode();
|
||||
}
|
||||
};
|
||||
|
||||
const DOMNodeTransforms = [
|
||||
transformStyle,
|
||||
...((process.env.NODE_ENV !== 'production') ? [transformTransition] : [])
|
||||
];
|
||||
const DOMDirectiveTransforms = {
|
||||
cloak: noopDirectiveTransform,
|
||||
html: transformVHtml,
|
||||
text: transformVText,
|
||||
model: transformModel,
|
||||
on: transformOn,
|
||||
show: transformShow
|
||||
};
|
||||
function compile(template, options = {}) {
|
||||
return baseCompile(template, extend({}, parserOptions, options, {
|
||||
nodeTransforms: [
|
||||
// ignore <script> and <tag>
|
||||
// this is not put inside DOMNodeTransforms because that list is used
|
||||
// by compiler-ssr to generate vnode fallback branches
|
||||
ignoreSideEffectTags,
|
||||
...DOMNodeTransforms,
|
||||
...(options.nodeTransforms || [])
|
||||
],
|
||||
directiveTransforms: extend({}, DOMDirectiveTransforms, options.directiveTransforms || {}),
|
||||
transformHoist: null
|
||||
}));
|
||||
}
|
||||
function parse(template, options = {}) {
|
||||
return baseParse(template, extend({}, parserOptions, options));
|
||||
}
|
||||
|
||||
export { DOMDirectiveTransforms, DOMNodeTransforms, TRANSITION, TRANSITION_GROUP, V_MODEL_CHECKBOX, V_MODEL_DYNAMIC, V_MODEL_RADIO, V_MODEL_SELECT, V_MODEL_TEXT, V_ON_WITH_KEYS, V_ON_WITH_MODIFIERS, V_SHOW, compile, createDOMCompilerError, parse, parserOptions, transformStyle };
|
||||
5642
node_modules/@vue/compiler-dom/dist/compiler-dom.global.js
generated
vendored
Normal file
5642
node_modules/@vue/compiler-dom/dist/compiler-dom.global.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
node_modules/@vue/compiler-dom/dist/compiler-dom.global.prod.js
generated
vendored
Normal file
1
node_modules/@vue/compiler-dom/dist/compiler-dom.global.prod.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
7
node_modules/@vue/compiler-dom/index.js
generated
vendored
Normal file
7
node_modules/@vue/compiler-dom/index.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
'use strict'
|
||||
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
module.exports = require('./dist/compiler-dom.cjs.prod.js')
|
||||
} else {
|
||||
module.exports = require('./dist/compiler-dom.cjs.js')
|
||||
}
|
||||
43
node_modules/@vue/compiler-dom/package.json
generated
vendored
Normal file
43
node_modules/@vue/compiler-dom/package.json
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
{
|
||||
"name": "@vue/compiler-dom",
|
||||
"version": "3.2.36",
|
||||
"description": "@vue/compiler-dom",
|
||||
"main": "index.js",
|
||||
"module": "dist/compiler-dom.esm-bundler.js",
|
||||
"types": "dist/compiler-dom.d.ts",
|
||||
"unpkg": "dist/compiler-dom.global.js",
|
||||
"jsdelivr": "dist/compiler-dom.global.js",
|
||||
"files": [
|
||||
"index.js",
|
||||
"dist"
|
||||
],
|
||||
"sideEffects": false,
|
||||
"buildOptions": {
|
||||
"name": "VueCompilerDOM",
|
||||
"compat": true,
|
||||
"formats": [
|
||||
"esm-bundler",
|
||||
"esm-browser",
|
||||
"cjs",
|
||||
"global"
|
||||
]
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/vuejs/core.git",
|
||||
"directory": "packages/compiler-dom"
|
||||
},
|
||||
"keywords": [
|
||||
"vue"
|
||||
],
|
||||
"author": "Evan You",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/vuejs/core/issues"
|
||||
},
|
||||
"homepage": "https://github.com/vuejs/core/tree/main/packages/compiler-dom#readme",
|
||||
"dependencies": {
|
||||
"@vue/shared": "3.2.36",
|
||||
"@vue/compiler-core": "3.2.36"
|
||||
}
|
||||
}
|
||||
21
node_modules/@vue/compiler-sfc/LICENSE
generated
vendored
Normal file
21
node_modules/@vue/compiler-sfc/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2018-present, Yuxi (Evan) You
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
80
node_modules/@vue/compiler-sfc/README.md
generated
vendored
Normal file
80
node_modules/@vue/compiler-sfc/README.md
generated
vendored
Normal file
@@ -0,0 +1,80 @@
|
||||
# @vue/compiler-sfc
|
||||
|
||||
> Lower level utilities for compiling Vue Single File Components
|
||||
|
||||
**Note: as of 3.2.13+, this package is included as a dependency of the main `vue` package and can be accessed as `vue/compiler-sfc`. This means you no longer need to explicitly install this package and ensure its version match that of `vue`'s. Just use the main `vue/compiler-sfc` deep import instead.**
|
||||
|
||||
This package contains lower level utilities that you can use if you are writing a plugin / transform for a bundler or module system that compiles Vue Single File Components (SFCs) into JavaScript. It is used in [vue-loader](https://github.com/vuejs/vue-loader), [rollup-plugin-vue](https://github.com/vuejs/rollup-plugin-vue) and [vite](https://github.com/vitejs/vite).
|
||||
|
||||
## API
|
||||
|
||||
The API is intentionally low-level due to the various considerations when integrating Vue SFCs in a build system:
|
||||
|
||||
- Separate hot-module replacement (HMR) for script, template and styles
|
||||
|
||||
- template updates should not reset component state
|
||||
- style updates should be performed without component re-render
|
||||
|
||||
- Leveraging the tool's plugin system for pre-processor handling. e.g. `<style lang="scss">` should be processed by the corresponding webpack loader.
|
||||
|
||||
- In some cases, transformers of each block in an SFC do not share the same execution context. For example, when used with `thread-loader` or other parallelized configurations, the template sub-loader in `vue-loader` may not have access to the full SFC and its descriptor.
|
||||
|
||||
The general idea is to generate a facade module that imports the individual blocks of the component. The trick is the module imports itself with different query strings so that the build system can handle each request as "virtual" modules:
|
||||
|
||||
```
|
||||
+--------------------+
|
||||
| |
|
||||
| script transform |
|
||||
+----->+ |
|
||||
| +--------------------+
|
||||
|
|
||||
+--------------------+ | +--------------------+
|
||||
| | | | |
|
||||
| facade transform +----------->+ template transform |
|
||||
| | | | |
|
||||
+--------------------+ | +--------------------+
|
||||
|
|
||||
| +--------------------+
|
||||
+----->+ |
|
||||
| style transform |
|
||||
| |
|
||||
+--------------------+
|
||||
```
|
||||
|
||||
Where the facade module looks like this:
|
||||
|
||||
```js
|
||||
// main script
|
||||
import script from '/project/foo.vue?vue&type=script'
|
||||
// template compiled to render function
|
||||
import { render } from '/project/foo.vue?vue&type=template&id=xxxxxx'
|
||||
// css
|
||||
import '/project/foo.vue?vue&type=style&index=0&id=xxxxxx'
|
||||
|
||||
// attach render function to script
|
||||
script.render = render
|
||||
|
||||
// attach additional metadata
|
||||
// some of these should be dev only
|
||||
script.__file = 'example.vue'
|
||||
script.__scopeId = 'xxxxxx'
|
||||
|
||||
// additional tooling-specific HMR handling code
|
||||
// using __VUE_HMR_API__ global
|
||||
|
||||
export default script
|
||||
```
|
||||
|
||||
### High Level Workflow
|
||||
|
||||
1. In facade transform, parse the source into descriptor with the `parse` API and generate the above facade module code based on the descriptor;
|
||||
|
||||
2. In script transform, use `compileScript` to process the script. This handles features like `<script setup>` and CSS variable injection. Alternatively, this can be done directly in the facade module (with the code inlined instead of imported), but it will require rewriting `export default` to a temp variable (a `rewriteDefault` convenience API is provided for this purpose) so additional options can be attached to the exported object.
|
||||
|
||||
3. In template transform, use `compileTemplate` to compile the raw template into render function code.
|
||||
|
||||
4. In style transform, use `compileStyle` to compile raw CSS to handle `<style scoped>`, `<style module>` and CSS variable injection.
|
||||
|
||||
Options needed for these APIs can be passed via the query string.
|
||||
|
||||
For detailed API references and options, check out the source type definitions. For actual usage of these APIs, check out [rollup-plugin-vue](https://github.com/vuejs/rollup-plugin-vue/tree/next) or [vue-loader](https://github.com/vuejs/vue-loader/tree/next).
|
||||
17538
node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js
generated
vendored
Normal file
17538
node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
321
node_modules/@vue/compiler-sfc/dist/compiler-sfc.d.ts
generated
vendored
Normal file
321
node_modules/@vue/compiler-sfc/dist/compiler-sfc.d.ts
generated
vendored
Normal file
@@ -0,0 +1,321 @@
|
||||
import { parse as babelParse } from '@babel/parser';
|
||||
import { BindingMetadata } from '@vue/compiler-core';
|
||||
import { CodegenResult } from '@vue/compiler-core';
|
||||
import { CompilerError } from '@vue/compiler-core';
|
||||
import { CompilerOptions } from '@vue/compiler-core';
|
||||
import { ElementNode } from '@vue/compiler-core';
|
||||
import { extractIdentifiers } from '@vue/compiler-core';
|
||||
import { generateCodeFrame } from '@vue/compiler-core';
|
||||
import { isInDestructureAssignment } from '@vue/compiler-core';
|
||||
import { isStaticProperty } from '@vue/compiler-core';
|
||||
import { LazyResult } from 'postcss';
|
||||
import MagicString from 'magic-string';
|
||||
import { ParserOptions } from '@vue/compiler-core';
|
||||
import { ParserPlugin } from '@babel/parser';
|
||||
import { RawSourceMap } from 'source-map';
|
||||
import { Result } from 'postcss';
|
||||
import { RootNode } from '@vue/compiler-core';
|
||||
import { shouldTransform as shouldTransformRef } from '@vue/reactivity-transform';
|
||||
import { SourceLocation } from '@vue/compiler-core';
|
||||
import { transform as transformRef } from '@vue/reactivity-transform';
|
||||
import { transformAST as transformRefAST } from '@vue/reactivity-transform';
|
||||
import { walkIdentifiers } from '@vue/compiler-core';
|
||||
|
||||
export declare interface AssetURLOptions {
|
||||
/**
|
||||
* If base is provided, instead of transforming relative asset urls into
|
||||
* imports, they will be directly rewritten to absolute urls.
|
||||
*/
|
||||
base?: string | null;
|
||||
/**
|
||||
* If true, also processes absolute urls.
|
||||
*/
|
||||
includeAbsolute?: boolean;
|
||||
tags?: AssetURLTagConfig;
|
||||
}
|
||||
|
||||
export declare interface AssetURLTagConfig {
|
||||
[name: string]: string[];
|
||||
}
|
||||
|
||||
export { babelParse }
|
||||
|
||||
export { BindingMetadata }
|
||||
|
||||
export { CompilerError }
|
||||
|
||||
export { CompilerOptions }
|
||||
|
||||
/**
|
||||
* Compile `<script setup>`
|
||||
* It requires the whole SFC descriptor because we need to handle and merge
|
||||
* normal `<script>` + `<script setup>` if both are present.
|
||||
*/
|
||||
export declare function compileScript(sfc: SFCDescriptor, options: SFCScriptCompileOptions): SFCScriptBlock;
|
||||
|
||||
export declare function compileStyle(options: SFCStyleCompileOptions): SFCStyleCompileResults;
|
||||
|
||||
export declare function compileStyleAsync(options: SFCAsyncStyleCompileOptions): Promise<SFCStyleCompileResults>;
|
||||
|
||||
export declare function compileTemplate(options: SFCTemplateCompileOptions): SFCTemplateCompileResults;
|
||||
|
||||
/**
|
||||
* Aligns with postcss-modules
|
||||
* https://github.com/css-modules/postcss-modules
|
||||
*/
|
||||
declare interface CSSModulesOptions {
|
||||
scopeBehaviour?: 'global' | 'local';
|
||||
generateScopedName?: string | ((name: string, filename: string, css: string) => string);
|
||||
hashPrefix?: string;
|
||||
localsConvention?: 'camelCase' | 'camelCaseOnly' | 'dashes' | 'dashesOnly';
|
||||
exportGlobals?: boolean;
|
||||
globalModulePaths?: RegExp[];
|
||||
}
|
||||
|
||||
export { extractIdentifiers }
|
||||
|
||||
export { generateCodeFrame }
|
||||
|
||||
declare interface ImportBinding {
|
||||
isType: boolean;
|
||||
imported: string;
|
||||
source: string;
|
||||
isFromSetup: boolean;
|
||||
isUsedInTemplate: boolean;
|
||||
}
|
||||
|
||||
export { isInDestructureAssignment }
|
||||
|
||||
export { isStaticProperty }
|
||||
|
||||
export { MagicString }
|
||||
|
||||
export declare function parse(source: string, { sourceMap, filename, sourceRoot, pad, ignoreEmpty, compiler }?: SFCParseOptions): SFCParseResult;
|
||||
|
||||
declare type PreprocessLang = 'less' | 'sass' | 'scss' | 'styl' | 'stylus';
|
||||
|
||||
/**
|
||||
* Utility for rewriting `export default` in a script block into a variable
|
||||
* declaration so that we can inject things into it
|
||||
*/
|
||||
export declare function rewriteDefault(input: string, as: string, parserPlugins?: ParserPlugin[]): string;
|
||||
|
||||
export declare interface SFCAsyncStyleCompileOptions extends SFCStyleCompileOptions {
|
||||
isAsync?: boolean;
|
||||
modules?: boolean;
|
||||
modulesOptions?: CSSModulesOptions;
|
||||
}
|
||||
|
||||
export declare interface SFCBlock {
|
||||
type: string;
|
||||
content: string;
|
||||
attrs: Record<string, string | true>;
|
||||
loc: SourceLocation;
|
||||
map?: RawSourceMap;
|
||||
lang?: string;
|
||||
src?: string;
|
||||
}
|
||||
|
||||
export declare interface SFCDescriptor {
|
||||
filename: string;
|
||||
source: string;
|
||||
template: SFCTemplateBlock | null;
|
||||
script: SFCScriptBlock | null;
|
||||
scriptSetup: SFCScriptBlock | null;
|
||||
styles: SFCStyleBlock[];
|
||||
customBlocks: SFCBlock[];
|
||||
cssVars: string[];
|
||||
/**
|
||||
* whether the SFC uses :slotted() modifier.
|
||||
* this is used as a compiler optimization hint.
|
||||
*/
|
||||
slotted: boolean;
|
||||
/**
|
||||
* compare with an existing descriptor to determine whether HMR should perform
|
||||
* a reload vs. re-render.
|
||||
*
|
||||
* Note: this comparison assumes the prev/next script are already identical,
|
||||
* and only checks the special case where <script setup lang="ts"> unused import
|
||||
* pruning result changes due to template changes.
|
||||
*/
|
||||
shouldForceReload: (prevImports: Record<string, ImportBinding>) => boolean;
|
||||
}
|
||||
|
||||
export declare interface SFCParseOptions {
|
||||
filename?: string;
|
||||
sourceMap?: boolean;
|
||||
sourceRoot?: string;
|
||||
pad?: boolean | 'line' | 'space';
|
||||
ignoreEmpty?: boolean;
|
||||
compiler?: TemplateCompiler;
|
||||
}
|
||||
|
||||
export declare interface SFCParseResult {
|
||||
descriptor: SFCDescriptor;
|
||||
errors: (CompilerError | SyntaxError)[];
|
||||
}
|
||||
|
||||
export declare interface SFCScriptBlock extends SFCBlock {
|
||||
type: 'script';
|
||||
setup?: string | boolean;
|
||||
bindings?: BindingMetadata;
|
||||
imports?: Record<string, ImportBinding>;
|
||||
/**
|
||||
* import('\@babel/types').Statement
|
||||
*/
|
||||
scriptAst?: any[];
|
||||
/**
|
||||
* import('\@babel/types').Statement
|
||||
*/
|
||||
scriptSetupAst?: any[];
|
||||
}
|
||||
|
||||
export declare interface SFCScriptCompileOptions {
|
||||
/**
|
||||
* Scope ID for prefixing injected CSS variables.
|
||||
* This must be consistent with the `id` passed to `compileStyle`.
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* Production mode. Used to determine whether to generate hashed CSS variables
|
||||
*/
|
||||
isProd?: boolean;
|
||||
/**
|
||||
* Enable/disable source map. Defaults to true.
|
||||
*/
|
||||
sourceMap?: boolean;
|
||||
/**
|
||||
* https://babeljs.io/docs/en/babel-parser#plugins
|
||||
*/
|
||||
babelParserPlugins?: ParserPlugin[];
|
||||
/**
|
||||
* (Experimental) Enable syntax transform for using refs without `.value` and
|
||||
* using destructured props with reactivity
|
||||
*/
|
||||
reactivityTransform?: boolean;
|
||||
/**
|
||||
* (Experimental) Enable syntax transform for using refs without `.value`
|
||||
* https://github.com/vuejs/rfcs/discussions/369
|
||||
* @deprecated now part of `reactivityTransform`
|
||||
* @default false
|
||||
*/
|
||||
refTransform?: boolean;
|
||||
/**
|
||||
* (Experimental) Enable syntax transform for destructuring from defineProps()
|
||||
* https://github.com/vuejs/rfcs/discussions/394
|
||||
* @deprecated now part of `reactivityTransform`
|
||||
* @default false
|
||||
*/
|
||||
propsDestructureTransform?: boolean;
|
||||
/**
|
||||
* @deprecated use `reactivityTransform` instead.
|
||||
*/
|
||||
refSugar?: boolean;
|
||||
/**
|
||||
* Compile the template and inline the resulting render function
|
||||
* directly inside setup().
|
||||
* - Only affects `<script setup>`
|
||||
* - This should only be used in production because it prevents the template
|
||||
* from being hot-reloaded separately from component state.
|
||||
*/
|
||||
inlineTemplate?: boolean;
|
||||
/**
|
||||
* Options for template compilation when inlining. Note these are options that
|
||||
* would normally be passed to `compiler-sfc`'s own `compileTemplate()`, not
|
||||
* options passed to `compiler-dom`.
|
||||
*/
|
||||
templateOptions?: Partial<SFCTemplateCompileOptions>;
|
||||
}
|
||||
|
||||
export declare interface SFCStyleBlock extends SFCBlock {
|
||||
type: 'style';
|
||||
scoped?: boolean;
|
||||
module?: string | boolean;
|
||||
}
|
||||
|
||||
export declare interface SFCStyleCompileOptions {
|
||||
source: string;
|
||||
filename: string;
|
||||
id: string;
|
||||
scoped?: boolean;
|
||||
trim?: boolean;
|
||||
isProd?: boolean;
|
||||
inMap?: RawSourceMap;
|
||||
preprocessLang?: PreprocessLang;
|
||||
preprocessOptions?: any;
|
||||
preprocessCustomRequire?: (id: string) => any;
|
||||
postcssOptions?: any;
|
||||
postcssPlugins?: any[];
|
||||
/**
|
||||
* @deprecated use `inMap` instead.
|
||||
*/
|
||||
map?: RawSourceMap;
|
||||
}
|
||||
|
||||
export declare interface SFCStyleCompileResults {
|
||||
code: string;
|
||||
map: RawSourceMap | undefined;
|
||||
rawResult: Result | LazyResult | undefined;
|
||||
errors: Error[];
|
||||
modules?: Record<string, string>;
|
||||
dependencies: Set<string>;
|
||||
}
|
||||
|
||||
export declare interface SFCTemplateBlock extends SFCBlock {
|
||||
type: 'template';
|
||||
ast: ElementNode;
|
||||
}
|
||||
|
||||
export declare interface SFCTemplateCompileOptions {
|
||||
source: string;
|
||||
filename: string;
|
||||
id: string;
|
||||
scoped?: boolean;
|
||||
slotted?: boolean;
|
||||
isProd?: boolean;
|
||||
ssr?: boolean;
|
||||
ssrCssVars?: string[];
|
||||
inMap?: RawSourceMap;
|
||||
compiler?: TemplateCompiler;
|
||||
compilerOptions?: CompilerOptions;
|
||||
preprocessLang?: string;
|
||||
preprocessOptions?: any;
|
||||
/**
|
||||
* In some cases, compiler-sfc may not be inside the project root (e.g. when
|
||||
* linked or globally installed). In such cases a custom `require` can be
|
||||
* passed to correctly resolve the preprocessors.
|
||||
*/
|
||||
preprocessCustomRequire?: (id: string) => any;
|
||||
/**
|
||||
* Configure what tags/attributes to transform into asset url imports,
|
||||
* or disable the transform altogether with `false`.
|
||||
*/
|
||||
transformAssetUrls?: AssetURLOptions | AssetURLTagConfig | boolean;
|
||||
}
|
||||
|
||||
export declare interface SFCTemplateCompileResults {
|
||||
code: string;
|
||||
ast?: RootNode;
|
||||
preamble?: string;
|
||||
source: string;
|
||||
tips: string[];
|
||||
errors: (string | CompilerError)[];
|
||||
map?: RawSourceMap;
|
||||
}
|
||||
|
||||
export { shouldTransformRef }
|
||||
|
||||
export declare interface TemplateCompiler {
|
||||
compile(template: string, options: CompilerOptions): CodegenResult;
|
||||
parse(template: string, options: ParserOptions): RootNode;
|
||||
}
|
||||
|
||||
export { transformRef }
|
||||
|
||||
export { transformRefAST }
|
||||
|
||||
export declare const walk: any;
|
||||
|
||||
export { walkIdentifiers }
|
||||
|
||||
export { }
|
||||
49343
node_modules/@vue/compiler-sfc/dist/compiler-sfc.esm-browser.js
generated
vendored
Normal file
49343
node_modules/@vue/compiler-sfc/dist/compiler-sfc.esm-browser.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
59
node_modules/@vue/compiler-sfc/package.json
generated
vendored
Normal file
59
node_modules/@vue/compiler-sfc/package.json
generated
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
{
|
||||
"name": "@vue/compiler-sfc",
|
||||
"version": "3.2.36",
|
||||
"description": "@vue/compiler-sfc",
|
||||
"main": "dist/compiler-sfc.cjs.js",
|
||||
"module": "dist/compiler-sfc.esm-browser.js",
|
||||
"types": "dist/compiler-sfc.d.ts",
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"buildOptions": {
|
||||
"name": "VueCompilerSFC",
|
||||
"formats": [
|
||||
"cjs",
|
||||
"esm-browser"
|
||||
],
|
||||
"prod": false,
|
||||
"enableNonBrowserBranches": true
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/vuejs/core.git",
|
||||
"directory": "packages/compiler-sfc"
|
||||
},
|
||||
"keywords": [
|
||||
"vue"
|
||||
],
|
||||
"author": "Evan You",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/vuejs/core/issues"
|
||||
},
|
||||
"homepage": "https://github.com/vuejs/core/tree/main/packages/compiler-sfc#readme",
|
||||
"dependencies": {
|
||||
"@babel/parser": "^7.16.4",
|
||||
"@vue/compiler-core": "3.2.36",
|
||||
"@vue/compiler-dom": "3.2.36",
|
||||
"@vue/compiler-ssr": "3.2.36",
|
||||
"@vue/reactivity-transform": "3.2.36",
|
||||
"@vue/shared": "3.2.36",
|
||||
"estree-walker": "^2.0.2",
|
||||
"magic-string": "^0.25.7",
|
||||
"source-map": "^0.6.1",
|
||||
"postcss": "^8.1.10"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/estree": "^0.0.48",
|
||||
"@babel/types": "^7.16.0",
|
||||
"@types/lru-cache": "^5.1.0",
|
||||
"pug": "^3.0.1",
|
||||
"sass": "^1.26.9",
|
||||
"@vue/consolidate": "^0.17.3",
|
||||
"hash-sum": "^2.0.0",
|
||||
"lru-cache": "^5.1.1",
|
||||
"merge-source-map": "^1.1.0",
|
||||
"postcss-modules": "^4.0.0",
|
||||
"postcss-selector-parser": "^6.0.4"
|
||||
}
|
||||
}
|
||||
21
node_modules/@vue/compiler-ssr/LICENSE
generated
vendored
Normal file
21
node_modules/@vue/compiler-ssr/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2018-present, Yuxi (Evan) You
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
1
node_modules/@vue/compiler-ssr/README.md
generated
vendored
Normal file
1
node_modules/@vue/compiler-ssr/README.md
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
# @vue/compiler-ssr
|
||||
1262
node_modules/@vue/compiler-ssr/dist/compiler-ssr.cjs.js
generated
vendored
Normal file
1262
node_modules/@vue/compiler-ssr/dist/compiler-ssr.cjs.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
6
node_modules/@vue/compiler-ssr/dist/compiler-ssr.d.ts
generated
vendored
Normal file
6
node_modules/@vue/compiler-ssr/dist/compiler-ssr.d.ts
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
import { CodegenResult } from '@vue/compiler-dom';
|
||||
import { CompilerOptions } from '@vue/compiler-dom';
|
||||
|
||||
export declare function compile(template: string, options?: CompilerOptions): CodegenResult;
|
||||
|
||||
export { }
|
||||
34
node_modules/@vue/compiler-ssr/package.json
generated
vendored
Normal file
34
node_modules/@vue/compiler-ssr/package.json
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
{
|
||||
"name": "@vue/compiler-ssr",
|
||||
"version": "3.2.36",
|
||||
"description": "@vue/compiler-ssr",
|
||||
"main": "dist/compiler-ssr.cjs.js",
|
||||
"types": "dist/compiler-ssr.d.ts",
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"buildOptions": {
|
||||
"prod": false,
|
||||
"formats": [
|
||||
"cjs"
|
||||
]
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/vuejs/core.git",
|
||||
"directory": "packages/compiler-ssr"
|
||||
},
|
||||
"keywords": [
|
||||
"vue"
|
||||
],
|
||||
"author": "Evan You",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/vuejs/core/issues"
|
||||
},
|
||||
"homepage": "https://github.com/vuejs/core/tree/main/packages/compiler-ssr#readme",
|
||||
"dependencies": {
|
||||
"@vue/shared": "3.2.36",
|
||||
"@vue/compiler-dom": "3.2.36"
|
||||
}
|
||||
}
|
||||
121
node_modules/@vue/reactivity-transform/README.md
generated
vendored
Normal file
121
node_modules/@vue/reactivity-transform/README.md
generated
vendored
Normal file
@@ -0,0 +1,121 @@
|
||||
# @vue/reactivity-transform
|
||||
|
||||
> ⚠️ This is experimental and currently only provided for testing and feedback. It may break during patches or even be removed. Use at your own risk!
|
||||
>
|
||||
> Follow https://github.com/vuejs/rfcs/discussions/369 for details and updates.
|
||||
|
||||
## Basic Rules
|
||||
|
||||
- Ref-creating APIs have `$`-prefixed versions that create reactive variables instead. They also do not need to be explicitly imported. These include:
|
||||
- `ref`
|
||||
- `computed`
|
||||
- `shallowRef`
|
||||
- `customRef`
|
||||
- `toRef`
|
||||
- `$()` can be used to destructure an object into reactive variables, or turn existing refs into reactive variables
|
||||
- `$$()` to "escape" the transform, which allows access to underlying refs
|
||||
|
||||
```js
|
||||
import { watchEffect } from 'vue'
|
||||
|
||||
// bind ref as a variable
|
||||
let count = $ref(0)
|
||||
|
||||
watchEffect(() => {
|
||||
// no need for .value
|
||||
console.log(count)
|
||||
})
|
||||
|
||||
// assignments are reactive
|
||||
count++
|
||||
|
||||
// get the actual ref
|
||||
console.log($$(count)) // { value: 1 }
|
||||
```
|
||||
|
||||
Macros can be optionally imported to make it more explicit:
|
||||
|
||||
```js
|
||||
// not necessary, but also works
|
||||
import { $, $ref } from 'vue/macros'
|
||||
|
||||
let count = $ref(0)
|
||||
const { x, y } = $(useMouse())
|
||||
```
|
||||
|
||||
### Global Types
|
||||
|
||||
To enable types for the macros globally, include the following in a `.d.ts` file:
|
||||
|
||||
```ts
|
||||
/// <reference types="vue/macros-global" />
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
This package is the lower-level transform that can be used standalone. Higher-level tooling (e.g. `@vitejs/plugin-vue` and `vue-loader`) will provide integration via options.
|
||||
|
||||
### `shouldTransform`
|
||||
|
||||
Can be used to do a cheap check to determine whether full transform should be performed.
|
||||
|
||||
```js
|
||||
import { shouldTransform } from '@vue/reactivity-transform'
|
||||
|
||||
shouldTransform(`let a = ref(0)`) // false
|
||||
shouldTransform(`let a = $ref(0)`) // true
|
||||
```
|
||||
|
||||
### `transform`
|
||||
|
||||
```js
|
||||
import { transform } from '@vue/reactivity-transform'
|
||||
|
||||
const src = `let a = $ref(0); a++`
|
||||
const {
|
||||
code, // import { ref as _ref } from 'vue'; let a = (ref(0)); a.value++"
|
||||
map
|
||||
} = transform(src, {
|
||||
filename: 'foo.ts',
|
||||
sourceMap: true,
|
||||
|
||||
// @babel/parser plugins to enable.
|
||||
// 'typescript' and 'jsx' will be auto-inferred from filename if provided,
|
||||
// so in most cases explicit parserPlugins are not necessary
|
||||
parserPlugins: [
|
||||
/* ... */
|
||||
]
|
||||
})
|
||||
```
|
||||
|
||||
**Options**
|
||||
|
||||
```ts
|
||||
interface RefTransformOptions {
|
||||
filename?: string
|
||||
sourceMap?: boolean // default: false
|
||||
parserPlugins?: ParserPlugin[]
|
||||
importHelpersFrom?: string // default: "vue"
|
||||
}
|
||||
```
|
||||
|
||||
### `transformAST`
|
||||
|
||||
Transform with an existing Babel AST + MagicString instance. This is used internally by `@vue/compiler-sfc` to avoid double parse/transform cost.
|
||||
|
||||
```js
|
||||
import { transformAST } from '@vue/reactivity-transform'
|
||||
import { parse } from '@babel/parser'
|
||||
import MagicString from 'magic-string'
|
||||
|
||||
const src = `let a = $ref(0); a++`
|
||||
const ast = parse(src, { sourceType: 'module' })
|
||||
const s = new MagicString(src)
|
||||
|
||||
const {
|
||||
rootRefs, // ['a']
|
||||
importedHelpers // ['ref']
|
||||
} = transformAST(ast, s)
|
||||
|
||||
console.log(s.toString()) // let a = _ref(0); a.value++
|
||||
```
|
||||
538
node_modules/@vue/reactivity-transform/dist/reactivity-transform.cjs.js
generated
vendored
Normal file
538
node_modules/@vue/reactivity-transform/dist/reactivity-transform.cjs.js
generated
vendored
Normal file
@@ -0,0 +1,538 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
var MagicString = require('magic-string');
|
||||
var estreeWalker = require('estree-walker');
|
||||
var compilerCore = require('@vue/compiler-core');
|
||||
var parser = require('@babel/parser');
|
||||
var shared = require('@vue/shared');
|
||||
|
||||
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e['default'] : e; }
|
||||
|
||||
var MagicString__default = /*#__PURE__*/_interopDefaultLegacy(MagicString);
|
||||
|
||||
const CONVERT_SYMBOL = '$';
|
||||
const ESCAPE_SYMBOL = '$$';
|
||||
const shorthands = ['ref', 'computed', 'shallowRef', 'toRef', 'customRef'];
|
||||
const transformCheckRE = /[^\w]\$(?:\$|ref|computed|shallowRef)?\s*(\(|\<)/;
|
||||
function shouldTransform(src) {
|
||||
return transformCheckRE.test(src);
|
||||
}
|
||||
function transform(src, { filename, sourceMap, parserPlugins, importHelpersFrom = 'vue' } = {}) {
|
||||
const plugins = parserPlugins || [];
|
||||
if (filename) {
|
||||
if (/\.tsx?$/.test(filename)) {
|
||||
plugins.push('typescript');
|
||||
}
|
||||
if (filename.endsWith('x')) {
|
||||
plugins.push('jsx');
|
||||
}
|
||||
}
|
||||
const ast = parser.parse(src, {
|
||||
sourceType: 'module',
|
||||
plugins
|
||||
});
|
||||
const s = new MagicString__default(src);
|
||||
const res = transformAST(ast.program, s, 0);
|
||||
// inject helper imports
|
||||
if (res.importedHelpers.length) {
|
||||
s.prepend(`import { ${res.importedHelpers
|
||||
.map(h => `${h} as _${h}`)
|
||||
.join(', ')} } from '${importHelpersFrom}'\n`);
|
||||
}
|
||||
return {
|
||||
...res,
|
||||
code: s.toString(),
|
||||
map: sourceMap
|
||||
? s.generateMap({
|
||||
source: filename,
|
||||
hires: true,
|
||||
includeContent: true
|
||||
})
|
||||
: null
|
||||
};
|
||||
}
|
||||
function transformAST(ast, s, offset = 0, knownRefs, knownProps) {
|
||||
// TODO remove when out of experimental
|
||||
warnExperimental();
|
||||
let convertSymbol = CONVERT_SYMBOL;
|
||||
let escapeSymbol = ESCAPE_SYMBOL;
|
||||
// macro import handling
|
||||
for (const node of ast.body) {
|
||||
if (node.type === 'ImportDeclaration' &&
|
||||
node.source.value === 'vue/macros') {
|
||||
// remove macro imports
|
||||
s.remove(node.start + offset, node.end + offset);
|
||||
// check aliasing
|
||||
for (const specifier of node.specifiers) {
|
||||
if (specifier.type === 'ImportSpecifier') {
|
||||
const imported = specifier.imported.name;
|
||||
const local = specifier.local.name;
|
||||
if (local !== imported) {
|
||||
if (imported === ESCAPE_SYMBOL) {
|
||||
escapeSymbol = local;
|
||||
}
|
||||
else if (imported === CONVERT_SYMBOL) {
|
||||
convertSymbol = local;
|
||||
}
|
||||
else {
|
||||
error(`macro imports for ref-creating methods do not support aliasing.`, specifier);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
const importedHelpers = new Set();
|
||||
const rootScope = {};
|
||||
const scopeStack = [rootScope];
|
||||
let currentScope = rootScope;
|
||||
let escapeScope; // inside $$()
|
||||
const excludedIds = new WeakSet();
|
||||
const parentStack = [];
|
||||
const propsLocalToPublicMap = Object.create(null);
|
||||
if (knownRefs) {
|
||||
for (const key of knownRefs) {
|
||||
rootScope[key] = true;
|
||||
}
|
||||
}
|
||||
if (knownProps) {
|
||||
for (const key in knownProps) {
|
||||
const { local } = knownProps[key];
|
||||
rootScope[local] = 'prop';
|
||||
propsLocalToPublicMap[local] = key;
|
||||
}
|
||||
}
|
||||
function isRefCreationCall(callee) {
|
||||
if (callee === convertSymbol) {
|
||||
return convertSymbol;
|
||||
}
|
||||
if (callee[0] === '$' && shorthands.includes(callee.slice(1))) {
|
||||
return callee;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function error(msg, node) {
|
||||
const e = new Error(msg);
|
||||
e.node = node;
|
||||
throw e;
|
||||
}
|
||||
function helper(msg) {
|
||||
importedHelpers.add(msg);
|
||||
return `_${msg}`;
|
||||
}
|
||||
function registerBinding(id, isRef = false) {
|
||||
excludedIds.add(id);
|
||||
if (currentScope) {
|
||||
currentScope[id.name] = isRef;
|
||||
}
|
||||
else {
|
||||
error('registerBinding called without active scope, something is wrong.', id);
|
||||
}
|
||||
}
|
||||
const registerRefBinding = (id) => registerBinding(id, true);
|
||||
let tempVarCount = 0;
|
||||
function genTempVar() {
|
||||
return `__$temp_${++tempVarCount}`;
|
||||
}
|
||||
function snip(node) {
|
||||
return s.original.slice(node.start + offset, node.end + offset);
|
||||
}
|
||||
function walkScope(node, isRoot = false) {
|
||||
for (const stmt of node.body) {
|
||||
if (stmt.type === 'VariableDeclaration') {
|
||||
walkVariableDeclaration(stmt, isRoot);
|
||||
}
|
||||
else if (stmt.type === 'FunctionDeclaration' ||
|
||||
stmt.type === 'ClassDeclaration') {
|
||||
if (stmt.declare || !stmt.id)
|
||||
continue;
|
||||
registerBinding(stmt.id);
|
||||
}
|
||||
else if ((stmt.type === 'ForOfStatement' || stmt.type === 'ForInStatement') &&
|
||||
stmt.left.type === 'VariableDeclaration') {
|
||||
walkVariableDeclaration(stmt.left);
|
||||
}
|
||||
else if (stmt.type === 'ExportNamedDeclaration' &&
|
||||
stmt.declaration &&
|
||||
stmt.declaration.type === 'VariableDeclaration') {
|
||||
walkVariableDeclaration(stmt.declaration, isRoot);
|
||||
}
|
||||
else if (stmt.type === 'LabeledStatement' &&
|
||||
stmt.body.type === 'VariableDeclaration') {
|
||||
walkVariableDeclaration(stmt.body, isRoot);
|
||||
}
|
||||
}
|
||||
}
|
||||
function walkVariableDeclaration(stmt, isRoot = false) {
|
||||
if (stmt.declare) {
|
||||
return;
|
||||
}
|
||||
for (const decl of stmt.declarations) {
|
||||
let refCall;
|
||||
const isCall = decl.init &&
|
||||
decl.init.type === 'CallExpression' &&
|
||||
decl.init.callee.type === 'Identifier';
|
||||
if (isCall &&
|
||||
(refCall = isRefCreationCall(decl.init.callee.name))) {
|
||||
processRefDeclaration(refCall, decl.id, decl.init);
|
||||
}
|
||||
else {
|
||||
const isProps = isRoot && isCall && decl.init.callee.name === 'defineProps';
|
||||
for (const id of compilerCore.extractIdentifiers(decl.id)) {
|
||||
if (isProps) {
|
||||
// for defineProps destructure, only exclude them since they
|
||||
// are already passed in as knownProps
|
||||
excludedIds.add(id);
|
||||
}
|
||||
else {
|
||||
registerBinding(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
function processRefDeclaration(method, id, call) {
|
||||
excludedIds.add(call.callee);
|
||||
if (method === convertSymbol) {
|
||||
// $
|
||||
// remove macro
|
||||
s.remove(call.callee.start + offset, call.callee.end + offset);
|
||||
if (id.type === 'Identifier') {
|
||||
// single variable
|
||||
registerRefBinding(id);
|
||||
}
|
||||
else if (id.type === 'ObjectPattern') {
|
||||
processRefObjectPattern(id, call);
|
||||
}
|
||||
else if (id.type === 'ArrayPattern') {
|
||||
processRefArrayPattern(id, call);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// shorthands
|
||||
if (id.type === 'Identifier') {
|
||||
registerRefBinding(id);
|
||||
// replace call
|
||||
s.overwrite(call.start + offset, call.start + method.length + offset, helper(method.slice(1)));
|
||||
}
|
||||
else {
|
||||
error(`${method}() cannot be used with destructure patterns.`, call);
|
||||
}
|
||||
}
|
||||
}
|
||||
function processRefObjectPattern(pattern, call, tempVar, path = []) {
|
||||
if (!tempVar) {
|
||||
tempVar = genTempVar();
|
||||
// const { x } = $(useFoo()) --> const __$temp_1 = useFoo()
|
||||
s.overwrite(pattern.start + offset, pattern.end + offset, tempVar);
|
||||
}
|
||||
for (const p of pattern.properties) {
|
||||
let nameId;
|
||||
let key;
|
||||
let defaultValue;
|
||||
if (p.type === 'ObjectProperty') {
|
||||
if (p.key.start === p.value.start) {
|
||||
// shorthand { foo }
|
||||
nameId = p.key;
|
||||
if (p.value.type === 'Identifier') {
|
||||
// avoid shorthand value identifier from being processed
|
||||
excludedIds.add(p.value);
|
||||
}
|
||||
else if (p.value.type === 'AssignmentPattern' &&
|
||||
p.value.left.type === 'Identifier') {
|
||||
// { foo = 1 }
|
||||
excludedIds.add(p.value.left);
|
||||
defaultValue = p.value.right;
|
||||
}
|
||||
}
|
||||
else {
|
||||
key = p.computed ? p.key : p.key.name;
|
||||
if (p.value.type === 'Identifier') {
|
||||
// { foo: bar }
|
||||
nameId = p.value;
|
||||
}
|
||||
else if (p.value.type === 'ObjectPattern') {
|
||||
processRefObjectPattern(p.value, call, tempVar, [...path, key]);
|
||||
}
|
||||
else if (p.value.type === 'ArrayPattern') {
|
||||
processRefArrayPattern(p.value, call, tempVar, [...path, key]);
|
||||
}
|
||||
else if (p.value.type === 'AssignmentPattern') {
|
||||
if (p.value.left.type === 'Identifier') {
|
||||
// { foo: bar = 1 }
|
||||
nameId = p.value.left;
|
||||
defaultValue = p.value.right;
|
||||
}
|
||||
else if (p.value.left.type === 'ObjectPattern') {
|
||||
processRefObjectPattern(p.value.left, call, tempVar, [
|
||||
...path,
|
||||
[key, p.value.right]
|
||||
]);
|
||||
}
|
||||
else if (p.value.left.type === 'ArrayPattern') {
|
||||
processRefArrayPattern(p.value.left, call, tempVar, [
|
||||
...path,
|
||||
[key, p.value.right]
|
||||
]);
|
||||
}
|
||||
else ;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
// rest element { ...foo }
|
||||
error(`reactivity destructure does not support rest elements.`, p);
|
||||
}
|
||||
if (nameId) {
|
||||
registerRefBinding(nameId);
|
||||
// inject toRef() after original replaced pattern
|
||||
const source = pathToString(tempVar, path);
|
||||
const keyStr = shared.isString(key)
|
||||
? `'${key}'`
|
||||
: key
|
||||
? snip(key)
|
||||
: `'${nameId.name}'`;
|
||||
const defaultStr = defaultValue ? `, ${snip(defaultValue)}` : ``;
|
||||
s.appendLeft(call.end + offset, `,\n ${nameId.name} = ${helper('toRef')}(${source}, ${keyStr}${defaultStr})`);
|
||||
}
|
||||
}
|
||||
}
|
||||
function processRefArrayPattern(pattern, call, tempVar, path = []) {
|
||||
if (!tempVar) {
|
||||
// const [x] = $(useFoo()) --> const __$temp_1 = useFoo()
|
||||
tempVar = genTempVar();
|
||||
s.overwrite(pattern.start + offset, pattern.end + offset, tempVar);
|
||||
}
|
||||
for (let i = 0; i < pattern.elements.length; i++) {
|
||||
const e = pattern.elements[i];
|
||||
if (!e)
|
||||
continue;
|
||||
let nameId;
|
||||
let defaultValue;
|
||||
if (e.type === 'Identifier') {
|
||||
// [a] --> [__a]
|
||||
nameId = e;
|
||||
}
|
||||
else if (e.type === 'AssignmentPattern') {
|
||||
// [a = 1]
|
||||
nameId = e.left;
|
||||
defaultValue = e.right;
|
||||
}
|
||||
else if (e.type === 'RestElement') {
|
||||
// [...a]
|
||||
error(`reactivity destructure does not support rest elements.`, e);
|
||||
}
|
||||
else if (e.type === 'ObjectPattern') {
|
||||
processRefObjectPattern(e, call, tempVar, [...path, i]);
|
||||
}
|
||||
else if (e.type === 'ArrayPattern') {
|
||||
processRefArrayPattern(e, call, tempVar, [...path, i]);
|
||||
}
|
||||
if (nameId) {
|
||||
registerRefBinding(nameId);
|
||||
// inject toRef() after original replaced pattern
|
||||
const source = pathToString(tempVar, path);
|
||||
const defaultStr = defaultValue ? `, ${snip(defaultValue)}` : ``;
|
||||
s.appendLeft(call.end + offset, `,\n ${nameId.name} = ${helper('toRef')}(${source}, ${i}${defaultStr})`);
|
||||
}
|
||||
}
|
||||
}
|
||||
function pathToString(source, path) {
|
||||
if (path.length) {
|
||||
for (const seg of path) {
|
||||
if (shared.isArray(seg)) {
|
||||
source = `(${source}${segToString(seg[0])} || ${snip(seg[1])})`;
|
||||
}
|
||||
else {
|
||||
source += segToString(seg);
|
||||
}
|
||||
}
|
||||
}
|
||||
return source;
|
||||
}
|
||||
function segToString(seg) {
|
||||
if (typeof seg === 'number') {
|
||||
return `[${seg}]`;
|
||||
}
|
||||
else if (typeof seg === 'string') {
|
||||
return `.${seg}`;
|
||||
}
|
||||
else {
|
||||
return snip(seg);
|
||||
}
|
||||
}
|
||||
function rewriteId(scope, id, parent, parentStack) {
|
||||
if (shared.hasOwn(scope, id.name)) {
|
||||
const bindingType = scope[id.name];
|
||||
if (bindingType) {
|
||||
const isProp = bindingType === 'prop';
|
||||
if (compilerCore.isStaticProperty(parent) && parent.shorthand) {
|
||||
// let binding used in a property shorthand
|
||||
// skip for destructure patterns
|
||||
if (!parent.inPattern ||
|
||||
compilerCore.isInDestructureAssignment(parent, parentStack)) {
|
||||
if (isProp) {
|
||||
if (escapeScope) {
|
||||
// prop binding in $$()
|
||||
// { prop } -> { prop: __props_prop }
|
||||
registerEscapedPropBinding(id);
|
||||
s.appendLeft(id.end + offset, `: __props_${propsLocalToPublicMap[id.name]}`);
|
||||
}
|
||||
else {
|
||||
// { prop } -> { prop: __props.prop }
|
||||
s.appendLeft(id.end + offset, `: ${shared.genPropsAccessExp(propsLocalToPublicMap[id.name])}`);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// { foo } -> { foo: foo.value }
|
||||
s.appendLeft(id.end + offset, `: ${id.name}.value`);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (isProp) {
|
||||
if (escapeScope) {
|
||||
// x --> __props_x
|
||||
registerEscapedPropBinding(id);
|
||||
s.overwrite(id.start + offset, id.end + offset, `__props_${propsLocalToPublicMap[id.name]}`);
|
||||
}
|
||||
else {
|
||||
// x --> __props.x
|
||||
s.overwrite(id.start + offset, id.end + offset, shared.genPropsAccessExp(propsLocalToPublicMap[id.name]));
|
||||
}
|
||||
}
|
||||
else {
|
||||
// x --> x.value
|
||||
s.appendLeft(id.end + offset, '.value');
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
const propBindingRefs = {};
|
||||
function registerEscapedPropBinding(id) {
|
||||
if (!propBindingRefs.hasOwnProperty(id.name)) {
|
||||
propBindingRefs[id.name] = true;
|
||||
const publicKey = propsLocalToPublicMap[id.name];
|
||||
s.prependRight(offset, `const __props_${publicKey} = ${helper(`toRef`)}(__props, '${publicKey}')\n`);
|
||||
}
|
||||
}
|
||||
// check root scope first
|
||||
walkScope(ast, true);
|
||||
estreeWalker.walk(ast, {
|
||||
enter(node, parent) {
|
||||
parent && parentStack.push(parent);
|
||||
// function scopes
|
||||
if (compilerCore.isFunctionType(node)) {
|
||||
scopeStack.push((currentScope = {}));
|
||||
compilerCore.walkFunctionParams(node, registerBinding);
|
||||
if (node.body.type === 'BlockStatement') {
|
||||
walkScope(node.body);
|
||||
}
|
||||
return;
|
||||
}
|
||||
// catch param
|
||||
if (node.type === 'CatchClause') {
|
||||
scopeStack.push((currentScope = {}));
|
||||
if (node.param && node.param.type === 'Identifier') {
|
||||
registerBinding(node.param);
|
||||
}
|
||||
walkScope(node.body);
|
||||
return;
|
||||
}
|
||||
// non-function block scopes
|
||||
if (node.type === 'BlockStatement' && !compilerCore.isFunctionType(parent)) {
|
||||
scopeStack.push((currentScope = {}));
|
||||
walkScope(node);
|
||||
return;
|
||||
}
|
||||
// skip type nodes
|
||||
if (parent &&
|
||||
parent.type.startsWith('TS') &&
|
||||
parent.type !== 'TSAsExpression' &&
|
||||
parent.type !== 'TSNonNullExpression' &&
|
||||
parent.type !== 'TSTypeAssertion') {
|
||||
return this.skip();
|
||||
}
|
||||
if (node.type === 'Identifier' &&
|
||||
// if inside $$(), skip unless this is a destructured prop binding
|
||||
!(escapeScope && rootScope[node.name] !== 'prop') &&
|
||||
compilerCore.isReferencedIdentifier(node, parent, parentStack) &&
|
||||
!excludedIds.has(node)) {
|
||||
// walk up the scope chain to check if id should be appended .value
|
||||
let i = scopeStack.length;
|
||||
while (i--) {
|
||||
if (rewriteId(scopeStack[i], node, parent, parentStack)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (node.type === 'CallExpression' && node.callee.type === 'Identifier') {
|
||||
const callee = node.callee.name;
|
||||
const refCall = isRefCreationCall(callee);
|
||||
if (refCall && (!parent || parent.type !== 'VariableDeclarator')) {
|
||||
return error(`${refCall} can only be used as the initializer of ` +
|
||||
`a variable declaration.`, node);
|
||||
}
|
||||
if (callee === escapeSymbol) {
|
||||
s.remove(node.callee.start + offset, node.callee.end + offset);
|
||||
escapeScope = node;
|
||||
}
|
||||
// TODO remove when out of experimental
|
||||
if (callee === '$raw') {
|
||||
error(`$raw() has been replaced by $$(). ` +
|
||||
`See ${RFC_LINK} for latest updates.`, node);
|
||||
}
|
||||
if (callee === '$fromRef') {
|
||||
error(`$fromRef() has been replaced by $(). ` +
|
||||
`See ${RFC_LINK} for latest updates.`, node);
|
||||
}
|
||||
}
|
||||
},
|
||||
leave(node, parent) {
|
||||
parent && parentStack.pop();
|
||||
if ((node.type === 'BlockStatement' && !compilerCore.isFunctionType(parent)) ||
|
||||
compilerCore.isFunctionType(node)) {
|
||||
scopeStack.pop();
|
||||
currentScope = scopeStack[scopeStack.length - 1] || null;
|
||||
}
|
||||
if (node === escapeScope) {
|
||||
escapeScope = undefined;
|
||||
}
|
||||
}
|
||||
});
|
||||
return {
|
||||
rootRefs: Object.keys(rootScope).filter(key => rootScope[key] === true),
|
||||
importedHelpers: [...importedHelpers]
|
||||
};
|
||||
}
|
||||
const RFC_LINK = `https://github.com/vuejs/rfcs/discussions/369`;
|
||||
const hasWarned = {};
|
||||
function warnExperimental() {
|
||||
// eslint-disable-next-line
|
||||
if (typeof window !== 'undefined') {
|
||||
return;
|
||||
}
|
||||
warnOnce(`Reactivity transform is an experimental feature.\n` +
|
||||
`Experimental features may change behavior between patch versions.\n` +
|
||||
`It is recommended to pin your vue dependencies to exact versions to avoid breakage.\n` +
|
||||
`You can follow the proposal's status at ${RFC_LINK}.`);
|
||||
}
|
||||
function warnOnce(msg) {
|
||||
const isNodeProd = typeof process !== 'undefined' && process.env.NODE_ENV === 'production';
|
||||
if (!isNodeProd && !false && !hasWarned[msg]) {
|
||||
hasWarned[msg] = true;
|
||||
warn(msg);
|
||||
}
|
||||
}
|
||||
function warn(msg) {
|
||||
console.warn(`\x1b[1m\x1b[33m[@vue/reactivity-transform]\x1b[0m\x1b[33m ${msg}\x1b[0m\n`);
|
||||
}
|
||||
|
||||
exports.shouldTransform = shouldTransform;
|
||||
exports.transform = transform;
|
||||
exports.transformAST = transformAST;
|
||||
33
node_modules/@vue/reactivity-transform/dist/reactivity-transform.d.ts
generated
vendored
Normal file
33
node_modules/@vue/reactivity-transform/dist/reactivity-transform.d.ts
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
import MagicString from 'magic-string';
|
||||
import { ParserPlugin } from '@babel/parser';
|
||||
import { Program } from '@babel/types';
|
||||
import { SourceMap } from 'magic-string';
|
||||
|
||||
export declare interface RefTransformOptions {
|
||||
filename?: string;
|
||||
sourceMap?: boolean;
|
||||
parserPlugins?: ParserPlugin[];
|
||||
importHelpersFrom?: string;
|
||||
}
|
||||
|
||||
export declare interface RefTransformResults {
|
||||
code: string;
|
||||
map: SourceMap | null;
|
||||
rootRefs: string[];
|
||||
importedHelpers: string[];
|
||||
}
|
||||
|
||||
export declare function shouldTransform(src: string): boolean;
|
||||
|
||||
export declare function transform(src: string, { filename, sourceMap, parserPlugins, importHelpersFrom }?: RefTransformOptions): RefTransformResults;
|
||||
|
||||
export declare function transformAST(ast: Program, s: MagicString, offset?: number, knownRefs?: string[], knownProps?: Record<string, // public prop key
|
||||
{
|
||||
local: string;
|
||||
default?: any;
|
||||
}>): {
|
||||
rootRefs: string[];
|
||||
importedHelpers: string[];
|
||||
};
|
||||
|
||||
export { }
|
||||
41
node_modules/@vue/reactivity-transform/package.json
generated
vendored
Normal file
41
node_modules/@vue/reactivity-transform/package.json
generated
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
{
|
||||
"name": "@vue/reactivity-transform",
|
||||
"version": "3.2.36",
|
||||
"description": "@vue/reactivity-transform",
|
||||
"main": "dist/reactivity-transform.cjs.js",
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"buildOptions": {
|
||||
"formats": [
|
||||
"cjs"
|
||||
],
|
||||
"prod": false
|
||||
},
|
||||
"types": "dist/reactivity-transform.d.ts",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/vuejs/core.git",
|
||||
"directory": "packages/reactivity-transform"
|
||||
},
|
||||
"keywords": [
|
||||
"vue"
|
||||
],
|
||||
"author": "Evan You",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/vuejs/core/issues"
|
||||
},
|
||||
"homepage": "https://github.com/vuejs/core/tree/dev/packages/reactivity-transform#readme",
|
||||
"dependencies": {
|
||||
"@babel/parser": "^7.16.4",
|
||||
"@vue/compiler-core": "3.2.36",
|
||||
"@vue/shared": "3.2.36",
|
||||
"estree-walker": "^2.0.2",
|
||||
"magic-string": "^0.25.7"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.16.0",
|
||||
"@babel/types": "^7.16.0"
|
||||
}
|
||||
}
|
||||
21
node_modules/@vue/reactivity/LICENSE
generated
vendored
Normal file
21
node_modules/@vue/reactivity/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2018-present, Yuxi (Evan) You
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
19
node_modules/@vue/reactivity/README.md
generated
vendored
Normal file
19
node_modules/@vue/reactivity/README.md
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
# @vue/reactivity
|
||||
|
||||
## Usage Note
|
||||
|
||||
This package is inlined into Global & Browser ESM builds of user-facing renderers (e.g. `@vue/runtime-dom`), but also published as a package that can be used standalone. The standalone build should not be used alongside a pre-bundled build of a user-facing renderer, as they will have different internal storage for reactivity connections. A user-facing renderer should re-export all APIs from this package.
|
||||
|
||||
For full exposed APIs, see `src/index.ts`. You can also run `yarn build reactivity --types` from repo root, which will generate an API report at `temp/reactivity.api.md`.
|
||||
|
||||
## Credits
|
||||
|
||||
The implementation of this module is inspired by the following prior art in the JavaScript ecosystem:
|
||||
|
||||
- [Meteor Tracker](https://docs.meteor.com/api/tracker.html)
|
||||
- [nx-js/observer-util](https://github.com/nx-js/observer-util)
|
||||
- [salesforce/observable-membrane](https://github.com/salesforce/observable-membrane)
|
||||
|
||||
## Caveats
|
||||
|
||||
- Built-in objects are not observed except for `Array`, `Map`, `WeakMap`, `Set` and `WeakSet`.
|
||||
1275
node_modules/@vue/reactivity/dist/reactivity.cjs.js
generated
vendored
Normal file
1275
node_modules/@vue/reactivity/dist/reactivity.cjs.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1198
node_modules/@vue/reactivity/dist/reactivity.cjs.prod.js
generated
vendored
Normal file
1198
node_modules/@vue/reactivity/dist/reactivity.cjs.prod.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
347
node_modules/@vue/reactivity/dist/reactivity.d.ts
generated
vendored
Normal file
347
node_modules/@vue/reactivity/dist/reactivity.d.ts
generated
vendored
Normal file
@@ -0,0 +1,347 @@
|
||||
import { IfAny } from '@vue/shared';
|
||||
|
||||
declare type BaseTypes = string | number | boolean;
|
||||
|
||||
declare type Builtin = Primitive | Function | Date | Error | RegExp;
|
||||
|
||||
declare type CollectionTypes = IterableCollections | WeakCollections;
|
||||
|
||||
export declare function computed<T>(getter: ComputedGetter<T>, debugOptions?: DebuggerOptions): ComputedRef<T>;
|
||||
|
||||
export declare function computed<T>(options: WritableComputedOptions<T>, debugOptions?: DebuggerOptions): WritableComputedRef<T>;
|
||||
|
||||
export declare type ComputedGetter<T> = (...args: any[]) => T;
|
||||
|
||||
export declare interface ComputedRef<T = any> extends WritableComputedRef<T> {
|
||||
readonly value: T;
|
||||
[ComputedRefSymbol]: true;
|
||||
}
|
||||
|
||||
declare class ComputedRefImpl<T> {
|
||||
private readonly _setter;
|
||||
dep?: Dep;
|
||||
private _value;
|
||||
readonly effect: ReactiveEffect<T>;
|
||||
readonly __v_isRef = true;
|
||||
readonly [ReactiveFlags.IS_READONLY]: boolean;
|
||||
_dirty: boolean;
|
||||
_cacheable: boolean;
|
||||
constructor(getter: ComputedGetter<T>, _setter: ComputedSetter<T>, isReadonly: boolean, isSSR: boolean);
|
||||
get value(): T;
|
||||
set value(newValue: T);
|
||||
}
|
||||
|
||||
declare const ComputedRefSymbol: unique symbol;
|
||||
|
||||
export declare type ComputedSetter<T> = (v: T) => void;
|
||||
|
||||
export declare function customRef<T>(factory: CustomRefFactory<T>): Ref<T>;
|
||||
|
||||
export declare type CustomRefFactory<T> = (track: () => void, trigger: () => void) => {
|
||||
get: () => T;
|
||||
set: (value: T) => void;
|
||||
};
|
||||
|
||||
export declare type DebuggerEvent = {
|
||||
effect: ReactiveEffect;
|
||||
} & DebuggerEventExtraInfo;
|
||||
|
||||
export declare type DebuggerEventExtraInfo = {
|
||||
target: object;
|
||||
type: TrackOpTypes | TriggerOpTypes;
|
||||
key: any;
|
||||
newValue?: any;
|
||||
oldValue?: any;
|
||||
oldTarget?: Map<any, any> | Set<any>;
|
||||
};
|
||||
|
||||
export declare interface DebuggerOptions {
|
||||
onTrack?: (event: DebuggerEvent) => void;
|
||||
onTrigger?: (event: DebuggerEvent) => void;
|
||||
}
|
||||
|
||||
export declare type DeepReadonly<T> = T extends Builtin ? T : T extends Map<infer K, infer V> ? ReadonlyMap<DeepReadonly<K>, DeepReadonly<V>> : T extends ReadonlyMap<infer K, infer V> ? ReadonlyMap<DeepReadonly<K>, DeepReadonly<V>> : T extends WeakMap<infer K, infer V> ? WeakMap<DeepReadonly<K>, DeepReadonly<V>> : T extends Set<infer U> ? ReadonlySet<DeepReadonly<U>> : T extends ReadonlySet<infer U> ? ReadonlySet<DeepReadonly<U>> : T extends WeakSet<infer U> ? WeakSet<DeepReadonly<U>> : T extends Promise<infer U> ? Promise<DeepReadonly<U>> : T extends Ref<infer U> ? Readonly<Ref<DeepReadonly<U>>> : T extends {} ? {
|
||||
readonly [K in keyof T]: DeepReadonly<T[K]>;
|
||||
} : Readonly<T>;
|
||||
|
||||
export declare function deferredComputed<T>(getter: () => T): ComputedRef<T>;
|
||||
|
||||
declare type Dep = Set<ReactiveEffect> & TrackedMarkers;
|
||||
|
||||
export declare function effect<T = any>(fn: () => T, options?: ReactiveEffectOptions): ReactiveEffectRunner;
|
||||
|
||||
export declare type EffectScheduler = (...args: any[]) => any;
|
||||
|
||||
export declare class EffectScope {
|
||||
/* Excluded from this release type: active */
|
||||
/* Excluded from this release type: effects */
|
||||
/* Excluded from this release type: cleanups */
|
||||
/* Excluded from this release type: parent */
|
||||
/* Excluded from this release type: scopes */
|
||||
/* Excluded from this release type: index */
|
||||
constructor(detached?: boolean);
|
||||
run<T>(fn: () => T): T | undefined;
|
||||
/* Excluded from this release type: on */
|
||||
/* Excluded from this release type: off */
|
||||
stop(fromParent?: boolean): void;
|
||||
}
|
||||
|
||||
export declare function effectScope(detached?: boolean): EffectScope;
|
||||
|
||||
export declare function enableTracking(): void;
|
||||
|
||||
export declare function getCurrentScope(): EffectScope | undefined;
|
||||
|
||||
export declare function isProxy(value: unknown): boolean;
|
||||
|
||||
export declare function isReactive(value: unknown): boolean;
|
||||
|
||||
export declare function isReadonly(value: unknown): boolean;
|
||||
|
||||
export declare function isRef<T>(r: Ref<T> | unknown): r is Ref<T>;
|
||||
|
||||
export declare function isShallow(value: unknown): boolean;
|
||||
|
||||
declare type IterableCollections = Map<any, any> | Set<any>;
|
||||
|
||||
export declare const ITERATE_KEY: unique symbol;
|
||||
|
||||
export declare function markRaw<T extends object>(value: T): T & {
|
||||
[RawSymbol]?: true;
|
||||
};
|
||||
|
||||
export declare function onScopeDispose(fn: () => void): void;
|
||||
|
||||
export declare function pauseTracking(): void;
|
||||
|
||||
declare type Primitive = string | number | boolean | bigint | symbol | undefined | null;
|
||||
|
||||
export declare function proxyRefs<T extends object>(objectWithRefs: T): ShallowUnwrapRef<T>;
|
||||
|
||||
declare const RawSymbol: unique symbol;
|
||||
|
||||
/**
|
||||
* Creates a reactive copy of the original object.
|
||||
*
|
||||
* The reactive conversion is "deep"—it affects all nested properties. In the
|
||||
* ES2015 Proxy based implementation, the returned proxy is **not** equal to the
|
||||
* original object. It is recommended to work exclusively with the reactive
|
||||
* proxy and avoid relying on the original object.
|
||||
*
|
||||
* A reactive object also automatically unwraps refs contained in it, so you
|
||||
* don't need to use `.value` when accessing and mutating their value:
|
||||
*
|
||||
* ```js
|
||||
* const count = ref(0)
|
||||
* const obj = reactive({
|
||||
* count
|
||||
* })
|
||||
*
|
||||
* obj.count++
|
||||
* obj.count // -> 1
|
||||
* count.value // -> 1
|
||||
* ```
|
||||
*/
|
||||
export declare function reactive<T extends object>(target: T): UnwrapNestedRefs<T>;
|
||||
|
||||
export declare class ReactiveEffect<T = any> {
|
||||
fn: () => T;
|
||||
scheduler: EffectScheduler | null;
|
||||
active: boolean;
|
||||
deps: Dep[];
|
||||
parent: ReactiveEffect | undefined;
|
||||
/* Excluded from this release type: computed */
|
||||
/* Excluded from this release type: allowRecurse */
|
||||
/* Excluded from this release type: deferStop */
|
||||
onStop?: () => void;
|
||||
onTrack?: (event: DebuggerEvent) => void;
|
||||
onTrigger?: (event: DebuggerEvent) => void;
|
||||
constructor(fn: () => T, scheduler?: EffectScheduler | null, scope?: EffectScope);
|
||||
run(): T | undefined;
|
||||
stop(): void;
|
||||
}
|
||||
|
||||
export declare interface ReactiveEffectOptions extends DebuggerOptions {
|
||||
lazy?: boolean;
|
||||
scheduler?: EffectScheduler;
|
||||
scope?: EffectScope;
|
||||
allowRecurse?: boolean;
|
||||
onStop?: () => void;
|
||||
}
|
||||
|
||||
export declare interface ReactiveEffectRunner<T = any> {
|
||||
(): T;
|
||||
effect: ReactiveEffect;
|
||||
}
|
||||
|
||||
export declare const enum ReactiveFlags {
|
||||
SKIP = "__v_skip",
|
||||
IS_REACTIVE = "__v_isReactive",
|
||||
IS_READONLY = "__v_isReadonly",
|
||||
IS_SHALLOW = "__v_isShallow",
|
||||
RAW = "__v_raw"
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a readonly copy of the original object. Note the returned copy is not
|
||||
* made reactive, but `readonly` can be called on an already reactive object.
|
||||
*/
|
||||
export declare function readonly<T extends object>(target: T): DeepReadonly<UnwrapNestedRefs<T>>;
|
||||
|
||||
export declare interface Ref<T = any> {
|
||||
value: T;
|
||||
/**
|
||||
* Type differentiator only.
|
||||
* We need this to be in public d.ts but don't want it to show up in IDE
|
||||
* autocomplete, so we use a private Symbol instead.
|
||||
*/
|
||||
[RefSymbol]: true;
|
||||
}
|
||||
|
||||
export declare function ref<T extends object>(value: T): [T] extends [Ref] ? T : Ref<UnwrapRef<T>>;
|
||||
|
||||
export declare function ref<T>(value: T): Ref<UnwrapRef<T>>;
|
||||
|
||||
export declare function ref<T = any>(): Ref<T | undefined>;
|
||||
|
||||
declare const RefSymbol: unique symbol;
|
||||
|
||||
/**
|
||||
* This is a special exported interface for other packages to declare
|
||||
* additional types that should bail out for ref unwrapping. For example
|
||||
* \@vue/runtime-dom can declare it like so in its d.ts:
|
||||
*
|
||||
* ``` ts
|
||||
* declare module '@vue/reactivity' {
|
||||
* export interface RefUnwrapBailTypes {
|
||||
* runtimeDOMBailTypes: Node | Window
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* Note that api-extractor somehow refuses to include `declare module`
|
||||
* augmentations in its generated d.ts, so we have to manually append them
|
||||
* to the final generated d.ts in our build process.
|
||||
*/
|
||||
export declare interface RefUnwrapBailTypes {
|
||||
}
|
||||
|
||||
export declare function resetTracking(): void;
|
||||
|
||||
export declare type ShallowReactive<T> = T & {
|
||||
[ShallowReactiveMarker]?: true;
|
||||
};
|
||||
|
||||
/**
|
||||
* Return a shallowly-reactive copy of the original object, where only the root
|
||||
* level properties are reactive. It also does not auto-unwrap refs (even at the
|
||||
* root level).
|
||||
*/
|
||||
export declare function shallowReactive<T extends object>(target: T): ShallowReactive<T>;
|
||||
|
||||
declare const ShallowReactiveMarker: unique symbol;
|
||||
|
||||
/**
|
||||
* Returns a reactive-copy of the original object, where only the root level
|
||||
* properties are readonly, and does NOT unwrap refs nor recursively convert
|
||||
* returned properties.
|
||||
* This is used for creating the props proxy object for stateful components.
|
||||
*/
|
||||
export declare function shallowReadonly<T extends object>(target: T): Readonly<T>;
|
||||
|
||||
export declare type ShallowRef<T = any> = Ref<T> & {
|
||||
[ShallowRefMarker]?: true;
|
||||
};
|
||||
|
||||
export declare function shallowRef<T extends object>(value: T): T extends Ref ? T : ShallowRef<T>;
|
||||
|
||||
export declare function shallowRef<T>(value: T): ShallowRef<T>;
|
||||
|
||||
export declare function shallowRef<T = any>(): ShallowRef<T | undefined>;
|
||||
|
||||
declare const ShallowRefMarker: unique symbol;
|
||||
|
||||
export declare type ShallowUnwrapRef<T> = {
|
||||
[K in keyof T]: T[K] extends Ref<infer V> ? V : T[K] extends Ref<infer V> | undefined ? unknown extends V ? undefined : V | undefined : T[K];
|
||||
};
|
||||
|
||||
declare function stop_2(runner: ReactiveEffectRunner): void;
|
||||
export { stop_2 as stop }
|
||||
|
||||
export declare function toRaw<T>(observed: T): T;
|
||||
|
||||
export declare type ToRef<T> = IfAny<T, Ref<T>, [T] extends [Ref] ? T : Ref<T>>;
|
||||
|
||||
export declare function toRef<T extends object, K extends keyof T>(object: T, key: K): ToRef<T[K]>;
|
||||
|
||||
export declare function toRef<T extends object, K extends keyof T>(object: T, key: K, defaultValue: T[K]): ToRef<Exclude<T[K], undefined>>;
|
||||
|
||||
export declare type ToRefs<T = any> = {
|
||||
[K in keyof T]: ToRef<T[K]>;
|
||||
};
|
||||
|
||||
export declare function toRefs<T extends object>(object: T): ToRefs<T>;
|
||||
|
||||
export declare function track(target: object, type: TrackOpTypes, key: unknown): void;
|
||||
|
||||
/**
|
||||
* wasTracked and newTracked maintain the status for several levels of effect
|
||||
* tracking recursion. One bit per level is used to define whether the dependency
|
||||
* was/is tracked.
|
||||
*/
|
||||
declare type TrackedMarkers = {
|
||||
/**
|
||||
* wasTracked
|
||||
*/
|
||||
w: number;
|
||||
/**
|
||||
* newTracked
|
||||
*/
|
||||
n: number;
|
||||
};
|
||||
|
||||
export declare const enum TrackOpTypes {
|
||||
GET = "get",
|
||||
HAS = "has",
|
||||
ITERATE = "iterate"
|
||||
}
|
||||
|
||||
export declare function trigger(target: object, type: TriggerOpTypes, key?: unknown, newValue?: unknown, oldValue?: unknown, oldTarget?: Map<unknown, unknown> | Set<unknown>): void;
|
||||
|
||||
export declare const enum TriggerOpTypes {
|
||||
SET = "set",
|
||||
ADD = "add",
|
||||
DELETE = "delete",
|
||||
CLEAR = "clear"
|
||||
}
|
||||
|
||||
export declare function triggerRef(ref: Ref): void;
|
||||
|
||||
export declare function unref<T>(ref: T | Ref<T>): T;
|
||||
|
||||
export declare type UnwrapNestedRefs<T> = T extends Ref ? T : UnwrapRefSimple<T>;
|
||||
|
||||
export declare type UnwrapRef<T> = T extends ShallowRef<infer V> ? V : T extends Ref<infer V> ? UnwrapRefSimple<V> : UnwrapRefSimple<T>;
|
||||
|
||||
declare type UnwrapRefSimple<T> = T extends Function | CollectionTypes | BaseTypes | Ref | RefUnwrapBailTypes[keyof RefUnwrapBailTypes] | {
|
||||
[RawSymbol]?: true;
|
||||
} ? T : T extends Array<any> ? {
|
||||
[K in keyof T]: UnwrapRefSimple<T[K]>;
|
||||
} : T extends object & {
|
||||
[ShallowReactiveMarker]?: never;
|
||||
} ? {
|
||||
[P in keyof T]: P extends symbol ? T[P] : UnwrapRef<T[P]>;
|
||||
} : T;
|
||||
|
||||
declare type WeakCollections = WeakMap<any, any> | WeakSet<any>;
|
||||
|
||||
export declare interface WritableComputedOptions<T> {
|
||||
get: ComputedGetter<T>;
|
||||
set: ComputedSetter<T>;
|
||||
}
|
||||
|
||||
export declare interface WritableComputedRef<T> extends Ref<T> {
|
||||
readonly effect: ReactiveEffect<T>;
|
||||
}
|
||||
|
||||
export { }
|
||||
1292
node_modules/@vue/reactivity/dist/reactivity.esm-browser.js
generated
vendored
Normal file
1292
node_modules/@vue/reactivity/dist/reactivity.esm-browser.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
node_modules/@vue/reactivity/dist/reactivity.esm-browser.prod.js
generated
vendored
Normal file
1
node_modules/@vue/reactivity/dist/reactivity.esm-browser.prod.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1251
node_modules/@vue/reactivity/dist/reactivity.esm-bundler.js
generated
vendored
Normal file
1251
node_modules/@vue/reactivity/dist/reactivity.esm-bundler.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1334
node_modules/@vue/reactivity/dist/reactivity.global.js
generated
vendored
Normal file
1334
node_modules/@vue/reactivity/dist/reactivity.global.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
node_modules/@vue/reactivity/dist/reactivity.global.prod.js
generated
vendored
Normal file
1
node_modules/@vue/reactivity/dist/reactivity.global.prod.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
7
node_modules/@vue/reactivity/index.js
generated
vendored
Normal file
7
node_modules/@vue/reactivity/index.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
'use strict'
|
||||
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
module.exports = require('./dist/reactivity.cjs.prod.js')
|
||||
} else {
|
||||
module.exports = require('./dist/reactivity.cjs.js')
|
||||
}
|
||||
41
node_modules/@vue/reactivity/package.json
generated
vendored
Normal file
41
node_modules/@vue/reactivity/package.json
generated
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
{
|
||||
"name": "@vue/reactivity",
|
||||
"version": "3.2.36",
|
||||
"description": "@vue/reactivity",
|
||||
"main": "index.js",
|
||||
"module": "dist/reactivity.esm-bundler.js",
|
||||
"types": "dist/reactivity.d.ts",
|
||||
"unpkg": "dist/reactivity.global.js",
|
||||
"jsdelivr": "dist/reactivity.global.js",
|
||||
"files": [
|
||||
"index.js",
|
||||
"dist"
|
||||
],
|
||||
"sideEffects": false,
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/vuejs/core.git",
|
||||
"directory": "packages/reactivity"
|
||||
},
|
||||
"buildOptions": {
|
||||
"name": "VueReactivity",
|
||||
"formats": [
|
||||
"esm-bundler",
|
||||
"esm-browser",
|
||||
"cjs",
|
||||
"global"
|
||||
]
|
||||
},
|
||||
"keywords": [
|
||||
"vue"
|
||||
],
|
||||
"author": "Evan You",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/vuejs/core/issues"
|
||||
},
|
||||
"homepage": "https://github.com/vuejs/core/tree/main/packages/reactivity#readme",
|
||||
"dependencies": {
|
||||
"@vue/shared": "3.2.36"
|
||||
}
|
||||
}
|
||||
21
node_modules/@vue/runtime-core/LICENSE
generated
vendored
Normal file
21
node_modules/@vue/runtime-core/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2018-present, Yuxi (Evan) You
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
28
node_modules/@vue/runtime-core/README.md
generated
vendored
Normal file
28
node_modules/@vue/runtime-core/README.md
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
# @vue/runtime-core
|
||||
|
||||
> This package is published only for typing and building custom renderers. It is NOT meant to be used in applications.
|
||||
|
||||
For full exposed APIs, see `src/index.ts`. You can also run `yarn build runtime-core --types` from repo root, which will generate an API report at `temp/runtime-core.api.md`.
|
||||
|
||||
## Building a Custom Renderer
|
||||
|
||||
``` ts
|
||||
import { createRenderer } from '@vue/runtime-core'
|
||||
|
||||
const { render, createApp } = createRenderer({
|
||||
patchProp,
|
||||
insert,
|
||||
remove,
|
||||
createElement,
|
||||
// ...
|
||||
})
|
||||
|
||||
// `render` is the low-level API
|
||||
// `createApp` returns an app instance with configurable context shared
|
||||
// by the entire app tree.
|
||||
export { render, createApp }
|
||||
|
||||
export * from '@vue/runtime-core'
|
||||
```
|
||||
|
||||
See `@vue/runtime-dom` for how a DOM-targeting renderer is implemented.
|
||||
7874
node_modules/@vue/runtime-core/dist/runtime-core.cjs.js
generated
vendored
Normal file
7874
node_modules/@vue/runtime-core/dist/runtime-core.cjs.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
6309
node_modules/@vue/runtime-core/dist/runtime-core.cjs.prod.js
generated
vendored
Normal file
6309
node_modules/@vue/runtime-core/dist/runtime-core.cjs.prod.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
2012
node_modules/@vue/runtime-core/dist/runtime-core.d.ts
generated
vendored
Normal file
2012
node_modules/@vue/runtime-core/dist/runtime-core.d.ts
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
7850
node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js
generated
vendored
Normal file
7850
node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
7
node_modules/@vue/runtime-core/index.js
generated
vendored
Normal file
7
node_modules/@vue/runtime-core/index.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
'use strict'
|
||||
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
module.exports = require('./dist/runtime-core.cjs.prod.js')
|
||||
} else {
|
||||
module.exports = require('./dist/runtime-core.cjs.js')
|
||||
}
|
||||
38
node_modules/@vue/runtime-core/package.json
generated
vendored
Normal file
38
node_modules/@vue/runtime-core/package.json
generated
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
{
|
||||
"name": "@vue/runtime-core",
|
||||
"version": "3.2.36",
|
||||
"description": "@vue/runtime-core",
|
||||
"main": "index.js",
|
||||
"module": "dist/runtime-core.esm-bundler.js",
|
||||
"types": "dist/runtime-core.d.ts",
|
||||
"files": [
|
||||
"index.js",
|
||||
"dist"
|
||||
],
|
||||
"buildOptions": {
|
||||
"name": "VueRuntimeCore",
|
||||
"formats": [
|
||||
"esm-bundler",
|
||||
"cjs"
|
||||
]
|
||||
},
|
||||
"sideEffects": false,
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/vuejs/core.git",
|
||||
"directory": "packages/runtime-core"
|
||||
},
|
||||
"keywords": [
|
||||
"vue"
|
||||
],
|
||||
"author": "Evan You",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/vuejs/core/issues"
|
||||
},
|
||||
"homepage": "https://github.com/vuejs/core/tree/main/packages/runtime-core#readme",
|
||||
"dependencies": {
|
||||
"@vue/shared": "3.2.36",
|
||||
"@vue/reactivity": "3.2.36"
|
||||
}
|
||||
}
|
||||
21
node_modules/@vue/runtime-dom/LICENSE
generated
vendored
Normal file
21
node_modules/@vue/runtime-dom/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2018-present, Yuxi (Evan) You
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
13
node_modules/@vue/runtime-dom/README.md
generated
vendored
Normal file
13
node_modules/@vue/runtime-dom/README.md
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
# @vue/runtime-dom
|
||||
|
||||
``` js
|
||||
import { h, createApp } from '@vue/runtime-dom'
|
||||
|
||||
const RootComponent = {
|
||||
render() {
|
||||
return h('div', 'hello world')
|
||||
}
|
||||
}
|
||||
|
||||
createApp(RootComponent).mount('#app')
|
||||
```
|
||||
1668
node_modules/@vue/runtime-dom/dist/runtime-dom.cjs.js
generated
vendored
Normal file
1668
node_modules/@vue/runtime-dom/dist/runtime-dom.cjs.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1563
node_modules/@vue/runtime-dom/dist/runtime-dom.cjs.prod.js
generated
vendored
Normal file
1563
node_modules/@vue/runtime-dom/dist/runtime-dom.cjs.prod.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1522
node_modules/@vue/runtime-dom/dist/runtime-dom.d.ts
generated
vendored
Normal file
1522
node_modules/@vue/runtime-dom/dist/runtime-dom.d.ts
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
10839
node_modules/@vue/runtime-dom/dist/runtime-dom.esm-browser.js
generated
vendored
Normal file
10839
node_modules/@vue/runtime-dom/dist/runtime-dom.esm-browser.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
node_modules/@vue/runtime-dom/dist/runtime-dom.esm-browser.prod.js
generated
vendored
Normal file
1
node_modules/@vue/runtime-dom/dist/runtime-dom.esm-browser.prod.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1698
node_modules/@vue/runtime-dom/dist/runtime-dom.esm-bundler.js
generated
vendored
Normal file
1698
node_modules/@vue/runtime-dom/dist/runtime-dom.esm-bundler.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
10972
node_modules/@vue/runtime-dom/dist/runtime-dom.global.js
generated
vendored
Normal file
10972
node_modules/@vue/runtime-dom/dist/runtime-dom.global.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
node_modules/@vue/runtime-dom/dist/runtime-dom.global.prod.js
generated
vendored
Normal file
1
node_modules/@vue/runtime-dom/dist/runtime-dom.global.prod.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
7
node_modules/@vue/runtime-dom/index.js
generated
vendored
Normal file
7
node_modules/@vue/runtime-dom/index.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
'use strict'
|
||||
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
module.exports = require('./dist/runtime-dom.cjs.prod.js')
|
||||
} else {
|
||||
module.exports = require('./dist/runtime-dom.cjs.js')
|
||||
}
|
||||
42
node_modules/@vue/runtime-dom/package.json
generated
vendored
Normal file
42
node_modules/@vue/runtime-dom/package.json
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
{
|
||||
"name": "@vue/runtime-dom",
|
||||
"version": "3.2.36",
|
||||
"description": "@vue/runtime-dom",
|
||||
"main": "index.js",
|
||||
"module": "dist/runtime-dom.esm-bundler.js",
|
||||
"types": "dist/runtime-dom.d.ts",
|
||||
"unpkg": "dist/runtime-dom.global.js",
|
||||
"files": [
|
||||
"index.js",
|
||||
"dist"
|
||||
],
|
||||
"sideEffects": false,
|
||||
"buildOptions": {
|
||||
"name": "VueRuntimeDOM",
|
||||
"formats": [
|
||||
"esm-bundler",
|
||||
"esm-browser",
|
||||
"cjs",
|
||||
"global"
|
||||
]
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/vuejs/core.git",
|
||||
"directory": "packages/runtime-dom"
|
||||
},
|
||||
"keywords": [
|
||||
"vue"
|
||||
],
|
||||
"author": "Evan You",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/vuejs/core/issues"
|
||||
},
|
||||
"homepage": "https://github.com/vuejs/core/tree/main/packages/runtime-dom#readme",
|
||||
"dependencies": {
|
||||
"@vue/shared": "3.2.36",
|
||||
"@vue/runtime-core": "3.2.36",
|
||||
"csstype": "^2.6.8"
|
||||
}
|
||||
}
|
||||
21
node_modules/@vue/server-renderer/LICENSE
generated
vendored
Normal file
21
node_modules/@vue/server-renderer/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2018-present, Yuxi (Evan) You
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
178
node_modules/@vue/server-renderer/README.md
generated
vendored
Normal file
178
node_modules/@vue/server-renderer/README.md
generated
vendored
Normal file
@@ -0,0 +1,178 @@
|
||||
# @vue/server-renderer
|
||||
|
||||
**Note: as of 3.2.13+, this package is included as a dependency of the main `vue` package and can be accessed as `vue/server-renderer`. This means you no longer need to explicitly install this package and ensure its version match that of `vue`'s. Just use the `vue/server-renderer` deep import instead.**
|
||||
|
||||
## Basic API
|
||||
|
||||
### `renderToString`
|
||||
|
||||
**Signature**
|
||||
|
||||
```ts
|
||||
function renderToString(
|
||||
input: App | VNode,
|
||||
context?: SSRContext
|
||||
): Promise<string>
|
||||
```
|
||||
|
||||
**Usage**
|
||||
|
||||
```js
|
||||
const { createSSRApp } = require('vue')
|
||||
const { renderToString } = require('@vue/server-renderer')
|
||||
|
||||
const app = createSSRApp({
|
||||
data: () => ({ msg: 'hello' }),
|
||||
template: `<div>{{ msg }}</div>`
|
||||
})
|
||||
|
||||
;(async () => {
|
||||
const html = await renderToString(app)
|
||||
console.log(html)
|
||||
})()
|
||||
```
|
||||
|
||||
### Handling Teleports
|
||||
|
||||
If the rendered app contains teleports, the teleported content will not be part of the rendered string. Instead, they are exposed under the `teleports` property of the ssr context object:
|
||||
|
||||
```js
|
||||
const ctx = {}
|
||||
const html = await renderToString(app, ctx)
|
||||
|
||||
console.log(ctx.teleports) // { '#teleported': 'teleported content' }
|
||||
```
|
||||
|
||||
## Streaming API
|
||||
|
||||
### `renderToNodeStream`
|
||||
|
||||
Renders input as a [Node.js Readable stream](https://nodejs.org/api/stream.html#stream_class_stream_readable).
|
||||
|
||||
**Signature**
|
||||
|
||||
```ts
|
||||
function renderToNodeStream(input: App | VNode, context?: SSRContext): Readable
|
||||
```
|
||||
|
||||
**Usage**
|
||||
|
||||
```js
|
||||
// inside a Node.js http handler
|
||||
renderToNodeStream(app).pipe(res)
|
||||
```
|
||||
|
||||
**Note:** This method is not supported in the ESM build of `@vue/server-renderer`, which is decoupled from Node.js environments. Use `pipeToNodeWritable` instead.
|
||||
|
||||
### `pipeToNodeWritable`
|
||||
|
||||
Render and pipe to an existing [Node.js Writable stream](https://nodejs.org/api/stream.html#stream_writable_streams) instance.
|
||||
|
||||
**Signature**
|
||||
|
||||
```ts
|
||||
function pipeToNodeWritable(
|
||||
input: App | VNode,
|
||||
context: SSRContext = {},
|
||||
writable: Writable
|
||||
): void
|
||||
```
|
||||
|
||||
**Usage**
|
||||
|
||||
```js
|
||||
// inside a Node.js http handler
|
||||
pipeToNodeWritable(app, {}, res)
|
||||
```
|
||||
|
||||
### `renderToWebStream`
|
||||
|
||||
Renders input as a [Web ReadableStream](https://developer.mozilla.org/en-US/docs/Web/API/Streams_API).
|
||||
|
||||
**Signature**
|
||||
|
||||
```ts
|
||||
function renderToWebStream(
|
||||
input: App | VNode,
|
||||
context?: SSRContext
|
||||
): ReadableStream
|
||||
```
|
||||
|
||||
**Usage**
|
||||
|
||||
```js
|
||||
// inside an environment with ReadableStream support
|
||||
return new Response(renderToWebStream(app))
|
||||
```
|
||||
|
||||
**Note:** in environments that do not expose `ReadableStream` constructor in the global scope, `pipeToWebWritable` should be used instead.
|
||||
|
||||
### `pipeToWebWritable`
|
||||
|
||||
Render and pipe to an existing [Web WritableStream](https://developer.mozilla.org/en-US/docs/Web/API/WritableStream) instance.
|
||||
|
||||
**Signature**
|
||||
|
||||
```ts
|
||||
function pipeToWebWritable(
|
||||
input: App | VNode,
|
||||
context: SSRContext = {},
|
||||
writable: WritableStream
|
||||
): void
|
||||
```
|
||||
|
||||
**Usage**
|
||||
|
||||
This is typically used in combination with [`TransformStream`](https://developer.mozilla.org/en-US/docs/Web/API/TransformStream):
|
||||
|
||||
```js
|
||||
// TransformStream is available in environments such as CloudFlare workers.
|
||||
// in Node.js, TransformStream needs to be explicitly imported from 'stream/web'
|
||||
const { readable, writable } = new TransformStream()
|
||||
pipeToWebWritable(app, {}, writable)
|
||||
|
||||
return new Response(readable)
|
||||
```
|
||||
|
||||
### `renderToSimpleStream`
|
||||
|
||||
Renders input in streaming mode using a simple readable interface.
|
||||
|
||||
**Signature**
|
||||
|
||||
```ts
|
||||
function renderToSimpleStream(
|
||||
input: App | VNode,
|
||||
context: SSRContext,
|
||||
options: SimpleReadable
|
||||
): SimpleReadable
|
||||
|
||||
interface SimpleReadable {
|
||||
push(content: string | null): void
|
||||
destroy(err: any): void
|
||||
}
|
||||
```
|
||||
|
||||
**Usage**
|
||||
|
||||
```js
|
||||
let res = ''
|
||||
|
||||
renderToSimpleStream(
|
||||
app,
|
||||
{},
|
||||
{
|
||||
push(chunk) {
|
||||
if (chunk === null) {
|
||||
// done
|
||||
console(`render complete: ${res}`)
|
||||
} else {
|
||||
res += chunk
|
||||
}
|
||||
},
|
||||
destroy(err) {
|
||||
// error encountered
|
||||
}
|
||||
}
|
||||
)
|
||||
```
|
||||
1023
node_modules/@vue/server-renderer/dist/server-renderer.cjs.js
generated
vendored
Normal file
1023
node_modules/@vue/server-renderer/dist/server-renderer.cjs.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
775
node_modules/@vue/server-renderer/dist/server-renderer.cjs.prod.js
generated
vendored
Normal file
775
node_modules/@vue/server-renderer/dist/server-renderer.cjs.prod.js
generated
vendored
Normal file
@@ -0,0 +1,775 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
var vue = require('vue');
|
||||
var shared = require('@vue/shared');
|
||||
var compilerSsr = require('@vue/compiler-ssr');
|
||||
|
||||
// leading comma for empty string ""
|
||||
const shouldIgnoreProp = shared.makeMap(`,key,ref,innerHTML,textContent,ref_key,ref_for`);
|
||||
function ssrRenderAttrs(props, tag) {
|
||||
let ret = '';
|
||||
for (const key in props) {
|
||||
if (shouldIgnoreProp(key) ||
|
||||
shared.isOn(key) ||
|
||||
(tag === 'textarea' && key === 'value')) {
|
||||
continue;
|
||||
}
|
||||
const value = props[key];
|
||||
if (key === 'class') {
|
||||
ret += ` class="${ssrRenderClass(value)}"`;
|
||||
}
|
||||
else if (key === 'style') {
|
||||
ret += ` style="${ssrRenderStyle(value)}"`;
|
||||
}
|
||||
else {
|
||||
ret += ssrRenderDynamicAttr(key, value, tag);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
// render an attr with dynamic (unknown) key.
|
||||
function ssrRenderDynamicAttr(key, value, tag) {
|
||||
if (!isRenderableValue(value)) {
|
||||
return ``;
|
||||
}
|
||||
const attrKey = tag && tag.indexOf('-') > 0
|
||||
? key // preserve raw name on custom elements
|
||||
: shared.propsToAttrMap[key] || key.toLowerCase();
|
||||
if (shared.isBooleanAttr(attrKey)) {
|
||||
return shared.includeBooleanAttr(value) ? ` ${attrKey}` : ``;
|
||||
}
|
||||
else if (shared.isSSRSafeAttrName(attrKey)) {
|
||||
return value === '' ? ` ${attrKey}` : ` ${attrKey}="${shared.escapeHtml(value)}"`;
|
||||
}
|
||||
else {
|
||||
console.warn(`[@vue/server-renderer] Skipped rendering unsafe attribute name: ${attrKey}`);
|
||||
return ``;
|
||||
}
|
||||
}
|
||||
// Render a v-bind attr with static key. The key is pre-processed at compile
|
||||
// time and we only need to check and escape value.
|
||||
function ssrRenderAttr(key, value) {
|
||||
if (!isRenderableValue(value)) {
|
||||
return ``;
|
||||
}
|
||||
return ` ${key}="${shared.escapeHtml(value)}"`;
|
||||
}
|
||||
function isRenderableValue(value) {
|
||||
if (value == null) {
|
||||
return false;
|
||||
}
|
||||
const type = typeof value;
|
||||
return type === 'string' || type === 'number' || type === 'boolean';
|
||||
}
|
||||
function ssrRenderClass(raw) {
|
||||
return shared.escapeHtml(shared.normalizeClass(raw));
|
||||
}
|
||||
function ssrRenderStyle(raw) {
|
||||
if (!raw) {
|
||||
return '';
|
||||
}
|
||||
if (shared.isString(raw)) {
|
||||
return shared.escapeHtml(raw);
|
||||
}
|
||||
const styles = shared.normalizeStyle(raw);
|
||||
return shared.escapeHtml(shared.stringifyStyle(styles));
|
||||
}
|
||||
|
||||
const compileCache = Object.create(null);
|
||||
function ssrCompile(template, instance) {
|
||||
// TODO: This is copied from runtime-core/src/component.ts and should probably be refactored
|
||||
const Component = instance.type;
|
||||
const { isCustomElement, compilerOptions } = instance.appContext.config;
|
||||
const { delimiters, compilerOptions: componentCompilerOptions } = Component;
|
||||
const finalCompilerOptions = shared.extend(shared.extend({
|
||||
isCustomElement,
|
||||
delimiters
|
||||
}, compilerOptions), componentCompilerOptions);
|
||||
finalCompilerOptions.isCustomElement =
|
||||
finalCompilerOptions.isCustomElement || shared.NO;
|
||||
finalCompilerOptions.isNativeTag = finalCompilerOptions.isNativeTag || shared.NO;
|
||||
const cacheKey = JSON.stringify({
|
||||
template,
|
||||
compilerOptions: finalCompilerOptions
|
||||
}, (key, value) => {
|
||||
return shared.isFunction(value) ? value.toString() : value;
|
||||
});
|
||||
const cached = compileCache[cacheKey];
|
||||
if (cached) {
|
||||
return cached;
|
||||
}
|
||||
finalCompilerOptions.onError = (err) => {
|
||||
{
|
||||
throw err;
|
||||
}
|
||||
};
|
||||
const { code } = compilerSsr.compile(template, finalCompilerOptions);
|
||||
return (compileCache[cacheKey] = Function('require', code)(require));
|
||||
}
|
||||
|
||||
function ssrRenderTeleport(parentPush, contentRenderFn, target, disabled, parentComponent) {
|
||||
parentPush('<!--teleport start-->');
|
||||
const context = parentComponent.appContext.provides[vue.ssrContextKey];
|
||||
const teleportBuffers = context.__teleportBuffers || (context.__teleportBuffers = {});
|
||||
const targetBuffer = teleportBuffers[target] || (teleportBuffers[target] = []);
|
||||
// record current index of the target buffer to handle nested teleports
|
||||
// since the parent needs to be rendered before the child
|
||||
const bufferIndex = targetBuffer.length;
|
||||
let teleportContent;
|
||||
if (disabled) {
|
||||
contentRenderFn(parentPush);
|
||||
teleportContent = `<!--teleport anchor-->`;
|
||||
}
|
||||
else {
|
||||
const { getBuffer, push } = createBuffer();
|
||||
contentRenderFn(push);
|
||||
push(`<!--teleport anchor-->`);
|
||||
teleportContent = getBuffer();
|
||||
}
|
||||
targetBuffer.splice(bufferIndex, 0, teleportContent);
|
||||
parentPush('<!--teleport end-->');
|
||||
}
|
||||
|
||||
const { createComponentInstance, setCurrentRenderingInstance, setupComponent, renderComponentRoot, normalizeVNode } = vue.ssrUtils;
|
||||
// Each component has a buffer array.
|
||||
// A buffer array can contain one of the following:
|
||||
// - plain string
|
||||
// - A resolved buffer (recursive arrays of strings that can be unrolled
|
||||
// synchronously)
|
||||
// - An async buffer (a Promise that resolves to a resolved buffer)
|
||||
function createBuffer() {
|
||||
let appendable = false;
|
||||
const buffer = [];
|
||||
return {
|
||||
getBuffer() {
|
||||
// Return static buffer and await on items during unroll stage
|
||||
return buffer;
|
||||
},
|
||||
push(item) {
|
||||
const isStringItem = shared.isString(item);
|
||||
if (appendable && isStringItem) {
|
||||
buffer[buffer.length - 1] += item;
|
||||
}
|
||||
else {
|
||||
buffer.push(item);
|
||||
}
|
||||
appendable = isStringItem;
|
||||
if (shared.isPromise(item) || (shared.isArray(item) && item.hasAsync)) {
|
||||
// promise, or child buffer with async, mark as async.
|
||||
// this allows skipping unnecessary await ticks during unroll stage
|
||||
buffer.hasAsync = true;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
function renderComponentVNode(vnode, parentComponent = null, slotScopeId) {
|
||||
const instance = createComponentInstance(vnode, parentComponent, null);
|
||||
const res = setupComponent(instance, true /* isSSR */);
|
||||
const hasAsyncSetup = shared.isPromise(res);
|
||||
const prefetches = instance.sp; /* LifecycleHooks.SERVER_PREFETCH */
|
||||
if (hasAsyncSetup || prefetches) {
|
||||
let p = hasAsyncSetup
|
||||
? res
|
||||
: Promise.resolve();
|
||||
if (prefetches) {
|
||||
p = p
|
||||
.then(() => Promise.all(prefetches.map(prefetch => prefetch.call(instance.proxy))))
|
||||
// Note: error display is already done by the wrapped lifecycle hook function.
|
||||
.catch(() => { });
|
||||
}
|
||||
return p.then(() => renderComponentSubTree(instance, slotScopeId));
|
||||
}
|
||||
else {
|
||||
return renderComponentSubTree(instance, slotScopeId);
|
||||
}
|
||||
}
|
||||
function renderComponentSubTree(instance, slotScopeId) {
|
||||
const comp = instance.type;
|
||||
const { getBuffer, push } = createBuffer();
|
||||
if (shared.isFunction(comp)) {
|
||||
let root = renderComponentRoot(instance);
|
||||
// #5817 scope ID attrs not falling through if functional component doesn't
|
||||
// have props
|
||||
if (!comp.props) {
|
||||
for (const key in instance.attrs) {
|
||||
if (key.startsWith(`data-v-`)) {
|
||||
(root.props || (root.props = {}))[key] = ``;
|
||||
}
|
||||
}
|
||||
}
|
||||
renderVNode(push, (instance.subTree = root), instance, slotScopeId);
|
||||
}
|
||||
else {
|
||||
if ((!instance.render || instance.render === shared.NOOP) &&
|
||||
!instance.ssrRender &&
|
||||
!comp.ssrRender &&
|
||||
shared.isString(comp.template)) {
|
||||
comp.ssrRender = ssrCompile(comp.template, instance);
|
||||
}
|
||||
// perf: enable caching of computed getters during render
|
||||
// since there cannot be state mutations during render.
|
||||
for (const e of instance.scope.effects) {
|
||||
if (e.computed)
|
||||
e.computed._cacheable = true;
|
||||
}
|
||||
const ssrRender = instance.ssrRender || comp.ssrRender;
|
||||
if (ssrRender) {
|
||||
// optimized
|
||||
// resolve fallthrough attrs
|
||||
let attrs = instance.inheritAttrs !== false ? instance.attrs : undefined;
|
||||
let hasCloned = false;
|
||||
let cur = instance;
|
||||
while (true) {
|
||||
const scopeId = cur.vnode.scopeId;
|
||||
if (scopeId) {
|
||||
if (!hasCloned) {
|
||||
attrs = { ...attrs };
|
||||
hasCloned = true;
|
||||
}
|
||||
attrs[scopeId] = '';
|
||||
}
|
||||
const parent = cur.parent;
|
||||
if (parent && parent.subTree && parent.subTree === cur.vnode) {
|
||||
// parent is a non-SSR compiled component and is rendering this
|
||||
// component as root. inherit its scopeId if present.
|
||||
cur = parent;
|
||||
}
|
||||
else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (slotScopeId) {
|
||||
if (!hasCloned)
|
||||
attrs = { ...attrs };
|
||||
attrs[slotScopeId.trim()] = '';
|
||||
}
|
||||
// set current rendering instance for asset resolution
|
||||
const prev = setCurrentRenderingInstance(instance);
|
||||
ssrRender(instance.proxy, push, instance, attrs,
|
||||
// compiler-optimized bindings
|
||||
instance.props, instance.setupState, instance.data, instance.ctx);
|
||||
setCurrentRenderingInstance(prev);
|
||||
}
|
||||
else if (instance.render && instance.render !== shared.NOOP) {
|
||||
renderVNode(push, (instance.subTree = renderComponentRoot(instance)), instance, slotScopeId);
|
||||
}
|
||||
else {
|
||||
const componentName = comp.name || comp.__file || `<Anonymous>`;
|
||||
vue.warn(`Component ${componentName} is missing template or render function.`);
|
||||
push(`<!---->`);
|
||||
}
|
||||
}
|
||||
return getBuffer();
|
||||
}
|
||||
function renderVNode(push, vnode, parentComponent, slotScopeId) {
|
||||
const { type, shapeFlag, children } = vnode;
|
||||
switch (type) {
|
||||
case vue.Text:
|
||||
push(shared.escapeHtml(children));
|
||||
break;
|
||||
case vue.Comment:
|
||||
push(children ? `<!--${shared.escapeHtmlComment(children)}-->` : `<!---->`);
|
||||
break;
|
||||
case vue.Static:
|
||||
push(children);
|
||||
break;
|
||||
case vue.Fragment:
|
||||
if (vnode.slotScopeIds) {
|
||||
slotScopeId =
|
||||
(slotScopeId ? slotScopeId + ' ' : '') + vnode.slotScopeIds.join(' ');
|
||||
}
|
||||
push(`<!--[-->`); // open
|
||||
renderVNodeChildren(push, children, parentComponent, slotScopeId);
|
||||
push(`<!--]-->`); // close
|
||||
break;
|
||||
default:
|
||||
if (shapeFlag & 1 /* ELEMENT */) {
|
||||
renderElementVNode(push, vnode, parentComponent, slotScopeId);
|
||||
}
|
||||
else if (shapeFlag & 6 /* COMPONENT */) {
|
||||
push(renderComponentVNode(vnode, parentComponent, slotScopeId));
|
||||
}
|
||||
else if (shapeFlag & 64 /* TELEPORT */) {
|
||||
renderTeleportVNode(push, vnode, parentComponent, slotScopeId);
|
||||
}
|
||||
else if (shapeFlag & 128 /* SUSPENSE */) {
|
||||
renderVNode(push, vnode.ssContent, parentComponent, slotScopeId);
|
||||
}
|
||||
else {
|
||||
vue.warn('[@vue/server-renderer] Invalid VNode type:', type, `(${typeof type})`);
|
||||
}
|
||||
}
|
||||
}
|
||||
function renderVNodeChildren(push, children, parentComponent, slotScopeId) {
|
||||
for (let i = 0; i < children.length; i++) {
|
||||
renderVNode(push, normalizeVNode(children[i]), parentComponent, slotScopeId);
|
||||
}
|
||||
}
|
||||
function renderElementVNode(push, vnode, parentComponent, slotScopeId) {
|
||||
const tag = vnode.type;
|
||||
let { props, children, shapeFlag, scopeId, dirs } = vnode;
|
||||
let openTag = `<${tag}`;
|
||||
if (dirs) {
|
||||
props = applySSRDirectives(vnode, props, dirs);
|
||||
}
|
||||
if (props) {
|
||||
openTag += ssrRenderAttrs(props, tag);
|
||||
}
|
||||
if (scopeId) {
|
||||
openTag += ` ${scopeId}`;
|
||||
}
|
||||
// inherit parent chain scope id if this is the root node
|
||||
let curParent = parentComponent;
|
||||
let curVnode = vnode;
|
||||
while (curParent && curVnode === curParent.subTree) {
|
||||
curVnode = curParent.vnode;
|
||||
if (curVnode.scopeId) {
|
||||
openTag += ` ${curVnode.scopeId}`;
|
||||
}
|
||||
curParent = curParent.parent;
|
||||
}
|
||||
if (slotScopeId) {
|
||||
openTag += ` ${slotScopeId}`;
|
||||
}
|
||||
push(openTag + `>`);
|
||||
if (!shared.isVoidTag(tag)) {
|
||||
let hasChildrenOverride = false;
|
||||
if (props) {
|
||||
if (props.innerHTML) {
|
||||
hasChildrenOverride = true;
|
||||
push(props.innerHTML);
|
||||
}
|
||||
else if (props.textContent) {
|
||||
hasChildrenOverride = true;
|
||||
push(shared.escapeHtml(props.textContent));
|
||||
}
|
||||
else if (tag === 'textarea' && props.value) {
|
||||
hasChildrenOverride = true;
|
||||
push(shared.escapeHtml(props.value));
|
||||
}
|
||||
}
|
||||
if (!hasChildrenOverride) {
|
||||
if (shapeFlag & 8 /* TEXT_CHILDREN */) {
|
||||
push(shared.escapeHtml(children));
|
||||
}
|
||||
else if (shapeFlag & 16 /* ARRAY_CHILDREN */) {
|
||||
renderVNodeChildren(push, children, parentComponent, slotScopeId);
|
||||
}
|
||||
}
|
||||
push(`</${tag}>`);
|
||||
}
|
||||
}
|
||||
function applySSRDirectives(vnode, rawProps, dirs) {
|
||||
const toMerge = [];
|
||||
for (let i = 0; i < dirs.length; i++) {
|
||||
const binding = dirs[i];
|
||||
const { dir: { getSSRProps } } = binding;
|
||||
if (getSSRProps) {
|
||||
const props = getSSRProps(binding, vnode);
|
||||
if (props)
|
||||
toMerge.push(props);
|
||||
}
|
||||
}
|
||||
return vue.mergeProps(rawProps || {}, ...toMerge);
|
||||
}
|
||||
function renderTeleportVNode(push, vnode, parentComponent, slotScopeId) {
|
||||
const target = vnode.props && vnode.props.to;
|
||||
const disabled = vnode.props && vnode.props.disabled;
|
||||
if (!target) {
|
||||
if (!disabled) {
|
||||
vue.warn(`[@vue/server-renderer] Teleport is missing target prop.`);
|
||||
}
|
||||
return [];
|
||||
}
|
||||
if (!shared.isString(target)) {
|
||||
vue.warn(`[@vue/server-renderer] Teleport target must be a query selector string.`);
|
||||
return [];
|
||||
}
|
||||
ssrRenderTeleport(push, push => {
|
||||
renderVNodeChildren(push, vnode.children, parentComponent, slotScopeId);
|
||||
}, target, disabled || disabled === '', parentComponent);
|
||||
}
|
||||
|
||||
const { isVNode } = vue.ssrUtils;
|
||||
async function unrollBuffer(buffer) {
|
||||
if (buffer.hasAsync) {
|
||||
let ret = '';
|
||||
for (let i = 0; i < buffer.length; i++) {
|
||||
let item = buffer[i];
|
||||
if (shared.isPromise(item)) {
|
||||
item = await item;
|
||||
}
|
||||
if (shared.isString(item)) {
|
||||
ret += item;
|
||||
}
|
||||
else {
|
||||
ret += await unrollBuffer(item);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
else {
|
||||
// sync buffer can be more efficiently unrolled without unnecessary await
|
||||
// ticks
|
||||
return unrollBufferSync(buffer);
|
||||
}
|
||||
}
|
||||
function unrollBufferSync(buffer) {
|
||||
let ret = '';
|
||||
for (let i = 0; i < buffer.length; i++) {
|
||||
let item = buffer[i];
|
||||
if (shared.isString(item)) {
|
||||
ret += item;
|
||||
}
|
||||
else {
|
||||
// since this is a sync buffer, child buffers are never promises
|
||||
ret += unrollBufferSync(item);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
async function renderToString(input, context = {}) {
|
||||
if (isVNode(input)) {
|
||||
// raw vnode, wrap with app (for context)
|
||||
return renderToString(vue.createApp({ render: () => input }), context);
|
||||
}
|
||||
// rendering an app
|
||||
const vnode = vue.createVNode(input._component, input._props);
|
||||
vnode.appContext = input._context;
|
||||
// provide the ssr context to the tree
|
||||
input.provide(vue.ssrContextKey, context);
|
||||
const buffer = await renderComponentVNode(vnode);
|
||||
const result = await unrollBuffer(buffer);
|
||||
await resolveTeleports(context);
|
||||
return result;
|
||||
}
|
||||
async function resolveTeleports(context) {
|
||||
if (context.__teleportBuffers) {
|
||||
context.teleports = context.teleports || {};
|
||||
for (const key in context.__teleportBuffers) {
|
||||
// note: it's OK to await sequentially here because the Promises were
|
||||
// created eagerly in parallel.
|
||||
context.teleports[key] = await unrollBuffer((await Promise.all(context.__teleportBuffers[key])));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const { isVNode: isVNode$1 } = vue.ssrUtils;
|
||||
async function unrollBuffer$1(buffer, stream) {
|
||||
if (buffer.hasAsync) {
|
||||
for (let i = 0; i < buffer.length; i++) {
|
||||
let item = buffer[i];
|
||||
if (shared.isPromise(item)) {
|
||||
item = await item;
|
||||
}
|
||||
if (shared.isString(item)) {
|
||||
stream.push(item);
|
||||
}
|
||||
else {
|
||||
await unrollBuffer$1(item, stream);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
// sync buffer can be more efficiently unrolled without unnecessary await
|
||||
// ticks
|
||||
unrollBufferSync$1(buffer, stream);
|
||||
}
|
||||
}
|
||||
function unrollBufferSync$1(buffer, stream) {
|
||||
for (let i = 0; i < buffer.length; i++) {
|
||||
let item = buffer[i];
|
||||
if (shared.isString(item)) {
|
||||
stream.push(item);
|
||||
}
|
||||
else {
|
||||
// since this is a sync buffer, child buffers are never promises
|
||||
unrollBufferSync$1(item, stream);
|
||||
}
|
||||
}
|
||||
}
|
||||
function renderToSimpleStream(input, context, stream) {
|
||||
if (isVNode$1(input)) {
|
||||
// raw vnode, wrap with app (for context)
|
||||
return renderToSimpleStream(vue.createApp({ render: () => input }), context, stream);
|
||||
}
|
||||
// rendering an app
|
||||
const vnode = vue.createVNode(input._component, input._props);
|
||||
vnode.appContext = input._context;
|
||||
// provide the ssr context to the tree
|
||||
input.provide(vue.ssrContextKey, context);
|
||||
Promise.resolve(renderComponentVNode(vnode))
|
||||
.then(buffer => unrollBuffer$1(buffer, stream))
|
||||
.then(() => resolveTeleports(context))
|
||||
.then(() => stream.push(null))
|
||||
.catch(error => {
|
||||
stream.destroy(error);
|
||||
});
|
||||
return stream;
|
||||
}
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
function renderToStream(input, context = {}) {
|
||||
console.warn(`[@vue/server-renderer] renderToStream is deprecated - use renderToNodeStream instead.`);
|
||||
return renderToNodeStream(input, context);
|
||||
}
|
||||
function renderToNodeStream(input, context = {}) {
|
||||
const stream = new (require('stream').Readable)({ read() { } })
|
||||
;
|
||||
if (!stream) {
|
||||
throw new Error(`ESM build of renderToStream() does not support renderToNodeStream(). ` +
|
||||
`Use pipeToNodeWritable() with an existing Node.js Writable stream ` +
|
||||
`instance instead.`);
|
||||
}
|
||||
return renderToSimpleStream(input, context, stream);
|
||||
}
|
||||
function pipeToNodeWritable(input, context = {}, writable) {
|
||||
renderToSimpleStream(input, context, {
|
||||
push(content) {
|
||||
if (content != null) {
|
||||
writable.write(content);
|
||||
}
|
||||
else {
|
||||
writable.end();
|
||||
}
|
||||
},
|
||||
destroy(err) {
|
||||
writable.destroy(err);
|
||||
}
|
||||
});
|
||||
}
|
||||
function renderToWebStream(input, context = {}) {
|
||||
if (typeof ReadableStream !== 'function') {
|
||||
throw new Error(`ReadableStream constructor is not available in the global scope. ` +
|
||||
`If the target environment does support web streams, consider using ` +
|
||||
`pipeToWebWritable() with an existing WritableStream instance instead.`);
|
||||
}
|
||||
const encoder = new TextEncoder();
|
||||
let cancelled = false;
|
||||
return new ReadableStream({
|
||||
start(controller) {
|
||||
renderToSimpleStream(input, context, {
|
||||
push(content) {
|
||||
if (cancelled)
|
||||
return;
|
||||
if (content != null) {
|
||||
controller.enqueue(encoder.encode(content));
|
||||
}
|
||||
else {
|
||||
controller.close();
|
||||
}
|
||||
},
|
||||
destroy(err) {
|
||||
controller.error(err);
|
||||
}
|
||||
});
|
||||
},
|
||||
cancel() {
|
||||
cancelled = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
function pipeToWebWritable(input, context = {}, writable) {
|
||||
const writer = writable.getWriter();
|
||||
const encoder = new TextEncoder();
|
||||
// #4287 CloudFlare workers do not implement `ready` property
|
||||
let hasReady = false;
|
||||
try {
|
||||
hasReady = shared.isPromise(writer.ready);
|
||||
}
|
||||
catch (e) { }
|
||||
renderToSimpleStream(input, context, {
|
||||
async push(content) {
|
||||
if (hasReady) {
|
||||
await writer.ready;
|
||||
}
|
||||
if (content != null) {
|
||||
return writer.write(encoder.encode(content));
|
||||
}
|
||||
else {
|
||||
return writer.close();
|
||||
}
|
||||
},
|
||||
destroy(err) {
|
||||
// TODO better error handling?
|
||||
console.log(err);
|
||||
writer.close();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function ssrRenderComponent(comp, props = null, children = null, parentComponent = null, slotScopeId) {
|
||||
return renderComponentVNode(vue.createVNode(comp, props, children), parentComponent, slotScopeId);
|
||||
}
|
||||
|
||||
function ssrRenderSlot(slots, slotName, slotProps, fallbackRenderFn, push, parentComponent, slotScopeId) {
|
||||
// template-compiled slots are always rendered as fragments
|
||||
push(`<!--[-->`);
|
||||
ssrRenderSlotInner(slots, slotName, slotProps, fallbackRenderFn, push, parentComponent, slotScopeId);
|
||||
push(`<!--]-->`);
|
||||
}
|
||||
function ssrRenderSlotInner(slots, slotName, slotProps, fallbackRenderFn, push, parentComponent, slotScopeId) {
|
||||
const slotFn = slots[slotName];
|
||||
if (slotFn) {
|
||||
const slotBuffer = [];
|
||||
const bufferedPush = (item) => {
|
||||
slotBuffer.push(item);
|
||||
};
|
||||
const ret = slotFn(slotProps, bufferedPush, parentComponent, slotScopeId ? ' ' + slotScopeId : '');
|
||||
if (shared.isArray(ret)) {
|
||||
// normal slot
|
||||
renderVNodeChildren(push, ret, parentComponent, slotScopeId);
|
||||
}
|
||||
else {
|
||||
// ssr slot.
|
||||
// check if the slot renders all comments, in which case use the fallback
|
||||
let isEmptySlot = true;
|
||||
for (let i = 0; i < slotBuffer.length; i++) {
|
||||
if (!isComment(slotBuffer[i])) {
|
||||
isEmptySlot = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (isEmptySlot) {
|
||||
if (fallbackRenderFn) {
|
||||
fallbackRenderFn();
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (let i = 0; i < slotBuffer.length; i++) {
|
||||
push(slotBuffer[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (fallbackRenderFn) {
|
||||
fallbackRenderFn();
|
||||
}
|
||||
}
|
||||
const commentRE = /<!--[^]*?-->/gm;
|
||||
function isComment(item) {
|
||||
return (typeof item === 'string' &&
|
||||
commentRE.test(item) &&
|
||||
!item.replace(commentRE, '').trim());
|
||||
}
|
||||
|
||||
function ssrInterpolate(value) {
|
||||
return shared.escapeHtml(shared.toDisplayString(value));
|
||||
}
|
||||
|
||||
function ssrRenderList(source, renderItem) {
|
||||
if (shared.isArray(source) || shared.isString(source)) {
|
||||
for (let i = 0, l = source.length; i < l; i++) {
|
||||
renderItem(source[i], i);
|
||||
}
|
||||
}
|
||||
else if (typeof source === 'number') {
|
||||
for (let i = 0; i < source; i++) {
|
||||
renderItem(i + 1, i);
|
||||
}
|
||||
}
|
||||
else if (shared.isObject(source)) {
|
||||
if (source[Symbol.iterator]) {
|
||||
const arr = Array.from(source);
|
||||
for (let i = 0, l = arr.length; i < l; i++) {
|
||||
renderItem(arr[i], i);
|
||||
}
|
||||
}
|
||||
else {
|
||||
const keys = Object.keys(source);
|
||||
for (let i = 0, l = keys.length; i < l; i++) {
|
||||
const key = keys[i];
|
||||
renderItem(source[key], key, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function ssrRenderSuspense(push, { default: renderContent }) {
|
||||
if (renderContent) {
|
||||
renderContent();
|
||||
}
|
||||
else {
|
||||
push(`<!---->`);
|
||||
}
|
||||
}
|
||||
|
||||
function ssrGetDirectiveProps(instance, dir, value, arg, modifiers = {}) {
|
||||
if (typeof dir !== 'function' && dir.getSSRProps) {
|
||||
return (dir.getSSRProps({
|
||||
dir,
|
||||
instance,
|
||||
value,
|
||||
oldValue: undefined,
|
||||
arg,
|
||||
modifiers
|
||||
}, null) || {});
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
const ssrLooseEqual = shared.looseEqual;
|
||||
function ssrLooseContain(arr, value) {
|
||||
return shared.looseIndexOf(arr, value) > -1;
|
||||
}
|
||||
// for <input :type="type" v-model="model" value="value">
|
||||
function ssrRenderDynamicModel(type, model, value) {
|
||||
switch (type) {
|
||||
case 'radio':
|
||||
return shared.looseEqual(model, value) ? ' checked' : '';
|
||||
case 'checkbox':
|
||||
return (shared.isArray(model) ? ssrLooseContain(model, value) : model)
|
||||
? ' checked'
|
||||
: '';
|
||||
default:
|
||||
// text types
|
||||
return ssrRenderAttr('value', model);
|
||||
}
|
||||
}
|
||||
// for <input v-bind="obj" v-model="model">
|
||||
function ssrGetDynamicModelProps(existingProps = {}, model) {
|
||||
const { type, value } = existingProps;
|
||||
switch (type) {
|
||||
case 'radio':
|
||||
return shared.looseEqual(model, value) ? { checked: true } : null;
|
||||
case 'checkbox':
|
||||
return (shared.isArray(model) ? ssrLooseContain(model, value) : model)
|
||||
? { checked: true }
|
||||
: null;
|
||||
default:
|
||||
// text types
|
||||
return { value: model };
|
||||
}
|
||||
}
|
||||
|
||||
vue.initDirectivesForSSR();
|
||||
|
||||
exports.ssrIncludeBooleanAttr = shared.includeBooleanAttr;
|
||||
exports.pipeToNodeWritable = pipeToNodeWritable;
|
||||
exports.pipeToWebWritable = pipeToWebWritable;
|
||||
exports.renderToNodeStream = renderToNodeStream;
|
||||
exports.renderToSimpleStream = renderToSimpleStream;
|
||||
exports.renderToStream = renderToStream;
|
||||
exports.renderToString = renderToString;
|
||||
exports.renderToWebStream = renderToWebStream;
|
||||
exports.ssrGetDirectiveProps = ssrGetDirectiveProps;
|
||||
exports.ssrGetDynamicModelProps = ssrGetDynamicModelProps;
|
||||
exports.ssrInterpolate = ssrInterpolate;
|
||||
exports.ssrLooseContain = ssrLooseContain;
|
||||
exports.ssrLooseEqual = ssrLooseEqual;
|
||||
exports.ssrRenderAttr = ssrRenderAttr;
|
||||
exports.ssrRenderAttrs = ssrRenderAttrs;
|
||||
exports.ssrRenderClass = ssrRenderClass;
|
||||
exports.ssrRenderComponent = ssrRenderComponent;
|
||||
exports.ssrRenderDynamicAttr = ssrRenderDynamicAttr;
|
||||
exports.ssrRenderDynamicModel = ssrRenderDynamicModel;
|
||||
exports.ssrRenderList = ssrRenderList;
|
||||
exports.ssrRenderSlot = ssrRenderSlot;
|
||||
exports.ssrRenderSlotInner = ssrRenderSlotInner;
|
||||
exports.ssrRenderStyle = ssrRenderStyle;
|
||||
exports.ssrRenderSuspense = ssrRenderSuspense;
|
||||
exports.ssrRenderTeleport = ssrRenderTeleport;
|
||||
exports.ssrRenderVNode = renderVNode;
|
||||
100
node_modules/@vue/server-renderer/dist/server-renderer.d.ts
generated
vendored
Normal file
100
node_modules/@vue/server-renderer/dist/server-renderer.d.ts
generated
vendored
Normal file
@@ -0,0 +1,100 @@
|
||||
/// <reference types="node" />
|
||||
|
||||
import { App } from 'vue';
|
||||
import { Component } from 'vue';
|
||||
import { ComponentInternalInstance } from 'vue';
|
||||
import { ComponentPublicInstance } from '@vue/runtime-core';
|
||||
import { Directive } from '@vue/runtime-core';
|
||||
import { Readable } from 'stream';
|
||||
import { Slots } from 'vue';
|
||||
import { includeBooleanAttr as ssrIncludeBooleanAttr } from '@vue/shared';
|
||||
import { VNode } from 'vue';
|
||||
import { Writable } from 'stream';
|
||||
|
||||
export declare function pipeToNodeWritable(input: App | VNode, context: SSRContext | undefined, writable: Writable): void;
|
||||
|
||||
export declare function pipeToWebWritable(input: App | VNode, context: SSRContext | undefined, writable: WritableStream): void;
|
||||
|
||||
declare type Props = Record<string, unknown>;
|
||||
|
||||
declare type PushFn = (item: SSRBufferItem) => void;
|
||||
|
||||
export declare function renderToNodeStream(input: App | VNode, context?: SSRContext): Readable;
|
||||
|
||||
export declare function renderToSimpleStream<T extends SimpleReadable>(input: App | VNode, context: SSRContext, stream: T): T;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
export declare function renderToStream(input: App | VNode, context?: SSRContext): Readable;
|
||||
|
||||
export declare function renderToString(input: App | VNode, context?: SSRContext): Promise<string>;
|
||||
|
||||
export declare function renderToWebStream(input: App | VNode, context?: SSRContext): ReadableStream;
|
||||
|
||||
export declare interface SimpleReadable {
|
||||
push(chunk: string | null): void;
|
||||
destroy(err: any): void;
|
||||
}
|
||||
|
||||
declare type SSRBuffer = SSRBufferItem[] & {
|
||||
hasAsync?: boolean;
|
||||
};
|
||||
|
||||
declare type SSRBufferItem = string | SSRBuffer | Promise<SSRBuffer>;
|
||||
|
||||
export declare type SSRContext = {
|
||||
[key: string]: any;
|
||||
teleports?: Record<string, string>;
|
||||
__teleportBuffers?: Record<string, SSRBuffer>;
|
||||
};
|
||||
|
||||
export declare function ssrGetDirectiveProps(instance: ComponentPublicInstance, dir: Directive, value?: any, arg?: string, modifiers?: Record<string, boolean>): Record<string, any>;
|
||||
|
||||
export declare function ssrGetDynamicModelProps(existingProps: any, model: unknown): {
|
||||
checked: boolean;
|
||||
value?: undefined;
|
||||
} | {
|
||||
value: unknown;
|
||||
checked?: undefined;
|
||||
} | null;
|
||||
|
||||
export { ssrIncludeBooleanAttr }
|
||||
|
||||
export declare function ssrInterpolate(value: unknown): string;
|
||||
|
||||
export declare function ssrLooseContain(arr: unknown[], value: unknown): boolean;
|
||||
|
||||
export declare const ssrLooseEqual: (a: unknown, b: unknown) => boolean;
|
||||
|
||||
export declare function ssrRenderAttr(key: string, value: unknown): string;
|
||||
|
||||
export declare function ssrRenderAttrs(props: Record<string, unknown>, tag?: string): string;
|
||||
|
||||
export declare function ssrRenderClass(raw: unknown): string;
|
||||
|
||||
export declare function ssrRenderComponent(comp: Component, props?: Props | null, children?: Slots | SSRSlots | null, parentComponent?: ComponentInternalInstance | null, slotScopeId?: string): SSRBuffer | Promise<SSRBuffer>;
|
||||
|
||||
export declare function ssrRenderDynamicAttr(key: string, value: unknown, tag?: string): string;
|
||||
|
||||
export declare function ssrRenderDynamicModel(type: unknown, model: unknown, value: unknown): string;
|
||||
|
||||
export declare function ssrRenderList(source: unknown, renderItem: (value: unknown, key: string | number, index?: number) => void): void;
|
||||
|
||||
export declare function ssrRenderSlot(slots: Slots | SSRSlots, slotName: string, slotProps: Props, fallbackRenderFn: (() => void) | null, push: PushFn, parentComponent: ComponentInternalInstance, slotScopeId?: string): void;
|
||||
|
||||
export declare function ssrRenderSlotInner(slots: Slots | SSRSlots, slotName: string, slotProps: Props, fallbackRenderFn: (() => void) | null, push: PushFn, parentComponent: ComponentInternalInstance, slotScopeId?: string): void;
|
||||
|
||||
export declare function ssrRenderStyle(raw: unknown): string;
|
||||
|
||||
export declare function ssrRenderSuspense(push: PushFn, { default: renderContent }: Record<string, (() => void) | undefined>): Promise<void>;
|
||||
|
||||
export declare function ssrRenderTeleport(parentPush: PushFn, contentRenderFn: (push: PushFn) => void, target: string, disabled: boolean, parentComponent: ComponentInternalInstance): void;
|
||||
|
||||
export declare function ssrRenderVNode(push: PushFn, vnode: VNode, parentComponent: ComponentInternalInstance, slotScopeId?: string): void;
|
||||
|
||||
declare type SSRSlot = (props: Props, push: PushFn, parentComponent: ComponentInternalInstance | null, scopeId: string | null) => void;
|
||||
|
||||
declare type SSRSlots = Record<string, SSRSlot>;
|
||||
|
||||
export { }
|
||||
969
node_modules/@vue/server-renderer/dist/server-renderer.esm-bundler.js
generated
vendored
Normal file
969
node_modules/@vue/server-renderer/dist/server-renderer.esm-bundler.js
generated
vendored
Normal file
@@ -0,0 +1,969 @@
|
||||
import { ssrContextKey, warn as warn$1, Fragment, Static, Comment, Text, mergeProps, ssrUtils, createApp, createVNode, initDirectivesForSSR } from 'vue';
|
||||
import { makeMap, isOn, escapeHtml, normalizeClass, propsToAttrMap, isBooleanAttr, includeBooleanAttr, isSSRSafeAttrName, isString, normalizeStyle, stringifyStyle, escapeHtmlComment, isVoidTag, isPromise, isArray, isFunction, NOOP, toDisplayString, isObject, looseEqual, looseIndexOf } from '@vue/shared';
|
||||
export { includeBooleanAttr as ssrIncludeBooleanAttr } from '@vue/shared';
|
||||
|
||||
// leading comma for empty string ""
|
||||
const shouldIgnoreProp = makeMap(`,key,ref,innerHTML,textContent,ref_key,ref_for`);
|
||||
function ssrRenderAttrs(props, tag) {
|
||||
let ret = '';
|
||||
for (const key in props) {
|
||||
if (shouldIgnoreProp(key) ||
|
||||
isOn(key) ||
|
||||
(tag === 'textarea' && key === 'value')) {
|
||||
continue;
|
||||
}
|
||||
const value = props[key];
|
||||
if (key === 'class') {
|
||||
ret += ` class="${ssrRenderClass(value)}"`;
|
||||
}
|
||||
else if (key === 'style') {
|
||||
ret += ` style="${ssrRenderStyle(value)}"`;
|
||||
}
|
||||
else {
|
||||
ret += ssrRenderDynamicAttr(key, value, tag);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
// render an attr with dynamic (unknown) key.
|
||||
function ssrRenderDynamicAttr(key, value, tag) {
|
||||
if (!isRenderableValue(value)) {
|
||||
return ``;
|
||||
}
|
||||
const attrKey = tag && tag.indexOf('-') > 0
|
||||
? key // preserve raw name on custom elements
|
||||
: propsToAttrMap[key] || key.toLowerCase();
|
||||
if (isBooleanAttr(attrKey)) {
|
||||
return includeBooleanAttr(value) ? ` ${attrKey}` : ``;
|
||||
}
|
||||
else if (isSSRSafeAttrName(attrKey)) {
|
||||
return value === '' ? ` ${attrKey}` : ` ${attrKey}="${escapeHtml(value)}"`;
|
||||
}
|
||||
else {
|
||||
console.warn(`[@vue/server-renderer] Skipped rendering unsafe attribute name: ${attrKey}`);
|
||||
return ``;
|
||||
}
|
||||
}
|
||||
// Render a v-bind attr with static key. The key is pre-processed at compile
|
||||
// time and we only need to check and escape value.
|
||||
function ssrRenderAttr(key, value) {
|
||||
if (!isRenderableValue(value)) {
|
||||
return ``;
|
||||
}
|
||||
return ` ${key}="${escapeHtml(value)}"`;
|
||||
}
|
||||
function isRenderableValue(value) {
|
||||
if (value == null) {
|
||||
return false;
|
||||
}
|
||||
const type = typeof value;
|
||||
return type === 'string' || type === 'number' || type === 'boolean';
|
||||
}
|
||||
function ssrRenderClass(raw) {
|
||||
return escapeHtml(normalizeClass(raw));
|
||||
}
|
||||
function ssrRenderStyle(raw) {
|
||||
if (!raw) {
|
||||
return '';
|
||||
}
|
||||
if (isString(raw)) {
|
||||
return escapeHtml(raw);
|
||||
}
|
||||
const styles = normalizeStyle(raw);
|
||||
return escapeHtml(stringifyStyle(styles));
|
||||
}
|
||||
|
||||
function ssrCompile(template, instance) {
|
||||
{
|
||||
throw new Error(`On-the-fly template compilation is not supported in the ESM build of ` +
|
||||
`@vue/server-renderer. All templates must be pre-compiled into ` +
|
||||
`render functions.`);
|
||||
}
|
||||
}
|
||||
|
||||
function ssrRenderTeleport(parentPush, contentRenderFn, target, disabled, parentComponent) {
|
||||
parentPush('<!--teleport start-->');
|
||||
const context = parentComponent.appContext.provides[ssrContextKey];
|
||||
const teleportBuffers = context.__teleportBuffers || (context.__teleportBuffers = {});
|
||||
const targetBuffer = teleportBuffers[target] || (teleportBuffers[target] = []);
|
||||
// record current index of the target buffer to handle nested teleports
|
||||
// since the parent needs to be rendered before the child
|
||||
const bufferIndex = targetBuffer.length;
|
||||
let teleportContent;
|
||||
if (disabled) {
|
||||
contentRenderFn(parentPush);
|
||||
teleportContent = `<!--teleport anchor-->`;
|
||||
}
|
||||
else {
|
||||
const { getBuffer, push } = createBuffer();
|
||||
contentRenderFn(push);
|
||||
push(`<!--teleport anchor-->`);
|
||||
teleportContent = getBuffer();
|
||||
}
|
||||
targetBuffer.splice(bufferIndex, 0, teleportContent);
|
||||
parentPush('<!--teleport end-->');
|
||||
}
|
||||
|
||||
const { createComponentInstance, setCurrentRenderingInstance, setupComponent, renderComponentRoot, normalizeVNode } = ssrUtils;
|
||||
// Each component has a buffer array.
|
||||
// A buffer array can contain one of the following:
|
||||
// - plain string
|
||||
// - A resolved buffer (recursive arrays of strings that can be unrolled
|
||||
// synchronously)
|
||||
// - An async buffer (a Promise that resolves to a resolved buffer)
|
||||
function createBuffer() {
|
||||
let appendable = false;
|
||||
const buffer = [];
|
||||
return {
|
||||
getBuffer() {
|
||||
// Return static buffer and await on items during unroll stage
|
||||
return buffer;
|
||||
},
|
||||
push(item) {
|
||||
const isStringItem = isString(item);
|
||||
if (appendable && isStringItem) {
|
||||
buffer[buffer.length - 1] += item;
|
||||
}
|
||||
else {
|
||||
buffer.push(item);
|
||||
}
|
||||
appendable = isStringItem;
|
||||
if (isPromise(item) || (isArray(item) && item.hasAsync)) {
|
||||
// promise, or child buffer with async, mark as async.
|
||||
// this allows skipping unnecessary await ticks during unroll stage
|
||||
buffer.hasAsync = true;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
function renderComponentVNode(vnode, parentComponent = null, slotScopeId) {
|
||||
const instance = createComponentInstance(vnode, parentComponent, null);
|
||||
const res = setupComponent(instance, true /* isSSR */);
|
||||
const hasAsyncSetup = isPromise(res);
|
||||
const prefetches = instance.sp; /* LifecycleHooks.SERVER_PREFETCH */
|
||||
if (hasAsyncSetup || prefetches) {
|
||||
let p = hasAsyncSetup
|
||||
? res
|
||||
: Promise.resolve();
|
||||
if (prefetches) {
|
||||
p = p
|
||||
.then(() => Promise.all(prefetches.map(prefetch => prefetch.call(instance.proxy))))
|
||||
// Note: error display is already done by the wrapped lifecycle hook function.
|
||||
.catch(() => { });
|
||||
}
|
||||
return p.then(() => renderComponentSubTree(instance, slotScopeId));
|
||||
}
|
||||
else {
|
||||
return renderComponentSubTree(instance, slotScopeId);
|
||||
}
|
||||
}
|
||||
function renderComponentSubTree(instance, slotScopeId) {
|
||||
const comp = instance.type;
|
||||
const { getBuffer, push } = createBuffer();
|
||||
if (isFunction(comp)) {
|
||||
let root = renderComponentRoot(instance);
|
||||
// #5817 scope ID attrs not falling through if functional component doesn't
|
||||
// have props
|
||||
if (!comp.props) {
|
||||
for (const key in instance.attrs) {
|
||||
if (key.startsWith(`data-v-`)) {
|
||||
(root.props || (root.props = {}))[key] = ``;
|
||||
}
|
||||
}
|
||||
}
|
||||
renderVNode(push, (instance.subTree = root), instance, slotScopeId);
|
||||
}
|
||||
else {
|
||||
if ((!instance.render || instance.render === NOOP) &&
|
||||
!instance.ssrRender &&
|
||||
!comp.ssrRender &&
|
||||
isString(comp.template)) {
|
||||
comp.ssrRender = ssrCompile(comp.template);
|
||||
}
|
||||
// perf: enable caching of computed getters during render
|
||||
// since there cannot be state mutations during render.
|
||||
for (const e of instance.scope.effects) {
|
||||
if (e.computed)
|
||||
e.computed._cacheable = true;
|
||||
}
|
||||
const ssrRender = instance.ssrRender || comp.ssrRender;
|
||||
if (ssrRender) {
|
||||
// optimized
|
||||
// resolve fallthrough attrs
|
||||
let attrs = instance.inheritAttrs !== false ? instance.attrs : undefined;
|
||||
let hasCloned = false;
|
||||
let cur = instance;
|
||||
while (true) {
|
||||
const scopeId = cur.vnode.scopeId;
|
||||
if (scopeId) {
|
||||
if (!hasCloned) {
|
||||
attrs = { ...attrs };
|
||||
hasCloned = true;
|
||||
}
|
||||
attrs[scopeId] = '';
|
||||
}
|
||||
const parent = cur.parent;
|
||||
if (parent && parent.subTree && parent.subTree === cur.vnode) {
|
||||
// parent is a non-SSR compiled component and is rendering this
|
||||
// component as root. inherit its scopeId if present.
|
||||
cur = parent;
|
||||
}
|
||||
else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (slotScopeId) {
|
||||
if (!hasCloned)
|
||||
attrs = { ...attrs };
|
||||
attrs[slotScopeId.trim()] = '';
|
||||
}
|
||||
// set current rendering instance for asset resolution
|
||||
const prev = setCurrentRenderingInstance(instance);
|
||||
ssrRender(instance.proxy, push, instance, attrs,
|
||||
// compiler-optimized bindings
|
||||
instance.props, instance.setupState, instance.data, instance.ctx);
|
||||
setCurrentRenderingInstance(prev);
|
||||
}
|
||||
else if (instance.render && instance.render !== NOOP) {
|
||||
renderVNode(push, (instance.subTree = renderComponentRoot(instance)), instance, slotScopeId);
|
||||
}
|
||||
else {
|
||||
const componentName = comp.name || comp.__file || `<Anonymous>`;
|
||||
warn$1(`Component ${componentName} is missing template or render function.`);
|
||||
push(`<!---->`);
|
||||
}
|
||||
}
|
||||
return getBuffer();
|
||||
}
|
||||
function renderVNode(push, vnode, parentComponent, slotScopeId) {
|
||||
const { type, shapeFlag, children } = vnode;
|
||||
switch (type) {
|
||||
case Text:
|
||||
push(escapeHtml(children));
|
||||
break;
|
||||
case Comment:
|
||||
push(children ? `<!--${escapeHtmlComment(children)}-->` : `<!---->`);
|
||||
break;
|
||||
case Static:
|
||||
push(children);
|
||||
break;
|
||||
case Fragment:
|
||||
if (vnode.slotScopeIds) {
|
||||
slotScopeId =
|
||||
(slotScopeId ? slotScopeId + ' ' : '') + vnode.slotScopeIds.join(' ');
|
||||
}
|
||||
push(`<!--[-->`); // open
|
||||
renderVNodeChildren(push, children, parentComponent, slotScopeId);
|
||||
push(`<!--]-->`); // close
|
||||
break;
|
||||
default:
|
||||
if (shapeFlag & 1 /* ELEMENT */) {
|
||||
renderElementVNode(push, vnode, parentComponent, slotScopeId);
|
||||
}
|
||||
else if (shapeFlag & 6 /* COMPONENT */) {
|
||||
push(renderComponentVNode(vnode, parentComponent, slotScopeId));
|
||||
}
|
||||
else if (shapeFlag & 64 /* TELEPORT */) {
|
||||
renderTeleportVNode(push, vnode, parentComponent, slotScopeId);
|
||||
}
|
||||
else if (shapeFlag & 128 /* SUSPENSE */) {
|
||||
renderVNode(push, vnode.ssContent, parentComponent, slotScopeId);
|
||||
}
|
||||
else {
|
||||
warn$1('[@vue/server-renderer] Invalid VNode type:', type, `(${typeof type})`);
|
||||
}
|
||||
}
|
||||
}
|
||||
function renderVNodeChildren(push, children, parentComponent, slotScopeId) {
|
||||
for (let i = 0; i < children.length; i++) {
|
||||
renderVNode(push, normalizeVNode(children[i]), parentComponent, slotScopeId);
|
||||
}
|
||||
}
|
||||
function renderElementVNode(push, vnode, parentComponent, slotScopeId) {
|
||||
const tag = vnode.type;
|
||||
let { props, children, shapeFlag, scopeId, dirs } = vnode;
|
||||
let openTag = `<${tag}`;
|
||||
if (dirs) {
|
||||
props = applySSRDirectives(vnode, props, dirs);
|
||||
}
|
||||
if (props) {
|
||||
openTag += ssrRenderAttrs(props, tag);
|
||||
}
|
||||
if (scopeId) {
|
||||
openTag += ` ${scopeId}`;
|
||||
}
|
||||
// inherit parent chain scope id if this is the root node
|
||||
let curParent = parentComponent;
|
||||
let curVnode = vnode;
|
||||
while (curParent && curVnode === curParent.subTree) {
|
||||
curVnode = curParent.vnode;
|
||||
if (curVnode.scopeId) {
|
||||
openTag += ` ${curVnode.scopeId}`;
|
||||
}
|
||||
curParent = curParent.parent;
|
||||
}
|
||||
if (slotScopeId) {
|
||||
openTag += ` ${slotScopeId}`;
|
||||
}
|
||||
push(openTag + `>`);
|
||||
if (!isVoidTag(tag)) {
|
||||
let hasChildrenOverride = false;
|
||||
if (props) {
|
||||
if (props.innerHTML) {
|
||||
hasChildrenOverride = true;
|
||||
push(props.innerHTML);
|
||||
}
|
||||
else if (props.textContent) {
|
||||
hasChildrenOverride = true;
|
||||
push(escapeHtml(props.textContent));
|
||||
}
|
||||
else if (tag === 'textarea' && props.value) {
|
||||
hasChildrenOverride = true;
|
||||
push(escapeHtml(props.value));
|
||||
}
|
||||
}
|
||||
if (!hasChildrenOverride) {
|
||||
if (shapeFlag & 8 /* TEXT_CHILDREN */) {
|
||||
push(escapeHtml(children));
|
||||
}
|
||||
else if (shapeFlag & 16 /* ARRAY_CHILDREN */) {
|
||||
renderVNodeChildren(push, children, parentComponent, slotScopeId);
|
||||
}
|
||||
}
|
||||
push(`</${tag}>`);
|
||||
}
|
||||
}
|
||||
function applySSRDirectives(vnode, rawProps, dirs) {
|
||||
const toMerge = [];
|
||||
for (let i = 0; i < dirs.length; i++) {
|
||||
const binding = dirs[i];
|
||||
const { dir: { getSSRProps } } = binding;
|
||||
if (getSSRProps) {
|
||||
const props = getSSRProps(binding, vnode);
|
||||
if (props)
|
||||
toMerge.push(props);
|
||||
}
|
||||
}
|
||||
return mergeProps(rawProps || {}, ...toMerge);
|
||||
}
|
||||
function renderTeleportVNode(push, vnode, parentComponent, slotScopeId) {
|
||||
const target = vnode.props && vnode.props.to;
|
||||
const disabled = vnode.props && vnode.props.disabled;
|
||||
if (!target) {
|
||||
if (!disabled) {
|
||||
warn$1(`[@vue/server-renderer] Teleport is missing target prop.`);
|
||||
}
|
||||
return [];
|
||||
}
|
||||
if (!isString(target)) {
|
||||
warn$1(`[@vue/server-renderer] Teleport target must be a query selector string.`);
|
||||
return [];
|
||||
}
|
||||
ssrRenderTeleport(push, push => {
|
||||
renderVNodeChildren(push, vnode.children, parentComponent, slotScopeId);
|
||||
}, target, disabled || disabled === '', parentComponent);
|
||||
}
|
||||
|
||||
const { isVNode } = ssrUtils;
|
||||
async function unrollBuffer(buffer) {
|
||||
if (buffer.hasAsync) {
|
||||
let ret = '';
|
||||
for (let i = 0; i < buffer.length; i++) {
|
||||
let item = buffer[i];
|
||||
if (isPromise(item)) {
|
||||
item = await item;
|
||||
}
|
||||
if (isString(item)) {
|
||||
ret += item;
|
||||
}
|
||||
else {
|
||||
ret += await unrollBuffer(item);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
else {
|
||||
// sync buffer can be more efficiently unrolled without unnecessary await
|
||||
// ticks
|
||||
return unrollBufferSync(buffer);
|
||||
}
|
||||
}
|
||||
function unrollBufferSync(buffer) {
|
||||
let ret = '';
|
||||
for (let i = 0; i < buffer.length; i++) {
|
||||
let item = buffer[i];
|
||||
if (isString(item)) {
|
||||
ret += item;
|
||||
}
|
||||
else {
|
||||
// since this is a sync buffer, child buffers are never promises
|
||||
ret += unrollBufferSync(item);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
async function renderToString(input, context = {}) {
|
||||
if (isVNode(input)) {
|
||||
// raw vnode, wrap with app (for context)
|
||||
return renderToString(createApp({ render: () => input }), context);
|
||||
}
|
||||
// rendering an app
|
||||
const vnode = createVNode(input._component, input._props);
|
||||
vnode.appContext = input._context;
|
||||
// provide the ssr context to the tree
|
||||
input.provide(ssrContextKey, context);
|
||||
const buffer = await renderComponentVNode(vnode);
|
||||
const result = await unrollBuffer(buffer);
|
||||
await resolveTeleports(context);
|
||||
return result;
|
||||
}
|
||||
async function resolveTeleports(context) {
|
||||
if (context.__teleportBuffers) {
|
||||
context.teleports = context.teleports || {};
|
||||
for (const key in context.__teleportBuffers) {
|
||||
// note: it's OK to await sequentially here because the Promises were
|
||||
// created eagerly in parallel.
|
||||
context.teleports[key] = await unrollBuffer((await Promise.all(context.__teleportBuffers[key])));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const { isVNode: isVNode$1 } = ssrUtils;
|
||||
async function unrollBuffer$1(buffer, stream) {
|
||||
if (buffer.hasAsync) {
|
||||
for (let i = 0; i < buffer.length; i++) {
|
||||
let item = buffer[i];
|
||||
if (isPromise(item)) {
|
||||
item = await item;
|
||||
}
|
||||
if (isString(item)) {
|
||||
stream.push(item);
|
||||
}
|
||||
else {
|
||||
await unrollBuffer$1(item, stream);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
// sync buffer can be more efficiently unrolled without unnecessary await
|
||||
// ticks
|
||||
unrollBufferSync$1(buffer, stream);
|
||||
}
|
||||
}
|
||||
function unrollBufferSync$1(buffer, stream) {
|
||||
for (let i = 0; i < buffer.length; i++) {
|
||||
let item = buffer[i];
|
||||
if (isString(item)) {
|
||||
stream.push(item);
|
||||
}
|
||||
else {
|
||||
// since this is a sync buffer, child buffers are never promises
|
||||
unrollBufferSync$1(item, stream);
|
||||
}
|
||||
}
|
||||
}
|
||||
function renderToSimpleStream(input, context, stream) {
|
||||
if (isVNode$1(input)) {
|
||||
// raw vnode, wrap with app (for context)
|
||||
return renderToSimpleStream(createApp({ render: () => input }), context, stream);
|
||||
}
|
||||
// rendering an app
|
||||
const vnode = createVNode(input._component, input._props);
|
||||
vnode.appContext = input._context;
|
||||
// provide the ssr context to the tree
|
||||
input.provide(ssrContextKey, context);
|
||||
Promise.resolve(renderComponentVNode(vnode))
|
||||
.then(buffer => unrollBuffer$1(buffer, stream))
|
||||
.then(() => resolveTeleports(context))
|
||||
.then(() => stream.push(null))
|
||||
.catch(error => {
|
||||
stream.destroy(error);
|
||||
});
|
||||
return stream;
|
||||
}
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
function renderToStream(input, context = {}) {
|
||||
console.warn(`[@vue/server-renderer] renderToStream is deprecated - use renderToNodeStream instead.`);
|
||||
return renderToNodeStream(input, context);
|
||||
}
|
||||
function renderToNodeStream(input, context = {}) {
|
||||
const stream = null;
|
||||
{
|
||||
throw new Error(`ESM build of renderToStream() does not support renderToNodeStream(). ` +
|
||||
`Use pipeToNodeWritable() with an existing Node.js Writable stream ` +
|
||||
`instance instead.`);
|
||||
}
|
||||
}
|
||||
function pipeToNodeWritable(input, context = {}, writable) {
|
||||
renderToSimpleStream(input, context, {
|
||||
push(content) {
|
||||
if (content != null) {
|
||||
writable.write(content);
|
||||
}
|
||||
else {
|
||||
writable.end();
|
||||
}
|
||||
},
|
||||
destroy(err) {
|
||||
writable.destroy(err);
|
||||
}
|
||||
});
|
||||
}
|
||||
function renderToWebStream(input, context = {}) {
|
||||
if (typeof ReadableStream !== 'function') {
|
||||
throw new Error(`ReadableStream constructor is not available in the global scope. ` +
|
||||
`If the target environment does support web streams, consider using ` +
|
||||
`pipeToWebWritable() with an existing WritableStream instance instead.`);
|
||||
}
|
||||
const encoder = new TextEncoder();
|
||||
let cancelled = false;
|
||||
return new ReadableStream({
|
||||
start(controller) {
|
||||
renderToSimpleStream(input, context, {
|
||||
push(content) {
|
||||
if (cancelled)
|
||||
return;
|
||||
if (content != null) {
|
||||
controller.enqueue(encoder.encode(content));
|
||||
}
|
||||
else {
|
||||
controller.close();
|
||||
}
|
||||
},
|
||||
destroy(err) {
|
||||
controller.error(err);
|
||||
}
|
||||
});
|
||||
},
|
||||
cancel() {
|
||||
cancelled = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
function pipeToWebWritable(input, context = {}, writable) {
|
||||
const writer = writable.getWriter();
|
||||
const encoder = new TextEncoder();
|
||||
// #4287 CloudFlare workers do not implement `ready` property
|
||||
let hasReady = false;
|
||||
try {
|
||||
hasReady = isPromise(writer.ready);
|
||||
}
|
||||
catch (e) { }
|
||||
renderToSimpleStream(input, context, {
|
||||
async push(content) {
|
||||
if (hasReady) {
|
||||
await writer.ready;
|
||||
}
|
||||
if (content != null) {
|
||||
return writer.write(encoder.encode(content));
|
||||
}
|
||||
else {
|
||||
return writer.close();
|
||||
}
|
||||
},
|
||||
destroy(err) {
|
||||
// TODO better error handling?
|
||||
console.log(err);
|
||||
writer.close();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function ssrRenderComponent(comp, props = null, children = null, parentComponent = null, slotScopeId) {
|
||||
return renderComponentVNode(createVNode(comp, props, children), parentComponent, slotScopeId);
|
||||
}
|
||||
|
||||
function ssrRenderSlot(slots, slotName, slotProps, fallbackRenderFn, push, parentComponent, slotScopeId) {
|
||||
// template-compiled slots are always rendered as fragments
|
||||
push(`<!--[-->`);
|
||||
ssrRenderSlotInner(slots, slotName, slotProps, fallbackRenderFn, push, parentComponent, slotScopeId);
|
||||
push(`<!--]-->`);
|
||||
}
|
||||
function ssrRenderSlotInner(slots, slotName, slotProps, fallbackRenderFn, push, parentComponent, slotScopeId) {
|
||||
const slotFn = slots[slotName];
|
||||
if (slotFn) {
|
||||
const slotBuffer = [];
|
||||
const bufferedPush = (item) => {
|
||||
slotBuffer.push(item);
|
||||
};
|
||||
const ret = slotFn(slotProps, bufferedPush, parentComponent, slotScopeId ? ' ' + slotScopeId : '');
|
||||
if (isArray(ret)) {
|
||||
// normal slot
|
||||
renderVNodeChildren(push, ret, parentComponent, slotScopeId);
|
||||
}
|
||||
else {
|
||||
// ssr slot.
|
||||
// check if the slot renders all comments, in which case use the fallback
|
||||
let isEmptySlot = true;
|
||||
for (let i = 0; i < slotBuffer.length; i++) {
|
||||
if (!isComment(slotBuffer[i])) {
|
||||
isEmptySlot = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (isEmptySlot) {
|
||||
if (fallbackRenderFn) {
|
||||
fallbackRenderFn();
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (let i = 0; i < slotBuffer.length; i++) {
|
||||
push(slotBuffer[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (fallbackRenderFn) {
|
||||
fallbackRenderFn();
|
||||
}
|
||||
}
|
||||
const commentRE = /<!--[^]*?-->/gm;
|
||||
function isComment(item) {
|
||||
return (typeof item === 'string' &&
|
||||
commentRE.test(item) &&
|
||||
!item.replace(commentRE, '').trim());
|
||||
}
|
||||
|
||||
function ssrInterpolate(value) {
|
||||
return escapeHtml(toDisplayString(value));
|
||||
}
|
||||
|
||||
function toRaw(observed) {
|
||||
const raw = observed && observed["__v_raw" /* RAW */];
|
||||
return raw ? toRaw(raw) : observed;
|
||||
}
|
||||
|
||||
function isRef(r) {
|
||||
return !!(r && r.__v_isRef === true);
|
||||
}
|
||||
|
||||
const stack = [];
|
||||
function pushWarningContext(vnode) {
|
||||
stack.push(vnode);
|
||||
}
|
||||
function popWarningContext() {
|
||||
stack.pop();
|
||||
}
|
||||
function warn(msg, ...args) {
|
||||
const instance = stack.length ? stack[stack.length - 1].component : null;
|
||||
const appWarnHandler = instance && instance.appContext.config.warnHandler;
|
||||
const trace = getComponentTrace();
|
||||
if (appWarnHandler) {
|
||||
callWithErrorHandling(appWarnHandler, instance, 11 /* APP_WARN_HANDLER */, [
|
||||
msg + args.join(''),
|
||||
instance && instance.proxy,
|
||||
trace
|
||||
.map(({ vnode }) => `at <${formatComponentName(instance, vnode.type)}>`)
|
||||
.join('\n'),
|
||||
trace
|
||||
]);
|
||||
}
|
||||
else {
|
||||
const warnArgs = [`[Vue warn]: ${msg}`, ...args];
|
||||
/* istanbul ignore if */
|
||||
if (trace.length &&
|
||||
// avoid spamming console during tests
|
||||
!false) {
|
||||
warnArgs.push(`\n`, ...formatTrace(trace));
|
||||
}
|
||||
console.warn(...warnArgs);
|
||||
}
|
||||
}
|
||||
function getComponentTrace() {
|
||||
let currentVNode = stack[stack.length - 1];
|
||||
if (!currentVNode) {
|
||||
return [];
|
||||
}
|
||||
// we can't just use the stack because it will be incomplete during updates
|
||||
// that did not start from the root. Re-construct the parent chain using
|
||||
// instance parent pointers.
|
||||
const normalizedStack = [];
|
||||
while (currentVNode) {
|
||||
const last = normalizedStack[0];
|
||||
if (last && last.vnode === currentVNode) {
|
||||
last.recurseCount++;
|
||||
}
|
||||
else {
|
||||
normalizedStack.push({
|
||||
vnode: currentVNode,
|
||||
recurseCount: 0
|
||||
});
|
||||
}
|
||||
const parentInstance = currentVNode.component && currentVNode.component.parent;
|
||||
currentVNode = parentInstance && parentInstance.vnode;
|
||||
}
|
||||
return normalizedStack;
|
||||
}
|
||||
/* istanbul ignore next */
|
||||
function formatTrace(trace) {
|
||||
const logs = [];
|
||||
trace.forEach((entry, i) => {
|
||||
logs.push(...(i === 0 ? [] : [`\n`]), ...formatTraceEntry(entry));
|
||||
});
|
||||
return logs;
|
||||
}
|
||||
function formatTraceEntry({ vnode, recurseCount }) {
|
||||
const postfix = recurseCount > 0 ? `... (${recurseCount} recursive calls)` : ``;
|
||||
const isRoot = vnode.component ? vnode.component.parent == null : false;
|
||||
const open = ` at <${formatComponentName(vnode.component, vnode.type, isRoot)}`;
|
||||
const close = `>` + postfix;
|
||||
return vnode.props
|
||||
? [open, ...formatProps(vnode.props), close]
|
||||
: [open + close];
|
||||
}
|
||||
/* istanbul ignore next */
|
||||
function formatProps(props) {
|
||||
const res = [];
|
||||
const keys = Object.keys(props);
|
||||
keys.slice(0, 3).forEach(key => {
|
||||
res.push(...formatProp(key, props[key]));
|
||||
});
|
||||
if (keys.length > 3) {
|
||||
res.push(` ...`);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
/* istanbul ignore next */
|
||||
function formatProp(key, value, raw) {
|
||||
if (isString(value)) {
|
||||
value = JSON.stringify(value);
|
||||
return raw ? value : [`${key}=${value}`];
|
||||
}
|
||||
else if (typeof value === 'number' ||
|
||||
typeof value === 'boolean' ||
|
||||
value == null) {
|
||||
return raw ? value : [`${key}=${value}`];
|
||||
}
|
||||
else if (isRef(value)) {
|
||||
value = formatProp(key, toRaw(value.value), true);
|
||||
return raw ? value : [`${key}=Ref<`, value, `>`];
|
||||
}
|
||||
else if (isFunction(value)) {
|
||||
return [`${key}=fn${value.name ? `<${value.name}>` : ``}`];
|
||||
}
|
||||
else {
|
||||
value = toRaw(value);
|
||||
return raw ? value : [`${key}=`, value];
|
||||
}
|
||||
}
|
||||
|
||||
const ErrorTypeStrings = {
|
||||
["sp" /* SERVER_PREFETCH */]: 'serverPrefetch hook',
|
||||
["bc" /* BEFORE_CREATE */]: 'beforeCreate hook',
|
||||
["c" /* CREATED */]: 'created hook',
|
||||
["bm" /* BEFORE_MOUNT */]: 'beforeMount hook',
|
||||
["m" /* MOUNTED */]: 'mounted hook',
|
||||
["bu" /* BEFORE_UPDATE */]: 'beforeUpdate hook',
|
||||
["u" /* UPDATED */]: 'updated',
|
||||
["bum" /* BEFORE_UNMOUNT */]: 'beforeUnmount hook',
|
||||
["um" /* UNMOUNTED */]: 'unmounted hook',
|
||||
["a" /* ACTIVATED */]: 'activated hook',
|
||||
["da" /* DEACTIVATED */]: 'deactivated hook',
|
||||
["ec" /* ERROR_CAPTURED */]: 'errorCaptured hook',
|
||||
["rtc" /* RENDER_TRACKED */]: 'renderTracked hook',
|
||||
["rtg" /* RENDER_TRIGGERED */]: 'renderTriggered hook',
|
||||
[0 /* SETUP_FUNCTION */]: 'setup function',
|
||||
[1 /* RENDER_FUNCTION */]: 'render function',
|
||||
[2 /* WATCH_GETTER */]: 'watcher getter',
|
||||
[3 /* WATCH_CALLBACK */]: 'watcher callback',
|
||||
[4 /* WATCH_CLEANUP */]: 'watcher cleanup function',
|
||||
[5 /* NATIVE_EVENT_HANDLER */]: 'native event handler',
|
||||
[6 /* COMPONENT_EVENT_HANDLER */]: 'component event handler',
|
||||
[7 /* VNODE_HOOK */]: 'vnode hook',
|
||||
[8 /* DIRECTIVE_HOOK */]: 'directive hook',
|
||||
[9 /* TRANSITION_HOOK */]: 'transition hook',
|
||||
[10 /* APP_ERROR_HANDLER */]: 'app errorHandler',
|
||||
[11 /* APP_WARN_HANDLER */]: 'app warnHandler',
|
||||
[12 /* FUNCTION_REF */]: 'ref function',
|
||||
[13 /* ASYNC_COMPONENT_LOADER */]: 'async component loader',
|
||||
[14 /* SCHEDULER */]: 'scheduler flush. This is likely a Vue internals bug. ' +
|
||||
'Please open an issue at https://new-issue.vuejs.org/?repo=vuejs/core'
|
||||
};
|
||||
function callWithErrorHandling(fn, instance, type, args) {
|
||||
let res;
|
||||
try {
|
||||
res = args ? fn(...args) : fn();
|
||||
}
|
||||
catch (err) {
|
||||
handleError(err, instance, type);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
function handleError(err, instance, type, throwInDev = true) {
|
||||
const contextVNode = instance ? instance.vnode : null;
|
||||
if (instance) {
|
||||
let cur = instance.parent;
|
||||
// the exposed instance is the render proxy to keep it consistent with 2.x
|
||||
const exposedInstance = instance.proxy;
|
||||
// in production the hook receives only the error code
|
||||
const errorInfo = (process.env.NODE_ENV !== 'production') ? ErrorTypeStrings[type] : type;
|
||||
while (cur) {
|
||||
const errorCapturedHooks = cur.ec;
|
||||
if (errorCapturedHooks) {
|
||||
for (let i = 0; i < errorCapturedHooks.length; i++) {
|
||||
if (errorCapturedHooks[i](err, exposedInstance, errorInfo) === false) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
cur = cur.parent;
|
||||
}
|
||||
// app-level handling
|
||||
const appErrorHandler = instance.appContext.config.errorHandler;
|
||||
if (appErrorHandler) {
|
||||
callWithErrorHandling(appErrorHandler, null, 10 /* APP_ERROR_HANDLER */, [err, exposedInstance, errorInfo]);
|
||||
return;
|
||||
}
|
||||
}
|
||||
logError(err, type, contextVNode, throwInDev);
|
||||
}
|
||||
function logError(err, type, contextVNode, throwInDev = true) {
|
||||
if ((process.env.NODE_ENV !== 'production')) {
|
||||
const info = ErrorTypeStrings[type];
|
||||
if (contextVNode) {
|
||||
pushWarningContext(contextVNode);
|
||||
}
|
||||
warn(`Unhandled error${info ? ` during execution of ${info}` : ``}`);
|
||||
if (contextVNode) {
|
||||
popWarningContext();
|
||||
}
|
||||
// crash in dev by default so it's more noticeable
|
||||
if (throwInDev) {
|
||||
throw err;
|
||||
}
|
||||
else {
|
||||
console.error(err);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// recover in prod to reduce the impact on end-user
|
||||
console.error(err);
|
||||
}
|
||||
}
|
||||
|
||||
const classifyRE = /(?:^|[-_])(\w)/g;
|
||||
const classify = (str) => str.replace(classifyRE, c => c.toUpperCase()).replace(/[-_]/g, '');
|
||||
function getComponentName(Component) {
|
||||
return isFunction(Component)
|
||||
? Component.displayName || Component.name
|
||||
: Component.name;
|
||||
}
|
||||
/* istanbul ignore next */
|
||||
function formatComponentName(instance, Component, isRoot = false) {
|
||||
let name = getComponentName(Component);
|
||||
if (!name && Component.__file) {
|
||||
const match = Component.__file.match(/([^/\\]+)\.\w+$/);
|
||||
if (match) {
|
||||
name = match[1];
|
||||
}
|
||||
}
|
||||
if (!name && instance && instance.parent) {
|
||||
// try to infer the name based on reverse resolution
|
||||
const inferFromRegistry = (registry) => {
|
||||
for (const key in registry) {
|
||||
if (registry[key] === Component) {
|
||||
return key;
|
||||
}
|
||||
}
|
||||
};
|
||||
name =
|
||||
inferFromRegistry(instance.components ||
|
||||
instance.parent.type.components) || inferFromRegistry(instance.appContext.components);
|
||||
}
|
||||
return name ? classify(name) : isRoot ? `App` : `Anonymous`;
|
||||
}
|
||||
|
||||
function ssrRenderList(source, renderItem) {
|
||||
if (isArray(source) || isString(source)) {
|
||||
for (let i = 0, l = source.length; i < l; i++) {
|
||||
renderItem(source[i], i);
|
||||
}
|
||||
}
|
||||
else if (typeof source === 'number') {
|
||||
if ((process.env.NODE_ENV !== 'production') && !Number.isInteger(source)) {
|
||||
warn(`The v-for range expect an integer value but got ${source}.`);
|
||||
return;
|
||||
}
|
||||
for (let i = 0; i < source; i++) {
|
||||
renderItem(i + 1, i);
|
||||
}
|
||||
}
|
||||
else if (isObject(source)) {
|
||||
if (source[Symbol.iterator]) {
|
||||
const arr = Array.from(source);
|
||||
for (let i = 0, l = arr.length; i < l; i++) {
|
||||
renderItem(arr[i], i);
|
||||
}
|
||||
}
|
||||
else {
|
||||
const keys = Object.keys(source);
|
||||
for (let i = 0, l = keys.length; i < l; i++) {
|
||||
const key = keys[i];
|
||||
renderItem(source[key], key, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function ssrRenderSuspense(push, { default: renderContent }) {
|
||||
if (renderContent) {
|
||||
renderContent();
|
||||
}
|
||||
else {
|
||||
push(`<!---->`);
|
||||
}
|
||||
}
|
||||
|
||||
function ssrGetDirectiveProps(instance, dir, value, arg, modifiers = {}) {
|
||||
if (typeof dir !== 'function' && dir.getSSRProps) {
|
||||
return (dir.getSSRProps({
|
||||
dir,
|
||||
instance,
|
||||
value,
|
||||
oldValue: undefined,
|
||||
arg,
|
||||
modifiers
|
||||
}, null) || {});
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
const ssrLooseEqual = looseEqual;
|
||||
function ssrLooseContain(arr, value) {
|
||||
return looseIndexOf(arr, value) > -1;
|
||||
}
|
||||
// for <input :type="type" v-model="model" value="value">
|
||||
function ssrRenderDynamicModel(type, model, value) {
|
||||
switch (type) {
|
||||
case 'radio':
|
||||
return looseEqual(model, value) ? ' checked' : '';
|
||||
case 'checkbox':
|
||||
return (isArray(model) ? ssrLooseContain(model, value) : model)
|
||||
? ' checked'
|
||||
: '';
|
||||
default:
|
||||
// text types
|
||||
return ssrRenderAttr('value', model);
|
||||
}
|
||||
}
|
||||
// for <input v-bind="obj" v-model="model">
|
||||
function ssrGetDynamicModelProps(existingProps = {}, model) {
|
||||
const { type, value } = existingProps;
|
||||
switch (type) {
|
||||
case 'radio':
|
||||
return looseEqual(model, value) ? { checked: true } : null;
|
||||
case 'checkbox':
|
||||
return (isArray(model) ? ssrLooseContain(model, value) : model)
|
||||
? { checked: true }
|
||||
: null;
|
||||
default:
|
||||
// text types
|
||||
return { value: model };
|
||||
}
|
||||
}
|
||||
|
||||
initDirectivesForSSR();
|
||||
|
||||
export { pipeToNodeWritable, pipeToWebWritable, renderToNodeStream, renderToSimpleStream, renderToStream, renderToString, renderToWebStream, ssrGetDirectiveProps, ssrGetDynamicModelProps, ssrInterpolate, ssrLooseContain, ssrLooseEqual, ssrRenderAttr, ssrRenderAttrs, ssrRenderClass, ssrRenderComponent, ssrRenderDynamicAttr, ssrRenderDynamicModel, ssrRenderList, ssrRenderSlot, ssrRenderSlotInner, ssrRenderStyle, ssrRenderSuspense, ssrRenderTeleport, renderVNode as ssrRenderVNode };
|
||||
7
node_modules/@vue/server-renderer/index.js
generated
vendored
Normal file
7
node_modules/@vue/server-renderer/index.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
'use strict'
|
||||
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
module.exports = require('./dist/server-renderer.cjs.prod.js')
|
||||
} else {
|
||||
module.exports = require('./dist/server-renderer.cjs.js')
|
||||
}
|
||||
40
node_modules/@vue/server-renderer/package.json
generated
vendored
Normal file
40
node_modules/@vue/server-renderer/package.json
generated
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
{
|
||||
"name": "@vue/server-renderer",
|
||||
"version": "3.2.36",
|
||||
"description": "@vue/server-renderer",
|
||||
"main": "index.js",
|
||||
"module": "dist/server-renderer.esm-bundler.js",
|
||||
"types": "dist/server-renderer.d.ts",
|
||||
"files": [
|
||||
"index.js",
|
||||
"dist"
|
||||
],
|
||||
"buildOptions": {
|
||||
"name": "VueServerRenderer",
|
||||
"formats": [
|
||||
"esm-bundler",
|
||||
"cjs"
|
||||
]
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/vuejs/core.git",
|
||||
"directory": "packages/server-renderer"
|
||||
},
|
||||
"keywords": [
|
||||
"vue"
|
||||
],
|
||||
"author": "Evan You",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/vuejs/core/issues"
|
||||
},
|
||||
"homepage": "https://github.com/vuejs/core/tree/main/packages/server-renderer#readme",
|
||||
"peerDependencies": {
|
||||
"vue": "3.2.36"
|
||||
},
|
||||
"dependencies": {
|
||||
"@vue/shared": "3.2.36",
|
||||
"@vue/compiler-ssr": "3.2.36"
|
||||
}
|
||||
}
|
||||
21
node_modules/@vue/shared/LICENSE
generated
vendored
Normal file
21
node_modules/@vue/shared/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2018-present, Yuxi (Evan) You
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
3
node_modules/@vue/shared/README.md
generated
vendored
Normal file
3
node_modules/@vue/shared/README.md
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
# @vue/shared
|
||||
|
||||
Internal utility functions and constants shared across `@vue` packages.
|
||||
659
node_modules/@vue/shared/dist/shared.cjs.js
generated
vendored
Normal file
659
node_modules/@vue/shared/dist/shared.cjs.js
generated
vendored
Normal file
@@ -0,0 +1,659 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
/**
|
||||
* Make a map and return a function for checking if a key
|
||||
* is in that map.
|
||||
* IMPORTANT: all calls of this function must be prefixed with
|
||||
* \/\*#\_\_PURE\_\_\*\/
|
||||
* So that rollup can tree-shake them if necessary.
|
||||
*/
|
||||
function makeMap(str, expectsLowerCase) {
|
||||
const map = Object.create(null);
|
||||
const list = str.split(',');
|
||||
for (let i = 0; i < list.length; i++) {
|
||||
map[list[i]] = true;
|
||||
}
|
||||
return expectsLowerCase ? val => !!map[val.toLowerCase()] : val => !!map[val];
|
||||
}
|
||||
|
||||
/**
|
||||
* dev only flag -> name mapping
|
||||
*/
|
||||
const PatchFlagNames = {
|
||||
[1 /* TEXT */]: `TEXT`,
|
||||
[2 /* CLASS */]: `CLASS`,
|
||||
[4 /* STYLE */]: `STYLE`,
|
||||
[8 /* PROPS */]: `PROPS`,
|
||||
[16 /* FULL_PROPS */]: `FULL_PROPS`,
|
||||
[32 /* HYDRATE_EVENTS */]: `HYDRATE_EVENTS`,
|
||||
[64 /* STABLE_FRAGMENT */]: `STABLE_FRAGMENT`,
|
||||
[128 /* KEYED_FRAGMENT */]: `KEYED_FRAGMENT`,
|
||||
[256 /* UNKEYED_FRAGMENT */]: `UNKEYED_FRAGMENT`,
|
||||
[512 /* NEED_PATCH */]: `NEED_PATCH`,
|
||||
[1024 /* DYNAMIC_SLOTS */]: `DYNAMIC_SLOTS`,
|
||||
[2048 /* DEV_ROOT_FRAGMENT */]: `DEV_ROOT_FRAGMENT`,
|
||||
[-1 /* HOISTED */]: `HOISTED`,
|
||||
[-2 /* BAIL */]: `BAIL`
|
||||
};
|
||||
|
||||
/**
|
||||
* Dev only
|
||||
*/
|
||||
const slotFlagsText = {
|
||||
[1 /* STABLE */]: 'STABLE',
|
||||
[2 /* DYNAMIC */]: 'DYNAMIC',
|
||||
[3 /* FORWARDED */]: 'FORWARDED'
|
||||
};
|
||||
|
||||
const GLOBALS_WHITE_LISTED = 'Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,' +
|
||||
'decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,' +
|
||||
'Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt';
|
||||
const isGloballyWhitelisted = /*#__PURE__*/ makeMap(GLOBALS_WHITE_LISTED);
|
||||
|
||||
const range = 2;
|
||||
function generateCodeFrame(source, start = 0, end = source.length) {
|
||||
// Split the content into individual lines but capture the newline sequence
|
||||
// that separated each line. This is important because the actual sequence is
|
||||
// needed to properly take into account the full line length for offset
|
||||
// comparison
|
||||
let lines = source.split(/(\r?\n)/);
|
||||
// Separate the lines and newline sequences into separate arrays for easier referencing
|
||||
const newlineSequences = lines.filter((_, idx) => idx % 2 === 1);
|
||||
lines = lines.filter((_, idx) => idx % 2 === 0);
|
||||
let count = 0;
|
||||
const res = [];
|
||||
for (let i = 0; i < lines.length; i++) {
|
||||
count +=
|
||||
lines[i].length +
|
||||
((newlineSequences[i] && newlineSequences[i].length) || 0);
|
||||
if (count >= start) {
|
||||
for (let j = i - range; j <= i + range || end > count; j++) {
|
||||
if (j < 0 || j >= lines.length)
|
||||
continue;
|
||||
const line = j + 1;
|
||||
res.push(`${line}${' '.repeat(Math.max(3 - String(line).length, 0))}| ${lines[j]}`);
|
||||
const lineLength = lines[j].length;
|
||||
const newLineSeqLength = (newlineSequences[j] && newlineSequences[j].length) || 0;
|
||||
if (j === i) {
|
||||
// push underline
|
||||
const pad = start - (count - (lineLength + newLineSeqLength));
|
||||
const length = Math.max(1, end > count ? lineLength - pad : end - start);
|
||||
res.push(` | ` + ' '.repeat(pad) + '^'.repeat(length));
|
||||
}
|
||||
else if (j > i) {
|
||||
if (end > count) {
|
||||
const length = Math.max(Math.min(end - count, lineLength), 1);
|
||||
res.push(` | ` + '^'.repeat(length));
|
||||
}
|
||||
count += lineLength + newLineSeqLength;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return res.join('\n');
|
||||
}
|
||||
|
||||
/**
|
||||
* On the client we only need to offer special cases for boolean attributes that
|
||||
* have different names from their corresponding dom properties:
|
||||
* - itemscope -> N/A
|
||||
* - allowfullscreen -> allowFullscreen
|
||||
* - formnovalidate -> formNoValidate
|
||||
* - ismap -> isMap
|
||||
* - nomodule -> noModule
|
||||
* - novalidate -> noValidate
|
||||
* - readonly -> readOnly
|
||||
*/
|
||||
const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;
|
||||
const isSpecialBooleanAttr = /*#__PURE__*/ makeMap(specialBooleanAttrs);
|
||||
/**
|
||||
* The full list is needed during SSR to produce the correct initial markup.
|
||||
*/
|
||||
const isBooleanAttr = /*#__PURE__*/ makeMap(specialBooleanAttrs +
|
||||
`,async,autofocus,autoplay,controls,default,defer,disabled,hidden,` +
|
||||
`loop,open,required,reversed,scoped,seamless,` +
|
||||
`checked,muted,multiple,selected`);
|
||||
/**
|
||||
* Boolean attributes should be included if the value is truthy or ''.
|
||||
* e.g. `<select multiple>` compiles to `{ multiple: '' }`
|
||||
*/
|
||||
function includeBooleanAttr(value) {
|
||||
return !!value || value === '';
|
||||
}
|
||||
const unsafeAttrCharRE = /[>/="'\u0009\u000a\u000c\u0020]/;
|
||||
const attrValidationCache = {};
|
||||
function isSSRSafeAttrName(name) {
|
||||
if (attrValidationCache.hasOwnProperty(name)) {
|
||||
return attrValidationCache[name];
|
||||
}
|
||||
const isUnsafe = unsafeAttrCharRE.test(name);
|
||||
if (isUnsafe) {
|
||||
console.error(`unsafe attribute name: ${name}`);
|
||||
}
|
||||
return (attrValidationCache[name] = !isUnsafe);
|
||||
}
|
||||
const propsToAttrMap = {
|
||||
acceptCharset: 'accept-charset',
|
||||
className: 'class',
|
||||
htmlFor: 'for',
|
||||
httpEquiv: 'http-equiv'
|
||||
};
|
||||
/**
|
||||
* CSS properties that accept plain numbers
|
||||
*/
|
||||
const isNoUnitNumericStyleProp = /*#__PURE__*/ makeMap(`animation-iteration-count,border-image-outset,border-image-slice,` +
|
||||
`border-image-width,box-flex,box-flex-group,box-ordinal-group,column-count,` +
|
||||
`columns,flex,flex-grow,flex-positive,flex-shrink,flex-negative,flex-order,` +
|
||||
`grid-row,grid-row-end,grid-row-span,grid-row-start,grid-column,` +
|
||||
`grid-column-end,grid-column-span,grid-column-start,font-weight,line-clamp,` +
|
||||
`line-height,opacity,order,orphans,tab-size,widows,z-index,zoom,` +
|
||||
// SVG
|
||||
`fill-opacity,flood-opacity,stop-opacity,stroke-dasharray,stroke-dashoffset,` +
|
||||
`stroke-miterlimit,stroke-opacity,stroke-width`);
|
||||
/**
|
||||
* Known attributes, this is used for stringification of runtime static nodes
|
||||
* so that we don't stringify bindings that cannot be set from HTML.
|
||||
* Don't also forget to allow `data-*` and `aria-*`!
|
||||
* Generated from https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes
|
||||
*/
|
||||
const isKnownHtmlAttr = /*#__PURE__*/ makeMap(`accept,accept-charset,accesskey,action,align,allow,alt,async,` +
|
||||
`autocapitalize,autocomplete,autofocus,autoplay,background,bgcolor,` +
|
||||
`border,buffered,capture,challenge,charset,checked,cite,class,code,` +
|
||||
`codebase,color,cols,colspan,content,contenteditable,contextmenu,controls,` +
|
||||
`coords,crossorigin,csp,data,datetime,decoding,default,defer,dir,dirname,` +
|
||||
`disabled,download,draggable,dropzone,enctype,enterkeyhint,for,form,` +
|
||||
`formaction,formenctype,formmethod,formnovalidate,formtarget,headers,` +
|
||||
`height,hidden,high,href,hreflang,http-equiv,icon,id,importance,integrity,` +
|
||||
`ismap,itemprop,keytype,kind,label,lang,language,loading,list,loop,low,` +
|
||||
`manifest,max,maxlength,minlength,media,min,multiple,muted,name,novalidate,` +
|
||||
`open,optimum,pattern,ping,placeholder,poster,preload,radiogroup,readonly,` +
|
||||
`referrerpolicy,rel,required,reversed,rows,rowspan,sandbox,scope,scoped,` +
|
||||
`selected,shape,size,sizes,slot,span,spellcheck,src,srcdoc,srclang,srcset,` +
|
||||
`start,step,style,summary,tabindex,target,title,translate,type,usemap,` +
|
||||
`value,width,wrap`);
|
||||
/**
|
||||
* Generated from https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute
|
||||
*/
|
||||
const isKnownSvgAttr = /*#__PURE__*/ makeMap(`xmlns,accent-height,accumulate,additive,alignment-baseline,alphabetic,amplitude,` +
|
||||
`arabic-form,ascent,attributeName,attributeType,azimuth,baseFrequency,` +
|
||||
`baseline-shift,baseProfile,bbox,begin,bias,by,calcMode,cap-height,class,` +
|
||||
`clip,clipPathUnits,clip-path,clip-rule,color,color-interpolation,` +
|
||||
`color-interpolation-filters,color-profile,color-rendering,` +
|
||||
`contentScriptType,contentStyleType,crossorigin,cursor,cx,cy,d,decelerate,` +
|
||||
`descent,diffuseConstant,direction,display,divisor,dominant-baseline,dur,dx,` +
|
||||
`dy,edgeMode,elevation,enable-background,end,exponent,fill,fill-opacity,` +
|
||||
`fill-rule,filter,filterRes,filterUnits,flood-color,flood-opacity,` +
|
||||
`font-family,font-size,font-size-adjust,font-stretch,font-style,` +
|
||||
`font-variant,font-weight,format,from,fr,fx,fy,g1,g2,glyph-name,` +
|
||||
`glyph-orientation-horizontal,glyph-orientation-vertical,glyphRef,` +
|
||||
`gradientTransform,gradientUnits,hanging,height,href,hreflang,horiz-adv-x,` +
|
||||
`horiz-origin-x,id,ideographic,image-rendering,in,in2,intercept,k,k1,k2,k3,` +
|
||||
`k4,kernelMatrix,kernelUnitLength,kerning,keyPoints,keySplines,keyTimes,` +
|
||||
`lang,lengthAdjust,letter-spacing,lighting-color,limitingConeAngle,local,` +
|
||||
`marker-end,marker-mid,marker-start,markerHeight,markerUnits,markerWidth,` +
|
||||
`mask,maskContentUnits,maskUnits,mathematical,max,media,method,min,mode,` +
|
||||
`name,numOctaves,offset,opacity,operator,order,orient,orientation,origin,` +
|
||||
`overflow,overline-position,overline-thickness,panose-1,paint-order,path,` +
|
||||
`pathLength,patternContentUnits,patternTransform,patternUnits,ping,` +
|
||||
`pointer-events,points,pointsAtX,pointsAtY,pointsAtZ,preserveAlpha,` +
|
||||
`preserveAspectRatio,primitiveUnits,r,radius,referrerPolicy,refX,refY,rel,` +
|
||||
`rendering-intent,repeatCount,repeatDur,requiredExtensions,requiredFeatures,` +
|
||||
`restart,result,rotate,rx,ry,scale,seed,shape-rendering,slope,spacing,` +
|
||||
`specularConstant,specularExponent,speed,spreadMethod,startOffset,` +
|
||||
`stdDeviation,stemh,stemv,stitchTiles,stop-color,stop-opacity,` +
|
||||
`strikethrough-position,strikethrough-thickness,string,stroke,` +
|
||||
`stroke-dasharray,stroke-dashoffset,stroke-linecap,stroke-linejoin,` +
|
||||
`stroke-miterlimit,stroke-opacity,stroke-width,style,surfaceScale,` +
|
||||
`systemLanguage,tabindex,tableValues,target,targetX,targetY,text-anchor,` +
|
||||
`text-decoration,text-rendering,textLength,to,transform,transform-origin,` +
|
||||
`type,u1,u2,underline-position,underline-thickness,unicode,unicode-bidi,` +
|
||||
`unicode-range,units-per-em,v-alphabetic,v-hanging,v-ideographic,` +
|
||||
`v-mathematical,values,vector-effect,version,vert-adv-y,vert-origin-x,` +
|
||||
`vert-origin-y,viewBox,viewTarget,visibility,width,widths,word-spacing,` +
|
||||
`writing-mode,x,x-height,x1,x2,xChannelSelector,xlink:actuate,xlink:arcrole,` +
|
||||
`xlink:href,xlink:role,xlink:show,xlink:title,xlink:type,xml:base,xml:lang,` +
|
||||
`xml:space,y,y1,y2,yChannelSelector,z,zoomAndPan`);
|
||||
|
||||
function normalizeStyle(value) {
|
||||
if (isArray(value)) {
|
||||
const res = {};
|
||||
for (let i = 0; i < value.length; i++) {
|
||||
const item = value[i];
|
||||
const normalized = isString(item)
|
||||
? parseStringStyle(item)
|
||||
: normalizeStyle(item);
|
||||
if (normalized) {
|
||||
for (const key in normalized) {
|
||||
res[key] = normalized[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
else if (isString(value)) {
|
||||
return value;
|
||||
}
|
||||
else if (isObject(value)) {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
const listDelimiterRE = /;(?![^(]*\))/g;
|
||||
const propertyDelimiterRE = /:(.+)/;
|
||||
function parseStringStyle(cssText) {
|
||||
const ret = {};
|
||||
cssText.split(listDelimiterRE).forEach(item => {
|
||||
if (item) {
|
||||
const tmp = item.split(propertyDelimiterRE);
|
||||
tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());
|
||||
}
|
||||
});
|
||||
return ret;
|
||||
}
|
||||
function stringifyStyle(styles) {
|
||||
let ret = '';
|
||||
if (!styles || isString(styles)) {
|
||||
return ret;
|
||||
}
|
||||
for (const key in styles) {
|
||||
const value = styles[key];
|
||||
const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key);
|
||||
if (isString(value) ||
|
||||
(typeof value === 'number' && isNoUnitNumericStyleProp(normalizedKey))) {
|
||||
// only render valid values
|
||||
ret += `${normalizedKey}:${value};`;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
function normalizeClass(value) {
|
||||
let res = '';
|
||||
if (isString(value)) {
|
||||
res = value;
|
||||
}
|
||||
else if (isArray(value)) {
|
||||
for (let i = 0; i < value.length; i++) {
|
||||
const normalized = normalizeClass(value[i]);
|
||||
if (normalized) {
|
||||
res += normalized + ' ';
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (isObject(value)) {
|
||||
for (const name in value) {
|
||||
if (value[name]) {
|
||||
res += name + ' ';
|
||||
}
|
||||
}
|
||||
}
|
||||
return res.trim();
|
||||
}
|
||||
function normalizeProps(props) {
|
||||
if (!props)
|
||||
return null;
|
||||
let { class: klass, style } = props;
|
||||
if (klass && !isString(klass)) {
|
||||
props.class = normalizeClass(klass);
|
||||
}
|
||||
if (style) {
|
||||
props.style = normalizeStyle(style);
|
||||
}
|
||||
return props;
|
||||
}
|
||||
|
||||
// These tag configs are shared between compiler-dom and runtime-dom, so they
|
||||
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element
|
||||
const HTML_TAGS = 'html,body,base,head,link,meta,style,title,address,article,aside,footer,' +
|
||||
'header,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,' +
|
||||
'figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,' +
|
||||
'data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,' +
|
||||
'time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,' +
|
||||
'canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,' +
|
||||
'th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,' +
|
||||
'option,output,progress,select,textarea,details,dialog,menu,' +
|
||||
'summary,template,blockquote,iframe,tfoot';
|
||||
// https://developer.mozilla.org/en-US/docs/Web/SVG/Element
|
||||
const SVG_TAGS = 'svg,animate,animateMotion,animateTransform,circle,clipPath,color-profile,' +
|
||||
'defs,desc,discard,ellipse,feBlend,feColorMatrix,feComponentTransfer,' +
|
||||
'feComposite,feConvolveMatrix,feDiffuseLighting,feDisplacementMap,' +
|
||||
'feDistanceLight,feDropShadow,feFlood,feFuncA,feFuncB,feFuncG,feFuncR,' +
|
||||
'feGaussianBlur,feImage,feMerge,feMergeNode,feMorphology,feOffset,' +
|
||||
'fePointLight,feSpecularLighting,feSpotLight,feTile,feTurbulence,filter,' +
|
||||
'foreignObject,g,hatch,hatchpath,image,line,linearGradient,marker,mask,' +
|
||||
'mesh,meshgradient,meshpatch,meshrow,metadata,mpath,path,pattern,' +
|
||||
'polygon,polyline,radialGradient,rect,set,solidcolor,stop,switch,symbol,' +
|
||||
'text,textPath,title,tspan,unknown,use,view';
|
||||
const VOID_TAGS = 'area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr';
|
||||
/**
|
||||
* Compiler only.
|
||||
* Do NOT use in runtime code paths unless behind `true` flag.
|
||||
*/
|
||||
const isHTMLTag = /*#__PURE__*/ makeMap(HTML_TAGS);
|
||||
/**
|
||||
* Compiler only.
|
||||
* Do NOT use in runtime code paths unless behind `true` flag.
|
||||
*/
|
||||
const isSVGTag = /*#__PURE__*/ makeMap(SVG_TAGS);
|
||||
/**
|
||||
* Compiler only.
|
||||
* Do NOT use in runtime code paths unless behind `true` flag.
|
||||
*/
|
||||
const isVoidTag = /*#__PURE__*/ makeMap(VOID_TAGS);
|
||||
|
||||
const escapeRE = /["'&<>]/;
|
||||
function escapeHtml(string) {
|
||||
const str = '' + string;
|
||||
const match = escapeRE.exec(str);
|
||||
if (!match) {
|
||||
return str;
|
||||
}
|
||||
let html = '';
|
||||
let escaped;
|
||||
let index;
|
||||
let lastIndex = 0;
|
||||
for (index = match.index; index < str.length; index++) {
|
||||
switch (str.charCodeAt(index)) {
|
||||
case 34: // "
|
||||
escaped = '"';
|
||||
break;
|
||||
case 38: // &
|
||||
escaped = '&';
|
||||
break;
|
||||
case 39: // '
|
||||
escaped = ''';
|
||||
break;
|
||||
case 60: // <
|
||||
escaped = '<';
|
||||
break;
|
||||
case 62: // >
|
||||
escaped = '>';
|
||||
break;
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
if (lastIndex !== index) {
|
||||
html += str.slice(lastIndex, index);
|
||||
}
|
||||
lastIndex = index + 1;
|
||||
html += escaped;
|
||||
}
|
||||
return lastIndex !== index ? html + str.slice(lastIndex, index) : html;
|
||||
}
|
||||
// https://www.w3.org/TR/html52/syntax.html#comments
|
||||
const commentStripRE = /^-?>|<!--|-->|--!>|<!-$/g;
|
||||
function escapeHtmlComment(src) {
|
||||
return src.replace(commentStripRE, '');
|
||||
}
|
||||
|
||||
function looseCompareArrays(a, b) {
|
||||
if (a.length !== b.length)
|
||||
return false;
|
||||
let equal = true;
|
||||
for (let i = 0; equal && i < a.length; i++) {
|
||||
equal = looseEqual(a[i], b[i]);
|
||||
}
|
||||
return equal;
|
||||
}
|
||||
function looseEqual(a, b) {
|
||||
if (a === b)
|
||||
return true;
|
||||
let aValidType = isDate(a);
|
||||
let bValidType = isDate(b);
|
||||
if (aValidType || bValidType) {
|
||||
return aValidType && bValidType ? a.getTime() === b.getTime() : false;
|
||||
}
|
||||
aValidType = isSymbol(a);
|
||||
bValidType = isSymbol(b);
|
||||
if (aValidType || bValidType) {
|
||||
return a === b;
|
||||
}
|
||||
aValidType = isArray(a);
|
||||
bValidType = isArray(b);
|
||||
if (aValidType || bValidType) {
|
||||
return aValidType && bValidType ? looseCompareArrays(a, b) : false;
|
||||
}
|
||||
aValidType = isObject(a);
|
||||
bValidType = isObject(b);
|
||||
if (aValidType || bValidType) {
|
||||
/* istanbul ignore if: this if will probably never be called */
|
||||
if (!aValidType || !bValidType) {
|
||||
return false;
|
||||
}
|
||||
const aKeysCount = Object.keys(a).length;
|
||||
const bKeysCount = Object.keys(b).length;
|
||||
if (aKeysCount !== bKeysCount) {
|
||||
return false;
|
||||
}
|
||||
for (const key in a) {
|
||||
const aHasKey = a.hasOwnProperty(key);
|
||||
const bHasKey = b.hasOwnProperty(key);
|
||||
if ((aHasKey && !bHasKey) ||
|
||||
(!aHasKey && bHasKey) ||
|
||||
!looseEqual(a[key], b[key])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return String(a) === String(b);
|
||||
}
|
||||
function looseIndexOf(arr, val) {
|
||||
return arr.findIndex(item => looseEqual(item, val));
|
||||
}
|
||||
|
||||
/**
|
||||
* For converting {{ interpolation }} values to displayed strings.
|
||||
* @private
|
||||
*/
|
||||
const toDisplayString = (val) => {
|
||||
return isString(val)
|
||||
? val
|
||||
: val == null
|
||||
? ''
|
||||
: isArray(val) ||
|
||||
(isObject(val) &&
|
||||
(val.toString === objectToString || !isFunction(val.toString)))
|
||||
? JSON.stringify(val, replacer, 2)
|
||||
: String(val);
|
||||
};
|
||||
const replacer = (_key, val) => {
|
||||
// can't use isRef here since @vue/shared has no deps
|
||||
if (val && val.__v_isRef) {
|
||||
return replacer(_key, val.value);
|
||||
}
|
||||
else if (isMap(val)) {
|
||||
return {
|
||||
[`Map(${val.size})`]: [...val.entries()].reduce((entries, [key, val]) => {
|
||||
entries[`${key} =>`] = val;
|
||||
return entries;
|
||||
}, {})
|
||||
};
|
||||
}
|
||||
else if (isSet(val)) {
|
||||
return {
|
||||
[`Set(${val.size})`]: [...val.values()]
|
||||
};
|
||||
}
|
||||
else if (isObject(val) && !isArray(val) && !isPlainObject(val)) {
|
||||
return String(val);
|
||||
}
|
||||
return val;
|
||||
};
|
||||
|
||||
const EMPTY_OBJ = Object.freeze({})
|
||||
;
|
||||
const EMPTY_ARR = Object.freeze([]) ;
|
||||
const NOOP = () => { };
|
||||
/**
|
||||
* Always return false.
|
||||
*/
|
||||
const NO = () => false;
|
||||
const onRE = /^on[^a-z]/;
|
||||
const isOn = (key) => onRE.test(key);
|
||||
const isModelListener = (key) => key.startsWith('onUpdate:');
|
||||
const extend = Object.assign;
|
||||
const remove = (arr, el) => {
|
||||
const i = arr.indexOf(el);
|
||||
if (i > -1) {
|
||||
arr.splice(i, 1);
|
||||
}
|
||||
};
|
||||
const hasOwnProperty = Object.prototype.hasOwnProperty;
|
||||
const hasOwn = (val, key) => hasOwnProperty.call(val, key);
|
||||
const isArray = Array.isArray;
|
||||
const isMap = (val) => toTypeString(val) === '[object Map]';
|
||||
const isSet = (val) => toTypeString(val) === '[object Set]';
|
||||
const isDate = (val) => toTypeString(val) === '[object Date]';
|
||||
const isFunction = (val) => typeof val === 'function';
|
||||
const isString = (val) => typeof val === 'string';
|
||||
const isSymbol = (val) => typeof val === 'symbol';
|
||||
const isObject = (val) => val !== null && typeof val === 'object';
|
||||
const isPromise = (val) => {
|
||||
return isObject(val) && isFunction(val.then) && isFunction(val.catch);
|
||||
};
|
||||
const objectToString = Object.prototype.toString;
|
||||
const toTypeString = (value) => objectToString.call(value);
|
||||
const toRawType = (value) => {
|
||||
// extract "RawType" from strings like "[object RawType]"
|
||||
return toTypeString(value).slice(8, -1);
|
||||
};
|
||||
const isPlainObject = (val) => toTypeString(val) === '[object Object]';
|
||||
const isIntegerKey = (key) => isString(key) &&
|
||||
key !== 'NaN' &&
|
||||
key[0] !== '-' &&
|
||||
'' + parseInt(key, 10) === key;
|
||||
const isReservedProp = /*#__PURE__*/ makeMap(
|
||||
// the leading comma is intentional so empty string "" is also included
|
||||
',key,ref,ref_for,ref_key,' +
|
||||
'onVnodeBeforeMount,onVnodeMounted,' +
|
||||
'onVnodeBeforeUpdate,onVnodeUpdated,' +
|
||||
'onVnodeBeforeUnmount,onVnodeUnmounted');
|
||||
const isBuiltInDirective = /*#__PURE__*/ makeMap('bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo');
|
||||
const cacheStringFunction = (fn) => {
|
||||
const cache = Object.create(null);
|
||||
return ((str) => {
|
||||
const hit = cache[str];
|
||||
return hit || (cache[str] = fn(str));
|
||||
});
|
||||
};
|
||||
const camelizeRE = /-(\w)/g;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
const camelize = cacheStringFunction((str) => {
|
||||
return str.replace(camelizeRE, (_, c) => (c ? c.toUpperCase() : ''));
|
||||
});
|
||||
const hyphenateRE = /\B([A-Z])/g;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
const hyphenate = cacheStringFunction((str) => str.replace(hyphenateRE, '-$1').toLowerCase());
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
const capitalize = cacheStringFunction((str) => str.charAt(0).toUpperCase() + str.slice(1));
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
const toHandlerKey = cacheStringFunction((str) => str ? `on${capitalize(str)}` : ``);
|
||||
// compare whether a value has changed, accounting for NaN.
|
||||
const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
|
||||
const invokeArrayFns = (fns, arg) => {
|
||||
for (let i = 0; i < fns.length; i++) {
|
||||
fns[i](arg);
|
||||
}
|
||||
};
|
||||
const def = (obj, key, value) => {
|
||||
Object.defineProperty(obj, key, {
|
||||
configurable: true,
|
||||
enumerable: false,
|
||||
value
|
||||
});
|
||||
};
|
||||
const toNumber = (val) => {
|
||||
const n = parseFloat(val);
|
||||
return isNaN(n) ? val : n;
|
||||
};
|
||||
let _globalThis;
|
||||
const getGlobalThis = () => {
|
||||
return (_globalThis ||
|
||||
(_globalThis =
|
||||
typeof globalThis !== 'undefined'
|
||||
? globalThis
|
||||
: typeof self !== 'undefined'
|
||||
? self
|
||||
: typeof window !== 'undefined'
|
||||
? window
|
||||
: typeof global !== 'undefined'
|
||||
? global
|
||||
: {}));
|
||||
};
|
||||
const identRE = /^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/;
|
||||
function genPropsAccessExp(name) {
|
||||
return identRE.test(name)
|
||||
? `__props.${name}`
|
||||
: `__props[${JSON.stringify(name)}]`;
|
||||
}
|
||||
|
||||
exports.EMPTY_ARR = EMPTY_ARR;
|
||||
exports.EMPTY_OBJ = EMPTY_OBJ;
|
||||
exports.NO = NO;
|
||||
exports.NOOP = NOOP;
|
||||
exports.PatchFlagNames = PatchFlagNames;
|
||||
exports.camelize = camelize;
|
||||
exports.capitalize = capitalize;
|
||||
exports.def = def;
|
||||
exports.escapeHtml = escapeHtml;
|
||||
exports.escapeHtmlComment = escapeHtmlComment;
|
||||
exports.extend = extend;
|
||||
exports.genPropsAccessExp = genPropsAccessExp;
|
||||
exports.generateCodeFrame = generateCodeFrame;
|
||||
exports.getGlobalThis = getGlobalThis;
|
||||
exports.hasChanged = hasChanged;
|
||||
exports.hasOwn = hasOwn;
|
||||
exports.hyphenate = hyphenate;
|
||||
exports.includeBooleanAttr = includeBooleanAttr;
|
||||
exports.invokeArrayFns = invokeArrayFns;
|
||||
exports.isArray = isArray;
|
||||
exports.isBooleanAttr = isBooleanAttr;
|
||||
exports.isBuiltInDirective = isBuiltInDirective;
|
||||
exports.isDate = isDate;
|
||||
exports.isFunction = isFunction;
|
||||
exports.isGloballyWhitelisted = isGloballyWhitelisted;
|
||||
exports.isHTMLTag = isHTMLTag;
|
||||
exports.isIntegerKey = isIntegerKey;
|
||||
exports.isKnownHtmlAttr = isKnownHtmlAttr;
|
||||
exports.isKnownSvgAttr = isKnownSvgAttr;
|
||||
exports.isMap = isMap;
|
||||
exports.isModelListener = isModelListener;
|
||||
exports.isNoUnitNumericStyleProp = isNoUnitNumericStyleProp;
|
||||
exports.isObject = isObject;
|
||||
exports.isOn = isOn;
|
||||
exports.isPlainObject = isPlainObject;
|
||||
exports.isPromise = isPromise;
|
||||
exports.isReservedProp = isReservedProp;
|
||||
exports.isSSRSafeAttrName = isSSRSafeAttrName;
|
||||
exports.isSVGTag = isSVGTag;
|
||||
exports.isSet = isSet;
|
||||
exports.isSpecialBooleanAttr = isSpecialBooleanAttr;
|
||||
exports.isString = isString;
|
||||
exports.isSymbol = isSymbol;
|
||||
exports.isVoidTag = isVoidTag;
|
||||
exports.looseEqual = looseEqual;
|
||||
exports.looseIndexOf = looseIndexOf;
|
||||
exports.makeMap = makeMap;
|
||||
exports.normalizeClass = normalizeClass;
|
||||
exports.normalizeProps = normalizeProps;
|
||||
exports.normalizeStyle = normalizeStyle;
|
||||
exports.objectToString = objectToString;
|
||||
exports.parseStringStyle = parseStringStyle;
|
||||
exports.propsToAttrMap = propsToAttrMap;
|
||||
exports.remove = remove;
|
||||
exports.slotFlagsText = slotFlagsText;
|
||||
exports.stringifyStyle = stringifyStyle;
|
||||
exports.toDisplayString = toDisplayString;
|
||||
exports.toHandlerKey = toHandlerKey;
|
||||
exports.toNumber = toNumber;
|
||||
exports.toRawType = toRawType;
|
||||
exports.toTypeString = toTypeString;
|
||||
658
node_modules/@vue/shared/dist/shared.cjs.prod.js
generated
vendored
Normal file
658
node_modules/@vue/shared/dist/shared.cjs.prod.js
generated
vendored
Normal file
@@ -0,0 +1,658 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
/**
|
||||
* Make a map and return a function for checking if a key
|
||||
* is in that map.
|
||||
* IMPORTANT: all calls of this function must be prefixed with
|
||||
* \/\*#\_\_PURE\_\_\*\/
|
||||
* So that rollup can tree-shake them if necessary.
|
||||
*/
|
||||
function makeMap(str, expectsLowerCase) {
|
||||
const map = Object.create(null);
|
||||
const list = str.split(',');
|
||||
for (let i = 0; i < list.length; i++) {
|
||||
map[list[i]] = true;
|
||||
}
|
||||
return expectsLowerCase ? val => !!map[val.toLowerCase()] : val => !!map[val];
|
||||
}
|
||||
|
||||
/**
|
||||
* dev only flag -> name mapping
|
||||
*/
|
||||
const PatchFlagNames = {
|
||||
[1 /* TEXT */]: `TEXT`,
|
||||
[2 /* CLASS */]: `CLASS`,
|
||||
[4 /* STYLE */]: `STYLE`,
|
||||
[8 /* PROPS */]: `PROPS`,
|
||||
[16 /* FULL_PROPS */]: `FULL_PROPS`,
|
||||
[32 /* HYDRATE_EVENTS */]: `HYDRATE_EVENTS`,
|
||||
[64 /* STABLE_FRAGMENT */]: `STABLE_FRAGMENT`,
|
||||
[128 /* KEYED_FRAGMENT */]: `KEYED_FRAGMENT`,
|
||||
[256 /* UNKEYED_FRAGMENT */]: `UNKEYED_FRAGMENT`,
|
||||
[512 /* NEED_PATCH */]: `NEED_PATCH`,
|
||||
[1024 /* DYNAMIC_SLOTS */]: `DYNAMIC_SLOTS`,
|
||||
[2048 /* DEV_ROOT_FRAGMENT */]: `DEV_ROOT_FRAGMENT`,
|
||||
[-1 /* HOISTED */]: `HOISTED`,
|
||||
[-2 /* BAIL */]: `BAIL`
|
||||
};
|
||||
|
||||
/**
|
||||
* Dev only
|
||||
*/
|
||||
const slotFlagsText = {
|
||||
[1 /* STABLE */]: 'STABLE',
|
||||
[2 /* DYNAMIC */]: 'DYNAMIC',
|
||||
[3 /* FORWARDED */]: 'FORWARDED'
|
||||
};
|
||||
|
||||
const GLOBALS_WHITE_LISTED = 'Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,' +
|
||||
'decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,' +
|
||||
'Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt';
|
||||
const isGloballyWhitelisted = /*#__PURE__*/ makeMap(GLOBALS_WHITE_LISTED);
|
||||
|
||||
const range = 2;
|
||||
function generateCodeFrame(source, start = 0, end = source.length) {
|
||||
// Split the content into individual lines but capture the newline sequence
|
||||
// that separated each line. This is important because the actual sequence is
|
||||
// needed to properly take into account the full line length for offset
|
||||
// comparison
|
||||
let lines = source.split(/(\r?\n)/);
|
||||
// Separate the lines and newline sequences into separate arrays for easier referencing
|
||||
const newlineSequences = lines.filter((_, idx) => idx % 2 === 1);
|
||||
lines = lines.filter((_, idx) => idx % 2 === 0);
|
||||
let count = 0;
|
||||
const res = [];
|
||||
for (let i = 0; i < lines.length; i++) {
|
||||
count +=
|
||||
lines[i].length +
|
||||
((newlineSequences[i] && newlineSequences[i].length) || 0);
|
||||
if (count >= start) {
|
||||
for (let j = i - range; j <= i + range || end > count; j++) {
|
||||
if (j < 0 || j >= lines.length)
|
||||
continue;
|
||||
const line = j + 1;
|
||||
res.push(`${line}${' '.repeat(Math.max(3 - String(line).length, 0))}| ${lines[j]}`);
|
||||
const lineLength = lines[j].length;
|
||||
const newLineSeqLength = (newlineSequences[j] && newlineSequences[j].length) || 0;
|
||||
if (j === i) {
|
||||
// push underline
|
||||
const pad = start - (count - (lineLength + newLineSeqLength));
|
||||
const length = Math.max(1, end > count ? lineLength - pad : end - start);
|
||||
res.push(` | ` + ' '.repeat(pad) + '^'.repeat(length));
|
||||
}
|
||||
else if (j > i) {
|
||||
if (end > count) {
|
||||
const length = Math.max(Math.min(end - count, lineLength), 1);
|
||||
res.push(` | ` + '^'.repeat(length));
|
||||
}
|
||||
count += lineLength + newLineSeqLength;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return res.join('\n');
|
||||
}
|
||||
|
||||
/**
|
||||
* On the client we only need to offer special cases for boolean attributes that
|
||||
* have different names from their corresponding dom properties:
|
||||
* - itemscope -> N/A
|
||||
* - allowfullscreen -> allowFullscreen
|
||||
* - formnovalidate -> formNoValidate
|
||||
* - ismap -> isMap
|
||||
* - nomodule -> noModule
|
||||
* - novalidate -> noValidate
|
||||
* - readonly -> readOnly
|
||||
*/
|
||||
const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;
|
||||
const isSpecialBooleanAttr = /*#__PURE__*/ makeMap(specialBooleanAttrs);
|
||||
/**
|
||||
* The full list is needed during SSR to produce the correct initial markup.
|
||||
*/
|
||||
const isBooleanAttr = /*#__PURE__*/ makeMap(specialBooleanAttrs +
|
||||
`,async,autofocus,autoplay,controls,default,defer,disabled,hidden,` +
|
||||
`loop,open,required,reversed,scoped,seamless,` +
|
||||
`checked,muted,multiple,selected`);
|
||||
/**
|
||||
* Boolean attributes should be included if the value is truthy or ''.
|
||||
* e.g. `<select multiple>` compiles to `{ multiple: '' }`
|
||||
*/
|
||||
function includeBooleanAttr(value) {
|
||||
return !!value || value === '';
|
||||
}
|
||||
const unsafeAttrCharRE = /[>/="'\u0009\u000a\u000c\u0020]/;
|
||||
const attrValidationCache = {};
|
||||
function isSSRSafeAttrName(name) {
|
||||
if (attrValidationCache.hasOwnProperty(name)) {
|
||||
return attrValidationCache[name];
|
||||
}
|
||||
const isUnsafe = unsafeAttrCharRE.test(name);
|
||||
if (isUnsafe) {
|
||||
console.error(`unsafe attribute name: ${name}`);
|
||||
}
|
||||
return (attrValidationCache[name] = !isUnsafe);
|
||||
}
|
||||
const propsToAttrMap = {
|
||||
acceptCharset: 'accept-charset',
|
||||
className: 'class',
|
||||
htmlFor: 'for',
|
||||
httpEquiv: 'http-equiv'
|
||||
};
|
||||
/**
|
||||
* CSS properties that accept plain numbers
|
||||
*/
|
||||
const isNoUnitNumericStyleProp = /*#__PURE__*/ makeMap(`animation-iteration-count,border-image-outset,border-image-slice,` +
|
||||
`border-image-width,box-flex,box-flex-group,box-ordinal-group,column-count,` +
|
||||
`columns,flex,flex-grow,flex-positive,flex-shrink,flex-negative,flex-order,` +
|
||||
`grid-row,grid-row-end,grid-row-span,grid-row-start,grid-column,` +
|
||||
`grid-column-end,grid-column-span,grid-column-start,font-weight,line-clamp,` +
|
||||
`line-height,opacity,order,orphans,tab-size,widows,z-index,zoom,` +
|
||||
// SVG
|
||||
`fill-opacity,flood-opacity,stop-opacity,stroke-dasharray,stroke-dashoffset,` +
|
||||
`stroke-miterlimit,stroke-opacity,stroke-width`);
|
||||
/**
|
||||
* Known attributes, this is used for stringification of runtime static nodes
|
||||
* so that we don't stringify bindings that cannot be set from HTML.
|
||||
* Don't also forget to allow `data-*` and `aria-*`!
|
||||
* Generated from https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes
|
||||
*/
|
||||
const isKnownHtmlAttr = /*#__PURE__*/ makeMap(`accept,accept-charset,accesskey,action,align,allow,alt,async,` +
|
||||
`autocapitalize,autocomplete,autofocus,autoplay,background,bgcolor,` +
|
||||
`border,buffered,capture,challenge,charset,checked,cite,class,code,` +
|
||||
`codebase,color,cols,colspan,content,contenteditable,contextmenu,controls,` +
|
||||
`coords,crossorigin,csp,data,datetime,decoding,default,defer,dir,dirname,` +
|
||||
`disabled,download,draggable,dropzone,enctype,enterkeyhint,for,form,` +
|
||||
`formaction,formenctype,formmethod,formnovalidate,formtarget,headers,` +
|
||||
`height,hidden,high,href,hreflang,http-equiv,icon,id,importance,integrity,` +
|
||||
`ismap,itemprop,keytype,kind,label,lang,language,loading,list,loop,low,` +
|
||||
`manifest,max,maxlength,minlength,media,min,multiple,muted,name,novalidate,` +
|
||||
`open,optimum,pattern,ping,placeholder,poster,preload,radiogroup,readonly,` +
|
||||
`referrerpolicy,rel,required,reversed,rows,rowspan,sandbox,scope,scoped,` +
|
||||
`selected,shape,size,sizes,slot,span,spellcheck,src,srcdoc,srclang,srcset,` +
|
||||
`start,step,style,summary,tabindex,target,title,translate,type,usemap,` +
|
||||
`value,width,wrap`);
|
||||
/**
|
||||
* Generated from https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute
|
||||
*/
|
||||
const isKnownSvgAttr = /*#__PURE__*/ makeMap(`xmlns,accent-height,accumulate,additive,alignment-baseline,alphabetic,amplitude,` +
|
||||
`arabic-form,ascent,attributeName,attributeType,azimuth,baseFrequency,` +
|
||||
`baseline-shift,baseProfile,bbox,begin,bias,by,calcMode,cap-height,class,` +
|
||||
`clip,clipPathUnits,clip-path,clip-rule,color,color-interpolation,` +
|
||||
`color-interpolation-filters,color-profile,color-rendering,` +
|
||||
`contentScriptType,contentStyleType,crossorigin,cursor,cx,cy,d,decelerate,` +
|
||||
`descent,diffuseConstant,direction,display,divisor,dominant-baseline,dur,dx,` +
|
||||
`dy,edgeMode,elevation,enable-background,end,exponent,fill,fill-opacity,` +
|
||||
`fill-rule,filter,filterRes,filterUnits,flood-color,flood-opacity,` +
|
||||
`font-family,font-size,font-size-adjust,font-stretch,font-style,` +
|
||||
`font-variant,font-weight,format,from,fr,fx,fy,g1,g2,glyph-name,` +
|
||||
`glyph-orientation-horizontal,glyph-orientation-vertical,glyphRef,` +
|
||||
`gradientTransform,gradientUnits,hanging,height,href,hreflang,horiz-adv-x,` +
|
||||
`horiz-origin-x,id,ideographic,image-rendering,in,in2,intercept,k,k1,k2,k3,` +
|
||||
`k4,kernelMatrix,kernelUnitLength,kerning,keyPoints,keySplines,keyTimes,` +
|
||||
`lang,lengthAdjust,letter-spacing,lighting-color,limitingConeAngle,local,` +
|
||||
`marker-end,marker-mid,marker-start,markerHeight,markerUnits,markerWidth,` +
|
||||
`mask,maskContentUnits,maskUnits,mathematical,max,media,method,min,mode,` +
|
||||
`name,numOctaves,offset,opacity,operator,order,orient,orientation,origin,` +
|
||||
`overflow,overline-position,overline-thickness,panose-1,paint-order,path,` +
|
||||
`pathLength,patternContentUnits,patternTransform,patternUnits,ping,` +
|
||||
`pointer-events,points,pointsAtX,pointsAtY,pointsAtZ,preserveAlpha,` +
|
||||
`preserveAspectRatio,primitiveUnits,r,radius,referrerPolicy,refX,refY,rel,` +
|
||||
`rendering-intent,repeatCount,repeatDur,requiredExtensions,requiredFeatures,` +
|
||||
`restart,result,rotate,rx,ry,scale,seed,shape-rendering,slope,spacing,` +
|
||||
`specularConstant,specularExponent,speed,spreadMethod,startOffset,` +
|
||||
`stdDeviation,stemh,stemv,stitchTiles,stop-color,stop-opacity,` +
|
||||
`strikethrough-position,strikethrough-thickness,string,stroke,` +
|
||||
`stroke-dasharray,stroke-dashoffset,stroke-linecap,stroke-linejoin,` +
|
||||
`stroke-miterlimit,stroke-opacity,stroke-width,style,surfaceScale,` +
|
||||
`systemLanguage,tabindex,tableValues,target,targetX,targetY,text-anchor,` +
|
||||
`text-decoration,text-rendering,textLength,to,transform,transform-origin,` +
|
||||
`type,u1,u2,underline-position,underline-thickness,unicode,unicode-bidi,` +
|
||||
`unicode-range,units-per-em,v-alphabetic,v-hanging,v-ideographic,` +
|
||||
`v-mathematical,values,vector-effect,version,vert-adv-y,vert-origin-x,` +
|
||||
`vert-origin-y,viewBox,viewTarget,visibility,width,widths,word-spacing,` +
|
||||
`writing-mode,x,x-height,x1,x2,xChannelSelector,xlink:actuate,xlink:arcrole,` +
|
||||
`xlink:href,xlink:role,xlink:show,xlink:title,xlink:type,xml:base,xml:lang,` +
|
||||
`xml:space,y,y1,y2,yChannelSelector,z,zoomAndPan`);
|
||||
|
||||
function normalizeStyle(value) {
|
||||
if (isArray(value)) {
|
||||
const res = {};
|
||||
for (let i = 0; i < value.length; i++) {
|
||||
const item = value[i];
|
||||
const normalized = isString(item)
|
||||
? parseStringStyle(item)
|
||||
: normalizeStyle(item);
|
||||
if (normalized) {
|
||||
for (const key in normalized) {
|
||||
res[key] = normalized[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
else if (isString(value)) {
|
||||
return value;
|
||||
}
|
||||
else if (isObject(value)) {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
const listDelimiterRE = /;(?![^(]*\))/g;
|
||||
const propertyDelimiterRE = /:(.+)/;
|
||||
function parseStringStyle(cssText) {
|
||||
const ret = {};
|
||||
cssText.split(listDelimiterRE).forEach(item => {
|
||||
if (item) {
|
||||
const tmp = item.split(propertyDelimiterRE);
|
||||
tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());
|
||||
}
|
||||
});
|
||||
return ret;
|
||||
}
|
||||
function stringifyStyle(styles) {
|
||||
let ret = '';
|
||||
if (!styles || isString(styles)) {
|
||||
return ret;
|
||||
}
|
||||
for (const key in styles) {
|
||||
const value = styles[key];
|
||||
const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key);
|
||||
if (isString(value) ||
|
||||
(typeof value === 'number' && isNoUnitNumericStyleProp(normalizedKey))) {
|
||||
// only render valid values
|
||||
ret += `${normalizedKey}:${value};`;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
function normalizeClass(value) {
|
||||
let res = '';
|
||||
if (isString(value)) {
|
||||
res = value;
|
||||
}
|
||||
else if (isArray(value)) {
|
||||
for (let i = 0; i < value.length; i++) {
|
||||
const normalized = normalizeClass(value[i]);
|
||||
if (normalized) {
|
||||
res += normalized + ' ';
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (isObject(value)) {
|
||||
for (const name in value) {
|
||||
if (value[name]) {
|
||||
res += name + ' ';
|
||||
}
|
||||
}
|
||||
}
|
||||
return res.trim();
|
||||
}
|
||||
function normalizeProps(props) {
|
||||
if (!props)
|
||||
return null;
|
||||
let { class: klass, style } = props;
|
||||
if (klass && !isString(klass)) {
|
||||
props.class = normalizeClass(klass);
|
||||
}
|
||||
if (style) {
|
||||
props.style = normalizeStyle(style);
|
||||
}
|
||||
return props;
|
||||
}
|
||||
|
||||
// These tag configs are shared between compiler-dom and runtime-dom, so they
|
||||
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element
|
||||
const HTML_TAGS = 'html,body,base,head,link,meta,style,title,address,article,aside,footer,' +
|
||||
'header,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,' +
|
||||
'figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,' +
|
||||
'data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,' +
|
||||
'time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,' +
|
||||
'canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,' +
|
||||
'th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,' +
|
||||
'option,output,progress,select,textarea,details,dialog,menu,' +
|
||||
'summary,template,blockquote,iframe,tfoot';
|
||||
// https://developer.mozilla.org/en-US/docs/Web/SVG/Element
|
||||
const SVG_TAGS = 'svg,animate,animateMotion,animateTransform,circle,clipPath,color-profile,' +
|
||||
'defs,desc,discard,ellipse,feBlend,feColorMatrix,feComponentTransfer,' +
|
||||
'feComposite,feConvolveMatrix,feDiffuseLighting,feDisplacementMap,' +
|
||||
'feDistanceLight,feDropShadow,feFlood,feFuncA,feFuncB,feFuncG,feFuncR,' +
|
||||
'feGaussianBlur,feImage,feMerge,feMergeNode,feMorphology,feOffset,' +
|
||||
'fePointLight,feSpecularLighting,feSpotLight,feTile,feTurbulence,filter,' +
|
||||
'foreignObject,g,hatch,hatchpath,image,line,linearGradient,marker,mask,' +
|
||||
'mesh,meshgradient,meshpatch,meshrow,metadata,mpath,path,pattern,' +
|
||||
'polygon,polyline,radialGradient,rect,set,solidcolor,stop,switch,symbol,' +
|
||||
'text,textPath,title,tspan,unknown,use,view';
|
||||
const VOID_TAGS = 'area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr';
|
||||
/**
|
||||
* Compiler only.
|
||||
* Do NOT use in runtime code paths unless behind `false` flag.
|
||||
*/
|
||||
const isHTMLTag = /*#__PURE__*/ makeMap(HTML_TAGS);
|
||||
/**
|
||||
* Compiler only.
|
||||
* Do NOT use in runtime code paths unless behind `false` flag.
|
||||
*/
|
||||
const isSVGTag = /*#__PURE__*/ makeMap(SVG_TAGS);
|
||||
/**
|
||||
* Compiler only.
|
||||
* Do NOT use in runtime code paths unless behind `false` flag.
|
||||
*/
|
||||
const isVoidTag = /*#__PURE__*/ makeMap(VOID_TAGS);
|
||||
|
||||
const escapeRE = /["'&<>]/;
|
||||
function escapeHtml(string) {
|
||||
const str = '' + string;
|
||||
const match = escapeRE.exec(str);
|
||||
if (!match) {
|
||||
return str;
|
||||
}
|
||||
let html = '';
|
||||
let escaped;
|
||||
let index;
|
||||
let lastIndex = 0;
|
||||
for (index = match.index; index < str.length; index++) {
|
||||
switch (str.charCodeAt(index)) {
|
||||
case 34: // "
|
||||
escaped = '"';
|
||||
break;
|
||||
case 38: // &
|
||||
escaped = '&';
|
||||
break;
|
||||
case 39: // '
|
||||
escaped = ''';
|
||||
break;
|
||||
case 60: // <
|
||||
escaped = '<';
|
||||
break;
|
||||
case 62: // >
|
||||
escaped = '>';
|
||||
break;
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
if (lastIndex !== index) {
|
||||
html += str.slice(lastIndex, index);
|
||||
}
|
||||
lastIndex = index + 1;
|
||||
html += escaped;
|
||||
}
|
||||
return lastIndex !== index ? html + str.slice(lastIndex, index) : html;
|
||||
}
|
||||
// https://www.w3.org/TR/html52/syntax.html#comments
|
||||
const commentStripRE = /^-?>|<!--|-->|--!>|<!-$/g;
|
||||
function escapeHtmlComment(src) {
|
||||
return src.replace(commentStripRE, '');
|
||||
}
|
||||
|
||||
function looseCompareArrays(a, b) {
|
||||
if (a.length !== b.length)
|
||||
return false;
|
||||
let equal = true;
|
||||
for (let i = 0; equal && i < a.length; i++) {
|
||||
equal = looseEqual(a[i], b[i]);
|
||||
}
|
||||
return equal;
|
||||
}
|
||||
function looseEqual(a, b) {
|
||||
if (a === b)
|
||||
return true;
|
||||
let aValidType = isDate(a);
|
||||
let bValidType = isDate(b);
|
||||
if (aValidType || bValidType) {
|
||||
return aValidType && bValidType ? a.getTime() === b.getTime() : false;
|
||||
}
|
||||
aValidType = isSymbol(a);
|
||||
bValidType = isSymbol(b);
|
||||
if (aValidType || bValidType) {
|
||||
return a === b;
|
||||
}
|
||||
aValidType = isArray(a);
|
||||
bValidType = isArray(b);
|
||||
if (aValidType || bValidType) {
|
||||
return aValidType && bValidType ? looseCompareArrays(a, b) : false;
|
||||
}
|
||||
aValidType = isObject(a);
|
||||
bValidType = isObject(b);
|
||||
if (aValidType || bValidType) {
|
||||
/* istanbul ignore if: this if will probably never be called */
|
||||
if (!aValidType || !bValidType) {
|
||||
return false;
|
||||
}
|
||||
const aKeysCount = Object.keys(a).length;
|
||||
const bKeysCount = Object.keys(b).length;
|
||||
if (aKeysCount !== bKeysCount) {
|
||||
return false;
|
||||
}
|
||||
for (const key in a) {
|
||||
const aHasKey = a.hasOwnProperty(key);
|
||||
const bHasKey = b.hasOwnProperty(key);
|
||||
if ((aHasKey && !bHasKey) ||
|
||||
(!aHasKey && bHasKey) ||
|
||||
!looseEqual(a[key], b[key])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return String(a) === String(b);
|
||||
}
|
||||
function looseIndexOf(arr, val) {
|
||||
return arr.findIndex(item => looseEqual(item, val));
|
||||
}
|
||||
|
||||
/**
|
||||
* For converting {{ interpolation }} values to displayed strings.
|
||||
* @private
|
||||
*/
|
||||
const toDisplayString = (val) => {
|
||||
return isString(val)
|
||||
? val
|
||||
: val == null
|
||||
? ''
|
||||
: isArray(val) ||
|
||||
(isObject(val) &&
|
||||
(val.toString === objectToString || !isFunction(val.toString)))
|
||||
? JSON.stringify(val, replacer, 2)
|
||||
: String(val);
|
||||
};
|
||||
const replacer = (_key, val) => {
|
||||
// can't use isRef here since @vue/shared has no deps
|
||||
if (val && val.__v_isRef) {
|
||||
return replacer(_key, val.value);
|
||||
}
|
||||
else if (isMap(val)) {
|
||||
return {
|
||||
[`Map(${val.size})`]: [...val.entries()].reduce((entries, [key, val]) => {
|
||||
entries[`${key} =>`] = val;
|
||||
return entries;
|
||||
}, {})
|
||||
};
|
||||
}
|
||||
else if (isSet(val)) {
|
||||
return {
|
||||
[`Set(${val.size})`]: [...val.values()]
|
||||
};
|
||||
}
|
||||
else if (isObject(val) && !isArray(val) && !isPlainObject(val)) {
|
||||
return String(val);
|
||||
}
|
||||
return val;
|
||||
};
|
||||
|
||||
const EMPTY_OBJ = {};
|
||||
const EMPTY_ARR = [];
|
||||
const NOOP = () => { };
|
||||
/**
|
||||
* Always return false.
|
||||
*/
|
||||
const NO = () => false;
|
||||
const onRE = /^on[^a-z]/;
|
||||
const isOn = (key) => onRE.test(key);
|
||||
const isModelListener = (key) => key.startsWith('onUpdate:');
|
||||
const extend = Object.assign;
|
||||
const remove = (arr, el) => {
|
||||
const i = arr.indexOf(el);
|
||||
if (i > -1) {
|
||||
arr.splice(i, 1);
|
||||
}
|
||||
};
|
||||
const hasOwnProperty = Object.prototype.hasOwnProperty;
|
||||
const hasOwn = (val, key) => hasOwnProperty.call(val, key);
|
||||
const isArray = Array.isArray;
|
||||
const isMap = (val) => toTypeString(val) === '[object Map]';
|
||||
const isSet = (val) => toTypeString(val) === '[object Set]';
|
||||
const isDate = (val) => toTypeString(val) === '[object Date]';
|
||||
const isFunction = (val) => typeof val === 'function';
|
||||
const isString = (val) => typeof val === 'string';
|
||||
const isSymbol = (val) => typeof val === 'symbol';
|
||||
const isObject = (val) => val !== null && typeof val === 'object';
|
||||
const isPromise = (val) => {
|
||||
return isObject(val) && isFunction(val.then) && isFunction(val.catch);
|
||||
};
|
||||
const objectToString = Object.prototype.toString;
|
||||
const toTypeString = (value) => objectToString.call(value);
|
||||
const toRawType = (value) => {
|
||||
// extract "RawType" from strings like "[object RawType]"
|
||||
return toTypeString(value).slice(8, -1);
|
||||
};
|
||||
const isPlainObject = (val) => toTypeString(val) === '[object Object]';
|
||||
const isIntegerKey = (key) => isString(key) &&
|
||||
key !== 'NaN' &&
|
||||
key[0] !== '-' &&
|
||||
'' + parseInt(key, 10) === key;
|
||||
const isReservedProp = /*#__PURE__*/ makeMap(
|
||||
// the leading comma is intentional so empty string "" is also included
|
||||
',key,ref,ref_for,ref_key,' +
|
||||
'onVnodeBeforeMount,onVnodeMounted,' +
|
||||
'onVnodeBeforeUpdate,onVnodeUpdated,' +
|
||||
'onVnodeBeforeUnmount,onVnodeUnmounted');
|
||||
const isBuiltInDirective = /*#__PURE__*/ makeMap('bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo');
|
||||
const cacheStringFunction = (fn) => {
|
||||
const cache = Object.create(null);
|
||||
return ((str) => {
|
||||
const hit = cache[str];
|
||||
return hit || (cache[str] = fn(str));
|
||||
});
|
||||
};
|
||||
const camelizeRE = /-(\w)/g;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
const camelize = cacheStringFunction((str) => {
|
||||
return str.replace(camelizeRE, (_, c) => (c ? c.toUpperCase() : ''));
|
||||
});
|
||||
const hyphenateRE = /\B([A-Z])/g;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
const hyphenate = cacheStringFunction((str) => str.replace(hyphenateRE, '-$1').toLowerCase());
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
const capitalize = cacheStringFunction((str) => str.charAt(0).toUpperCase() + str.slice(1));
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
const toHandlerKey = cacheStringFunction((str) => str ? `on${capitalize(str)}` : ``);
|
||||
// compare whether a value has changed, accounting for NaN.
|
||||
const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
|
||||
const invokeArrayFns = (fns, arg) => {
|
||||
for (let i = 0; i < fns.length; i++) {
|
||||
fns[i](arg);
|
||||
}
|
||||
};
|
||||
const def = (obj, key, value) => {
|
||||
Object.defineProperty(obj, key, {
|
||||
configurable: true,
|
||||
enumerable: false,
|
||||
value
|
||||
});
|
||||
};
|
||||
const toNumber = (val) => {
|
||||
const n = parseFloat(val);
|
||||
return isNaN(n) ? val : n;
|
||||
};
|
||||
let _globalThis;
|
||||
const getGlobalThis = () => {
|
||||
return (_globalThis ||
|
||||
(_globalThis =
|
||||
typeof globalThis !== 'undefined'
|
||||
? globalThis
|
||||
: typeof self !== 'undefined'
|
||||
? self
|
||||
: typeof window !== 'undefined'
|
||||
? window
|
||||
: typeof global !== 'undefined'
|
||||
? global
|
||||
: {}));
|
||||
};
|
||||
const identRE = /^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/;
|
||||
function genPropsAccessExp(name) {
|
||||
return identRE.test(name)
|
||||
? `__props.${name}`
|
||||
: `__props[${JSON.stringify(name)}]`;
|
||||
}
|
||||
|
||||
exports.EMPTY_ARR = EMPTY_ARR;
|
||||
exports.EMPTY_OBJ = EMPTY_OBJ;
|
||||
exports.NO = NO;
|
||||
exports.NOOP = NOOP;
|
||||
exports.PatchFlagNames = PatchFlagNames;
|
||||
exports.camelize = camelize;
|
||||
exports.capitalize = capitalize;
|
||||
exports.def = def;
|
||||
exports.escapeHtml = escapeHtml;
|
||||
exports.escapeHtmlComment = escapeHtmlComment;
|
||||
exports.extend = extend;
|
||||
exports.genPropsAccessExp = genPropsAccessExp;
|
||||
exports.generateCodeFrame = generateCodeFrame;
|
||||
exports.getGlobalThis = getGlobalThis;
|
||||
exports.hasChanged = hasChanged;
|
||||
exports.hasOwn = hasOwn;
|
||||
exports.hyphenate = hyphenate;
|
||||
exports.includeBooleanAttr = includeBooleanAttr;
|
||||
exports.invokeArrayFns = invokeArrayFns;
|
||||
exports.isArray = isArray;
|
||||
exports.isBooleanAttr = isBooleanAttr;
|
||||
exports.isBuiltInDirective = isBuiltInDirective;
|
||||
exports.isDate = isDate;
|
||||
exports.isFunction = isFunction;
|
||||
exports.isGloballyWhitelisted = isGloballyWhitelisted;
|
||||
exports.isHTMLTag = isHTMLTag;
|
||||
exports.isIntegerKey = isIntegerKey;
|
||||
exports.isKnownHtmlAttr = isKnownHtmlAttr;
|
||||
exports.isKnownSvgAttr = isKnownSvgAttr;
|
||||
exports.isMap = isMap;
|
||||
exports.isModelListener = isModelListener;
|
||||
exports.isNoUnitNumericStyleProp = isNoUnitNumericStyleProp;
|
||||
exports.isObject = isObject;
|
||||
exports.isOn = isOn;
|
||||
exports.isPlainObject = isPlainObject;
|
||||
exports.isPromise = isPromise;
|
||||
exports.isReservedProp = isReservedProp;
|
||||
exports.isSSRSafeAttrName = isSSRSafeAttrName;
|
||||
exports.isSVGTag = isSVGTag;
|
||||
exports.isSet = isSet;
|
||||
exports.isSpecialBooleanAttr = isSpecialBooleanAttr;
|
||||
exports.isString = isString;
|
||||
exports.isSymbol = isSymbol;
|
||||
exports.isVoidTag = isVoidTag;
|
||||
exports.looseEqual = looseEqual;
|
||||
exports.looseIndexOf = looseIndexOf;
|
||||
exports.makeMap = makeMap;
|
||||
exports.normalizeClass = normalizeClass;
|
||||
exports.normalizeProps = normalizeProps;
|
||||
exports.normalizeStyle = normalizeStyle;
|
||||
exports.objectToString = objectToString;
|
||||
exports.parseStringStyle = parseStringStyle;
|
||||
exports.propsToAttrMap = propsToAttrMap;
|
||||
exports.remove = remove;
|
||||
exports.slotFlagsText = slotFlagsText;
|
||||
exports.stringifyStyle = stringifyStyle;
|
||||
exports.toDisplayString = toDisplayString;
|
||||
exports.toHandlerKey = toHandlerKey;
|
||||
exports.toNumber = toNumber;
|
||||
exports.toRawType = toRawType;
|
||||
exports.toTypeString = toTypeString;
|
||||
356
node_modules/@vue/shared/dist/shared.d.ts
generated
vendored
Normal file
356
node_modules/@vue/shared/dist/shared.d.ts
generated
vendored
Normal file
@@ -0,0 +1,356 @@
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export declare const camelize: (str: string) => string;
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export declare const capitalize: (str: string) => string;
|
||||
|
||||
export declare const def: (obj: object, key: string | symbol, value: any) => void;
|
||||
|
||||
export declare const EMPTY_ARR: readonly never[];
|
||||
|
||||
export declare const EMPTY_OBJ: {
|
||||
readonly [key: string]: any;
|
||||
};
|
||||
|
||||
export declare function escapeHtml(string: unknown): string;
|
||||
|
||||
export declare function escapeHtmlComment(src: string): string;
|
||||
|
||||
export declare const extend: {
|
||||
<T, U>(target: T, source: U): T & U;
|
||||
<T_1, U_1, V>(target: T_1, source1: U_1, source2: V): T_1 & U_1 & V;
|
||||
<T_2, U_2, V_1, W>(target: T_2, source1: U_2, source2: V_1, source3: W): T_2 & U_2 & V_1 & W;
|
||||
(target: object, ...sources: any[]): any;
|
||||
};
|
||||
|
||||
export declare function generateCodeFrame(source: string, start?: number, end?: number): string;
|
||||
|
||||
export declare function genPropsAccessExp(name: string): string;
|
||||
|
||||
export declare const getGlobalThis: () => any;
|
||||
|
||||
export declare const hasChanged: (value: any, oldValue: any) => boolean;
|
||||
|
||||
export declare const hasOwn: (val: object, key: string | symbol) => key is never;
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export declare const hyphenate: (str: string) => string;
|
||||
|
||||
export declare type IfAny<T, Y, N> = 0 extends 1 & T ? Y : N;
|
||||
|
||||
/**
|
||||
* Boolean attributes should be included if the value is truthy or ''.
|
||||
* e.g. `<select multiple>` compiles to `{ multiple: '' }`
|
||||
*/
|
||||
export declare function includeBooleanAttr(value: unknown): boolean;
|
||||
|
||||
export declare const invokeArrayFns: (fns: Function[], arg?: any) => void;
|
||||
|
||||
export declare const isArray: (arg: any) => arg is any[];
|
||||
|
||||
/**
|
||||
* The full list is needed during SSR to produce the correct initial markup.
|
||||
*/
|
||||
export declare const isBooleanAttr: (key: string) => boolean;
|
||||
|
||||
export declare const isBuiltInDirective: (key: string) => boolean;
|
||||
|
||||
export declare const isDate: (val: unknown) => val is Date;
|
||||
|
||||
export declare const isFunction: (val: unknown) => val is Function;
|
||||
|
||||
export declare const isGloballyWhitelisted: (key: string) => boolean;
|
||||
|
||||
/**
|
||||
* Compiler only.
|
||||
* Do NOT use in runtime code paths unless behind `__DEV__` flag.
|
||||
*/
|
||||
export declare const isHTMLTag: (key: string) => boolean;
|
||||
|
||||
export declare const isIntegerKey: (key: unknown) => boolean;
|
||||
|
||||
/**
|
||||
* Known attributes, this is used for stringification of runtime static nodes
|
||||
* so that we don't stringify bindings that cannot be set from HTML.
|
||||
* Don't also forget to allow `data-*` and `aria-*`!
|
||||
* Generated from https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes
|
||||
*/
|
||||
export declare const isKnownHtmlAttr: (key: string) => boolean;
|
||||
|
||||
/**
|
||||
* Generated from https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute
|
||||
*/
|
||||
export declare const isKnownSvgAttr: (key: string) => boolean;
|
||||
|
||||
export declare const isMap: (val: unknown) => val is Map<any, any>;
|
||||
|
||||
export declare const isModelListener: (key: string) => boolean;
|
||||
|
||||
/**
|
||||
* CSS properties that accept plain numbers
|
||||
*/
|
||||
export declare const isNoUnitNumericStyleProp: (key: string) => boolean;
|
||||
|
||||
export declare const isObject: (val: unknown) => val is Record<any, any>;
|
||||
|
||||
export declare const isOn: (key: string) => boolean;
|
||||
|
||||
export declare const isPlainObject: (val: unknown) => val is object;
|
||||
|
||||
export declare const isPromise: <T = any>(val: unknown) => val is Promise<T>;
|
||||
|
||||
export declare const isReservedProp: (key: string) => boolean;
|
||||
|
||||
export declare const isSet: (val: unknown) => val is Set<any>;
|
||||
|
||||
export declare const isSpecialBooleanAttr: (key: string) => boolean;
|
||||
|
||||
export declare function isSSRSafeAttrName(name: string): boolean;
|
||||
|
||||
export declare const isString: (val: unknown) => val is string;
|
||||
|
||||
/**
|
||||
* Compiler only.
|
||||
* Do NOT use in runtime code paths unless behind `__DEV__` flag.
|
||||
*/
|
||||
export declare const isSVGTag: (key: string) => boolean;
|
||||
|
||||
export declare const isSymbol: (val: unknown) => val is symbol;
|
||||
|
||||
/**
|
||||
* Compiler only.
|
||||
* Do NOT use in runtime code paths unless behind `__DEV__` flag.
|
||||
*/
|
||||
export declare const isVoidTag: (key: string) => boolean;
|
||||
|
||||
export declare function looseEqual(a: any, b: any): boolean;
|
||||
|
||||
export declare function looseIndexOf(arr: any[], val: any): number;
|
||||
|
||||
export declare type LooseRequired<T> = {
|
||||
[P in string & keyof T]: T[P];
|
||||
};
|
||||
|
||||
/**
|
||||
* Make a map and return a function for checking if a key
|
||||
* is in that map.
|
||||
* IMPORTANT: all calls of this function must be prefixed with
|
||||
* \/\*#\_\_PURE\_\_\*\/
|
||||
* So that rollup can tree-shake them if necessary.
|
||||
*/
|
||||
export declare function makeMap(str: string, expectsLowerCase?: boolean): (key: string) => boolean;
|
||||
|
||||
/**
|
||||
* Always return false.
|
||||
*/
|
||||
export declare const NO: () => boolean;
|
||||
|
||||
export declare const NOOP: () => void;
|
||||
|
||||
export declare function normalizeClass(value: unknown): string;
|
||||
|
||||
export declare type NormalizedStyle = Record<string, string | number>;
|
||||
|
||||
export declare function normalizeProps(props: Record<string, any> | null): Record<string, any> | null;
|
||||
|
||||
export declare function normalizeStyle(value: unknown): NormalizedStyle | string | undefined;
|
||||
|
||||
export declare const objectToString: () => string;
|
||||
|
||||
export declare function parseStringStyle(cssText: string): NormalizedStyle;
|
||||
|
||||
/**
|
||||
* dev only flag -> name mapping
|
||||
*/
|
||||
export declare const PatchFlagNames: {
|
||||
[x: number]: string;
|
||||
};
|
||||
|
||||
/**
|
||||
* Patch flags are optimization hints generated by the compiler.
|
||||
* when a block with dynamicChildren is encountered during diff, the algorithm
|
||||
* enters "optimized mode". In this mode, we know that the vdom is produced by
|
||||
* a render function generated by the compiler, so the algorithm only needs to
|
||||
* handle updates explicitly marked by these patch flags.
|
||||
*
|
||||
* Patch flags can be combined using the | bitwise operator and can be checked
|
||||
* using the & operator, e.g.
|
||||
*
|
||||
* ```js
|
||||
* const flag = TEXT | CLASS
|
||||
* if (flag & TEXT) { ... }
|
||||
* ```
|
||||
*
|
||||
* Check the `patchElement` function in '../../runtime-core/src/renderer.ts' to see how the
|
||||
* flags are handled during diff.
|
||||
*/
|
||||
export declare const enum PatchFlags {
|
||||
/**
|
||||
* Indicates an element with dynamic textContent (children fast path)
|
||||
*/
|
||||
TEXT = 1,
|
||||
/**
|
||||
* Indicates an element with dynamic class binding.
|
||||
*/
|
||||
CLASS = 2,
|
||||
/**
|
||||
* Indicates an element with dynamic style
|
||||
* The compiler pre-compiles static string styles into static objects
|
||||
* + detects and hoists inline static objects
|
||||
* e.g. `style="color: red"` and `:style="{ color: 'red' }"` both get hoisted
|
||||
* as:
|
||||
* ```js
|
||||
* const style = { color: 'red' }
|
||||
* render() { return e('div', { style }) }
|
||||
* ```
|
||||
*/
|
||||
STYLE = 4,
|
||||
/**
|
||||
* Indicates an element that has non-class/style dynamic props.
|
||||
* Can also be on a component that has any dynamic props (includes
|
||||
* class/style). when this flag is present, the vnode also has a dynamicProps
|
||||
* array that contains the keys of the props that may change so the runtime
|
||||
* can diff them faster (without having to worry about removed props)
|
||||
*/
|
||||
PROPS = 8,
|
||||
/**
|
||||
* Indicates an element with props with dynamic keys. When keys change, a full
|
||||
* diff is always needed to remove the old key. This flag is mutually
|
||||
* exclusive with CLASS, STYLE and PROPS.
|
||||
*/
|
||||
FULL_PROPS = 16,
|
||||
/**
|
||||
* Indicates an element with event listeners (which need to be attached
|
||||
* during hydration)
|
||||
*/
|
||||
HYDRATE_EVENTS = 32,
|
||||
/**
|
||||
* Indicates a fragment whose children order doesn't change.
|
||||
*/
|
||||
STABLE_FRAGMENT = 64,
|
||||
/**
|
||||
* Indicates a fragment with keyed or partially keyed children
|
||||
*/
|
||||
KEYED_FRAGMENT = 128,
|
||||
/**
|
||||
* Indicates a fragment with unkeyed children.
|
||||
*/
|
||||
UNKEYED_FRAGMENT = 256,
|
||||
/**
|
||||
* Indicates an element that only needs non-props patching, e.g. ref or
|
||||
* directives (onVnodeXXX hooks). since every patched vnode checks for refs
|
||||
* and onVnodeXXX hooks, it simply marks the vnode so that a parent block
|
||||
* will track it.
|
||||
*/
|
||||
NEED_PATCH = 512,
|
||||
/**
|
||||
* Indicates a component with dynamic slots (e.g. slot that references a v-for
|
||||
* iterated value, or dynamic slot names).
|
||||
* Components with this flag are always force updated.
|
||||
*/
|
||||
DYNAMIC_SLOTS = 1024,
|
||||
/**
|
||||
* Indicates a fragment that was created only because the user has placed
|
||||
* comments at the root level of a template. This is a dev-only flag since
|
||||
* comments are stripped in production.
|
||||
*/
|
||||
DEV_ROOT_FRAGMENT = 2048,
|
||||
/**
|
||||
* SPECIAL FLAGS -------------------------------------------------------------
|
||||
* Special flags are negative integers. They are never matched against using
|
||||
* bitwise operators (bitwise matching should only happen in branches where
|
||||
* patchFlag > 0), and are mutually exclusive. When checking for a special
|
||||
* flag, simply check patchFlag === FLAG.
|
||||
*/
|
||||
/**
|
||||
* Indicates a hoisted static vnode. This is a hint for hydration to skip
|
||||
* the entire sub tree since static content never needs to be updated.
|
||||
*/
|
||||
HOISTED = -1,
|
||||
/**
|
||||
* A special flag that indicates that the diffing algorithm should bail out
|
||||
* of optimized mode. For example, on block fragments created by renderSlot()
|
||||
* when encountering non-compiler generated slots (i.e. manually written
|
||||
* render functions, which should always be fully diffed)
|
||||
* OR manually cloneVNodes
|
||||
*/
|
||||
BAIL = -2
|
||||
}
|
||||
|
||||
export declare const propsToAttrMap: Record<string, string | undefined>;
|
||||
|
||||
export declare const remove: <T>(arr: T[], el: T) => void;
|
||||
|
||||
export declare const enum ShapeFlags {
|
||||
ELEMENT = 1,
|
||||
FUNCTIONAL_COMPONENT = 2,
|
||||
STATEFUL_COMPONENT = 4,
|
||||
TEXT_CHILDREN = 8,
|
||||
ARRAY_CHILDREN = 16,
|
||||
SLOTS_CHILDREN = 32,
|
||||
TELEPORT = 64,
|
||||
SUSPENSE = 128,
|
||||
COMPONENT_SHOULD_KEEP_ALIVE = 256,
|
||||
COMPONENT_KEPT_ALIVE = 512,
|
||||
COMPONENT = 6
|
||||
}
|
||||
|
||||
export declare const enum SlotFlags {
|
||||
/**
|
||||
* Stable slots that only reference slot props or context state. The slot
|
||||
* can fully capture its own dependencies so when passed down the parent won't
|
||||
* need to force the child to update.
|
||||
*/
|
||||
STABLE = 1,
|
||||
/**
|
||||
* Slots that reference scope variables (v-for or an outer slot prop), or
|
||||
* has conditional structure (v-if, v-for). The parent will need to force
|
||||
* the child to update because the slot does not fully capture its dependencies.
|
||||
*/
|
||||
DYNAMIC = 2,
|
||||
/**
|
||||
* `<slot/>` being forwarded into a child component. Whether the parent needs
|
||||
* to update the child is dependent on what kind of slots the parent itself
|
||||
* received. This has to be refined at runtime, when the child's vnode
|
||||
* is being created (in `normalizeChildren`)
|
||||
*/
|
||||
FORWARDED = 3
|
||||
}
|
||||
|
||||
/**
|
||||
* Dev only
|
||||
*/
|
||||
export declare const slotFlagsText: {
|
||||
1: string;
|
||||
2: string;
|
||||
3: string;
|
||||
};
|
||||
|
||||
export declare function stringifyStyle(styles: NormalizedStyle | string | undefined): string;
|
||||
|
||||
/**
|
||||
* For converting {{ interpolation }} values to displayed strings.
|
||||
* @private
|
||||
*/
|
||||
export declare const toDisplayString: (val: unknown) => string;
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export declare const toHandlerKey: (str: string) => string;
|
||||
|
||||
export declare const toNumber: (val: any) => any;
|
||||
|
||||
export declare const toRawType: (value: unknown) => string;
|
||||
|
||||
export declare const toTypeString: (value: unknown) => string;
|
||||
|
||||
export declare type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
|
||||
|
||||
export { }
|
||||
596
node_modules/@vue/shared/dist/shared.esm-bundler.js
generated
vendored
Normal file
596
node_modules/@vue/shared/dist/shared.esm-bundler.js
generated
vendored
Normal file
@@ -0,0 +1,596 @@
|
||||
/**
|
||||
* Make a map and return a function for checking if a key
|
||||
* is in that map.
|
||||
* IMPORTANT: all calls of this function must be prefixed with
|
||||
* \/\*#\_\_PURE\_\_\*\/
|
||||
* So that rollup can tree-shake them if necessary.
|
||||
*/
|
||||
function makeMap(str, expectsLowerCase) {
|
||||
const map = Object.create(null);
|
||||
const list = str.split(',');
|
||||
for (let i = 0; i < list.length; i++) {
|
||||
map[list[i]] = true;
|
||||
}
|
||||
return expectsLowerCase ? val => !!map[val.toLowerCase()] : val => !!map[val];
|
||||
}
|
||||
|
||||
/**
|
||||
* dev only flag -> name mapping
|
||||
*/
|
||||
const PatchFlagNames = {
|
||||
[1 /* TEXT */]: `TEXT`,
|
||||
[2 /* CLASS */]: `CLASS`,
|
||||
[4 /* STYLE */]: `STYLE`,
|
||||
[8 /* PROPS */]: `PROPS`,
|
||||
[16 /* FULL_PROPS */]: `FULL_PROPS`,
|
||||
[32 /* HYDRATE_EVENTS */]: `HYDRATE_EVENTS`,
|
||||
[64 /* STABLE_FRAGMENT */]: `STABLE_FRAGMENT`,
|
||||
[128 /* KEYED_FRAGMENT */]: `KEYED_FRAGMENT`,
|
||||
[256 /* UNKEYED_FRAGMENT */]: `UNKEYED_FRAGMENT`,
|
||||
[512 /* NEED_PATCH */]: `NEED_PATCH`,
|
||||
[1024 /* DYNAMIC_SLOTS */]: `DYNAMIC_SLOTS`,
|
||||
[2048 /* DEV_ROOT_FRAGMENT */]: `DEV_ROOT_FRAGMENT`,
|
||||
[-1 /* HOISTED */]: `HOISTED`,
|
||||
[-2 /* BAIL */]: `BAIL`
|
||||
};
|
||||
|
||||
/**
|
||||
* Dev only
|
||||
*/
|
||||
const slotFlagsText = {
|
||||
[1 /* STABLE */]: 'STABLE',
|
||||
[2 /* DYNAMIC */]: 'DYNAMIC',
|
||||
[3 /* FORWARDED */]: 'FORWARDED'
|
||||
};
|
||||
|
||||
const GLOBALS_WHITE_LISTED = 'Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,' +
|
||||
'decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,' +
|
||||
'Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt';
|
||||
const isGloballyWhitelisted = /*#__PURE__*/ makeMap(GLOBALS_WHITE_LISTED);
|
||||
|
||||
const range = 2;
|
||||
function generateCodeFrame(source, start = 0, end = source.length) {
|
||||
// Split the content into individual lines but capture the newline sequence
|
||||
// that separated each line. This is important because the actual sequence is
|
||||
// needed to properly take into account the full line length for offset
|
||||
// comparison
|
||||
let lines = source.split(/(\r?\n)/);
|
||||
// Separate the lines and newline sequences into separate arrays for easier referencing
|
||||
const newlineSequences = lines.filter((_, idx) => idx % 2 === 1);
|
||||
lines = lines.filter((_, idx) => idx % 2 === 0);
|
||||
let count = 0;
|
||||
const res = [];
|
||||
for (let i = 0; i < lines.length; i++) {
|
||||
count +=
|
||||
lines[i].length +
|
||||
((newlineSequences[i] && newlineSequences[i].length) || 0);
|
||||
if (count >= start) {
|
||||
for (let j = i - range; j <= i + range || end > count; j++) {
|
||||
if (j < 0 || j >= lines.length)
|
||||
continue;
|
||||
const line = j + 1;
|
||||
res.push(`${line}${' '.repeat(Math.max(3 - String(line).length, 0))}| ${lines[j]}`);
|
||||
const lineLength = lines[j].length;
|
||||
const newLineSeqLength = (newlineSequences[j] && newlineSequences[j].length) || 0;
|
||||
if (j === i) {
|
||||
// push underline
|
||||
const pad = start - (count - (lineLength + newLineSeqLength));
|
||||
const length = Math.max(1, end > count ? lineLength - pad : end - start);
|
||||
res.push(` | ` + ' '.repeat(pad) + '^'.repeat(length));
|
||||
}
|
||||
else if (j > i) {
|
||||
if (end > count) {
|
||||
const length = Math.max(Math.min(end - count, lineLength), 1);
|
||||
res.push(` | ` + '^'.repeat(length));
|
||||
}
|
||||
count += lineLength + newLineSeqLength;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return res.join('\n');
|
||||
}
|
||||
|
||||
/**
|
||||
* On the client we only need to offer special cases for boolean attributes that
|
||||
* have different names from their corresponding dom properties:
|
||||
* - itemscope -> N/A
|
||||
* - allowfullscreen -> allowFullscreen
|
||||
* - formnovalidate -> formNoValidate
|
||||
* - ismap -> isMap
|
||||
* - nomodule -> noModule
|
||||
* - novalidate -> noValidate
|
||||
* - readonly -> readOnly
|
||||
*/
|
||||
const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;
|
||||
const isSpecialBooleanAttr = /*#__PURE__*/ makeMap(specialBooleanAttrs);
|
||||
/**
|
||||
* The full list is needed during SSR to produce the correct initial markup.
|
||||
*/
|
||||
const isBooleanAttr = /*#__PURE__*/ makeMap(specialBooleanAttrs +
|
||||
`,async,autofocus,autoplay,controls,default,defer,disabled,hidden,` +
|
||||
`loop,open,required,reversed,scoped,seamless,` +
|
||||
`checked,muted,multiple,selected`);
|
||||
/**
|
||||
* Boolean attributes should be included if the value is truthy or ''.
|
||||
* e.g. `<select multiple>` compiles to `{ multiple: '' }`
|
||||
*/
|
||||
function includeBooleanAttr(value) {
|
||||
return !!value || value === '';
|
||||
}
|
||||
const unsafeAttrCharRE = /[>/="'\u0009\u000a\u000c\u0020]/;
|
||||
const attrValidationCache = {};
|
||||
function isSSRSafeAttrName(name) {
|
||||
if (attrValidationCache.hasOwnProperty(name)) {
|
||||
return attrValidationCache[name];
|
||||
}
|
||||
const isUnsafe = unsafeAttrCharRE.test(name);
|
||||
if (isUnsafe) {
|
||||
console.error(`unsafe attribute name: ${name}`);
|
||||
}
|
||||
return (attrValidationCache[name] = !isUnsafe);
|
||||
}
|
||||
const propsToAttrMap = {
|
||||
acceptCharset: 'accept-charset',
|
||||
className: 'class',
|
||||
htmlFor: 'for',
|
||||
httpEquiv: 'http-equiv'
|
||||
};
|
||||
/**
|
||||
* CSS properties that accept plain numbers
|
||||
*/
|
||||
const isNoUnitNumericStyleProp = /*#__PURE__*/ makeMap(`animation-iteration-count,border-image-outset,border-image-slice,` +
|
||||
`border-image-width,box-flex,box-flex-group,box-ordinal-group,column-count,` +
|
||||
`columns,flex,flex-grow,flex-positive,flex-shrink,flex-negative,flex-order,` +
|
||||
`grid-row,grid-row-end,grid-row-span,grid-row-start,grid-column,` +
|
||||
`grid-column-end,grid-column-span,grid-column-start,font-weight,line-clamp,` +
|
||||
`line-height,opacity,order,orphans,tab-size,widows,z-index,zoom,` +
|
||||
// SVG
|
||||
`fill-opacity,flood-opacity,stop-opacity,stroke-dasharray,stroke-dashoffset,` +
|
||||
`stroke-miterlimit,stroke-opacity,stroke-width`);
|
||||
/**
|
||||
* Known attributes, this is used for stringification of runtime static nodes
|
||||
* so that we don't stringify bindings that cannot be set from HTML.
|
||||
* Don't also forget to allow `data-*` and `aria-*`!
|
||||
* Generated from https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes
|
||||
*/
|
||||
const isKnownHtmlAttr = /*#__PURE__*/ makeMap(`accept,accept-charset,accesskey,action,align,allow,alt,async,` +
|
||||
`autocapitalize,autocomplete,autofocus,autoplay,background,bgcolor,` +
|
||||
`border,buffered,capture,challenge,charset,checked,cite,class,code,` +
|
||||
`codebase,color,cols,colspan,content,contenteditable,contextmenu,controls,` +
|
||||
`coords,crossorigin,csp,data,datetime,decoding,default,defer,dir,dirname,` +
|
||||
`disabled,download,draggable,dropzone,enctype,enterkeyhint,for,form,` +
|
||||
`formaction,formenctype,formmethod,formnovalidate,formtarget,headers,` +
|
||||
`height,hidden,high,href,hreflang,http-equiv,icon,id,importance,integrity,` +
|
||||
`ismap,itemprop,keytype,kind,label,lang,language,loading,list,loop,low,` +
|
||||
`manifest,max,maxlength,minlength,media,min,multiple,muted,name,novalidate,` +
|
||||
`open,optimum,pattern,ping,placeholder,poster,preload,radiogroup,readonly,` +
|
||||
`referrerpolicy,rel,required,reversed,rows,rowspan,sandbox,scope,scoped,` +
|
||||
`selected,shape,size,sizes,slot,span,spellcheck,src,srcdoc,srclang,srcset,` +
|
||||
`start,step,style,summary,tabindex,target,title,translate,type,usemap,` +
|
||||
`value,width,wrap`);
|
||||
/**
|
||||
* Generated from https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute
|
||||
*/
|
||||
const isKnownSvgAttr = /*#__PURE__*/ makeMap(`xmlns,accent-height,accumulate,additive,alignment-baseline,alphabetic,amplitude,` +
|
||||
`arabic-form,ascent,attributeName,attributeType,azimuth,baseFrequency,` +
|
||||
`baseline-shift,baseProfile,bbox,begin,bias,by,calcMode,cap-height,class,` +
|
||||
`clip,clipPathUnits,clip-path,clip-rule,color,color-interpolation,` +
|
||||
`color-interpolation-filters,color-profile,color-rendering,` +
|
||||
`contentScriptType,contentStyleType,crossorigin,cursor,cx,cy,d,decelerate,` +
|
||||
`descent,diffuseConstant,direction,display,divisor,dominant-baseline,dur,dx,` +
|
||||
`dy,edgeMode,elevation,enable-background,end,exponent,fill,fill-opacity,` +
|
||||
`fill-rule,filter,filterRes,filterUnits,flood-color,flood-opacity,` +
|
||||
`font-family,font-size,font-size-adjust,font-stretch,font-style,` +
|
||||
`font-variant,font-weight,format,from,fr,fx,fy,g1,g2,glyph-name,` +
|
||||
`glyph-orientation-horizontal,glyph-orientation-vertical,glyphRef,` +
|
||||
`gradientTransform,gradientUnits,hanging,height,href,hreflang,horiz-adv-x,` +
|
||||
`horiz-origin-x,id,ideographic,image-rendering,in,in2,intercept,k,k1,k2,k3,` +
|
||||
`k4,kernelMatrix,kernelUnitLength,kerning,keyPoints,keySplines,keyTimes,` +
|
||||
`lang,lengthAdjust,letter-spacing,lighting-color,limitingConeAngle,local,` +
|
||||
`marker-end,marker-mid,marker-start,markerHeight,markerUnits,markerWidth,` +
|
||||
`mask,maskContentUnits,maskUnits,mathematical,max,media,method,min,mode,` +
|
||||
`name,numOctaves,offset,opacity,operator,order,orient,orientation,origin,` +
|
||||
`overflow,overline-position,overline-thickness,panose-1,paint-order,path,` +
|
||||
`pathLength,patternContentUnits,patternTransform,patternUnits,ping,` +
|
||||
`pointer-events,points,pointsAtX,pointsAtY,pointsAtZ,preserveAlpha,` +
|
||||
`preserveAspectRatio,primitiveUnits,r,radius,referrerPolicy,refX,refY,rel,` +
|
||||
`rendering-intent,repeatCount,repeatDur,requiredExtensions,requiredFeatures,` +
|
||||
`restart,result,rotate,rx,ry,scale,seed,shape-rendering,slope,spacing,` +
|
||||
`specularConstant,specularExponent,speed,spreadMethod,startOffset,` +
|
||||
`stdDeviation,stemh,stemv,stitchTiles,stop-color,stop-opacity,` +
|
||||
`strikethrough-position,strikethrough-thickness,string,stroke,` +
|
||||
`stroke-dasharray,stroke-dashoffset,stroke-linecap,stroke-linejoin,` +
|
||||
`stroke-miterlimit,stroke-opacity,stroke-width,style,surfaceScale,` +
|
||||
`systemLanguage,tabindex,tableValues,target,targetX,targetY,text-anchor,` +
|
||||
`text-decoration,text-rendering,textLength,to,transform,transform-origin,` +
|
||||
`type,u1,u2,underline-position,underline-thickness,unicode,unicode-bidi,` +
|
||||
`unicode-range,units-per-em,v-alphabetic,v-hanging,v-ideographic,` +
|
||||
`v-mathematical,values,vector-effect,version,vert-adv-y,vert-origin-x,` +
|
||||
`vert-origin-y,viewBox,viewTarget,visibility,width,widths,word-spacing,` +
|
||||
`writing-mode,x,x-height,x1,x2,xChannelSelector,xlink:actuate,xlink:arcrole,` +
|
||||
`xlink:href,xlink:role,xlink:show,xlink:title,xlink:type,xml:base,xml:lang,` +
|
||||
`xml:space,y,y1,y2,yChannelSelector,z,zoomAndPan`);
|
||||
|
||||
function normalizeStyle(value) {
|
||||
if (isArray(value)) {
|
||||
const res = {};
|
||||
for (let i = 0; i < value.length; i++) {
|
||||
const item = value[i];
|
||||
const normalized = isString(item)
|
||||
? parseStringStyle(item)
|
||||
: normalizeStyle(item);
|
||||
if (normalized) {
|
||||
for (const key in normalized) {
|
||||
res[key] = normalized[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
else if (isString(value)) {
|
||||
return value;
|
||||
}
|
||||
else if (isObject(value)) {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
const listDelimiterRE = /;(?![^(]*\))/g;
|
||||
const propertyDelimiterRE = /:(.+)/;
|
||||
function parseStringStyle(cssText) {
|
||||
const ret = {};
|
||||
cssText.split(listDelimiterRE).forEach(item => {
|
||||
if (item) {
|
||||
const tmp = item.split(propertyDelimiterRE);
|
||||
tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());
|
||||
}
|
||||
});
|
||||
return ret;
|
||||
}
|
||||
function stringifyStyle(styles) {
|
||||
let ret = '';
|
||||
if (!styles || isString(styles)) {
|
||||
return ret;
|
||||
}
|
||||
for (const key in styles) {
|
||||
const value = styles[key];
|
||||
const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key);
|
||||
if (isString(value) ||
|
||||
(typeof value === 'number' && isNoUnitNumericStyleProp(normalizedKey))) {
|
||||
// only render valid values
|
||||
ret += `${normalizedKey}:${value};`;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
function normalizeClass(value) {
|
||||
let res = '';
|
||||
if (isString(value)) {
|
||||
res = value;
|
||||
}
|
||||
else if (isArray(value)) {
|
||||
for (let i = 0; i < value.length; i++) {
|
||||
const normalized = normalizeClass(value[i]);
|
||||
if (normalized) {
|
||||
res += normalized + ' ';
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (isObject(value)) {
|
||||
for (const name in value) {
|
||||
if (value[name]) {
|
||||
res += name + ' ';
|
||||
}
|
||||
}
|
||||
}
|
||||
return res.trim();
|
||||
}
|
||||
function normalizeProps(props) {
|
||||
if (!props)
|
||||
return null;
|
||||
let { class: klass, style } = props;
|
||||
if (klass && !isString(klass)) {
|
||||
props.class = normalizeClass(klass);
|
||||
}
|
||||
if (style) {
|
||||
props.style = normalizeStyle(style);
|
||||
}
|
||||
return props;
|
||||
}
|
||||
|
||||
// These tag configs are shared between compiler-dom and runtime-dom, so they
|
||||
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element
|
||||
const HTML_TAGS = 'html,body,base,head,link,meta,style,title,address,article,aside,footer,' +
|
||||
'header,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,' +
|
||||
'figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,' +
|
||||
'data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,' +
|
||||
'time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,' +
|
||||
'canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,' +
|
||||
'th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,' +
|
||||
'option,output,progress,select,textarea,details,dialog,menu,' +
|
||||
'summary,template,blockquote,iframe,tfoot';
|
||||
// https://developer.mozilla.org/en-US/docs/Web/SVG/Element
|
||||
const SVG_TAGS = 'svg,animate,animateMotion,animateTransform,circle,clipPath,color-profile,' +
|
||||
'defs,desc,discard,ellipse,feBlend,feColorMatrix,feComponentTransfer,' +
|
||||
'feComposite,feConvolveMatrix,feDiffuseLighting,feDisplacementMap,' +
|
||||
'feDistanceLight,feDropShadow,feFlood,feFuncA,feFuncB,feFuncG,feFuncR,' +
|
||||
'feGaussianBlur,feImage,feMerge,feMergeNode,feMorphology,feOffset,' +
|
||||
'fePointLight,feSpecularLighting,feSpotLight,feTile,feTurbulence,filter,' +
|
||||
'foreignObject,g,hatch,hatchpath,image,line,linearGradient,marker,mask,' +
|
||||
'mesh,meshgradient,meshpatch,meshrow,metadata,mpath,path,pattern,' +
|
||||
'polygon,polyline,radialGradient,rect,set,solidcolor,stop,switch,symbol,' +
|
||||
'text,textPath,title,tspan,unknown,use,view';
|
||||
const VOID_TAGS = 'area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr';
|
||||
/**
|
||||
* Compiler only.
|
||||
* Do NOT use in runtime code paths unless behind `(process.env.NODE_ENV !== 'production')` flag.
|
||||
*/
|
||||
const isHTMLTag = /*#__PURE__*/ makeMap(HTML_TAGS);
|
||||
/**
|
||||
* Compiler only.
|
||||
* Do NOT use in runtime code paths unless behind `(process.env.NODE_ENV !== 'production')` flag.
|
||||
*/
|
||||
const isSVGTag = /*#__PURE__*/ makeMap(SVG_TAGS);
|
||||
/**
|
||||
* Compiler only.
|
||||
* Do NOT use in runtime code paths unless behind `(process.env.NODE_ENV !== 'production')` flag.
|
||||
*/
|
||||
const isVoidTag = /*#__PURE__*/ makeMap(VOID_TAGS);
|
||||
|
||||
const escapeRE = /["'&<>]/;
|
||||
function escapeHtml(string) {
|
||||
const str = '' + string;
|
||||
const match = escapeRE.exec(str);
|
||||
if (!match) {
|
||||
return str;
|
||||
}
|
||||
let html = '';
|
||||
let escaped;
|
||||
let index;
|
||||
let lastIndex = 0;
|
||||
for (index = match.index; index < str.length; index++) {
|
||||
switch (str.charCodeAt(index)) {
|
||||
case 34: // "
|
||||
escaped = '"';
|
||||
break;
|
||||
case 38: // &
|
||||
escaped = '&';
|
||||
break;
|
||||
case 39: // '
|
||||
escaped = ''';
|
||||
break;
|
||||
case 60: // <
|
||||
escaped = '<';
|
||||
break;
|
||||
case 62: // >
|
||||
escaped = '>';
|
||||
break;
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
if (lastIndex !== index) {
|
||||
html += str.slice(lastIndex, index);
|
||||
}
|
||||
lastIndex = index + 1;
|
||||
html += escaped;
|
||||
}
|
||||
return lastIndex !== index ? html + str.slice(lastIndex, index) : html;
|
||||
}
|
||||
// https://www.w3.org/TR/html52/syntax.html#comments
|
||||
const commentStripRE = /^-?>|<!--|-->|--!>|<!-$/g;
|
||||
function escapeHtmlComment(src) {
|
||||
return src.replace(commentStripRE, '');
|
||||
}
|
||||
|
||||
function looseCompareArrays(a, b) {
|
||||
if (a.length !== b.length)
|
||||
return false;
|
||||
let equal = true;
|
||||
for (let i = 0; equal && i < a.length; i++) {
|
||||
equal = looseEqual(a[i], b[i]);
|
||||
}
|
||||
return equal;
|
||||
}
|
||||
function looseEqual(a, b) {
|
||||
if (a === b)
|
||||
return true;
|
||||
let aValidType = isDate(a);
|
||||
let bValidType = isDate(b);
|
||||
if (aValidType || bValidType) {
|
||||
return aValidType && bValidType ? a.getTime() === b.getTime() : false;
|
||||
}
|
||||
aValidType = isSymbol(a);
|
||||
bValidType = isSymbol(b);
|
||||
if (aValidType || bValidType) {
|
||||
return a === b;
|
||||
}
|
||||
aValidType = isArray(a);
|
||||
bValidType = isArray(b);
|
||||
if (aValidType || bValidType) {
|
||||
return aValidType && bValidType ? looseCompareArrays(a, b) : false;
|
||||
}
|
||||
aValidType = isObject(a);
|
||||
bValidType = isObject(b);
|
||||
if (aValidType || bValidType) {
|
||||
/* istanbul ignore if: this if will probably never be called */
|
||||
if (!aValidType || !bValidType) {
|
||||
return false;
|
||||
}
|
||||
const aKeysCount = Object.keys(a).length;
|
||||
const bKeysCount = Object.keys(b).length;
|
||||
if (aKeysCount !== bKeysCount) {
|
||||
return false;
|
||||
}
|
||||
for (const key in a) {
|
||||
const aHasKey = a.hasOwnProperty(key);
|
||||
const bHasKey = b.hasOwnProperty(key);
|
||||
if ((aHasKey && !bHasKey) ||
|
||||
(!aHasKey && bHasKey) ||
|
||||
!looseEqual(a[key], b[key])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return String(a) === String(b);
|
||||
}
|
||||
function looseIndexOf(arr, val) {
|
||||
return arr.findIndex(item => looseEqual(item, val));
|
||||
}
|
||||
|
||||
/**
|
||||
* For converting {{ interpolation }} values to displayed strings.
|
||||
* @private
|
||||
*/
|
||||
const toDisplayString = (val) => {
|
||||
return isString(val)
|
||||
? val
|
||||
: val == null
|
||||
? ''
|
||||
: isArray(val) ||
|
||||
(isObject(val) &&
|
||||
(val.toString === objectToString || !isFunction(val.toString)))
|
||||
? JSON.stringify(val, replacer, 2)
|
||||
: String(val);
|
||||
};
|
||||
const replacer = (_key, val) => {
|
||||
// can't use isRef here since @vue/shared has no deps
|
||||
if (val && val.__v_isRef) {
|
||||
return replacer(_key, val.value);
|
||||
}
|
||||
else if (isMap(val)) {
|
||||
return {
|
||||
[`Map(${val.size})`]: [...val.entries()].reduce((entries, [key, val]) => {
|
||||
entries[`${key} =>`] = val;
|
||||
return entries;
|
||||
}, {})
|
||||
};
|
||||
}
|
||||
else if (isSet(val)) {
|
||||
return {
|
||||
[`Set(${val.size})`]: [...val.values()]
|
||||
};
|
||||
}
|
||||
else if (isObject(val) && !isArray(val) && !isPlainObject(val)) {
|
||||
return String(val);
|
||||
}
|
||||
return val;
|
||||
};
|
||||
|
||||
const EMPTY_OBJ = (process.env.NODE_ENV !== 'production')
|
||||
? Object.freeze({})
|
||||
: {};
|
||||
const EMPTY_ARR = (process.env.NODE_ENV !== 'production') ? Object.freeze([]) : [];
|
||||
const NOOP = () => { };
|
||||
/**
|
||||
* Always return false.
|
||||
*/
|
||||
const NO = () => false;
|
||||
const onRE = /^on[^a-z]/;
|
||||
const isOn = (key) => onRE.test(key);
|
||||
const isModelListener = (key) => key.startsWith('onUpdate:');
|
||||
const extend = Object.assign;
|
||||
const remove = (arr, el) => {
|
||||
const i = arr.indexOf(el);
|
||||
if (i > -1) {
|
||||
arr.splice(i, 1);
|
||||
}
|
||||
};
|
||||
const hasOwnProperty = Object.prototype.hasOwnProperty;
|
||||
const hasOwn = (val, key) => hasOwnProperty.call(val, key);
|
||||
const isArray = Array.isArray;
|
||||
const isMap = (val) => toTypeString(val) === '[object Map]';
|
||||
const isSet = (val) => toTypeString(val) === '[object Set]';
|
||||
const isDate = (val) => toTypeString(val) === '[object Date]';
|
||||
const isFunction = (val) => typeof val === 'function';
|
||||
const isString = (val) => typeof val === 'string';
|
||||
const isSymbol = (val) => typeof val === 'symbol';
|
||||
const isObject = (val) => val !== null && typeof val === 'object';
|
||||
const isPromise = (val) => {
|
||||
return isObject(val) && isFunction(val.then) && isFunction(val.catch);
|
||||
};
|
||||
const objectToString = Object.prototype.toString;
|
||||
const toTypeString = (value) => objectToString.call(value);
|
||||
const toRawType = (value) => {
|
||||
// extract "RawType" from strings like "[object RawType]"
|
||||
return toTypeString(value).slice(8, -1);
|
||||
};
|
||||
const isPlainObject = (val) => toTypeString(val) === '[object Object]';
|
||||
const isIntegerKey = (key) => isString(key) &&
|
||||
key !== 'NaN' &&
|
||||
key[0] !== '-' &&
|
||||
'' + parseInt(key, 10) === key;
|
||||
const isReservedProp = /*#__PURE__*/ makeMap(
|
||||
// the leading comma is intentional so empty string "" is also included
|
||||
',key,ref,ref_for,ref_key,' +
|
||||
'onVnodeBeforeMount,onVnodeMounted,' +
|
||||
'onVnodeBeforeUpdate,onVnodeUpdated,' +
|
||||
'onVnodeBeforeUnmount,onVnodeUnmounted');
|
||||
const isBuiltInDirective = /*#__PURE__*/ makeMap('bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo');
|
||||
const cacheStringFunction = (fn) => {
|
||||
const cache = Object.create(null);
|
||||
return ((str) => {
|
||||
const hit = cache[str];
|
||||
return hit || (cache[str] = fn(str));
|
||||
});
|
||||
};
|
||||
const camelizeRE = /-(\w)/g;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
const camelize = cacheStringFunction((str) => {
|
||||
return str.replace(camelizeRE, (_, c) => (c ? c.toUpperCase() : ''));
|
||||
});
|
||||
const hyphenateRE = /\B([A-Z])/g;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
const hyphenate = cacheStringFunction((str) => str.replace(hyphenateRE, '-$1').toLowerCase());
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
const capitalize = cacheStringFunction((str) => str.charAt(0).toUpperCase() + str.slice(1));
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
const toHandlerKey = cacheStringFunction((str) => str ? `on${capitalize(str)}` : ``);
|
||||
// compare whether a value has changed, accounting for NaN.
|
||||
const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
|
||||
const invokeArrayFns = (fns, arg) => {
|
||||
for (let i = 0; i < fns.length; i++) {
|
||||
fns[i](arg);
|
||||
}
|
||||
};
|
||||
const def = (obj, key, value) => {
|
||||
Object.defineProperty(obj, key, {
|
||||
configurable: true,
|
||||
enumerable: false,
|
||||
value
|
||||
});
|
||||
};
|
||||
const toNumber = (val) => {
|
||||
const n = parseFloat(val);
|
||||
return isNaN(n) ? val : n;
|
||||
};
|
||||
let _globalThis;
|
||||
const getGlobalThis = () => {
|
||||
return (_globalThis ||
|
||||
(_globalThis =
|
||||
typeof globalThis !== 'undefined'
|
||||
? globalThis
|
||||
: typeof self !== 'undefined'
|
||||
? self
|
||||
: typeof window !== 'undefined'
|
||||
? window
|
||||
: typeof global !== 'undefined'
|
||||
? global
|
||||
: {}));
|
||||
};
|
||||
const identRE = /^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/;
|
||||
function genPropsAccessExp(name) {
|
||||
return identRE.test(name)
|
||||
? `__props.${name}`
|
||||
: `__props[${JSON.stringify(name)}]`;
|
||||
}
|
||||
|
||||
export { EMPTY_ARR, EMPTY_OBJ, NO, NOOP, PatchFlagNames, camelize, capitalize, def, escapeHtml, escapeHtmlComment, extend, genPropsAccessExp, generateCodeFrame, getGlobalThis, hasChanged, hasOwn, hyphenate, includeBooleanAttr, invokeArrayFns, isArray, isBooleanAttr, isBuiltInDirective, isDate, isFunction, isGloballyWhitelisted, isHTMLTag, isIntegerKey, isKnownHtmlAttr, isKnownSvgAttr, isMap, isModelListener, isNoUnitNumericStyleProp, isObject, isOn, isPlainObject, isPromise, isReservedProp, isSSRSafeAttrName, isSVGTag, isSet, isSpecialBooleanAttr, isString, isSymbol, isVoidTag, looseEqual, looseIndexOf, makeMap, normalizeClass, normalizeProps, normalizeStyle, objectToString, parseStringStyle, propsToAttrMap, remove, slotFlagsText, stringifyStyle, toDisplayString, toHandlerKey, toNumber, toRawType, toTypeString };
|
||||
7
node_modules/@vue/shared/index.js
generated
vendored
Normal file
7
node_modules/@vue/shared/index.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
'use strict'
|
||||
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
module.exports = require('./dist/shared.cjs.prod.js')
|
||||
} else {
|
||||
module.exports = require('./dist/shared.cjs.js')
|
||||
}
|
||||
33
node_modules/@vue/shared/package.json
generated
vendored
Normal file
33
node_modules/@vue/shared/package.json
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
{
|
||||
"name": "@vue/shared",
|
||||
"version": "3.2.36",
|
||||
"description": "internal utils shared across @vue packages",
|
||||
"main": "index.js",
|
||||
"module": "dist/shared.esm-bundler.js",
|
||||
"types": "dist/shared.d.ts",
|
||||
"files": [
|
||||
"index.js",
|
||||
"dist"
|
||||
],
|
||||
"sideEffects": false,
|
||||
"buildOptions": {
|
||||
"formats": [
|
||||
"esm-bundler",
|
||||
"cjs"
|
||||
]
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/vuejs/core.git",
|
||||
"directory": "packages/shared"
|
||||
},
|
||||
"keywords": [
|
||||
"vue"
|
||||
],
|
||||
"author": "Evan You",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/vuejs/core/issues"
|
||||
},
|
||||
"homepage": "https://github.com/vuejs/core/tree/main/packages/shared#readme"
|
||||
}
|
||||
Reference in New Issue
Block a user