🔧 npm update

This commit is contained in:
2025-04-15 20:50:11 +02:00
parent ce5b9ac0c8
commit 94a90edabd
828 changed files with 256791 additions and 197083 deletions
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+82 -24
View File
@@ -1,7 +1,7 @@
import { PatchFlags } from '@vue/shared';
export { generateCodeFrame } from '@vue/shared';
import { Node as Node$1, Identifier, Function, BlockStatement as BlockStatement$1, Program, ObjectProperty } from '@babel/types';
import { ParserPlugin } from '@babel/parser';
import { RawSourceMap, SourceMapGenerator } from 'source-map-js';
export { generateCodeFrame } from '@vue/shared';
export declare const FRAGMENT: unique symbol;
export declare const TELEPORT: unique symbol;
@@ -35,7 +35,14 @@ export declare const CAMELIZE: unique symbol;
export declare const CAPITALIZE: unique symbol;
export declare const TO_HANDLER_KEY: unique symbol;
export declare const SET_BLOCK_TRACKING: unique symbol;
/**
* @deprecated no longer needed in 3.5+ because we no longer hoist element nodes
* but kept for backwards compat
*/
export declare const PUSH_SCOPE_ID: unique symbol;
/**
* @deprecated kept for backwards compat
*/
export declare const POP_SCOPE_ID: unique symbol;
export declare const WITH_CTX: unique symbol;
export declare const UNREF: unique symbol;
@@ -89,7 +96,7 @@ export interface TransformContext extends Required<Omit<TransformOptions, keyof
hoists: (JSChildNode | null)[];
imports: ImportItem[];
temps: number;
cached: number;
cached: (CacheExpression | null)[];
identifiers: {
[name: string]: number | undefined;
};
@@ -100,6 +107,7 @@ export interface TransformContext extends Required<Omit<TransformOptions, keyof
vOnce: number;
};
parent: ParentNode | null;
grandParent: ParentNode | null;
childIndex: number;
currentNode: RootNode | TemplateChildNode | null;
inVOnce: boolean;
@@ -112,7 +120,7 @@ export interface TransformContext extends Required<Omit<TransformOptions, keyof
addIdentifiers(exp: ExpressionNode | string): void;
removeIdentifiers(exp: ExpressionNode | string): void;
hoist(exp: string | JSChildNode | ArrayExpression): SimpleExpressionNode;
cache<T extends JSChildNode>(exp: T, isVNode?: boolean): CacheExpression | T;
cache(exp: JSChildNode, isVNode?: boolean, inVOnce?: boolean): CacheExpression;
constantCache: WeakMap<TemplateChildNode, ConstantTypes>;
filters?: Set<string>;
}
@@ -124,7 +132,7 @@ export declare function createStructuralDirectiveTransform(name: string | RegExp
export declare const transformElement: NodeTransform;
export declare function resolveComponentType(node: ComponentNode, context: TransformContext, ssr?: boolean): string | symbol | CallExpression;
export type PropsExpression = ObjectExpression | CallExpression | ExpressionNode;
export declare function buildProps(node: ElementNode, context: TransformContext, props: (DirectiveNode | AttributeNode)[] | undefined, isComponent: boolean, isDynamicComponent: boolean, ssr?: boolean): {
export declare function buildProps(node: ElementNode, context: TransformContext, props: ElementNode['props'] | undefined, isComponent: boolean, isDynamicComponent: boolean, ssr?: boolean): {
props: PropsExpression | undefined;
directives: DirectiveNode[];
patchFlag: number;
@@ -200,7 +208,7 @@ export interface RootNode extends Node {
directives: string[];
hoists: (JSChildNode | null)[];
imports: ImportItem[];
cached: number;
cached: (CacheExpression | null)[];
temps: number;
ssrHelpers?: symbol[];
codegenNode?: TemplateChildNode | JSChildNode | BlockStatement;
@@ -264,7 +272,7 @@ export interface DirectiveNode extends Node {
rawName?: string;
exp: ExpressionNode | undefined;
arg: ExpressionNode | undefined;
modifiers: string[];
modifiers: SimpleExpressionNode[];
/**
* optional property to cache the expression parse result for v-for
*/
@@ -278,7 +286,7 @@ export interface DirectiveNode extends Node {
export declare enum ConstantTypes {
NOT_CONSTANT = 0,
CAN_SKIP_PATCH = 1,
CAN_HOIST = 2,
CAN_CACHE = 2,
CAN_STRINGIFY = 3
}
export interface SimpleExpressionNode extends Node {
@@ -363,8 +371,8 @@ export interface VNodeCall extends Node {
type: NodeTypes.VNODE_CALL;
tag: string | symbol | CallExpression;
props: PropsExpression | undefined;
children: TemplateChildNode[] | TemplateTextChildNode | SlotsExpression | ForRenderListExpression | SimpleExpressionNode | undefined;
patchFlag: string | undefined;
children: TemplateChildNode[] | TemplateTextChildNode | SlotsExpression | ForRenderListExpression | SimpleExpressionNode | CacheExpression | undefined;
patchFlag: PatchFlags | undefined;
dynamicProps: string | SimpleExpressionNode | undefined;
directives: DirectiveArguments | undefined;
isBlock: boolean;
@@ -418,7 +426,9 @@ export interface CacheExpression extends Node {
type: NodeTypes.JS_CACHE_EXPRESSION;
index: number;
value: JSChildNode;
isVNode: boolean;
needPauseTracking: boolean;
inVOnce: boolean;
needArraySpread: boolean;
}
export interface MemoExpression extends CallExpression {
callee: typeof WITH_MEMO;
@@ -478,7 +488,7 @@ export interface SlotsObjectProperty extends Property {
value: SlotFunctionExpression;
}
export interface SlotFunctionExpression extends FunctionExpression {
returns: TemplateChildNode[];
returns: TemplateChildNode[] | CacheExpression;
}
export interface DynamicSlotsExpression extends CallExpression {
callee: typeof CREATE_SLOTS;
@@ -514,7 +524,7 @@ export interface ForCodegenNode extends VNodeCall {
tag: typeof FRAGMENT;
props: undefined;
children: ForRenderListExpression;
patchFlag: string;
patchFlag: PatchFlags;
disableTracking: boolean;
}
export interface ForRenderListExpression extends CallExpression {
@@ -522,7 +532,7 @@ export interface ForRenderListExpression extends CallExpression {
arguments: [ExpressionNode, ForIteratorExpression];
}
export interface ForIteratorExpression extends FunctionExpression {
returns: BlockCodegenNode;
returns?: BlockCodegenNode;
}
export declare const locStub: SourceLocation;
export declare function createRoot(children: TemplateChildNode[], source?: string): RootNode;
@@ -537,7 +547,7 @@ type InferCodegenNodeType<T> = T extends typeof RENDER_SLOT ? RenderSlotCall : C
export declare function createCallExpression<T extends CallExpression['callee']>(callee: T, args?: CallExpression['arguments'], loc?: SourceLocation): InferCodegenNodeType<T>;
export declare function createFunctionExpression(params: FunctionExpression['params'], returns?: FunctionExpression['returns'], newline?: boolean, isSlot?: boolean, loc?: SourceLocation): FunctionExpression;
export declare function createConditionalExpression(test: ConditionalExpression['test'], consequent: ConditionalExpression['consequent'], alternate: ConditionalExpression['alternate'], newline?: boolean): ConditionalExpression;
export declare function createCacheExpression(index: number, value: JSChildNode, isVNode?: boolean): CacheExpression;
export declare function createCacheExpression(index: number, value: JSChildNode, needPauseTracking?: boolean, inVOnce?: boolean): CacheExpression;
export declare function createBlockStatement(body: BlockStatement['body']): BlockStatement;
export declare function createTemplateLiteral(elements: TemplateLiteral['elements']): TemplateLiteral;
export declare function createIfStatement(test: IfStatement['test'], consequent: IfStatement['consequent'], alternate?: IfStatement['alternate']): IfStatement;
@@ -612,7 +622,8 @@ export declare enum ErrorCodes {
X_CACHE_HANDLER_NOT_SUPPORTED = 49,
X_SCOPE_ID_NOT_SUPPORTED = 50,
X_VNODE_HOOKS = 51,
__EXTEND_POINT__ = 52
X_V_BIND_INVALID_SAME_NAME_ARGUMENT = 52,
__EXTEND_POINT__ = 53
}
export declare const errorMessages: Record<ErrorCodes, string>;
@@ -651,6 +662,11 @@ export interface ParserOptions extends ErrorHandlingOptions, CompilerCompatOptio
* e.g. elements that should preserve whitespace inside, e.g. `<pre>`
*/
isPreTag?: (tag: string) => boolean;
/**
* Elements that should ignore the first newline token per parinsg spec
* e.g. `<textarea>` and `<pre>`
*/
isIgnoreNewlineTag?: (tag: string) => boolean;
/**
* Platform-specific built-in components e.g. `<Transition>`
*/
@@ -669,6 +685,7 @@ export interface ParserOptions extends ErrorHandlingOptions, CompilerCompatOptio
delimiters?: [string, string];
/**
* Whitespace handling strategy
* @default 'condense'
*/
whitespace?: 'preserve' | 'condense';
/**
@@ -832,7 +849,7 @@ export interface TransformOptions extends SharedTransformCodegenOptions, ErrorHa
*/
prefixIdentifiers?: boolean;
/**
* Hoist static VNodes and props objects to `_hoisted_x` constants
* Cache static VNodes and props objects to `_hoisted_x` constants
* @default false
*/
hoistStatic?: boolean;
@@ -923,6 +940,41 @@ export interface CodegenOptions extends SharedTransformCodegenOptions {
}
export type CompilerOptions = ParserOptions & TransformOptions & CodegenOptions;
/**
* The `SourceMapGenerator` type from `source-map-js` is a bit incomplete as it
* misses `toJSON()`. We also need to add types for internal properties which we
* need to access for better performance.
*
* Since TS 5.3, dts generation starts to strangely include broken triple slash
* references for source-map-js, so we are inlining all source map related types
* here to to workaround that.
*/
export interface CodegenSourceMapGenerator {
setSourceContent(sourceFile: string, sourceContent: string): void;
toJSON(): RawSourceMap;
_sources: Set<string>;
_names: Set<string>;
_mappings: {
add(mapping: MappingItem): void;
};
}
export interface RawSourceMap {
file?: string;
sourceRoot?: string;
version: string;
sources: string[];
names: string[];
sourcesContent?: string[];
mappings: string;
}
interface MappingItem {
source: string;
generatedLine: number;
generatedColumn: number;
originalLine: number;
originalColumn: number;
name: string | null;
}
type CodegenNode = TemplateChildNode | JSChildNode | SSRCodegenNode;
export interface CodegenResult {
code: string;
@@ -938,7 +990,7 @@ export interface CodegenContext extends Omit<Required<CodegenOptions>, 'bindingM
offset: number;
indentLevel: number;
pure: boolean;
map?: SourceMapGenerator;
map?: CodegenSourceMapGenerator;
helper(key: symbol): string;
push(code: string, newlineIndex?: number, node?: CodegenNode): void;
indent(): void;
@@ -965,9 +1017,12 @@ export declare const isSimpleIdentifier: (name: string) => boolean;
* inside square brackets), but it's ok since these are only used on template
* expressions and false positives are invalid expressions in the first place.
*/
export declare const isMemberExpressionBrowser: (path: string) => boolean;
export declare const isMemberExpressionNode: (path: string, context: TransformContext) => boolean;
export declare const isMemberExpression: (path: string, context: TransformContext) => boolean;
export declare const isMemberExpressionBrowser: (exp: ExpressionNode) => boolean;
export declare const isMemberExpressionNode: (exp: ExpressionNode, context: TransformContext) => boolean;
export declare const isMemberExpression: (exp: ExpressionNode, context: TransformContext) => boolean;
export declare const isFnExpressionBrowser: (exp: ExpressionNode) => boolean;
export declare const isFnExpressionNode: (exp: ExpressionNode, context: TransformContext) => boolean;
export declare const isFnExpression: (exp: ExpressionNode, context: TransformContext) => boolean;
export declare function advancePositionWithClone(pos: Position, source: string, numberOfCharacters?: number): Position;
export declare function advancePositionWithMutation(pos: Position, source: string, numberOfCharacters?: number): Position;
export declare function assert(condition: boolean, msg?: string): void;
@@ -981,11 +1036,14 @@ export declare function isTemplateNode(node: RootNode | TemplateChildNode): node
export declare function isSlotOutlet(node: RootNode | TemplateChildNode): node is SlotOutletNode;
export declare function injectProp(node: VNodeCall | RenderSlotCall, prop: Property, context: TransformContext): void;
export declare function toValidAssetId(name: string, type: 'component' | 'directive' | 'filter'): string;
export declare function hasScopeRef(node: TemplateChildNode | IfBranchNode | ExpressionNode | undefined, ids: TransformContext['identifiers']): boolean;
export declare function hasScopeRef(node: TemplateChildNode | IfBranchNode | ExpressionNode | CacheExpression | undefined, ids: TransformContext['identifiers']): boolean;
export declare function getMemoedVNodeCall(node: BlockCodegenNode | MemoExpression): VNodeCall | RenderSlotCall;
export declare const forAliasRE: RegExp;
export declare function walkIdentifiers(root: Node$1, onIdentifier: (node: Identifier, parent: Node$1, parentStack: Node$1[], isReference: boolean, isLocal: boolean) => void, includeAll?: boolean, parentStack?: Node$1[], knownIds?: Record<string, number>): void;
/**
* Return value indicates whether the AST walked can be a constant
*/
export declare function walkIdentifiers(root: Node$1, onIdentifier: (node: Identifier, parent: Node$1 | null, parentStack: Node$1[], isReference: boolean, isLocal: boolean) => void, includeAll?: boolean, parentStack?: Node$1[], knownIds?: Record<string, number>): void;
export declare function isReferencedIdentifier(id: Identifier, parent: Node$1 | null, parentStack: Node$1[]): boolean;
export declare function isInDestructureAssignment(parent: Node$1, parentStack: Node$1[]): boolean;
export declare function isInNewExpression(parentStack: Node$1[]): boolean;
@@ -1029,5 +1087,5 @@ interface SlotOutletProcessResult {
}
export declare function processSlotOutlet(node: SlotOutletNode, context: TransformContext): SlotOutletProcessResult;
export declare function getConstantType(node: TemplateChildNode | SimpleExpressionNode, context: TransformContext): ConstantTypes;
export declare function getConstantType(node: TemplateChildNode | SimpleExpressionNode | CacheExpression, context: TransformContext): ConstantTypes;
File diff suppressed because it is too large Load Diff
+5 -5
View File
@@ -1,6 +1,6 @@
{
"name": "@vue/compiler-core",
"version": "3.4.15",
"version": "3.5.13",
"description": "@vue/compiler-core",
"main": "index.js",
"module": "dist/compiler-core.esm-bundler.js",
@@ -46,13 +46,13 @@
},
"homepage": "https://github.com/vuejs/core/tree/main/packages/compiler-core#readme",
"dependencies": {
"@babel/parser": "^7.23.6",
"@babel/parser": "^7.25.3",
"entities": "^4.5.0",
"estree-walker": "^2.0.2",
"source-map-js": "^1.0.2",
"@vue/shared": "3.4.15"
"source-map-js": "^1.2.0",
"@vue/shared": "3.5.13"
},
"devDependencies": {
"@babel/types": "^7.23.6"
"@babel/types": "^7.25.2"
}
}
+1 -1
View File
@@ -1 +1 @@
# @vue/compiler-dom
# @vue/compiler-dom
+236 -35
View File
@@ -1,5 +1,5 @@
/**
* @vue/compiler-dom v3.4.15
* @vue/compiler-dom v3.5.13
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT
**/
@@ -11,15 +11,27 @@ var compilerCore = require('@vue/compiler-core');
var shared = require('@vue/shared');
const V_MODEL_RADIO = Symbol(`vModelRadio` );
const V_MODEL_CHECKBOX = Symbol(`vModelCheckbox` );
const V_MODEL_CHECKBOX = Symbol(
`vModelCheckbox`
);
const V_MODEL_TEXT = Symbol(`vModelText` );
const V_MODEL_SELECT = Symbol(`vModelSelect` );
const V_MODEL_DYNAMIC = Symbol(`vModelDynamic` );
const V_ON_WITH_MODIFIERS = Symbol(`vOnModifiersGuard` );
const V_ON_WITH_KEYS = Symbol(`vOnKeysGuard` );
const V_MODEL_SELECT = Symbol(
`vModelSelect`
);
const V_MODEL_DYNAMIC = Symbol(
`vModelDynamic`
);
const V_ON_WITH_MODIFIERS = Symbol(
`vOnModifiersGuard`
);
const V_ON_WITH_KEYS = Symbol(
`vOnKeysGuard`
);
const V_SHOW = Symbol(`vShow` );
const TRANSITION = Symbol(`Transition` );
const TRANSITION_GROUP = Symbol(`TransitionGroup` );
const TRANSITION_GROUP = Symbol(
`TransitionGroup`
);
compilerCore.registerRuntimeHelpers({
[V_MODEL_RADIO]: `vModelRadio`,
[V_MODEL_CHECKBOX]: `vModelCheckbox`,
@@ -38,6 +50,7 @@ const parserOptions = {
isVoidTag: shared.isVoidTag,
isNativeTag: (tag) => shared.isHTMLTag(tag) || shared.isSVGTag(tag) || shared.isMathMLTag(tag),
isPreTag: (tag) => tag === "pre",
isIgnoreNewlineTag: (tag) => tag === "pre" || tag === "textarea",
decodeEntities: void 0,
isBuiltInComponent: (tag) => {
if (tag === "Transition" || tag === "transition") {
@@ -291,16 +304,13 @@ const isNonKeyModifier = /* @__PURE__ */ shared.makeMap(
`stop,prevent,self,ctrl,shift,alt,meta,exact,middle`
);
const maybeKeyModifier = /* @__PURE__ */ shared.makeMap("left,right");
const isKeyboardEvent = /* @__PURE__ */ shared.makeMap(
`onkeyup,onkeydown,onkeypress`,
true
);
const isKeyboardEvent = /* @__PURE__ */ shared.makeMap(`onkeyup,onkeydown,onkeypress`);
const resolveModifiers = (key, modifiers, context, loc) => {
const keyModifiers = [];
const nonKeyModifiers = [];
const eventOptionModifiers = [];
for (let i = 0; i < modifiers.length; i++) {
const modifier = modifiers[i];
const modifier = modifiers[i].content;
if (modifier === "native" && compilerCore.checkCompatEnabled(
"COMPILER_V_ON_NATIVE",
context,
@@ -312,7 +322,7 @@ const resolveModifiers = (key, modifiers, context, loc) => {
} else {
if (maybeKeyModifier(modifier)) {
if (compilerCore.isStaticExp(key)) {
if (isKeyboardEvent(key.content)) {
if (isKeyboardEvent(key.content.toLowerCase())) {
keyModifiers.push(modifier);
} else {
nonKeyModifiers.push(modifier);
@@ -349,8 +359,7 @@ const transformClick = (key, event) => {
const transformOn = (dir, node, context) => {
return compilerCore.transformOn(dir, node, context, (baseResult) => {
const { modifiers } = dir;
if (!modifiers.length)
return baseResult;
if (!modifiers.length) return baseResult;
let { key, value: handlerExp } = baseResult.props[0];
const { keyModifiers, nonKeyModifiers, eventOptionModifiers } = resolveModifiers(key, modifiers, context, dir.loc);
if (nonKeyModifiers.includes("right")) {
@@ -366,7 +375,7 @@ const transformOn = (dir, node, context) => {
]);
}
if (keyModifiers.length && // if event name is dynamic, always wrap with keys guard
(!compilerCore.isStaticExp(key) || isKeyboardEvent(key.content))) {
(!compilerCore.isStaticExp(key) || isKeyboardEvent(key.content.toLowerCase()))) {
handlerExp = compilerCore.createCallExpression(context.helper(V_ON_WITH_KEYS), [
handlerExp,
JSON.stringify(keyModifiers)
@@ -446,6 +455,7 @@ const stringifyStatic = (children, context, parent) => {
if (context.scopes.vSlot > 0) {
return;
}
const isParentCached = parent.type === 1 && parent.codegenNode && parent.codegenNode.type === 13 && parent.codegenNode.children && !shared.isArray(parent.codegenNode.children) && parent.codegenNode.children.type === 20;
let nc = 0;
let ec = 0;
const currentChunk = [];
@@ -459,29 +469,44 @@ const stringifyStatic = (children, context, parent) => {
// will insert / hydrate
String(currentChunk.length)
]);
replaceHoist(currentChunk[0], staticCall, context);
if (currentChunk.length > 1) {
for (let i2 = 1; i2 < currentChunk.length; i2++) {
replaceHoist(currentChunk[i2], null, context);
const deleteCount = currentChunk.length - 1;
if (isParentCached) {
children.splice(
currentIndex - currentChunk.length,
currentChunk.length,
// @ts-expect-error
staticCall
);
} else {
currentChunk[0].codegenNode.value = staticCall;
if (currentChunk.length > 1) {
children.splice(currentIndex - currentChunk.length + 1, deleteCount);
const cacheIndex = context.cached.indexOf(
currentChunk[currentChunk.length - 1].codegenNode
);
if (cacheIndex > -1) {
for (let i2 = cacheIndex; i2 < context.cached.length; i2++) {
const c = context.cached[i2];
if (c) c.index -= deleteCount;
}
context.cached.splice(cacheIndex - deleteCount + 1, deleteCount);
}
}
const deleteCount = currentChunk.length - 1;
children.splice(currentIndex - currentChunk.length + 1, deleteCount);
return deleteCount;
}
return deleteCount;
}
return 0;
};
let i = 0;
for (; i < children.length; i++) {
const child = children[i];
const hoisted = getHoistedNode(child);
if (hoisted) {
const node = child;
const result = analyzeNode(node);
const isCached = isParentCached || getCachedNode(child);
if (isCached) {
const result = analyzeNode(child);
if (result) {
nc += result[0];
ec += result[1];
currentChunk.push(node);
currentChunk.push(child);
continue;
}
}
@@ -492,14 +517,14 @@ const stringifyStatic = (children, context, parent) => {
}
stringifyCurrentChunk(i);
};
const getHoistedNode = (node) => (node.type === 1 && node.tagType === 0 || node.type == 12) && node.codegenNode && node.codegenNode.type === 4 && node.codegenNode.hoisted;
const getCachedNode = (node) => {
if ((node.type === 1 && node.tagType === 0 || node.type === 12) && node.codegenNode && node.codegenNode.type === 20) {
return node.codegenNode;
}
};
const dataAriaRE = /^(data|aria)-/;
const isStringifiableAttr = (name, ns) => {
return (ns === 0 ? shared.isKnownHtmlAttr(name) : ns === 1 ? shared.isKnownSvgAttr(name) : false) || dataAriaRE.test(name);
};
const replaceHoist = (node, replacement, context) => {
const hoistToReplace = node.codegenNode.hoisted;
context.hoists[context.hoists.indexOf(hoistToReplace)] = replacement;
return (ns === 0 ? shared.isKnownHtmlAttr(name) : ns === 1 ? shared.isKnownSvgAttr(name) : ns === 2 ? shared.isKnownMathMLAttr(name) : false) || dataAriaRE.test(name);
};
const isNonStringifiable = /* @__PURE__ */ shared.makeMap(
`caption,thead,tr,th,tbody,td,tfoot,colgroup,col`
@@ -519,6 +544,7 @@ function analyzeNode(node) {
return false;
};
function walk(node2) {
const isOptionTag = node2.tag === "option" && node2.ns === 0;
for (let i = 0; i < node2.props.length; i++) {
const p = node2.props[i];
if (p.type === 6 && !isStringifiableAttr(p.name, node2.ns)) {
@@ -531,6 +557,9 @@ function analyzeNode(node) {
if (p.exp && (p.exp.type === 8 || p.exp.constType < 3)) {
return bail();
}
if (isOptionTag && compilerCore.isStaticArgOf(p.arg, "value") && p.exp && !p.exp.isStatic) {
return bail();
}
}
}
for (let i = 0; i < node2.children.length; i++) {
@@ -664,9 +693,181 @@ const ignoreSideEffectTags = (node, context) => {
}
};
function isValidHTMLNesting(parent, child) {
if (parent in onlyValidChildren) {
return onlyValidChildren[parent].has(child);
}
if (child in onlyValidParents) {
return onlyValidParents[child].has(parent);
}
if (parent in knownInvalidChildren) {
if (knownInvalidChildren[parent].has(child)) return false;
}
if (child in knownInvalidParents) {
if (knownInvalidParents[child].has(parent)) return false;
}
return true;
}
const headings = /* @__PURE__ */ new Set(["h1", "h2", "h3", "h4", "h5", "h6"]);
const emptySet = /* @__PURE__ */ new Set([]);
const onlyValidChildren = {
head: /* @__PURE__ */ new Set([
"base",
"basefront",
"bgsound",
"link",
"meta",
"title",
"noscript",
"noframes",
"style",
"script",
"template"
]),
optgroup: /* @__PURE__ */ new Set(["option"]),
select: /* @__PURE__ */ new Set(["optgroup", "option", "hr"]),
// table
table: /* @__PURE__ */ new Set(["caption", "colgroup", "tbody", "tfoot", "thead"]),
tr: /* @__PURE__ */ new Set(["td", "th"]),
colgroup: /* @__PURE__ */ new Set(["col"]),
tbody: /* @__PURE__ */ new Set(["tr"]),
thead: /* @__PURE__ */ new Set(["tr"]),
tfoot: /* @__PURE__ */ new Set(["tr"]),
// these elements can not have any children elements
script: emptySet,
iframe: emptySet,
option: emptySet,
textarea: emptySet,
style: emptySet,
title: emptySet
};
const onlyValidParents = {
// sections
html: emptySet,
body: /* @__PURE__ */ new Set(["html"]),
head: /* @__PURE__ */ new Set(["html"]),
// table
td: /* @__PURE__ */ new Set(["tr"]),
colgroup: /* @__PURE__ */ new Set(["table"]),
caption: /* @__PURE__ */ new Set(["table"]),
tbody: /* @__PURE__ */ new Set(["table"]),
tfoot: /* @__PURE__ */ new Set(["table"]),
col: /* @__PURE__ */ new Set(["colgroup"]),
th: /* @__PURE__ */ new Set(["tr"]),
thead: /* @__PURE__ */ new Set(["table"]),
tr: /* @__PURE__ */ new Set(["tbody", "thead", "tfoot"]),
// data list
dd: /* @__PURE__ */ new Set(["dl", "div"]),
dt: /* @__PURE__ */ new Set(["dl", "div"]),
// other
figcaption: /* @__PURE__ */ new Set(["figure"]),
// li: new Set(["ul", "ol"]),
summary: /* @__PURE__ */ new Set(["details"]),
area: /* @__PURE__ */ new Set(["map"])
};
const knownInvalidChildren = {
p: /* @__PURE__ */ new Set([
"address",
"article",
"aside",
"blockquote",
"center",
"details",
"dialog",
"dir",
"div",
"dl",
"fieldset",
"figure",
"footer",
"form",
"h1",
"h2",
"h3",
"h4",
"h5",
"h6",
"header",
"hgroup",
"hr",
"li",
"main",
"nav",
"menu",
"ol",
"p",
"pre",
"section",
"table",
"ul"
]),
svg: /* @__PURE__ */ new Set([
"b",
"blockquote",
"br",
"code",
"dd",
"div",
"dl",
"dt",
"em",
"embed",
"h1",
"h2",
"h3",
"h4",
"h5",
"h6",
"hr",
"i",
"img",
"li",
"menu",
"meta",
"ol",
"p",
"pre",
"ruby",
"s",
"small",
"span",
"strong",
"sub",
"sup",
"table",
"u",
"ul",
"var"
])
};
const knownInvalidParents = {
a: /* @__PURE__ */ new Set(["a"]),
button: /* @__PURE__ */ new Set(["button"]),
dd: /* @__PURE__ */ new Set(["dd", "dt"]),
dt: /* @__PURE__ */ new Set(["dd", "dt"]),
form: /* @__PURE__ */ new Set(["form"]),
li: /* @__PURE__ */ new Set(["li"]),
h1: headings,
h2: headings,
h3: headings,
h4: headings,
h5: headings,
h6: headings
};
const validateHtmlNesting = (node, context) => {
if (node.type === 1 && node.tagType === 0 && context.parent && context.parent.type === 1 && context.parent.tagType === 0 && !isValidHTMLNesting(context.parent.tag, node.tag)) {
const error = new SyntaxError(
`<${node.tag}> cannot be child of <${context.parent.tag}>, according to HTML specifications. This can cause hydration errors or potentially disrupt future functionality.`
);
error.loc = node.loc;
context.onWarn(error);
}
};
const DOMNodeTransforms = [
transformStyle,
...[transformTransition]
...[transformTransition, validateHtmlNesting]
];
const DOMDirectiveTransforms = {
cloak: compilerCore.noopDirectiveTransform,
+63 -34
View File
@@ -1,5 +1,5 @@
/**
* @vue/compiler-dom v3.4.15
* @vue/compiler-dom v3.5.13
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT
**/
@@ -11,15 +11,27 @@ var compilerCore = require('@vue/compiler-core');
var shared = require('@vue/shared');
const V_MODEL_RADIO = Symbol(``);
const V_MODEL_CHECKBOX = Symbol(``);
const V_MODEL_CHECKBOX = Symbol(
``
);
const V_MODEL_TEXT = Symbol(``);
const V_MODEL_SELECT = Symbol(``);
const V_MODEL_DYNAMIC = Symbol(``);
const V_ON_WITH_MODIFIERS = Symbol(``);
const V_ON_WITH_KEYS = Symbol(``);
const V_MODEL_SELECT = Symbol(
``
);
const V_MODEL_DYNAMIC = Symbol(
``
);
const V_ON_WITH_MODIFIERS = Symbol(
``
);
const V_ON_WITH_KEYS = Symbol(
``
);
const V_SHOW = Symbol(``);
const TRANSITION = Symbol(``);
const TRANSITION_GROUP = Symbol(``);
const TRANSITION_GROUP = Symbol(
``
);
compilerCore.registerRuntimeHelpers({
[V_MODEL_RADIO]: `vModelRadio`,
[V_MODEL_CHECKBOX]: `vModelCheckbox`,
@@ -38,6 +50,7 @@ const parserOptions = {
isVoidTag: shared.isVoidTag,
isNativeTag: (tag) => shared.isHTMLTag(tag) || shared.isSVGTag(tag) || shared.isMathMLTag(tag),
isPreTag: (tag) => tag === "pre",
isIgnoreNewlineTag: (tag) => tag === "pre" || tag === "textarea",
decodeEntities: void 0,
isBuiltInComponent: (tag) => {
if (tag === "Transition" || tag === "transition") {
@@ -273,16 +286,13 @@ const isNonKeyModifier = /* @__PURE__ */ shared.makeMap(
`stop,prevent,self,ctrl,shift,alt,meta,exact,middle`
);
const maybeKeyModifier = /* @__PURE__ */ shared.makeMap("left,right");
const isKeyboardEvent = /* @__PURE__ */ shared.makeMap(
`onkeyup,onkeydown,onkeypress`,
true
);
const isKeyboardEvent = /* @__PURE__ */ shared.makeMap(`onkeyup,onkeydown,onkeypress`);
const resolveModifiers = (key, modifiers, context, loc) => {
const keyModifiers = [];
const nonKeyModifiers = [];
const eventOptionModifiers = [];
for (let i = 0; i < modifiers.length; i++) {
const modifier = modifiers[i];
const modifier = modifiers[i].content;
if (modifier === "native" && compilerCore.checkCompatEnabled(
"COMPILER_V_ON_NATIVE",
context,
@@ -294,7 +304,7 @@ const resolveModifiers = (key, modifiers, context, loc) => {
} else {
if (maybeKeyModifier(modifier)) {
if (compilerCore.isStaticExp(key)) {
if (isKeyboardEvent(key.content)) {
if (isKeyboardEvent(key.content.toLowerCase())) {
keyModifiers.push(modifier);
} else {
nonKeyModifiers.push(modifier);
@@ -331,8 +341,7 @@ const transformClick = (key, event) => {
const transformOn = (dir, node, context) => {
return compilerCore.transformOn(dir, node, context, (baseResult) => {
const { modifiers } = dir;
if (!modifiers.length)
return baseResult;
if (!modifiers.length) return baseResult;
let { key, value: handlerExp } = baseResult.props[0];
const { keyModifiers, nonKeyModifiers, eventOptionModifiers } = resolveModifiers(key, modifiers, context, dir.loc);
if (nonKeyModifiers.includes("right")) {
@@ -348,7 +357,7 @@ const transformOn = (dir, node, context) => {
]);
}
if (keyModifiers.length && // if event name is dynamic, always wrap with keys guard
(!compilerCore.isStaticExp(key) || isKeyboardEvent(key.content))) {
(!compilerCore.isStaticExp(key) || isKeyboardEvent(key.content.toLowerCase()))) {
handlerExp = compilerCore.createCallExpression(context.helper(V_ON_WITH_KEYS), [
handlerExp,
JSON.stringify(keyModifiers)
@@ -382,6 +391,7 @@ const stringifyStatic = (children, context, parent) => {
if (context.scopes.vSlot > 0) {
return;
}
const isParentCached = parent.type === 1 && parent.codegenNode && parent.codegenNode.type === 13 && parent.codegenNode.children && !shared.isArray(parent.codegenNode.children) && parent.codegenNode.children.type === 20;
let nc = 0;
let ec = 0;
const currentChunk = [];
@@ -395,29 +405,44 @@ const stringifyStatic = (children, context, parent) => {
// will insert / hydrate
String(currentChunk.length)
]);
replaceHoist(currentChunk[0], staticCall, context);
if (currentChunk.length > 1) {
for (let i2 = 1; i2 < currentChunk.length; i2++) {
replaceHoist(currentChunk[i2], null, context);
const deleteCount = currentChunk.length - 1;
if (isParentCached) {
children.splice(
currentIndex - currentChunk.length,
currentChunk.length,
// @ts-expect-error
staticCall
);
} else {
currentChunk[0].codegenNode.value = staticCall;
if (currentChunk.length > 1) {
children.splice(currentIndex - currentChunk.length + 1, deleteCount);
const cacheIndex = context.cached.indexOf(
currentChunk[currentChunk.length - 1].codegenNode
);
if (cacheIndex > -1) {
for (let i2 = cacheIndex; i2 < context.cached.length; i2++) {
const c = context.cached[i2];
if (c) c.index -= deleteCount;
}
context.cached.splice(cacheIndex - deleteCount + 1, deleteCount);
}
}
const deleteCount = currentChunk.length - 1;
children.splice(currentIndex - currentChunk.length + 1, deleteCount);
return deleteCount;
}
return deleteCount;
}
return 0;
};
let i = 0;
for (; i < children.length; i++) {
const child = children[i];
const hoisted = getHoistedNode(child);
if (hoisted) {
const node = child;
const result = analyzeNode(node);
const isCached = isParentCached || getCachedNode(child);
if (isCached) {
const result = analyzeNode(child);
if (result) {
nc += result[0];
ec += result[1];
currentChunk.push(node);
currentChunk.push(child);
continue;
}
}
@@ -428,14 +453,14 @@ const stringifyStatic = (children, context, parent) => {
}
stringifyCurrentChunk(i);
};
const getHoistedNode = (node) => (node.type === 1 && node.tagType === 0 || node.type == 12) && node.codegenNode && node.codegenNode.type === 4 && node.codegenNode.hoisted;
const getCachedNode = (node) => {
if ((node.type === 1 && node.tagType === 0 || node.type === 12) && node.codegenNode && node.codegenNode.type === 20) {
return node.codegenNode;
}
};
const dataAriaRE = /^(data|aria)-/;
const isStringifiableAttr = (name, ns) => {
return (ns === 0 ? shared.isKnownHtmlAttr(name) : ns === 1 ? shared.isKnownSvgAttr(name) : false) || dataAriaRE.test(name);
};
const replaceHoist = (node, replacement, context) => {
const hoistToReplace = node.codegenNode.hoisted;
context.hoists[context.hoists.indexOf(hoistToReplace)] = replacement;
return (ns === 0 ? shared.isKnownHtmlAttr(name) : ns === 1 ? shared.isKnownSvgAttr(name) : ns === 2 ? shared.isKnownMathMLAttr(name) : false) || dataAriaRE.test(name);
};
const isNonStringifiable = /* @__PURE__ */ shared.makeMap(
`caption,thead,tr,th,tbody,td,tfoot,colgroup,col`
@@ -455,6 +480,7 @@ function analyzeNode(node) {
return false;
};
function walk(node2) {
const isOptionTag = node2.tag === "option" && node2.ns === 0;
for (let i = 0; i < node2.props.length; i++) {
const p = node2.props[i];
if (p.type === 6 && !isStringifiableAttr(p.name, node2.ns)) {
@@ -467,6 +493,9 @@ function analyzeNode(node) {
if (p.exp && (p.exp.type === 8 || p.exp.constType < 3)) {
return bail();
}
if (isOptionTag && compilerCore.isStaticArgOf(p.arg, "value") && p.exp && !p.exp.isStatic) {
return bail();
}
}
}
for (let i = 0; i < node2.children.length; i++) {
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
+198 -17
View File
@@ -1,5 +1,5 @@
/**
* @vue/compiler-dom v3.4.15
* @vue/compiler-dom v3.5.13
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT
**/
@@ -8,15 +8,27 @@ export * from '@vue/compiler-core';
import { isVoidTag, isHTMLTag, isSVGTag, isMathMLTag, parseStringStyle, capitalize, makeMap, 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_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_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` : ``);
const TRANSITION_GROUP = Symbol(
!!(process.env.NODE_ENV !== "production") ? `TransitionGroup` : ``
);
registerRuntimeHelpers({
[V_MODEL_RADIO]: `vModelRadio`,
[V_MODEL_CHECKBOX]: `vModelCheckbox`,
@@ -49,6 +61,7 @@ const parserOptions = {
isVoidTag,
isNativeTag: (tag) => isHTMLTag(tag) || isSVGTag(tag) || isMathMLTag(tag),
isPreTag: (tag) => tag === "pre",
isIgnoreNewlineTag: (tag) => tag === "pre" || tag === "textarea",
decodeEntities: decodeHtmlBrowser ,
isBuiltInComponent: (tag) => {
if (tag === "Transition" || tag === "transition") {
@@ -302,16 +315,13 @@ const isNonKeyModifier = /* @__PURE__ */ makeMap(
`stop,prevent,self,ctrl,shift,alt,meta,exact,middle`
);
const maybeKeyModifier = /* @__PURE__ */ makeMap("left,right");
const isKeyboardEvent = /* @__PURE__ */ makeMap(
`onkeyup,onkeydown,onkeypress`,
true
);
const isKeyboardEvent = /* @__PURE__ */ makeMap(`onkeyup,onkeydown,onkeypress`);
const resolveModifiers = (key, modifiers, context, loc) => {
const keyModifiers = [];
const nonKeyModifiers = [];
const eventOptionModifiers = [];
for (let i = 0; i < modifiers.length; i++) {
const modifier = modifiers[i];
const modifier = modifiers[i].content;
if (modifier === "native" && checkCompatEnabled(
"COMPILER_V_ON_NATIVE",
context,
@@ -323,7 +333,7 @@ const resolveModifiers = (key, modifiers, context, loc) => {
} else {
if (maybeKeyModifier(modifier)) {
if (isStaticExp(key)) {
if (isKeyboardEvent(key.content)) {
if (isKeyboardEvent(key.content.toLowerCase())) {
keyModifiers.push(modifier);
} else {
nonKeyModifiers.push(modifier);
@@ -360,8 +370,7 @@ const transformClick = (key, event) => {
const transformOn = (dir, node, context) => {
return transformOn$1(dir, node, context, (baseResult) => {
const { modifiers } = dir;
if (!modifiers.length)
return baseResult;
if (!modifiers.length) return baseResult;
let { key, value: handlerExp } = baseResult.props[0];
const { keyModifiers, nonKeyModifiers, eventOptionModifiers } = resolveModifiers(key, modifiers, context, dir.loc);
if (nonKeyModifiers.includes("right")) {
@@ -377,7 +386,7 @@ const transformOn = (dir, node, context) => {
]);
}
if (keyModifiers.length && // if event name is dynamic, always wrap with keys guard
(!isStaticExp(key) || isKeyboardEvent(key.content))) {
(!isStaticExp(key) || isKeyboardEvent(key.content.toLowerCase()))) {
handlerExp = createCallExpression(context.helper(V_ON_WITH_KEYS), [
handlerExp,
JSON.stringify(keyModifiers)
@@ -464,9 +473,181 @@ const ignoreSideEffectTags = (node, context) => {
}
};
function isValidHTMLNesting(parent, child) {
if (parent in onlyValidChildren) {
return onlyValidChildren[parent].has(child);
}
if (child in onlyValidParents) {
return onlyValidParents[child].has(parent);
}
if (parent in knownInvalidChildren) {
if (knownInvalidChildren[parent].has(child)) return false;
}
if (child in knownInvalidParents) {
if (knownInvalidParents[child].has(parent)) return false;
}
return true;
}
const headings = /* @__PURE__ */ new Set(["h1", "h2", "h3", "h4", "h5", "h6"]);
const emptySet = /* @__PURE__ */ new Set([]);
const onlyValidChildren = {
head: /* @__PURE__ */ new Set([
"base",
"basefront",
"bgsound",
"link",
"meta",
"title",
"noscript",
"noframes",
"style",
"script",
"template"
]),
optgroup: /* @__PURE__ */ new Set(["option"]),
select: /* @__PURE__ */ new Set(["optgroup", "option", "hr"]),
// table
table: /* @__PURE__ */ new Set(["caption", "colgroup", "tbody", "tfoot", "thead"]),
tr: /* @__PURE__ */ new Set(["td", "th"]),
colgroup: /* @__PURE__ */ new Set(["col"]),
tbody: /* @__PURE__ */ new Set(["tr"]),
thead: /* @__PURE__ */ new Set(["tr"]),
tfoot: /* @__PURE__ */ new Set(["tr"]),
// these elements can not have any children elements
script: emptySet,
iframe: emptySet,
option: emptySet,
textarea: emptySet,
style: emptySet,
title: emptySet
};
const onlyValidParents = {
// sections
html: emptySet,
body: /* @__PURE__ */ new Set(["html"]),
head: /* @__PURE__ */ new Set(["html"]),
// table
td: /* @__PURE__ */ new Set(["tr"]),
colgroup: /* @__PURE__ */ new Set(["table"]),
caption: /* @__PURE__ */ new Set(["table"]),
tbody: /* @__PURE__ */ new Set(["table"]),
tfoot: /* @__PURE__ */ new Set(["table"]),
col: /* @__PURE__ */ new Set(["colgroup"]),
th: /* @__PURE__ */ new Set(["tr"]),
thead: /* @__PURE__ */ new Set(["table"]),
tr: /* @__PURE__ */ new Set(["tbody", "thead", "tfoot"]),
// data list
dd: /* @__PURE__ */ new Set(["dl", "div"]),
dt: /* @__PURE__ */ new Set(["dl", "div"]),
// other
figcaption: /* @__PURE__ */ new Set(["figure"]),
// li: new Set(["ul", "ol"]),
summary: /* @__PURE__ */ new Set(["details"]),
area: /* @__PURE__ */ new Set(["map"])
};
const knownInvalidChildren = {
p: /* @__PURE__ */ new Set([
"address",
"article",
"aside",
"blockquote",
"center",
"details",
"dialog",
"dir",
"div",
"dl",
"fieldset",
"figure",
"footer",
"form",
"h1",
"h2",
"h3",
"h4",
"h5",
"h6",
"header",
"hgroup",
"hr",
"li",
"main",
"nav",
"menu",
"ol",
"p",
"pre",
"section",
"table",
"ul"
]),
svg: /* @__PURE__ */ new Set([
"b",
"blockquote",
"br",
"code",
"dd",
"div",
"dl",
"dt",
"em",
"embed",
"h1",
"h2",
"h3",
"h4",
"h5",
"h6",
"hr",
"i",
"img",
"li",
"menu",
"meta",
"ol",
"p",
"pre",
"ruby",
"s",
"small",
"span",
"strong",
"sub",
"sup",
"table",
"u",
"ul",
"var"
])
};
const knownInvalidParents = {
a: /* @__PURE__ */ new Set(["a"]),
button: /* @__PURE__ */ new Set(["button"]),
dd: /* @__PURE__ */ new Set(["dd", "dt"]),
dt: /* @__PURE__ */ new Set(["dd", "dt"]),
form: /* @__PURE__ */ new Set(["form"]),
li: /* @__PURE__ */ new Set(["li"]),
h1: headings,
h2: headings,
h3: headings,
h4: headings,
h5: headings,
h6: headings
};
const validateHtmlNesting = (node, context) => {
if (node.type === 1 && node.tagType === 0 && context.parent && context.parent.type === 1 && context.parent.tagType === 0 && !isValidHTMLNesting(context.parent.tag, node.tag)) {
const error = new SyntaxError(
`<${node.tag}> cannot be child of <${context.parent.tag}>, according to HTML specifications. This can cause hydration errors or potentially disrupt future functionality.`
);
error.loc = node.loc;
context.onWarn(error);
}
};
const DOMNodeTransforms = [
transformStyle,
...!!(process.env.NODE_ENV !== "production") ? [transformTransition] : []
...!!(process.env.NODE_ENV !== "production") ? [transformTransition, validateHtmlNesting] : []
];
const DOMDirectiveTransforms = {
cloak: noopDirectiveTransform,
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@vue/compiler-dom",
"version": "3.4.15",
"version": "3.5.13",
"description": "@vue/compiler-dom",
"main": "index.js",
"module": "dist/compiler-dom.esm-bundler.js",
@@ -51,7 +51,7 @@
},
"homepage": "https://github.com/vuejs/core/tree/main/packages/compiler-dom#readme",
"dependencies": {
"@vue/shared": "3.4.15",
"@vue/compiler-core": "3.4.15"
"@vue/shared": "3.5.13",
"@vue/compiler-core": "3.5.13"
}
}
+16502 -12177
View File
File diff suppressed because it is too large Load Diff
+8 -66
View File
@@ -1,8 +1,7 @@
import * as _babel_types from '@babel/types';
import { Statement, Expression, TSType, Node, Program, CallExpression, ObjectPattern, TSModuleDeclaration, TSPropertySignature, TSMethodSignature, TSCallSignatureDeclaration, TSFunctionType } from '@babel/types';
import { RootNode, CompilerOptions, CodegenResult, ParserOptions, CompilerError, SourceLocation, BindingMetadata as BindingMetadata$1 } from '@vue/compiler-core';
import { RootNode, CompilerOptions, CodegenResult, ParserOptions, CompilerError, RawSourceMap, SourceLocation, BindingMetadata as BindingMetadata$1 } from '@vue/compiler-core';
export { BindingMetadata, CompilerError, CompilerOptions, extractIdentifiers, generateCodeFrame, isInDestructureAssignment, isStaticProperty, walkIdentifiers } from '@vue/compiler-core';
import { RawSourceMap } from 'source-map-js';
import { ParserPlugin } from '@babel/parser';
export { parse as babelParse } from '@babel/parser';
import { Result, LazyResult } from 'postcss';
@@ -118,10 +117,11 @@ export interface SFCScriptCompileOptions {
*/
hoistStatic?: boolean;
/**
* (**Experimental**) Enable reactive destructure for `defineProps`
* @default false
* Set to `false` to disable reactive destructure for `defineProps` (pre-3.5
* behavior), or set to `'error'` to throw hard error on props destructures.
* @default true
*/
propsDestructure?: boolean;
propsDestructure?: boolean | 'error';
/**
* File system access methods to be used when resolving types
* imported in SFC macros. Defaults to ts.sys in Node.js, can be overwritten
@@ -160,11 +160,6 @@ export interface SFCParseOptions {
ignoreEmpty?: boolean;
compiler?: TemplateCompiler;
templateParseOptions?: ParserOptions;
/**
* TODO remove in 3.5
* @deprecated use `templateParseOptions: { prefixIdentifiers: false }` instead
*/
parseExpressions?: boolean;
}
export interface SFCBlock {
type: string;
@@ -400,6 +395,7 @@ export declare class ScriptCompileContext {
fs?: NonNullable<SFCScriptCompileOptions['fs']>;
constructor(descriptor: SFCDescriptor, options: Partial<SFCScriptCompileOptions>);
getString(node: Node, scriptSetup?: boolean): string;
warn(msg: string, node: Node, scope?: TypeScope): void;
error(msg: string, node: Node, scope?: TypeScope): never;
}
@@ -468,68 +464,14 @@ export declare function registerTS(_loadTS: () => typeof TS): void;
* @private
*/
export declare function invalidateTypeCache(filename: string): void;
export declare function inferRuntimeType(ctx: TypeResolveContext, node: Node & MaybeWithScope, scope?: TypeScope): string[];
export declare function inferRuntimeType(ctx: TypeResolveContext, node: Node & MaybeWithScope, scope?: TypeScope, isKeyOf?: boolean): string[];
export declare function extractRuntimeEmits(ctx: TypeResolveContext): Set<string>;
export declare const version: string;
export declare const parseCache: Map<string, SFCParseResult>;
export declare const errorMessages: {
0: string;
1: string;
2: string;
3: string;
4: string;
5: string;
6: string;
7: string;
8: string;
9: string;
10: string;
11: string;
12: string;
13: string;
14: string;
15: string;
16: string;
17: string;
18: string;
19: string;
20: string;
21: string;
22: string;
23: string;
24: string;
25: string;
26: string;
27: string;
28: string;
29: string;
30: string;
31: string;
32: string;
33: string;
34: string;
35: string;
36: string;
37: string;
38: string;
39: string;
40: string;
41: string;
42: string;
43: string;
44: string;
45: string;
46: string;
47: string;
48: string;
49: string;
50: string;
51: string;
52: string;
};
export declare const errorMessages: Record<number, string>;
export declare const walk: any;
File diff suppressed because it is too large Load Diff
+16 -16
View File
@@ -1,6 +1,6 @@
{
"name": "@vue/compiler-sfc",
"version": "3.4.15",
"version": "3.5.13",
"description": "@vue/compiler-sfc",
"main": "dist/compiler-sfc.cjs.js",
"module": "dist/compiler-sfc.esm-browser.js",
@@ -42,26 +42,26 @@
},
"homepage": "https://github.com/vuejs/core/tree/main/packages/compiler-sfc#readme",
"dependencies": {
"@babel/parser": "^7.23.6",
"@babel/parser": "^7.25.3",
"estree-walker": "^2.0.2",
"magic-string": "^0.30.5",
"postcss": "^8.4.33",
"source-map-js": "^1.0.2",
"@vue/compiler-core": "3.4.15",
"@vue/shared": "3.4.15",
"@vue/compiler-dom": "3.4.15",
"@vue/compiler-ssr": "3.4.15"
"magic-string": "^0.30.11",
"postcss": "^8.4.48",
"source-map-js": "^1.2.0",
"@vue/compiler-core": "3.5.13",
"@vue/shared": "3.5.13",
"@vue/compiler-dom": "3.5.13",
"@vue/compiler-ssr": "3.5.13"
},
"devDependencies": {
"@babel/types": "^7.23.6",
"@vue/consolidate": "^0.17.3",
"@babel/types": "^7.25.2",
"@vue/consolidate": "^1.0.0",
"hash-sum": "^2.0.0",
"lru-cache": "^10.1.0",
"lru-cache": "10.1.0",
"merge-source-map": "^1.1.0",
"minimatch": "^9.0.3",
"minimatch": "~9.0.5",
"postcss-modules": "^6.0.0",
"postcss-selector-parser": "^6.0.15",
"pug": "^3.0.2",
"sass": "^1.69.7"
"postcss-selector-parser": "^7.0.0",
"pug": "^3.0.3",
"sass": "^1.80.6"
}
}
+1 -1
View File
@@ -1 +1 @@
# @vue/compiler-ssr
# @vue/compiler-ssr
+79 -30
View File
@@ -1,5 +1,5 @@
/**
* @vue/compiler-ssr v3.4.15
* @vue/compiler-ssr v3.5.13
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT
**/
@@ -21,11 +21,17 @@ const SSR_RENDER_ATTRS = Symbol(`ssrRenderAttrs`);
const SSR_RENDER_ATTR = Symbol(`ssrRenderAttr`);
const SSR_RENDER_DYNAMIC_ATTR = Symbol(`ssrRenderDynamicAttr`);
const SSR_RENDER_LIST = Symbol(`ssrRenderList`);
const SSR_INCLUDE_BOOLEAN_ATTR = Symbol(`ssrIncludeBooleanAttr`);
const SSR_INCLUDE_BOOLEAN_ATTR = Symbol(
`ssrIncludeBooleanAttr`
);
const SSR_LOOSE_EQUAL = Symbol(`ssrLooseEqual`);
const SSR_LOOSE_CONTAIN = Symbol(`ssrLooseContain`);
const SSR_RENDER_DYNAMIC_MODEL = Symbol(`ssrRenderDynamicModel`);
const SSR_GET_DYNAMIC_MODEL_PROPS = Symbol(`ssrGetDynamicModelProps`);
const SSR_RENDER_DYNAMIC_MODEL = Symbol(
`ssrRenderDynamicModel`
);
const SSR_GET_DYNAMIC_MODEL_PROPS = Symbol(
`ssrGetDynamicModelProps`
);
const SSR_RENDER_TELEPORT = Symbol(`ssrRenderTeleport`);
const SSR_RENDER_SUSPENSE = Symbol(`ssrRenderSuspense`);
const SSR_GET_DIRECTIVE_PROPS = Symbol(`ssrGetDirectiveProps`);
@@ -56,7 +62,7 @@ const ssrTransformIf = compilerDom.createStructuralDirectiveTransform(
/^(if|else|else-if)$/,
compilerDom.processIf
);
function ssrProcessIf(node, context, disableNestedFragments = false) {
function ssrProcessIf(node, context, disableNestedFragments = false, disableComment = false) {
const [rootBranch] = node.branches;
const ifStatement = compilerDom.createIfStatement(
rootBranch.condition,
@@ -80,7 +86,7 @@ function ssrProcessIf(node, context, disableNestedFragments = false) {
currentIf.alternate = branchBlockStatement;
}
}
if (!currentIf.alternate) {
if (!currentIf.alternate && !disableComment) {
currentIf.alternate = compilerDom.createBlockStatement([
compilerDom.createCallExpression(`_push`, ["`<!---->`"])
]);
@@ -93,10 +99,7 @@ function processIfBranch(branch, context, disableNestedFragments = false) {
return processChildrenAsStatement(branch, context, needFragmentWrapper);
}
const ssrTransformFor = compilerDom.createStructuralDirectiveTransform(
"for",
compilerDom.processFor
);
const ssrTransformFor = compilerDom.createStructuralDirectiveTransform("for", compilerDom.processFor);
function ssrProcessFor(node, context, disableNestedFragments = false) {
const needFragmentWrapper = !disableNestedFragments && (node.children.length !== 1 || node.children[0].type !== 1);
const renderLoop = compilerDom.createFunctionExpression(
@@ -137,14 +140,20 @@ const ssrTransformSlotOutlet = (node, context) => {
args.push(`"${context.scopeId}-s"`);
}
let method = SSR_RENDER_SLOT;
const parent = context.parent;
let componentType;
if (parent && parent.type === 1 && parent.tagType === 1 && ((componentType = compilerDom.resolveComponentType(parent, context, true)) === compilerDom.TRANSITION || componentType === compilerDom.TRANSITION_GROUP) && parent.children.filter((c) => c.type === 1).length === 1) {
method = SSR_RENDER_SLOT_INNER;
if (!(context.scopeId && context.slotted !== false)) {
args.push("null");
let parent = context.parent;
if (parent) {
const children = parent.children;
if (parent.type === 10) {
parent = context.grandParent;
}
let componentType;
if (parent.type === 1 && parent.tagType === 1 && ((componentType = compilerDom.resolveComponentType(parent, context, true)) === compilerDom.TRANSITION || componentType === compilerDom.TRANSITION_GROUP) && children.filter((c) => c.type === 1).length === 1) {
method = SSR_RENDER_SLOT_INNER;
if (!(context.scopeId && context.slotted !== false)) {
args.push("null");
}
args.push("true");
}
args.push("true");
}
node.ssrCodegenNode = compilerDom.createCallExpression(context.helper(method), args);
}
@@ -353,6 +362,28 @@ const ssrTransformElement = (node, context) => {
])
];
}
} else if (directives.length && !node.children.length) {
const vText = compilerDom.findDir(node, "text");
if (!vText) {
const tempId = `_temp${context.temps++}`;
propsExp.arguments = [
compilerDom.createAssignmentExpression(
compilerDom.createSimpleExpression(tempId, false),
mergedProps
)
];
rawChildrenMap.set(
node,
compilerDom.createConditionalExpression(
compilerDom.createSimpleExpression(`"textContent" in ${tempId}`, false),
compilerDom.createCallExpression(context.helper(SSR_INTERPOLATE), [
compilerDom.createSimpleExpression(`${tempId}.textContent`, false)
]),
compilerDom.createSimpleExpression(`${tempId}.innerHTML ?? ''`, false),
false
)
);
}
}
if (needTagForRuntime) {
propsExp.arguments.push(`"${node.tag}"`);
@@ -370,7 +401,10 @@ const ssrTransformElement = (node, context) => {
}
if (prop.type === 7) {
if (prop.name === "html" && prop.exp) {
rawChildrenMap.set(node, prop.exp);
rawChildrenMap.set(
node,
compilerDom.createCompoundExpression([`(`, prop.exp, `) ?? ''`])
);
} else if (prop.name === "text" && prop.exp) {
node.children = [compilerDom.createInterpolation(prop.exp, prop.loc)];
} else if (prop.name === "slot") {
@@ -617,6 +651,13 @@ function ssrProcessTransitionGroup(node, context) {
* be patched using the same key map) so we need to account for that here
* by disabling nested fragment wrappers from being generated.
*/
true,
/**
* TransitionGroup filters out comment children at runtime and thus
* doesn't expect comments to be present during hydration. We need to
* account for that by disabling the empty comment that is otherwise
* rendered for a falsy v-if that has no v-else specified. (#6715)
*/
true
);
context.pushStringPart(`</`);
@@ -631,11 +672,11 @@ function ssrProcessTransitionGroup(node, context) {
context.pushStringPart(` ${scopeId}`);
}
context.pushStringPart(`>`);
processChildren(node, context, false, true);
processChildren(node, context, false, true, true);
context.pushStringPart(`</${tag.value.content}>`);
}
} else {
processChildren(node, context, true, true);
processChildren(node, context, true, true, true);
}
}
@@ -953,7 +994,7 @@ function createChildContext(parent, withSlotScopeId = parent.withSlotScopeId) {
withSlotScopeId
);
}
function processChildren(parent, context, asFragment = false, disableNestedFragments = false) {
function processChildren(parent, context, asFragment = false, disableNestedFragments = false, disableComment = false) {
if (asFragment) {
context.pushStringPart(`<!--[-->`);
}
@@ -989,7 +1030,9 @@ function processChildren(parent, context, asFragment = false, disableNestedFragm
context.pushStringPart(shared.escapeHtml(child.content));
break;
case 3:
context.pushStringPart(`<!--${child.content}-->`);
if (!disableComment) {
context.pushStringPart(`<!--${child.content}-->`);
}
break;
case 5:
context.pushStringPart(
@@ -999,7 +1042,7 @@ function processChildren(parent, context, asFragment = false, disableNestedFragm
);
break;
case 9:
ssrProcessIf(child, context, disableNestedFragments);
ssrProcessIf(child, context, disableNestedFragments, disableComment);
break;
case 11:
ssrProcessFor(child, context, disableNestedFragments);
@@ -1156,11 +1199,18 @@ const ssrTransformModel = (dir, node, context) => {
checkDuplicatedValue();
node.children = [compilerDom.createInterpolation(model, model.loc)];
} else if (node.tag === "select") {
node.children.forEach((child) => {
if (child.type === 1) {
processOption(child);
}
});
const processChildren = (children) => {
children.forEach((child) => {
if (child.type === 1) {
processOption(child);
} else if (child.type === 11) {
processChildren(child.children);
} else if (child.type === 9) {
child.branches.forEach((b) => processChildren(b.children));
}
});
};
processChildren(node.children);
} else {
context.onError(
compilerDom.createDOMCompilerError(
@@ -1228,8 +1278,7 @@ const ssrInjectFallthroughAttrs = (node, context) => {
let hasEncounteredIf = false;
for (const c of filterChild(parent)) {
if (c.type === 9 || c.type === 1 && compilerDom.findDir(c, "if")) {
if (hasEncounteredIf)
return;
if (hasEncounteredIf) return;
hasEncounteredIf = true;
} else if (
// node before v-if
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@vue/compiler-ssr",
"version": "3.4.15",
"version": "3.5.13",
"description": "@vue/compiler-ssr",
"main": "dist/compiler-ssr.cjs.js",
"types": "dist/compiler-ssr.d.ts",
@@ -28,7 +28,7 @@
},
"homepage": "https://github.com/vuejs/core/tree/main/packages/compiler-ssr#readme",
"dependencies": {
"@vue/shared": "3.4.15",
"@vue/compiler-dom": "3.4.15"
"@vue/shared": "3.5.13",
"@vue/compiler-dom": "3.5.13"
}
}
+1248 -588
View File
File diff suppressed because it is too large Load Diff
+1151 -550
View File
File diff suppressed because it is too large Load Diff
+298 -201
View File
@@ -16,185 +16,16 @@ export declare enum ReactiveFlags {
IS_REACTIVE = "__v_isReactive",
IS_READONLY = "__v_isReadonly",
IS_SHALLOW = "__v_isShallow",
RAW = "__v_raw"
RAW = "__v_raw",
IS_REF = "__v_isRef"
}
type Dep = Map<ReactiveEffect, number> & {
cleanup: () => void;
computed?: ComputedRefImpl<any>;
};
export declare class EffectScope {
detached: boolean;
constructor(detached?: boolean);
get active(): boolean;
run<T>(fn: () => T): T | undefined;
stop(fromParent?: boolean): void;
}
/**
* Creates an effect scope object which can capture the reactive effects (i.e.
* computed and watchers) created within it so that these effects can be
* disposed together. For detailed use cases of this API, please consult its
* corresponding {@link https://github.com/vuejs/rfcs/blob/master/active-rfcs/0041-reactivity-effect-scope.md | RFC}.
*
* @param detached - Can be used to create a "detached" effect scope.
* @see {@link https://vuejs.org/api/reactivity-advanced.html#effectscope}
*/
export declare function effectScope(detached?: boolean): EffectScope;
/**
* Returns the current active effect scope if there is one.
*
* @see {@link https://vuejs.org/api/reactivity-advanced.html#getcurrentscope}
*/
export declare function getCurrentScope(): EffectScope | undefined;
/**
* Registers a dispose callback on the current active effect scope. The
* callback will be invoked when the associated effect scope is stopped.
*
* @param fn - The callback function to attach to the scope's cleanup.
* @see {@link https://vuejs.org/api/reactivity-advanced.html#onscopedispose}
*/
export declare function onScopeDispose(fn: () => void): void;
export type EffectScheduler = (...args: any[]) => any;
export type DebuggerEvent = {
effect: ReactiveEffect;
} & DebuggerEventExtraInfo;
export type DebuggerEventExtraInfo = {
target: object;
type: TrackOpTypes | TriggerOpTypes;
key: any;
newValue?: any;
oldValue?: any;
oldTarget?: Map<any, any> | Set<any>;
};
export declare class ReactiveEffect<T = any> {
fn: () => T;
trigger: () => void;
scheduler?: EffectScheduler | undefined;
active: boolean;
deps: Dep[];
onStop?: () => void;
onTrack?: (event: DebuggerEvent) => void;
onTrigger?: (event: DebuggerEvent) => void;
constructor(fn: () => T, trigger: () => void, scheduler?: EffectScheduler | undefined, scope?: EffectScope);
get dirty(): boolean;
set dirty(v: boolean);
run(): T;
stop(): void;
}
export interface DebuggerOptions {
onTrack?: (event: DebuggerEvent) => void;
onTrigger?: (event: DebuggerEvent) => void;
}
export interface ReactiveEffectOptions extends DebuggerOptions {
lazy?: boolean;
scheduler?: EffectScheduler;
scope?: EffectScope;
allowRecurse?: boolean;
onStop?: () => void;
}
export interface ReactiveEffectRunner<T = any> {
(): T;
effect: ReactiveEffect;
}
/**
* Registers the given function to track reactive updates.
*
* The given function will be run once immediately. Every time any reactive
* property that's accessed within it gets updated, the function will run again.
*
* @param fn - The function that will track reactive updates.
* @param options - Allows to control the effect's behaviour.
* @returns A runner that can be used to control the effect after creation.
*/
export declare function effect<T = any>(fn: () => T, options?: ReactiveEffectOptions): ReactiveEffectRunner;
/**
* Stops the effect associated with the given runner.
*
* @param runner - Association with the effect to stop tracking.
*/
export declare function stop(runner: ReactiveEffectRunner): void;
/**
* Temporarily pauses tracking.
*/
export declare function pauseTracking(): void;
/**
* Re-enables effect tracking (if it was paused).
*/
export declare function enableTracking(): void;
/**
* Resets the previous global effect tracking state.
*/
export declare function resetTracking(): void;
export declare function pauseScheduling(): void;
export declare function resetScheduling(): void;
declare const ComputedRefSymbol: unique symbol;
export interface ComputedRef<T = any> extends WritableComputedRef<T> {
readonly value: T;
[ComputedRefSymbol]: true;
}
export interface WritableComputedRef<T> extends Ref<T> {
readonly effect: ReactiveEffect<T>;
}
export type ComputedGetter<T> = (oldValue?: T) => T;
export type ComputedSetter<T> = (newValue: T) => void;
export interface WritableComputedOptions<T> {
get: ComputedGetter<T>;
set: ComputedSetter<T>;
}
declare class ComputedRefImpl<T> {
private readonly _setter;
dep?: Dep;
private _value;
readonly effect: ReactiveEffect<T>;
readonly __v_isRef = true;
readonly [ReactiveFlags.IS_READONLY]: boolean;
_cacheable: boolean;
constructor(getter: ComputedGetter<T>, _setter: ComputedSetter<T>, isReadonly: boolean, isSSR: boolean);
get value(): T;
set value(newValue: T);
get _dirty(): boolean;
set _dirty(v: boolean);
}
/**
* Takes a getter function and returns a readonly reactive ref object for the
* returned value from the getter. It can also take an object with get and set
* functions to create a writable ref object.
*
* @example
* ```js
* // Creating a readonly computed ref:
* const count = ref(1)
* const plusOne = computed(() => count.value + 1)
*
* console.log(plusOne.value) // 2
* plusOne.value++ // error
* ```
*
* ```js
* // Creating a writable computed ref:
* const count = ref(1)
* const plusOne = computed({
* get: () => count.value + 1,
* set: (val) => {
* count.value = val - 1
* }
* })
*
* plusOne.value = 1
* console.log(count.value) // 0
* ```
*
* @param getter - Function that produces the next value.
* @param debugOptions - For debugging. See {@link https://vuejs.org/guide/extras/reactivity-in-depth.html#computed-debugging}.
* @see {@link https://vuejs.org/api/reactivity-core.html#computed}
*/
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 type UnwrapNestedRefs<T> = T extends Ref ? T : UnwrapRefSimple<T>;
declare const ReactiveMarkerSymbol: unique symbol;
export interface ReactiveMarker {
[ReactiveMarkerSymbol]?: void;
}
export type Reactive<T> = UnwrapNestedRefs<T> & (T extends readonly any[] ? ReactiveMarker : {});
/**
* Returns a reactive proxy of the object.
*
@@ -210,7 +41,7 @@ export type UnwrapNestedRefs<T> = T extends Ref ? T : UnwrapRefSimple<T>;
* @param target - The source object.
* @see {@link https://vuejs.org/api/reactivity-core.html#reactive}
*/
export declare function reactive<T extends object>(target: T): UnwrapNestedRefs<T>;
export declare function reactive<T extends object>(target: T): Reactive<T>;
declare const ShallowReactiveMarker: unique symbol;
export type ShallowReactive<T> = T & {
[ShallowReactiveMarker]?: true;
@@ -248,7 +79,7 @@ export type ShallowReactive<T> = T & {
export declare function shallowReactive<T extends object>(target: T): ShallowReactive<T>;
type Primitive = string | number | boolean | bigint | symbol | undefined | null;
type Builtin = Primitive | Function | Date | Error | RegExp;
export 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 {} ? {
export 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, unknown> ? Readonly<Ref<DeepReadonly<U>>> : T extends {} ? {
readonly [K in keyof T]: DeepReadonly<T[K]>;
} : Readonly<T>;
/**
@@ -351,7 +182,7 @@ export declare function isShallow(value: unknown): boolean;
* @param value - The value to check.
* @see {@link https://vuejs.org/api/reactivity-utilities.html#isproxy}
*/
export declare function isProxy(value: unknown): boolean;
export declare function isProxy(value: any): boolean;
/**
* Returns the raw, original object of a Vue-created proxy.
*
@@ -402,11 +233,192 @@ export type Raw<T> = T & {
* @see {@link https://vuejs.org/api/reactivity-advanced.html#markraw}
*/
export declare function markRaw<T extends object>(value: T): Raw<T>;
/**
* Returns a reactive proxy of the given value (if possible).
*
* If the given value is not an object, the original value itself is returned.
*
* @param value - The value for which a reactive proxy shall be created.
*/
export declare const toReactive: <T extends unknown>(value: T) => T;
/**
* Returns a readonly proxy of the given value (if possible).
*
* If the given value is not an object, the original value itself is returned.
*
* @param value - The value for which a readonly proxy shall be created.
*/
export declare const toReadonly: <T extends unknown>(value: T) => DeepReadonly<T>;
export type EffectScheduler = (...args: any[]) => any;
export type DebuggerEvent = {
effect: Subscriber;
} & DebuggerEventExtraInfo;
export type DebuggerEventExtraInfo = {
target: object;
type: TrackOpTypes | TriggerOpTypes;
key: any;
newValue?: any;
oldValue?: any;
oldTarget?: Map<any, any> | Set<any>;
};
export interface DebuggerOptions {
onTrack?: (event: DebuggerEvent) => void;
onTrigger?: (event: DebuggerEvent) => void;
}
export interface ReactiveEffectOptions extends DebuggerOptions {
scheduler?: EffectScheduler;
allowRecurse?: boolean;
onStop?: () => void;
}
export declare enum EffectFlags {
/**
* ReactiveEffect only
*/
ACTIVE = 1,
RUNNING = 2,
TRACKING = 4,
NOTIFIED = 8,
DIRTY = 16,
ALLOW_RECURSE = 32,
PAUSED = 64
}
/**
* Subscriber is a type that tracks (or subscribes to) a list of deps.
*/
interface Subscriber extends DebuggerOptions {
}
export declare class ReactiveEffect<T = any> implements Subscriber, ReactiveEffectOptions {
fn: () => T;
scheduler?: EffectScheduler;
onStop?: () => void;
onTrack?: (event: DebuggerEvent) => void;
onTrigger?: (event: DebuggerEvent) => void;
constructor(fn: () => T);
pause(): void;
resume(): void;
run(): T;
stop(): void;
trigger(): void;
get dirty(): boolean;
}
export interface ReactiveEffectRunner<T = any> {
(): T;
effect: ReactiveEffect;
}
export interface ReactiveEffectRunner<T = any> {
(): T;
effect: ReactiveEffect;
}
export declare function effect<T = any>(fn: () => T, options?: ReactiveEffectOptions): ReactiveEffectRunner<T>;
/**
* Stops the effect associated with the given runner.
*
* @param runner - Association with the effect to stop tracking.
*/
export declare function stop(runner: ReactiveEffectRunner): void;
/**
* Temporarily pauses tracking.
*/
export declare function pauseTracking(): void;
/**
* Re-enables effect tracking (if it was paused).
*/
export declare function enableTracking(): void;
/**
* Resets the previous global effect tracking state.
*/
export declare function resetTracking(): void;
/**
* Registers a cleanup function for the current active effect.
* The cleanup function is called right before the next effect run, or when the
* effect is stopped.
*
* Throws a warning if there is no current active effect. The warning can be
* suppressed by passing `true` to the second argument.
*
* @param fn - the cleanup function to be registered
* @param failSilently - if `true`, will not throw warning when called without
* an active effect.
*/
export declare function onEffectCleanup(fn: () => void, failSilently?: boolean): void;
declare const ComputedRefSymbol: unique symbol;
declare const WritableComputedRefSymbol: unique symbol;
interface BaseComputedRef<T, S = T> extends Ref<T, S> {
[ComputedRefSymbol]: true;
/**
* @deprecated computed no longer uses effect
*/
effect: ComputedRefImpl;
}
export interface ComputedRef<T = any> extends BaseComputedRef<T> {
readonly value: T;
}
export interface WritableComputedRef<T, S = T> extends BaseComputedRef<T, S> {
[WritableComputedRefSymbol]: true;
}
export type ComputedGetter<T> = (oldValue?: T) => T;
export type ComputedSetter<T> = (newValue: T) => void;
export interface WritableComputedOptions<T, S = T> {
get: ComputedGetter<T>;
set: ComputedSetter<S>;
}
/**
* @private exported by @vue/reactivity for Vue core use, but not exported from
* the main vue package
*/
export declare class ComputedRefImpl<T = any> implements Subscriber {
fn: ComputedGetter<T>;
private readonly setter;
effect: this;
onTrack?: (event: DebuggerEvent) => void;
onTrigger?: (event: DebuggerEvent) => void;
constructor(fn: ComputedGetter<T>, setter: ComputedSetter<T> | undefined, isSSR: boolean);
get value(): T;
set value(newValue: T);
}
/**
* Takes a getter function and returns a readonly reactive ref object for the
* returned value from the getter. It can also take an object with get and set
* functions to create a writable ref object.
*
* @example
* ```js
* // Creating a readonly computed ref:
* const count = ref(1)
* const plusOne = computed(() => count.value + 1)
*
* console.log(plusOne.value) // 2
* plusOne.value++ // error
* ```
*
* ```js
* // Creating a writable computed ref:
* const count = ref(1)
* const plusOne = computed({
* get: () => count.value + 1,
* set: (val) => {
* count.value = val - 1
* }
* })
*
* plusOne.value = 1
* console.log(count.value) // 0
* ```
*
* @param getter - Function that produces the next value.
* @param debugOptions - For debugging. See {@link https://vuejs.org/guide/extras/reactivity-in-depth.html#computed-debugging}.
* @see {@link https://vuejs.org/api/reactivity-core.html#computed}
*/
export declare function computed<T>(getter: ComputedGetter<T>, debugOptions?: DebuggerOptions): ComputedRef<T>;
export declare function computed<T, S = T>(options: WritableComputedOptions<T, S>, debugOptions?: DebuggerOptions): WritableComputedRef<T, S>;
declare const RefSymbol: unique symbol;
declare const RawSymbol: unique symbol;
export interface Ref<T = any> {
value: T;
export interface Ref<T = any, S = T> {
get value(): T;
set value(_: S);
/**
* Type differentiator only.
* We need this to be in public d.ts but don't want it to show up in IDE
@@ -428,10 +440,10 @@ export declare function isRef<T>(r: Ref<T> | unknown): r is Ref<T>;
* @param value - The object to wrap in the ref.
* @see {@link https://vuejs.org/api/reactivity-core.html#ref}
*/
export declare function ref<T>(value: T): Ref<UnwrapRef<T>>;
export declare function ref<T>(value: T): [T] extends [Ref] ? IfAny<T, Ref<T>, T> : Ref<UnwrapRef<T>, UnwrapRef<T> | T>;
export declare function ref<T = any>(): Ref<T | undefined>;
declare const ShallowRefMarker: unique symbol;
export type ShallowRef<T = any> = Ref<T> & {
export type ShallowRef<T = any, S = T> = Ref<T, S> & {
[ShallowRefMarker]?: true;
};
/**
@@ -479,8 +491,8 @@ export declare function shallowRef<T = any>(): ShallowRef<T | undefined>;
* @see {@link https://vuejs.org/api/reactivity-advanced.html#triggerref}
*/
export declare function triggerRef(ref: Ref): void;
export type MaybeRef<T = any> = T | Ref<T>;
export type MaybeRefOrGetter<T = any> = MaybeRef<T> | (() => T);
export type MaybeRef<T = any> = T | Ref<T> | ShallowRef<T> | WritableComputedRef<T>;
export type MaybeRefOrGetter<T = any> = MaybeRef<T> | ComputedRef<T> | (() => T);
/**
* Returns the inner value if the argument is a ref, otherwise return the
* argument itself. This is a sugar function for
@@ -514,13 +526,11 @@ export declare function unref<T>(ref: MaybeRef<T> | ComputedRef<T>): T;
* @param source - A getter, an existing ref, or a non-function value.
* @see {@link https://vuejs.org/api/reactivity-utilities.html#tovalue}
*/
export declare function toValue<T>(source: MaybeRefOrGetter<T> | ComputedRef<T>): T;
export declare function toValue<T>(source: MaybeRefOrGetter<T>): T;
/**
* Returns a reactive proxy for the given object.
*
* If the object already is reactive, it's returned as-is. If not, a new
* reactive proxy is created. Direct child properties that are refs are properly
* handled, as well.
* Returns a proxy for the given object that shallowly unwraps properties that
* are refs. If the object already is reactive, it's returned as-is. If not, a
* new reactive proxy is created.
*
* @param objectWithRefs - Either an already-reactive object or a simple object
* that contains refs.
@@ -597,7 +607,6 @@ export type ToRef<T> = IfAny<T, Ref<T>, [T] extends [Ref] ? T : Ref<T>>;
export declare function toRef<T>(value: T): T extends () => infer R ? Readonly<Ref<R>> : T extends Ref ? T : Ref<UnwrapRef<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>>;
type BaseTypes = string | number | boolean;
/**
* This is a special exported interface for other packages to declare
* additional types that should bail out for ref unwrapping. For example
@@ -614,11 +623,11 @@ type BaseTypes = string | number | boolean;
export interface RefUnwrapBailTypes {
}
export type ShallowUnwrapRef<T> = {
[K in keyof T]: DistrubuteRef<T[K]>;
[K in keyof T]: DistributeRef<T[K]>;
};
type DistrubuteRef<T> = T extends Ref<infer V> ? V : T;
export type UnwrapRef<T> = T extends ShallowRef<infer V> ? V : T extends Ref<infer V> ? UnwrapRefSimple<V> : UnwrapRefSimple<T>;
type UnwrapRefSimple<T> = T extends Function | BaseTypes | Ref | RefUnwrapBailTypes[keyof RefUnwrapBailTypes] | {
type DistributeRef<T> = T extends Ref<infer V, unknown> ? V : T;
export type UnwrapRef<T> = T extends ShallowRef<infer V, unknown> ? V : T extends Ref<infer V, unknown> ? UnwrapRefSimple<V> : UnwrapRefSimple<T>;
type UnwrapRefSimple<T> = T extends Builtin | Ref | RefUnwrapBailTypes[keyof RefUnwrapBailTypes] | {
[RawSymbol]?: true;
} ? T : T extends Map<infer K, infer V> ? Map<K, UnwrapRefSimple<V>> & UnwrapRef<Omit<T, keyof Map<any, any>>> : T extends WeakMap<infer K, infer V> ? WeakMap<K, UnwrapRefSimple<V>> & UnwrapRef<Omit<T, keyof WeakMap<any, any>>> : T extends Set<infer V> ? Set<UnwrapRefSimple<V>> & UnwrapRef<Omit<T, keyof Set<any>>> : T extends WeakSet<infer V> ? WeakSet<UnwrapRefSimple<V>> & UnwrapRef<Omit<T, keyof WeakSet<any>>> : T extends ReadonlyArray<any> ? {
[K in keyof T]: UnwrapRefSimple<T[K]>;
@@ -628,12 +637,9 @@ type UnwrapRefSimple<T> = T extends Function | BaseTypes | Ref | RefUnwrapBailTy
[P in keyof T]: P extends symbol ? T[P] : UnwrapRef<T[P]>;
} : T;
/**
* @deprecated use `computed` instead. See #5912
*/
export declare const deferredComputed: typeof computed;
export declare const ITERATE_KEY: unique symbol;
export declare const MAP_KEY_ITERATE_KEY: unique symbol;
export declare const ARRAY_ITERATE_KEY: unique symbol;
/**
* Tracks access to a reactive property.
*
@@ -655,3 +661,94 @@ export declare function track(target: object, type: TrackOpTypes, key: unknown):
*/
export declare function trigger(target: object, type: TriggerOpTypes, key?: unknown, newValue?: unknown, oldValue?: unknown, oldTarget?: Map<unknown, unknown> | Set<unknown>): void;
export declare class EffectScope {
detached: boolean;
private _isPaused;
constructor(detached?: boolean);
get active(): boolean;
pause(): void;
/**
* Resumes the effect scope, including all child scopes and effects.
*/
resume(): void;
run<T>(fn: () => T): T | undefined;
stop(fromParent?: boolean): void;
}
/**
* Creates an effect scope object which can capture the reactive effects (i.e.
* computed and watchers) created within it so that these effects can be
* disposed together. For detailed use cases of this API, please consult its
* corresponding {@link https://github.com/vuejs/rfcs/blob/master/active-rfcs/0041-reactivity-effect-scope.md | RFC}.
*
* @param detached - Can be used to create a "detached" effect scope.
* @see {@link https://vuejs.org/api/reactivity-advanced.html#effectscope}
*/
export declare function effectScope(detached?: boolean): EffectScope;
/**
* Returns the current active effect scope if there is one.
*
* @see {@link https://vuejs.org/api/reactivity-advanced.html#getcurrentscope}
*/
export declare function getCurrentScope(): EffectScope | undefined;
/**
* Registers a dispose callback on the current active effect scope. The
* callback will be invoked when the associated effect scope is stopped.
*
* @param fn - The callback function to attach to the scope's cleanup.
* @see {@link https://vuejs.org/api/reactivity-advanced.html#onscopedispose}
*/
export declare function onScopeDispose(fn: () => void, failSilently?: boolean): void;
/**
* Track array iteration and return:
* - if input is reactive: a cloned raw array with reactive values
* - if input is non-reactive or shallowReactive: the original raw array
*/
export declare function reactiveReadArray<T>(array: T[]): T[];
/**
* Track array iteration and return raw array
*/
export declare function shallowReadArray<T>(arr: T[]): T[];
export declare enum WatchErrorCodes {
WATCH_GETTER = 2,
WATCH_CALLBACK = 3,
WATCH_CLEANUP = 4
}
export type WatchEffect = (onCleanup: OnCleanup) => void;
export type WatchSource<T = any> = Ref<T, any> | ComputedRef<T> | (() => T);
export type WatchCallback<V = any, OV = any> = (value: V, oldValue: OV, onCleanup: OnCleanup) => any;
export type OnCleanup = (cleanupFn: () => void) => void;
export interface WatchOptions<Immediate = boolean> extends DebuggerOptions {
immediate?: Immediate;
deep?: boolean | number;
once?: boolean;
scheduler?: WatchScheduler;
onWarn?: (msg: string, ...args: any[]) => void;
}
export type WatchStopHandle = () => void;
export interface WatchHandle extends WatchStopHandle {
pause: () => void;
resume: () => void;
stop: () => void;
}
export type WatchScheduler = (job: () => void, isFirstRun: boolean) => void;
/**
* Returns the current active effect if there is one.
*/
export declare function getCurrentWatcher(): ReactiveEffect<any> | undefined;
/**
* Registers a cleanup callback on the current active effect. This
* registered cleanup callback will be invoked right before the
* associated effect re-runs.
*
* @param cleanupFn - The callback function to attach to the effect's cleanup.
* @param failSilently - if `true`, will not throw warning when called without
* an active effect.
* @param owner - The effect that this cleanup function should be attached to.
* By default, the current active effect.
*/
export declare function onWatcherCleanup(cleanupFn: () => void, failSilently?: boolean, owner?: ReactiveEffect | undefined): void;
export declare function watch(source: WatchSource | WatchSource[] | WatchEffect | object, cb?: WatchCallback | null, options?: WatchOptions): WatchHandle;
export declare function traverse(value: unknown, depth?: number, seen?: Set<unknown>): unknown;
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large Load Diff
+1265 -592
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@vue/reactivity",
"version": "3.4.15",
"version": "3.5.13",
"description": "@vue/reactivity",
"main": "index.js",
"module": "dist/reactivity.esm-bundler.js",
@@ -50,6 +50,6 @@
},
"homepage": "https://github.com/vuejs/core/tree/main/packages/reactivity#readme",
"dependencies": {
"@vue/shared": "3.4.15"
"@vue/shared": "3.5.13"
}
}
+1 -1
View File
@@ -13,7 +13,7 @@ const { render, createApp } = createRenderer({
patchProp,
insert,
remove,
createElement
createElement,
// ...
})
+3056 -2788
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+651 -481
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@vue/runtime-core",
"version": "3.4.15",
"version": "3.5.13",
"description": "@vue/runtime-core",
"main": "index.js",
"module": "dist/runtime-core.esm-bundler.js",
@@ -46,7 +46,7 @@
},
"homepage": "https://github.com/vuejs/core/tree/main/packages/runtime-core#readme",
"dependencies": {
"@vue/shared": "3.4.15",
"@vue/reactivity": "3.4.15"
"@vue/shared": "3.5.13",
"@vue/reactivity": "3.5.13"
}
}
+2 -2
View File
@@ -1,12 +1,12 @@
# @vue/runtime-dom
``` js
```js
import { h, createApp } from '@vue/runtime-dom'
const RootComponent = {
render() {
return h('div', 'hello world')
}
},
}
createApp(RootComponent).mount('#app')
+422 -156
View File
File diff suppressed because it is too large Load Diff
+367 -152
View File
@@ -1,5 +1,5 @@
/**
* @vue/runtime-dom v3.4.15
* @vue/runtime-dom v3.5.13
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT
**/
@@ -10,6 +10,17 @@ Object.defineProperty(exports, '__esModule', { value: true });
var runtimeCore = require('@vue/runtime-core');
var shared = require('@vue/shared');
let policy = void 0;
const tt = typeof window !== "undefined" && window.trustedTypes;
if (tt) {
try {
policy = /* @__PURE__ */ tt.createPolicy("vue", {
createHTML: (val) => val
});
} catch (e) {
}
}
const unsafeToTrustedHTML = policy ? (val) => policy.createHTML(val) : (val) => val;
const svgNS = "http://www.w3.org/2000/svg";
const mathmlNS = "http://www.w3.org/1998/Math/MathML";
const doc = typeof document !== "undefined" ? document : null;
@@ -25,7 +36,7 @@ const nodeOps = {
}
},
createElement: (tag, namespace, is, props) => {
const el = namespace === "svg" ? doc.createElementNS(svgNS, tag) : namespace === "mathml" ? doc.createElementNS(mathmlNS, tag) : doc.createElement(tag, is ? { is } : void 0);
const el = namespace === "svg" ? doc.createElementNS(svgNS, tag) : namespace === "mathml" ? doc.createElementNS(mathmlNS, tag) : is ? doc.createElement(tag, { is }) : doc.createElement(tag);
if (tag === "select" && props && props.multiple != null) {
el.setAttribute("multiple", props.multiple);
}
@@ -54,11 +65,12 @@ const nodeOps = {
if (start && (start === end || start.nextSibling)) {
while (true) {
parent.insertBefore(start.cloneNode(true), anchor);
if (start === end || !(start = start.nextSibling))
break;
if (start === end || !(start = start.nextSibling)) break;
}
} else {
templateContainer.innerHTML = namespace === "svg" ? `<svg>${content}</svg>` : namespace === "mathml" ? `<math>${content}</math>` : content;
templateContainer.innerHTML = unsafeToTrustedHTML(
namespace === "svg" ? `<svg>${content}</svg>` : namespace === "mathml" ? `<math>${content}</math>` : content
);
const template = templateContainer.content;
if (namespace === "svg" || namespace === "mathml") {
const wrapper = template.firstChild;
@@ -81,8 +93,6 @@ const nodeOps = {
const TRANSITION = "transition";
const ANIMATION = "animation";
const vtcKey = Symbol("_vtc");
const Transition = (props, { slots }) => runtimeCore.h(runtimeCore.BaseTransition, resolveTransitionProps(props), slots);
Transition.displayName = "Transition";
const DOMTransitionPropsValidators = {
name: String,
type: String,
@@ -101,11 +111,19 @@ const DOMTransitionPropsValidators = {
leaveActiveClass: String,
leaveToClass: String
};
const TransitionPropsValidators = Transition.props = /* @__PURE__ */ shared.extend(
const TransitionPropsValidators = /* @__PURE__ */ shared.extend(
{},
runtimeCore.BaseTransitionPropsValidators,
DOMTransitionPropsValidators
);
const decorate$1 = (t) => {
t.displayName = "Transition";
t.props = TransitionPropsValidators;
return t;
};
const Transition = /* @__PURE__ */ decorate$1(
(props, { slots }) => runtimeCore.h(runtimeCore.BaseTransition, resolveTransitionProps(props), slots)
);
const callHook = (hook, args = []) => {
if (shared.isArray(hook)) {
hook.forEach((h2) => h2(...args));
@@ -153,7 +171,8 @@ function resolveTransitionProps(rawProps) {
onAppear = onEnter,
onAppearCancelled = onEnterCancelled
} = baseProps;
const finishEnter = (el, isAppear, done) => {
const finishEnter = (el, isAppear, done, isCancelled) => {
el._enterCancelled = isCancelled;
removeTransitionClass(el, isAppear ? appearToClass : enterToClass);
removeTransitionClass(el, isAppear ? appearActiveClass : enterActiveClass);
done && done();
@@ -196,8 +215,13 @@ function resolveTransitionProps(rawProps) {
el._isLeaving = true;
const resolve = () => finishLeave(el, done);
addTransitionClass(el, leaveFromClass);
forceReflow();
addTransitionClass(el, leaveActiveClass);
if (!el._enterCancelled) {
forceReflow();
addTransitionClass(el, leaveActiveClass);
} else {
addTransitionClass(el, leaveActiveClass);
forceReflow();
}
nextFrame(() => {
if (!el._isLeaving) {
return;
@@ -211,11 +235,11 @@ function resolveTransitionProps(rawProps) {
callHook(onLeave, [el, resolve]);
},
onEnterCancelled(el) {
finishEnter(el, false);
finishEnter(el, false, void 0, true);
callHook(onEnterCancelled, [el]);
},
onAppearCancelled(el) {
finishEnter(el, true);
finishEnter(el, true, void 0, true);
callHook(onAppearCancelled, [el]);
},
onLeaveCancelled(el) {
@@ -265,7 +289,7 @@ function whenTransitionEnds(el, expectedType, explicitTimeout, resolve) {
resolve();
}
};
if (explicitTimeout) {
if (explicitTimeout != null) {
return setTimeout(resolveIfNotStale, explicitTimeout);
}
const { type, timeout, propCount } = getTransitionInfo(el, expectedType);
@@ -336,8 +360,7 @@ function getTimeout(delays, durations) {
return Math.max(...durations.map((d, i) => toMs(d) + toMs(delays[i])));
}
function toMs(s) {
if (s === "auto")
return 0;
if (s === "auto") return 0;
return Number(s.slice(0, -1).replace(",", ".")) * 1e3;
}
function forceReflow() {
@@ -358,10 +381,11 @@ function patchClass(el, value, isSVG) {
}
}
const vShowOldKey = Symbol("_vod");
const vShowOriginalDisplay = Symbol("_vod");
const vShowHidden = Symbol("_vsh");
const vShow = {
beforeMount(el, { value }, { transition }) {
el[vShowOldKey] = el.style.display === "none" ? "" : el.style.display;
el[vShowOriginalDisplay] = el.style.display === "none" ? "" : el.style.display;
if (transition && value) {
transition.beforeEnter(el);
} else {
@@ -374,8 +398,7 @@ const vShow = {
}
},
updated(el, { value, oldValue }, { transition }) {
if (!value === !oldValue)
return;
if (!value === !oldValue) return;
if (transition) {
if (value) {
transition.beforeEnter(el);
@@ -395,7 +418,8 @@ const vShow = {
}
};
function setDisplay(el, value) {
el.style.display = value ? el[vShowOldKey] : "none";
el.style.display = value ? el[vShowOriginalDisplay] : "none";
el[vShowHidden] = !value;
}
function initVShowForSSR() {
vShow.getSSRProps = ({ value }) => {
@@ -410,19 +434,32 @@ function useCssVars(getter) {
return;
}
const displayRE = /(^|;)\s*display\s*:/;
function patchStyle(el, prev, next) {
const style = el.style;
const currentDisplay = style.display;
const isCssString = shared.isString(next);
let hasControlledDisplay = false;
if (next && !isCssString) {
if (prev && !shared.isString(prev)) {
for (const key in prev) {
if (next[key] == null) {
setStyle(style, key, "");
if (prev) {
if (!shared.isString(prev)) {
for (const key in prev) {
if (next[key] == null) {
setStyle(style, key, "");
}
}
} else {
for (const prevStyle of prev.split(";")) {
const key = prevStyle.slice(0, prevStyle.indexOf(":")).trim();
if (next[key] == null) {
setStyle(style, key, "");
}
}
}
}
for (const key in next) {
if (key === "display") {
hasControlledDisplay = true;
}
setStyle(style, key, next[key]);
}
} else {
@@ -433,13 +470,17 @@ function patchStyle(el, prev, next) {
next += ";" + cssVarText;
}
style.cssText = next;
hasControlledDisplay = displayRE.test(next);
}
} else if (prev) {
el.removeAttribute("style");
}
}
if (vShowOldKey in el) {
style.display = currentDisplay;
if (vShowOriginalDisplay in el) {
el[vShowOriginalDisplay] = hasControlledDisplay ? style.display : "";
if (el[vShowHidden]) {
style.display = "none";
}
}
}
const importantRE = /\s*!important$/;
@@ -447,8 +488,7 @@ function setStyle(style, name, val) {
if (shared.isArray(val)) {
val.forEach((v) => setStyle(style, name, v));
} else {
if (val == null)
val = "";
if (val == null) val = "";
if (name.startsWith("--")) {
style.setProperty(name, val);
} else {
@@ -487,7 +527,7 @@ function autoPrefix(style, rawName) {
}
const xlinkNS = "http://www.w3.org/1999/xlink";
function patchAttr(el, key, value, isSVG, instance) {
function patchAttr(el, key, value, isSVG, instance, isBoolean = shared.isSpecialBooleanAttr(key)) {
if (isSVG && key.startsWith("xlink:")) {
if (value == null) {
el.removeAttributeNS(xlinkNS, key.slice(6, key.length));
@@ -495,35 +535,40 @@ function patchAttr(el, key, value, isSVG, instance) {
el.setAttributeNS(xlinkNS, key, value);
}
} else {
const isBoolean = shared.isSpecialBooleanAttr(key);
if (value == null || isBoolean && !shared.includeBooleanAttr(value)) {
el.removeAttribute(key);
} else {
el.setAttribute(key, isBoolean ? "" : value);
el.setAttribute(
key,
isBoolean ? "" : shared.isSymbol(value) ? String(value) : value
);
}
}
}
function patchDOMProp(el, key, value, prevChildren, parentComponent, parentSuspense, unmountChildren) {
function patchDOMProp(el, key, value, parentComponent, attrName) {
if (key === "innerHTML" || key === "textContent") {
if (prevChildren) {
unmountChildren(prevChildren, parentComponent, parentSuspense);
if (value != null) {
el[key] = key === "innerHTML" ? unsafeToTrustedHTML(value) : value;
}
el[key] = value == null ? "" : value;
return;
}
const tag = el.tagName;
if (key === "value" && tag !== "PROGRESS" && // custom elements may use _value internally
!tag.includes("-")) {
el._value = value;
const oldValue = tag === "OPTION" ? el.getAttribute("value") : el.value;
const newValue = value == null ? "" : value;
if (oldValue !== newValue) {
const oldValue = tag === "OPTION" ? el.getAttribute("value") || "" : el.value;
const newValue = value == null ? (
// #11647: value should be set as empty string for null and undefined,
// but <input type="checkbox"> should be set as 'on'.
el.type === "checkbox" ? "on" : ""
) : String(value);
if (oldValue !== newValue || !("_value" in el)) {
el.value = newValue;
}
if (value == null) {
el.removeAttribute(key);
}
el._value = value;
return;
}
let needRemove = false;
@@ -543,7 +588,7 @@ function patchDOMProp(el, key, value, prevChildren, parentComponent, parentSuspe
el[key] = value;
} catch (e) {
}
needRemove && el.removeAttribute(key);
needRemove && el.removeAttribute(attrName || key);
}
function addEventListener(el, event, handler, options) {
@@ -561,7 +606,10 @@ function patchEvent(el, rawName, prevValue, nextValue, instance = null) {
} else {
const [name, options] = parseName(rawName);
if (nextValue) {
const invoker = invokers[rawName] = createInvoker(nextValue, instance);
const invoker = invokers[rawName] = createInvoker(
nextValue,
instance
);
addEventListener(el, name, invoker, options);
} else if (existingInvoker) {
removeEventListener(el, name, existingInvoker, options);
@@ -611,7 +659,9 @@ function patchStopImmediatePropagation(e, value) {
originalStop.call(e);
e._stopped = true;
};
return value.map((fn) => (e2) => !e2._stopped && fn && fn(e2));
return value.map(
(fn) => (e2) => !e2._stopped && fn && fn(e2)
);
} else {
return value;
}
@@ -619,7 +669,7 @@ function patchStopImmediatePropagation(e, value) {
const isNativeOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // lowercase letter
key.charCodeAt(2) > 96 && key.charCodeAt(2) < 123;
const patchProp = (el, key, prevValue, nextValue, namespace, prevChildren, parentComponent, parentSuspense, unmountChildren) => {
const patchProp = (el, key, prevValue, nextValue, namespace, parentComponent) => {
const isSVG = namespace === "svg";
if (key === "class") {
patchClass(el, nextValue, isSVG);
@@ -630,15 +680,15 @@ const patchProp = (el, key, prevValue, nextValue, namespace, prevChildren, paren
patchEvent(el, key, prevValue, nextValue, parentComponent);
}
} else if (key[0] === "." ? (key = key.slice(1), true) : key[0] === "^" ? (key = key.slice(1), false) : shouldSetAsProp(el, key, nextValue, isSVG)) {
patchDOMProp(
el,
key,
nextValue,
prevChildren,
parentComponent,
parentSuspense,
unmountChildren
);
patchDOMProp(el, key, nextValue);
if (!el.tagName.includes("-") && (key === "value" || key === "checked" || key === "selected")) {
patchAttr(el, key, nextValue, isSVG, parentComponent, key !== "value");
}
} else if (
// #11081 force set props for possible async custom element
el._isVueCE && (/[A-Z]/.test(key) || !shared.isString(nextValue))
) {
patchDOMProp(el, shared.camelize(key), nextValue, parentComponent, key);
} else {
if (key === "true-value") {
el._trueValue = nextValue;
@@ -682,66 +732,110 @@ function shouldSetAsProp(el, key, value, isSVG) {
return key in el;
}
const REMOVAL = {};
/*! #__NO_SIDE_EFFECTS__ */
// @__NO_SIDE_EFFECTS__
function defineCustomElement(options, hydrate2) {
const Comp = runtimeCore.defineComponent(options);
function defineCustomElement(options, extraOptions, _createApp) {
const Comp = runtimeCore.defineComponent(options, extraOptions);
if (shared.isPlainObject(Comp)) shared.extend(Comp, extraOptions);
class VueCustomElement extends VueElement {
constructor(initialProps) {
super(Comp, initialProps, hydrate2);
super(Comp, initialProps, _createApp);
}
}
VueCustomElement.def = Comp;
return VueCustomElement;
}
/*! #__NO_SIDE_EFFECTS__ */
const defineSSRCustomElement = /* @__NO_SIDE_EFFECTS__ */ (options) => {
return /* @__PURE__ */ defineCustomElement(options, hydrate);
const defineSSRCustomElement = /* @__NO_SIDE_EFFECTS__ */ (options, extraOptions) => {
return /* @__PURE__ */ defineCustomElement(options, extraOptions, createSSRApp);
};
const BaseClass = typeof HTMLElement !== "undefined" ? HTMLElement : class {
};
class VueElement extends BaseClass {
constructor(_def, _props = {}, hydrate2) {
constructor(_def, _props = {}, _createApp = createApp) {
super();
this._def = _def;
this._props = _props;
this._createApp = _createApp;
this._isVueCE = true;
/**
* @internal
*/
this._instance = null;
/**
* @internal
*/
this._app = null;
/**
* @internal
*/
this._nonce = this._def.nonce;
this._connected = false;
this._resolved = false;
this._numberProps = null;
this._styleChildren = /* @__PURE__ */ new WeakSet();
this._ob = null;
if (this.shadowRoot && hydrate2) {
hydrate2(this._createVNode(), this.shadowRoot);
if (this.shadowRoot && _createApp !== createApp) {
this._root = this.shadowRoot;
} else {
this.attachShadow({ mode: "open" });
if (!this._def.__asyncLoader) {
this._resolveProps(this._def);
if (_def.shadowRoot !== false) {
this.attachShadow({ mode: "open" });
this._root = this.shadowRoot;
} else {
this._root = this;
}
}
if (!this._def.__asyncLoader) {
this._resolveProps(this._def);
}
}
connectedCallback() {
if (!this.isConnected) return;
if (!this.shadowRoot) {
this._parseSlots();
}
this._connected = true;
let parent = this;
while (parent = parent && (parent.parentNode || parent.host)) {
if (parent instanceof VueElement) {
this._parent = parent;
break;
}
}
if (!this._instance) {
if (this._resolved) {
this._setParent();
this._update();
} else {
this._resolveDef();
if (parent && parent._pendingResolve) {
this._pendingResolve = parent._pendingResolve.then(() => {
this._pendingResolve = void 0;
this._resolveDef();
});
} else {
this._resolveDef();
}
}
}
}
_setParent(parent = this._parent) {
if (parent) {
this._instance.parent = parent._instance;
this._instance.provides = parent._instance.provides;
}
}
disconnectedCallback() {
this._connected = false;
if (this._ob) {
this._ob.disconnect();
this._ob = null;
}
runtimeCore.nextTick(() => {
if (!this._connected) {
render(null, this.shadowRoot);
this._instance = null;
if (this._ob) {
this._ob.disconnect();
this._ob = null;
}
this._app && this._app.unmount();
if (this._instance) this._instance.ce = void 0;
this._app = this._instance = null;
}
});
}
@@ -749,7 +843,9 @@ class VueElement extends BaseClass {
* resolve inner component definition (handle possible async component)
*/
_resolveDef() {
this._resolved = true;
if (this._pendingResolve) {
return;
}
for (let i = 0; i < this.attributes.length; i++) {
this._setAttr(this.attributes[i].name);
}
@@ -760,6 +856,8 @@ class VueElement extends BaseClass {
});
this._ob.observe(this, { attributes: true });
const resolve = (def, isAsync = false) => {
this._resolved = true;
this._pendingResolve = void 0;
const { props, styles } = def;
let numberProps;
if (props && !shared.isArray(props)) {
@@ -777,22 +875,44 @@ class VueElement extends BaseClass {
if (isAsync) {
this._resolveProps(def);
}
this._applyStyles(styles);
this._update();
if (this.shadowRoot) {
this._applyStyles(styles);
}
this._mount(def);
};
const asyncDef = this._def.__asyncLoader;
if (asyncDef) {
asyncDef().then((def) => resolve(def, true));
this._pendingResolve = asyncDef().then(
(def) => resolve(this._def = def, true)
);
} else {
resolve(this._def);
}
}
_mount(def) {
this._app = this._createApp(def);
if (def.configureApp) {
def.configureApp(this._app);
}
this._app._ceVNode = this._createVNode();
this._app.mount(this._root);
const exposed = this._instance && this._instance.exposed;
if (!exposed) return;
for (const key in exposed) {
if (!shared.hasOwn(this, key)) {
Object.defineProperty(this, key, {
// unwrap ref to be consistent with public instance behavior
get: () => runtimeCore.unref(exposed[key])
});
}
}
}
_resolveProps(def) {
const { props } = def;
const declaredPropKeys = shared.isArray(props) ? props : Object.keys(props || {});
for (const key of Object.keys(this)) {
if (key[0] !== "_" && declaredPropKeys.includes(key)) {
this._setProp(key, this[key], true, false);
this._setProp(key, this[key]);
}
}
for (const key of declaredPropKeys.map(shared.camelize)) {
@@ -801,18 +921,20 @@ class VueElement extends BaseClass {
return this._getProp(key);
},
set(val) {
this._setProp(key, val);
this._setProp(key, val, true, true);
}
});
}
}
_setAttr(key) {
let value = this.getAttribute(key);
if (key.startsWith("data-v-")) return;
const has = this.hasAttribute(key);
let value = has ? this.getAttribute(key) : REMOVAL;
const camelKey = shared.camelize(key);
if (this._numberProps && this._numberProps[camelKey]) {
if (has && this._numberProps && this._numberProps[camelKey]) {
value = shared.toNumber(value);
}
this._setProp(camelKey, value, false);
this._setProp(camelKey, value, false, true);
}
/**
* @internal
@@ -823,13 +945,22 @@ class VueElement extends BaseClass {
/**
* @internal
*/
_setProp(key, val, shouldReflect = true, shouldUpdate = true) {
_setProp(key, val, shouldReflect = true, shouldUpdate = false) {
if (val !== this._props[key]) {
this._props[key] = val;
if (val === REMOVAL) {
delete this._props[key];
} else {
this._props[key] = val;
if (key === "key" && this._app) {
this._app._ceVNode.key = val;
}
}
if (shouldUpdate && this._instance) {
this._update();
}
if (shouldReflect) {
const ob = this._ob;
ob && ob.disconnect();
if (val === true) {
this.setAttribute(shared.hyphenate(key), "");
} else if (typeof val === "string" || typeof val === "number") {
@@ -837,23 +968,30 @@ class VueElement extends BaseClass {
} else if (!val) {
this.removeAttribute(shared.hyphenate(key));
}
ob && ob.observe(this, { attributes: true });
}
}
}
_update() {
render(this._createVNode(), this.shadowRoot);
render(this._createVNode(), this._root);
}
_createVNode() {
const vnode = runtimeCore.createVNode(this._def, shared.extend({}, this._props));
const baseProps = {};
if (!this.shadowRoot) {
baseProps.onVnodeMounted = baseProps.onVnodeUpdated = this._renderSlots.bind(this);
}
const vnode = runtimeCore.createVNode(this._def, shared.extend(baseProps, this._props));
if (!this._instance) {
vnode.ce = (instance) => {
this._instance = instance;
instance.ce = this;
instance.isCE = true;
const dispatch = (event, args) => {
this.dispatchEvent(
new CustomEvent(event, {
detail: args
})
new CustomEvent(
event,
shared.isPlainObject(args[0]) ? shared.extend({ detail: args }, args[0]) : { detail: args }
)
);
};
instance.emit = (event, ...args) => {
@@ -862,27 +1000,92 @@ class VueElement extends BaseClass {
dispatch(shared.hyphenate(event), args);
}
};
let parent = this;
while (parent = parent && (parent.parentNode || parent.host)) {
if (parent instanceof VueElement) {
instance.parent = parent._instance;
instance.provides = parent._instance.provides;
break;
}
}
this._setParent();
};
}
return vnode;
}
_applyStyles(styles) {
if (styles) {
styles.forEach((css) => {
const s = document.createElement("style");
s.textContent = css;
this.shadowRoot.appendChild(s);
});
_applyStyles(styles, owner) {
if (!styles) return;
if (owner) {
if (owner === this._def || this._styleChildren.has(owner)) {
return;
}
this._styleChildren.add(owner);
}
const nonce = this._nonce;
for (let i = styles.length - 1; i >= 0; i--) {
const s = document.createElement("style");
if (nonce) s.setAttribute("nonce", nonce);
s.textContent = styles[i];
this.shadowRoot.prepend(s);
}
}
/**
* Only called when shadowRoot is false
*/
_parseSlots() {
const slots = this._slots = {};
let n;
while (n = this.firstChild) {
const slotName = n.nodeType === 1 && n.getAttribute("slot") || "default";
(slots[slotName] || (slots[slotName] = [])).push(n);
this.removeChild(n);
}
}
/**
* Only called when shadowRoot is false
*/
_renderSlots() {
const outlets = (this._teleportTarget || this).querySelectorAll("slot");
const scopeId = this._instance.type.__scopeId;
for (let i = 0; i < outlets.length; i++) {
const o = outlets[i];
const slotName = o.getAttribute("name") || "default";
const content = this._slots[slotName];
const parent = o.parentNode;
if (content) {
for (const n of content) {
if (scopeId && n.nodeType === 1) {
const id = scopeId + "-s";
const walker = document.createTreeWalker(n, 1);
n.setAttribute(id, "");
let child;
while (child = walker.nextNode()) {
child.setAttribute(id, "");
}
}
parent.insertBefore(n, o);
}
} else {
while (o.firstChild) parent.insertBefore(o.firstChild, o);
}
parent.removeChild(o);
}
}
/**
* @internal
*/
_injectChildStyle(comp) {
this._applyStyles(comp.styles, comp);
}
/**
* @internal
*/
_removeChildStyle(comp) {
}
}
function useHost(caller) {
const instance = runtimeCore.getCurrentInstance();
const el = instance && instance.ce;
if (el) {
return el;
}
return null;
}
function useShadowRoot() {
const el = useHost();
return el && el.shadowRoot;
}
function useCssModule(name = "$style") {
@@ -907,7 +1110,11 @@ const positionMap = /* @__PURE__ */ new WeakMap();
const newPositionMap = /* @__PURE__ */ new WeakMap();
const moveCbKey = Symbol("_moveCb");
const enterCbKey = Symbol("_enterCb");
const TransitionGroupImpl = {
const decorate = (t) => {
delete t.props.mode;
return t;
};
const TransitionGroupImpl = /* @__PURE__ */ decorate({
name: "TransitionGroup",
props: /* @__PURE__ */ shared.extend({}, TransitionPropsValidators, {
tag: String,
@@ -956,7 +1163,28 @@ const TransitionGroupImpl = {
const rawProps = runtimeCore.toRaw(props);
const cssTransitionProps = resolveTransitionProps(rawProps);
let tag = rawProps.tag || runtimeCore.Fragment;
prevChildren = children;
prevChildren = [];
if (children) {
for (let i = 0; i < children.length; i++) {
const child = children[i];
if (child.el && child.el instanceof Element) {
prevChildren.push(child);
runtimeCore.setTransitionHooks(
child,
runtimeCore.resolveTransitionHooks(
child,
cssTransitionProps,
state,
instance
)
);
positionMap.set(
child,
child.el.getBoundingClientRect()
);
}
}
}
children = slots.default ? runtimeCore.getTransitionRawChildren(slots.default()) : [];
for (let i = 0; i < children.length; i++) {
const child = children[i];
@@ -967,22 +1195,10 @@ const TransitionGroupImpl = {
);
}
}
if (prevChildren) {
for (let i = 0; i < prevChildren.length; i++) {
const child = prevChildren[i];
runtimeCore.setTransitionHooks(
child,
runtimeCore.resolveTransitionHooks(child, cssTransitionProps, state, instance)
);
positionMap.set(child, child.el.getBoundingClientRect());
}
}
return runtimeCore.createVNode(tag, null, children);
};
}
};
const removeMode = (props) => delete props.mode;
/* @__PURE__ */ removeMode(TransitionGroupImpl.props);
});
const TransitionGroup = TransitionGroupImpl;
function callPendingCbs(c) {
const el = c.el;
@@ -1045,8 +1261,7 @@ const vModelText = {
el[assignKey] = getModelAssigner(vnode);
const castToNumber = number || vnode.props && vnode.props.type === "number";
addEventListener(el, lazy ? "change" : "input", (e) => {
if (e.target.composing)
return;
if (e.target.composing) return;
let domValue = el.value;
if (trim) {
domValue = domValue.trim();
@@ -1071,17 +1286,16 @@ const vModelText = {
mounted(el, { value }) {
el.value = value == null ? "" : value;
},
beforeUpdate(el, { value, modifiers: { lazy, trim, number } }, vnode) {
beforeUpdate(el, { value, oldValue, modifiers: { lazy, trim, number } }, vnode) {
el[assignKey] = getModelAssigner(vnode);
if (el.composing)
return;
const elValue = number || el.type === "number" ? shared.looseToNumber(el.value) : el.value;
if (el.composing) return;
const elValue = (number || el.type === "number") && !/^0\d/.test(el.value) ? shared.looseToNumber(el.value) : el.value;
const newValue = value == null ? "" : value;
if (elValue === newValue) {
return;
}
if (document.activeElement === el && el.type !== "range") {
if (lazy) {
if (lazy && value === oldValue) {
return;
}
if (trim && el.value.trim() === newValue) {
@@ -1133,12 +1347,17 @@ const vModelCheckbox = {
};
function setChecked(el, { value, oldValue }, vnode) {
el._modelValue = value;
let checked;
if (shared.isArray(value)) {
el.checked = shared.looseIndexOf(value, vnode.props.value) > -1;
checked = shared.looseIndexOf(value, vnode.props.value) > -1;
} else if (shared.isSet(value)) {
el.checked = value.has(vnode.props.value);
} else if (value !== oldValue) {
el.checked = shared.looseEqual(value, getCheckboxValue(el, true));
checked = value.has(vnode.props.value);
} else {
if (value === oldValue) return;
checked = shared.looseEqual(value, getCheckboxValue(el, true));
}
if (el.checked !== checked) {
el.checked = checked;
}
}
const vModelRadio = {
@@ -1177,27 +1396,24 @@ const vModelSelect = {
},
// set value in mounted & updated because <select> relies on its children
// <option>s.
mounted(el, { value, oldValue, modifiers: { number } }) {
setSelected(el, value, oldValue, number);
mounted(el, { value }) {
setSelected(el, value);
},
beforeUpdate(el, _binding, vnode) {
el[assignKey] = getModelAssigner(vnode);
},
updated(el, { value, oldValue, modifiers: { number } }) {
updated(el, { value }) {
if (!el._assigning) {
setSelected(el, value, oldValue, number);
setSelected(el, value);
}
}
};
function setSelected(el, value, oldValue, number) {
function setSelected(el, value) {
const isMultiple = el.multiple;
const isArrayValue = shared.isArray(value);
if (isMultiple && !isArrayValue && !shared.isSet(value)) {
return;
}
if (isArrayValue && shared.looseEqual(value, oldValue)) {
return;
}
for (let i = 0, l = el.options.length; i < l; i++) {
const option = el.options[i];
const optionValue = getValue(option);
@@ -1205,21 +1421,16 @@ function setSelected(el, value, oldValue, number) {
if (isArrayValue) {
const optionType = typeof optionValue;
if (optionType === "string" || optionType === "number") {
option.selected = value.includes(
number ? shared.looseToNumber(optionValue) : optionValue
);
option.selected = value.some((v) => String(v) === String(optionValue));
} else {
option.selected = shared.looseIndexOf(value, optionValue) > -1;
}
} else {
option.selected = value.has(optionValue);
}
} else {
if (shared.looseEqual(getValue(option), value)) {
if (el.selectedIndex !== i)
el.selectedIndex = i;
return;
}
} else if (shared.looseEqual(getValue(option), value)) {
if (el.selectedIndex !== i) el.selectedIndex = i;
return;
}
}
if (!isMultiple && el.selectedIndex !== -1) {
@@ -1327,8 +1538,7 @@ const withModifiers = (fn, modifiers) => {
return cache[cacheKey] || (cache[cacheKey] = (event, ...args) => {
for (let i = 0; i < modifiers.length; i++) {
const guard = modifierGuards[modifiers[i]];
if (guard && guard(event, modifiers))
return;
if (guard && guard(event, modifiers)) return;
}
return fn(event, ...args);
});
@@ -1350,7 +1560,9 @@ const withKeys = (fn, modifiers) => {
return;
}
const eventKey = shared.hyphenate(event.key);
if (modifiers.some((k) => k === eventKey || keyNames[k] === eventKey)) {
if (modifiers.some(
(k) => k === eventKey || keyNames[k] === eventKey
)) {
return fn(event);
}
});
@@ -1378,13 +1590,14 @@ const createApp = (...args) => {
const { mount } = app;
app.mount = (containerOrSelector) => {
const container = normalizeContainer(containerOrSelector);
if (!container)
return;
if (!container) return;
const component = app._component;
if (!shared.isFunction(component) && !component.render && !component.template) {
component.template = container.innerHTML;
}
container.innerHTML = "";
if (container.nodeType === 1) {
container.textContent = "";
}
const proxy = mount(container, false, resolveRootNamespace(container));
if (container instanceof Element) {
container.removeAttribute("v-cloak");
@@ -1441,6 +1654,8 @@ exports.initDirectivesForSSR = initDirectivesForSSR;
exports.render = render;
exports.useCssModule = useCssModule;
exports.useCssVars = useCssVars;
exports.useHost = useHost;
exports.useShadowRoot = useShadowRoot;
exports.vModelCheckbox = vModelCheckbox;
exports.vModelDynamic = vModelDynamic;
exports.vModelRadio = vModelRadio;
+166 -82
View File
@@ -1,62 +1,7 @@
import { SetupContext, RenderFunction, ComputedOptions, MethodOptions, ComponentOptionsMixin, EmitsOptions, ComponentInjectOptions, SlotsType, ComponentOptionsWithoutProps, ComponentOptionsWithArrayProps, ComponentPropsOptions, ComponentOptionsWithObjectProps, ExtractPropTypes, DefineComponent, RootHydrateFunction, ConcreteComponent, BaseTransitionProps, FunctionalComponent, ObjectDirective, VNodeRef, RootRenderFunction, CreateAppFunction } from '@vue/runtime-core';
import { BaseTransitionProps, FunctionalComponent, ObjectDirective, Directive, App, SetupContext, RenderFunction, ComponentOptions, ComponentObjectPropsOptions, EmitsOptions, ComputedOptions, MethodOptions, ComponentOptionsMixin, ComponentInjectOptions, SlotsType, Component, ComponentProvideOptions, ExtractPropTypes, EmitsToProps, ComponentOptionsBase, CreateComponentPublicInstanceWithMixins, ComponentPublicInstance, DefineComponent, ComponentCustomElementInterface, CreateAppFunction, ConcreteComponent, VNodeRef, RootRenderFunction, RootHydrateFunction } from '@vue/runtime-core';
export * from '@vue/runtime-core';
import * as CSS from 'csstype';
export type VueElementConstructor<P = {}> = {
new (initialProps?: Record<string, any>): VueElement & P;
};
export declare function defineCustomElement<Props, RawBindings = object>(setup: (props: Readonly<Props>, ctx: SetupContext) => RawBindings | RenderFunction): VueElementConstructor<Props>;
export declare function defineCustomElement<Props = {}, RawBindings = {}, D = {}, C extends ComputedOptions = {}, M extends MethodOptions = {}, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, E extends EmitsOptions = EmitsOptions, EE extends string = string, I extends ComponentInjectOptions = {}, II extends string = string, S extends SlotsType = {}>(options: ComponentOptionsWithoutProps<Props, RawBindings, D, C, M, Mixin, Extends, E, EE, I, II, S> & {
styles?: string[];
}): VueElementConstructor<Props>;
export declare function defineCustomElement<PropNames extends string, RawBindings, D, C extends ComputedOptions = {}, M extends MethodOptions = {}, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, E extends EmitsOptions = Record<string, any>, EE extends string = string, I extends ComponentInjectOptions = {}, II extends string = string, S extends SlotsType = {}>(options: ComponentOptionsWithArrayProps<PropNames, RawBindings, D, C, M, Mixin, Extends, E, EE, I, II, S> & {
styles?: string[];
}): VueElementConstructor<{
[K in PropNames]: any;
}>;
export declare function defineCustomElement<PropsOptions extends Readonly<ComponentPropsOptions>, RawBindings, D, C extends ComputedOptions = {}, M extends MethodOptions = {}, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, E extends EmitsOptions = Record<string, any>, EE extends string = string, I extends ComponentInjectOptions = {}, II extends string = string, S extends SlotsType = {}>(options: ComponentOptionsWithObjectProps<PropsOptions, RawBindings, D, C, M, Mixin, Extends, E, EE, I, II, S> & {
styles?: string[];
}): VueElementConstructor<ExtractPropTypes<PropsOptions>>;
export declare function defineCustomElement<P>(options: DefineComponent<P, any, any, any>): VueElementConstructor<ExtractPropTypes<P>>;
/*! #__NO_SIDE_EFFECTS__ */
export declare const defineSSRCustomElement: typeof defineCustomElement;
declare const BaseClass: {
new (): HTMLElement;
prototype: HTMLElement;
};
type InnerComponentDef = ConcreteComponent & {
styles?: string[];
};
export declare class VueElement extends BaseClass {
private _def;
private _props;
private _connected;
private _resolved;
private _numberProps;
private _styles?;
private _ob?;
constructor(_def: InnerComponentDef, _props?: Record<string, any>, hydrate?: RootHydrateFunction);
connectedCallback(): void;
disconnectedCallback(): void;
/**
* resolve inner component definition (handle possible async component)
*/
private _resolveDef;
private _resolveProps;
protected _setAttr(key: string): void;
private _update;
private _createVNode;
private _applyStyles;
}
export declare function useCssModule(name?: string): Record<string, string>;
/**
* Runtime helper for SFC's CSS variable injection feature.
* @private
*/
export declare function useCssVars(getter: (ctx: any) => Record<string, string>): void;
declare const TRANSITION = "transition";
declare const ANIMATION = "animation";
type AnimationTypes = typeof TRANSITION | typeof ANIMATION;
@@ -78,52 +23,164 @@ export interface TransitionProps extends BaseTransitionProps<Element> {
leaveActiveClass?: string;
leaveToClass?: string;
}
/**
* DOM Transition is a higher-order-component based on the platform-agnostic
* base Transition component, with DOM-specific logic.
*/
export declare const Transition: FunctionalComponent<TransitionProps>;
export type TransitionGroupProps = Omit<TransitionProps, 'mode'> & {
tag?: string;
moveClass?: string;
};
export declare const TransitionGroup: new () => {
$props: TransitionGroupProps;
export declare const TransitionGroup: {
new (): {
$props: TransitionGroupProps;
};
};
type AssignerFn = (value: any) => void;
declare const assignKey: unique symbol;
type ModelDirective<T> = ObjectDirective<T & {
[assignKey]: AssignerFn;
_assigning?: boolean;
}>;
export declare const vModelText: ModelDirective<HTMLInputElement | HTMLTextAreaElement>;
export declare const vModelCheckbox: ModelDirective<HTMLInputElement>;
export declare const vModelRadio: ModelDirective<HTMLInputElement>;
export declare const vModelSelect: ModelDirective<HTMLSelectElement>;
export declare const vModelDynamic: ObjectDirective<HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement>;
declare const vShowOriginalDisplay: unique symbol;
declare const vShowHidden: unique symbol;
interface VShowElement extends HTMLElement {
[vShowOriginalDisplay]: string;
[vShowHidden]: boolean;
}
export declare const vShow: ObjectDirective<VShowElement> & {
name?: 'show';
};
declare const systemModifiers: readonly ["ctrl", "shift", "alt", "meta"];
type SystemModifiers = (typeof systemModifiers)[number];
type CompatModifiers = keyof typeof keyNames;
type VOnModifiers = SystemModifiers | ModifierGuards | CompatModifiers;
type ModifierGuards = 'shift' | 'ctrl' | 'alt' | 'meta' | 'left' | 'right' | 'stop' | 'prevent' | 'self' | 'middle' | 'exact';
/**
* @private
*/
export declare const withModifiers: <T extends (event: Event, ...args: unknown[]) => any>(fn: T & {
_withMods?: {
[key: string]: T;
} | undefined;
}, modifiers: string[]) => T;
};
}, modifiers: VOnModifiers[]) => T;
declare const keyNames: Record<'esc' | 'space' | 'up' | 'left' | 'right' | 'down' | 'delete', string>;
/**
* @private
*/
export declare const withKeys: <T extends (event: KeyboardEvent) => any>(fn: T & {
_withKeys?: {
[k: string]: T;
} | undefined;
};
}, modifiers: string[]) => T;
type VOnDirective = Directive<any, any, VOnModifiers>;
declare const vShowOldKey: unique symbol;
interface VShowElement extends HTMLElement {
[vShowOldKey]: string;
}
export declare const vShow: ObjectDirective<VShowElement> & {
name?: 'show';
type AssignerFn = (value: any) => void;
declare const assignKey: unique symbol;
type ModelDirective<T, Modifiers extends string = string> = ObjectDirective<T & {
[assignKey]: AssignerFn;
_assigning?: boolean;
}, any, Modifiers>;
export declare const vModelText: ModelDirective<HTMLInputElement | HTMLTextAreaElement, 'trim' | 'number' | 'lazy'>;
export declare const vModelCheckbox: ModelDirective<HTMLInputElement>;
export declare const vModelRadio: ModelDirective<HTMLInputElement>;
export declare const vModelSelect: ModelDirective<HTMLSelectElement, 'number'>;
export declare const vModelDynamic: ObjectDirective<HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement>;
type VModelDirective = typeof vModelText | typeof vModelCheckbox | typeof vModelSelect | typeof vModelRadio | typeof vModelDynamic;
export type VueElementConstructor<P = {}> = {
new (initialProps?: Record<string, any>): VueElement & P;
};
export interface CustomElementOptions {
styles?: string[];
shadowRoot?: boolean;
nonce?: string;
configureApp?: (app: App) => void;
}
export declare function defineCustomElement<Props, RawBindings = object>(setup: (props: Props, ctx: SetupContext) => RawBindings | RenderFunction, options?: Pick<ComponentOptions, 'name' | 'inheritAttrs' | 'emits'> & CustomElementOptions & {
props?: (keyof Props)[];
}): VueElementConstructor<Props>;
export declare function defineCustomElement<Props, RawBindings = object>(setup: (props: Props, ctx: SetupContext) => RawBindings | RenderFunction, options?: Pick<ComponentOptions, 'name' | 'inheritAttrs' | 'emits'> & CustomElementOptions & {
props?: ComponentObjectPropsOptions<Props>;
}): VueElementConstructor<Props>;
export declare function defineCustomElement<RuntimePropsOptions extends ComponentObjectPropsOptions = ComponentObjectPropsOptions, PropsKeys extends string = string, RuntimeEmitsOptions extends EmitsOptions = {}, EmitsKeys extends string = string, Data = {}, SetupBindings = {}, Computed extends ComputedOptions = {}, Methods extends MethodOptions = {}, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, InjectOptions extends ComponentInjectOptions = {}, InjectKeys extends string = string, Slots extends SlotsType = {}, LocalComponents extends Record<string, Component> = {}, Directives extends Record<string, Directive> = {}, Exposed extends string = string, Provide extends ComponentProvideOptions = ComponentProvideOptions, InferredProps = string extends PropsKeys ? ComponentObjectPropsOptions extends RuntimePropsOptions ? {} : ExtractPropTypes<RuntimePropsOptions> : {
[key in PropsKeys]?: any;
}, ResolvedProps = InferredProps & EmitsToProps<RuntimeEmitsOptions>>(options: CustomElementOptions & {
props?: (RuntimePropsOptions & ThisType<void>) | PropsKeys[];
} & ComponentOptionsBase<ResolvedProps, SetupBindings, Data, Computed, Methods, Mixin, Extends, RuntimeEmitsOptions, EmitsKeys, {}, // Defaults
InjectOptions, InjectKeys, Slots, LocalComponents, Directives, Exposed, Provide> & ThisType<CreateComponentPublicInstanceWithMixins<Readonly<ResolvedProps>, SetupBindings, Data, Computed, Methods, Mixin, Extends, RuntimeEmitsOptions, EmitsKeys, {}, false, InjectOptions, Slots, LocalComponents, Directives, Exposed>>, extraOptions?: CustomElementOptions): VueElementConstructor<ResolvedProps>;
export declare function defineCustomElement<T extends {
new (...args: any[]): ComponentPublicInstance<any>;
}>(options: T, extraOptions?: CustomElementOptions): VueElementConstructor<T extends DefineComponent<infer P, any, any, any> ? P : unknown>;
/*! #__NO_SIDE_EFFECTS__ */
export declare const defineSSRCustomElement: typeof defineCustomElement;
declare const BaseClass: typeof HTMLElement;
type InnerComponentDef = ConcreteComponent & CustomElementOptions;
export declare class VueElement extends BaseClass implements ComponentCustomElementInterface {
/**
* Component def - note this may be an AsyncWrapper, and this._def will
* be overwritten by the inner component when resolved.
*/
private _def;
private _props;
private _createApp;
_isVueCE: boolean;
private _connected;
private _resolved;
private _numberProps;
private _styleChildren;
private _pendingResolve;
private _parent;
/**
* dev only
*/
private _styles?;
/**
* dev only
*/
private _childStyles?;
private _ob?;
private _slots?;
constructor(
/**
* Component def - note this may be an AsyncWrapper, and this._def will
* be overwritten by the inner component when resolved.
*/
_def: InnerComponentDef, _props?: Record<string, any>, _createApp?: CreateAppFunction<Element>);
connectedCallback(): void;
private _setParent;
disconnectedCallback(): void;
/**
* resolve inner component definition (handle possible async component)
*/
private _resolveDef;
private _mount;
private _resolveProps;
protected _setAttr(key: string): void;
private _update;
private _createVNode;
private _applyStyles;
/**
* Only called when shadowRoot is false
*/
private _parseSlots;
/**
* Only called when shadowRoot is false
*/
private _renderSlots;
}
export declare function useHost(caller?: string): VueElement | null;
/**
* Retrieve the shadowRoot of the current custom element. Only usable in setup()
* of a `defineCustomElement` component.
*/
export declare function useShadowRoot(): ShadowRoot | null;
export declare function useCssModule(name?: string): Record<string, string>;
/**
* Runtime helper for SFC's CSS variable injection feature.
* @private
*/
export declare function useCssVars(getter: (ctx: any) => Record<string, string>): void;
export interface CSSProperties extends CSS.Properties<string | number>, CSS.PropertiesHyphen<string | number> {
/**
@@ -437,8 +494,9 @@ export interface DataHTMLAttributes extends HTMLAttributes {
value?: string | ReadonlyArray<string> | number;
}
export interface DetailsHTMLAttributes extends HTMLAttributes {
name?: string;
open?: Booleanish;
onToggle?: Event;
onToggle?: (payload: ToggleEvent) => void;
}
export interface DelHTMLAttributes extends HTMLAttributes {
cite?: string;
@@ -446,6 +504,7 @@ export interface DelHTMLAttributes extends HTMLAttributes {
}
export interface DialogHTMLAttributes extends HTMLAttributes {
open?: Booleanish;
onClose?: (payload: Event) => void;
}
export interface EmbedHTMLAttributes extends HTMLAttributes {
height?: Numberish;
@@ -478,6 +537,7 @@ export interface IframeHTMLAttributes extends HTMLAttributes {
/** @deprecated */
frameborder?: Numberish;
height?: Numberish;
loading?: 'eager' | 'lazy';
/** @deprecated */
marginheight?: Numberish;
/** @deprecated */
@@ -1265,7 +1325,8 @@ export interface Events {
onVolumechange: Event;
onWaiting: Event;
onSelect: Event;
onScroll: UIEvent;
onScroll: Event;
onScrollend: Event;
onTouchcancel: TouchEvent;
onTouchend: TouchEvent;
onTouchmove: TouchEvent;
@@ -1290,7 +1351,7 @@ type EventHandlers<E> = {
};
export type ReservedProps = {
key?: string | number | symbol;
key?: PropertyKey;
ref?: VNodeRef;
ref_for?: boolean;
ref_key?: string;
@@ -1299,9 +1360,32 @@ export type NativeElements = {
[K in keyof IntrinsicElementAttributes]: IntrinsicElementAttributes[K] & ReservedProps;
};
/**
* This is a stub implementation to prevent the need to use dom types.
*
* To enable proper types, add `"dom"` to `"lib"` in your `tsconfig.json`.
*/
type DomStub = {};
type DomType<T> = typeof globalThis extends {
window: unknown;
} ? T : DomStub;
declare module '@vue/reactivity' {
interface RefUnwrapBailTypes {
runtimeDOMBailTypes: Node | Window;
runtimeDOMBailTypes: DomType<Node | Window>;
}
}
declare module '@vue/runtime-core' {
interface GlobalComponents {
Transition: DefineComponent<TransitionProps>;
TransitionGroup: DefineComponent<TransitionGroupProps>;
}
interface GlobalDirectives {
vShow: typeof vShow;
vOn: VOnDirective;
vBind: VModelDirective;
vIf: Directive<any, boolean>;
VOnce: Directive;
VSlot: Directive;
}
}
export declare const render: RootRenderFunction<Element | ShadowRoot>;
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large Load Diff
+4697 -3518
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
+7 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@vue/runtime-dom",
"version": "3.4.15",
"version": "3.5.13",
"description": "@vue/runtime-dom",
"main": "index.js",
"module": "dist/runtime-dom.esm-bundler.js",
@@ -50,7 +50,11 @@
"homepage": "https://github.com/vuejs/core/tree/main/packages/runtime-dom#readme",
"dependencies": {
"csstype": "^3.1.3",
"@vue/shared": "3.4.15",
"@vue/runtime-core": "3.4.15"
"@vue/shared": "3.5.13",
"@vue/runtime-core": "3.5.13",
"@vue/reactivity": "3.5.13"
},
"devDependencies": {
"@types/trusted-types": "^2.0.7"
}
}
+8 -8
View File
@@ -11,7 +11,7 @@
```ts
function renderToString(
input: App | VNode,
context?: SSRContext
context?: SSRContext,
): Promise<string>
```
@@ -23,7 +23,7 @@ const { renderToString } = require('@vue/server-renderer')
const app = createSSRApp({
data: () => ({ msg: 'hello' }),
template: `<div>{{ msg }}</div>`
template: `<div>{{ msg }}</div>`,
})
;(async () => {
@@ -74,7 +74,7 @@ Render and pipe to an existing [Node.js Writable stream](https://nodejs.org/api/
function pipeToNodeWritable(
input: App | VNode,
context: SSRContext = {},
writable: Writable
writable: Writable,
): void
```
@@ -94,7 +94,7 @@ Renders input as a [Web ReadableStream](https://developer.mozilla.org/en-US/docs
```ts
function renderToWebStream(
input: App | VNode,
context?: SSRContext
context?: SSRContext,
): ReadableStream
```
@@ -117,7 +117,7 @@ Render and pipe to an existing [Web WritableStream](https://developer.mozilla.or
function pipeToWebWritable(
input: App | VNode,
context: SSRContext = {},
writable: WritableStream
writable: WritableStream,
): void
```
@@ -144,7 +144,7 @@ Renders input in streaming mode using a simple readable interface.
function renderToSimpleStream(
input: App | VNode,
context: SSRContext,
options: SimpleReadable
options: SimpleReadable,
): SimpleReadable
interface SimpleReadable {
@@ -172,7 +172,7 @@ renderToSimpleStream(
},
destroy(err) {
// error encountered
}
}
},
},
)
```
+115 -96
View File
@@ -1,5 +1,5 @@
/**
* @vue/server-renderer v3.4.15
* @vue/server-renderer v3.5.13
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT
**/
@@ -24,7 +24,7 @@ function _interopNamespaceDefault(e) {
var Vue__namespace = /*#__PURE__*/_interopNamespaceDefault(Vue);
const shouldIgnoreProp = shared.makeMap(
const shouldIgnoreProp = /* @__PURE__ */ shared.makeMap(
`,key,ref,innerHTML,textContent,ref_key,ref_for`
);
function ssrRenderAttrs(props, tag) {
@@ -38,6 +38,8 @@ function ssrRenderAttrs(props, tag) {
ret += ` class="${ssrRenderClass(value)}"`;
} else if (key === "style") {
ret += ` style="${ssrRenderStyle(value)}"`;
} else if (key === "className") {
ret += ` class="${String(value)}"`;
} else {
ret += ssrRenderDynamicAttr(key, value, tag);
}
@@ -88,6 +90,7 @@ function ssrRenderComponent(comp, props = null, children = null, parentComponent
);
}
const { ensureValidVNode } = Vue.ssrUtils;
function ssrRenderSlot(slots, slotName, slotProps, fallbackRenderFn, push, parentComponent, slotScopeId) {
push(`<!--[-->`);
ssrRenderSlotInner(
@@ -115,7 +118,17 @@ function ssrRenderSlotInner(slots, slotName, slotProps, fallbackRenderFn, push,
slotScopeId ? " " + slotScopeId : ""
);
if (shared.isArray(ret)) {
renderVNodeChildren(push, ret, parentComponent, slotScopeId);
const validSlotContent = ensureValidVNode(ret);
if (validSlotContent) {
renderVNodeChildren(
push,
validSlotContent,
parentComponent,
slotScopeId
);
} else if (fallbackRenderFn) {
fallbackRenderFn();
}
} else {
let isEmptySlot = true;
if (transition) {
@@ -148,13 +161,11 @@ function ssrRenderSlotInner(slots, slotName, slotProps, fallbackRenderFn, push,
fallbackRenderFn();
}
}
const commentTestRE = /^<!--.*-->$/s;
const commentTestRE = /^<!--[\s\S]*-->$/;
const commentRE = /<!--[^]*?-->/gm;
function isComment(item) {
if (typeof item !== "string" || !commentTestRE.test(item))
return false;
if (item.length <= 8)
return true;
if (typeof item !== "string" || !commentTestRE.test(item)) return false;
if (item.length <= 8) return true;
return !item.replace(commentRE, "").trim();
}
@@ -167,9 +178,10 @@ function ssrRenderTeleport(parentPush, contentRenderFn, target, disabled, parent
let teleportContent;
if (disabled) {
contentRenderFn(parentPush);
teleportContent = `<!--teleport anchor-->`;
teleportContent = `<!--teleport start anchor--><!--teleport anchor-->`;
} else {
const { getBuffer, push } = createBuffer();
push(`<!--teleport start anchor-->`);
contentRenderFn(push);
push(`<!--teleport anchor-->`);
teleportContent = getBuffer();
@@ -182,35 +194,26 @@ function ssrInterpolate(value) {
return shared.escapeHtml(shared.toDisplayString(value));
}
let shouldTrack = true;
const trackStack = [];
function pauseTracking() {
trackStack.push(shouldTrack);
shouldTrack = false;
}
function resetTracking() {
const last = trackStack.pop();
shouldTrack = last === void 0 ? true : last;
}
function toRaw(observed) {
const raw = observed && observed["__v_raw"];
return raw ? toRaw(raw) : observed;
}
function isRef(r) {
return !!(r && r.__v_isRef === true);
return r ? r["__v_isRef"] === true : false;
}
const stack = [];
function pushWarningContext(vnode) {
function pushWarningContext$1(vnode) {
stack.push(vnode);
}
function popWarningContext() {
function popWarningContext$1() {
stack.pop();
}
let isWarning = false;
function warn$1(msg, ...args) {
pauseTracking();
if (isWarning) return;
isWarning = true;
const instance = stack.length ? stack[stack.length - 1].component : null;
const appWarnHandler = instance && instance.appContext.config.warnHandler;
const trace = getComponentTrace();
@@ -220,7 +223,11 @@ function warn$1(msg, ...args) {
instance,
11,
[
msg + args.join(""),
// eslint-disable-next-line no-restricted-syntax
msg + args.map((a) => {
var _a, _b;
return (_b = (_a = a.toString) == null ? void 0 : _a.call(a)) != null ? _b : JSON.stringify(a);
}).join(""),
instance && instance.proxy,
trace.map(
({ vnode }) => `at <${formatComponentName(instance, vnode.type)}>`
@@ -237,7 +244,7 @@ function warn$1(msg, ...args) {
}
console.warn(...warnArgs);
}
resetTracking();
isWarning = false;
}
function getComponentTrace() {
let currentVNode = stack[stack.length - 1];
@@ -336,19 +343,20 @@ const ErrorTypeStrings = {
[11]: "app warnHandler",
[12]: "ref function",
[13]: "async component loader",
[14]: "scheduler flush. This is likely a Vue internals bug. Please open an issue at https://github.com/vuejs/core ."
[14]: "scheduler flush",
[15]: "component update",
[16]: "app unmount cleanup function"
};
function callWithErrorHandling(fn, instance, type, args) {
let res;
try {
res = args ? fn(...args) : fn();
return 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;
const { errorHandler, throwUnhandledErrorInProduction } = instance && instance.appContext.config || shared.EMPTY_OBJ;
if (instance) {
let cur = instance.parent;
const exposedInstance = instance.proxy;
@@ -364,28 +372,26 @@ function handleError(err, instance, type, throwInDev = true) {
}
cur = cur.parent;
}
const appErrorHandler = instance.appContext.config.errorHandler;
if (appErrorHandler) {
callWithErrorHandling(
appErrorHandler,
null,
10,
[err, exposedInstance, errorInfo]
);
if (errorHandler) {
callWithErrorHandling(errorHandler, null, 10, [
err,
exposedInstance,
errorInfo
]);
return;
}
}
logError(err, type, contextVNode, throwInDev);
logError(err, type, contextVNode, throwInDev, throwUnhandledErrorInProduction);
}
function logError(err, type, contextVNode, throwInDev = true) {
function logError(err, type, contextVNode, throwInDev = true, throwInProd = false) {
{
const info = ErrorTypeStrings[type];
if (contextVNode) {
pushWarningContext(contextVNode);
pushWarningContext$1(contextVNode);
}
warn$1(`Unhandled error${info ? ` during execution of ${info}` : ``}`);
if (contextVNode) {
popWarningContext();
popWarningContext$1();
}
if (throwInDev) {
throw err;
@@ -399,14 +405,11 @@ function logError(err, type, contextVNode, throwInDev = true) {
const g = shared.getGlobalThis();
const registerGlobalSetter = (key, setter) => {
let setters;
if (!(setters = g[key]))
setters = g[key] = [];
if (!(setters = g[key])) setters = g[key] = [];
setters.push(setter);
return (v) => {
if (setters.length > 1)
setters.forEach((set) => set(v));
else
setters[0](v);
if (setters.length > 1) setters.forEach((set) => set(v));
else setters[0](v);
};
};
registerGlobalSetter(
@@ -490,7 +493,7 @@ function ssrGetDirectiveProps(instance, dir, value, arg, modifiers = {}) {
return dir.getSSRProps(
{
dir,
instance,
instance: Vue.ssrUtils.getComponentPublicInstance(instance.$),
value,
oldValue: void 0,
arg,
@@ -607,7 +610,9 @@ const {
setCurrentRenderingInstance,
setupComponent,
renderComponentRoot,
normalizeVNode
normalizeVNode,
pushWarningContext,
popWarningContext
} = Vue.ssrUtils;
function createBuffer() {
let appendable = false;
@@ -620,9 +625,9 @@ function createBuffer() {
const isStringItem = shared.isString(item);
if (appendable && isStringItem) {
buffer[buffer.length - 1] += item;
} else {
buffer.push(item);
return;
}
buffer.push(item);
appendable = isStringItem;
if (shared.isPromise(item) || shared.isArray(item) && item.hasAsync) {
buffer.hasAsync = true;
@@ -631,29 +636,36 @@ function createBuffer() {
};
}
function renderComponentVNode(vnode, parentComponent = null, slotScopeId) {
const instance = createComponentInstance(vnode, parentComponent, null);
const instance = vnode.component = createComponentInstance(
vnode,
parentComponent,
null
);
pushWarningContext(vnode);
const res = setupComponent(
instance,
true
/* isSSR */
);
popWarningContext();
const hasAsyncSetup = shared.isPromise(res);
const prefetches = instance.sp;
let prefetches = instance.sp;
if (hasAsyncSetup || prefetches) {
let p = hasAsyncSetup ? res : Promise.resolve();
if (prefetches) {
p = p.then(
() => Promise.all(
const p = Promise.resolve(res).then(() => {
if (hasAsyncSetup) prefetches = instance.sp;
if (prefetches) {
return Promise.all(
prefetches.map((prefetch) => prefetch.call(instance.proxy))
)
).catch(shared.NOOP);
}
);
}
}).catch(shared.NOOP);
return p.then(() => renderComponentSubTree(instance, slotScopeId));
} else {
return renderComponentSubTree(instance, slotScopeId);
}
}
function renderComponentSubTree(instance, slotScopeId) {
pushWarningContext(instance.vnode);
const comp = instance.type;
const { getBuffer, push } = createBuffer();
if (shared.isFunction(comp)) {
@@ -670,12 +682,6 @@ function renderComponentSubTree(instance, slotScopeId) {
if ((!instance.render || instance.render === shared.NOOP) && !instance.ssrRender && !comp.ssrRender && shared.isString(comp.template)) {
comp.ssrRender = ssrCompile(comp.template, instance);
}
for (const e of instance.scope.effects) {
if (e.computed) {
e.computed._dirty = true;
e.computed._cacheable = true;
}
}
const ssrRender = instance.ssrRender || comp.ssrRender;
if (ssrRender) {
let attrs = instance.inheritAttrs !== false ? instance.attrs : void 0;
@@ -698,9 +704,11 @@ function renderComponentSubTree(instance, slotScopeId) {
}
}
if (slotScopeId) {
if (!hasCloned)
attrs = { ...attrs };
attrs[slotScopeId.trim()] = "";
if (!hasCloned) attrs = { ...attrs };
const slotScopeIdList = slotScopeId.trim().split(" ");
for (let i = 0; i < slotScopeIdList.length; i++) {
attrs[slotScopeIdList[i]] = "";
}
}
const prev = setCurrentRenderingInstance(instance);
try {
@@ -731,10 +739,14 @@ function renderComponentSubTree(instance, slotScopeId) {
push(`<!---->`);
}
}
popWarningContext();
return getBuffer();
}
function renderVNode(push, vnode, parentComponent, slotScopeId) {
const { type, shapeFlag, children } = vnode;
const { type, shapeFlag, children, dirs, props } = vnode;
if (dirs) {
vnode.props = applySSRDirectives(vnode, props, dirs);
}
switch (type) {
case Vue.Text:
push(shared.escapeHtml(children));
@@ -785,11 +797,8 @@ function renderVNodeChildren(push, children, parentComponent, slotScopeId) {
}
function renderElementVNode(push, vnode, parentComponent, slotScopeId) {
const tag = vnode.type;
let { props, children, shapeFlag, scopeId, dirs } = vnode;
let { props, children, shapeFlag, scopeId } = vnode;
let openTag = `<${tag}`;
if (dirs) {
props = applySSRDirectives(vnode, props, dirs);
}
if (props) {
openTag += ssrRenderAttrs(props, tag);
}
@@ -847,8 +856,7 @@ function applySSRDirectives(vnode, rawProps, dirs) {
} = binding;
if (getSSRProps) {
const props = getSSRProps(binding, vnode);
if (props)
toMerge.push(props);
if (props) toMerge.push(props);
}
}
return Vue.mergeProps(rawProps || {}, ...toMerge);
@@ -885,24 +893,36 @@ function renderTeleportVNode(push, vnode, parentComponent, slotScopeId) {
}
const { isVNode: isVNode$1 } = Vue.ssrUtils;
async function unrollBuffer$1(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$1(item);
}
}
return ret;
} else {
return unrollBufferSync$1(buffer);
function nestedUnrollBuffer(buffer, parentRet, startIndex) {
if (!buffer.hasAsync) {
return parentRet + unrollBufferSync$1(buffer);
}
let ret = parentRet;
for (let i = startIndex; i < buffer.length; i += 1) {
const item = buffer[i];
if (shared.isString(item)) {
ret += item;
continue;
}
if (shared.isPromise(item)) {
return item.then((nestedItem) => {
buffer[i] = nestedItem;
return nestedUnrollBuffer(buffer, ret, i);
});
}
const result = nestedUnrollBuffer(item, ret, 0);
if (shared.isPromise(result)) {
return result.then((nestedItem) => {
buffer[i] = nestedItem;
return nestedUnrollBuffer(buffer, "", i);
});
}
ret = result;
}
return ret;
}
function unrollBuffer$1(buffer) {
return nestedUnrollBuffer(buffer, "", 0);
}
function unrollBufferSync$1(buffer) {
let ret = "";
@@ -1036,8 +1056,7 @@ function renderToWebStream(input, context = {}) {
start(controller) {
renderToSimpleStream(input, context, {
push(content) {
if (cancelled)
return;
if (cancelled) return;
if (content != null) {
controller.enqueue(encoder.encode(content));
} else {
+81 -57
View File
@@ -1,5 +1,5 @@
/**
* @vue/server-renderer v3.4.15
* @vue/server-renderer v3.5.13
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT
**/
@@ -24,7 +24,7 @@ function _interopNamespaceDefault(e) {
var Vue__namespace = /*#__PURE__*/_interopNamespaceDefault(Vue);
const shouldIgnoreProp = shared.makeMap(
const shouldIgnoreProp = /* @__PURE__ */ shared.makeMap(
`,key,ref,innerHTML,textContent,ref_key,ref_for`
);
function ssrRenderAttrs(props, tag) {
@@ -38,6 +38,8 @@ function ssrRenderAttrs(props, tag) {
ret += ` class="${ssrRenderClass(value)}"`;
} else if (key === "style") {
ret += ` style="${ssrRenderStyle(value)}"`;
} else if (key === "className") {
ret += ` class="${String(value)}"`;
} else {
ret += ssrRenderDynamicAttr(key, value, tag);
}
@@ -88,6 +90,7 @@ function ssrRenderComponent(comp, props = null, children = null, parentComponent
);
}
const { ensureValidVNode } = Vue.ssrUtils;
function ssrRenderSlot(slots, slotName, slotProps, fallbackRenderFn, push, parentComponent, slotScopeId) {
push(`<!--[-->`);
ssrRenderSlotInner(
@@ -115,7 +118,17 @@ function ssrRenderSlotInner(slots, slotName, slotProps, fallbackRenderFn, push,
slotScopeId ? " " + slotScopeId : ""
);
if (shared.isArray(ret)) {
renderVNodeChildren(push, ret, parentComponent, slotScopeId);
const validSlotContent = ensureValidVNode(ret);
if (validSlotContent) {
renderVNodeChildren(
push,
validSlotContent,
parentComponent,
slotScopeId
);
} else if (fallbackRenderFn) {
fallbackRenderFn();
}
} else {
let isEmptySlot = true;
if (transition) {
@@ -148,13 +161,11 @@ function ssrRenderSlotInner(slots, slotName, slotProps, fallbackRenderFn, push,
fallbackRenderFn();
}
}
const commentTestRE = /^<!--.*-->$/s;
const commentTestRE = /^<!--[\s\S]*-->$/;
const commentRE = /<!--[^]*?-->/gm;
function isComment(item) {
if (typeof item !== "string" || !commentTestRE.test(item))
return false;
if (item.length <= 8)
return true;
if (typeof item !== "string" || !commentTestRE.test(item)) return false;
if (item.length <= 8) return true;
return !item.replace(commentRE, "").trim();
}
@@ -167,9 +178,10 @@ function ssrRenderTeleport(parentPush, contentRenderFn, target, disabled, parent
let teleportContent;
if (disabled) {
contentRenderFn(parentPush);
teleportContent = `<!--teleport anchor-->`;
teleportContent = `<!--teleport start anchor--><!--teleport anchor-->`;
} else {
const { getBuffer, push } = createBuffer();
push(`<!--teleport start anchor-->`);
contentRenderFn(push);
push(`<!--teleport anchor-->`);
teleportContent = getBuffer();
@@ -220,7 +232,7 @@ function ssrGetDirectiveProps(instance, dir, value, arg, modifiers = {}) {
return dir.getSSRProps(
{
dir,
instance,
instance: Vue.ssrUtils.getComponentPublicInstance(instance.$),
value,
oldValue: void 0,
arg,
@@ -330,7 +342,9 @@ const {
setCurrentRenderingInstance,
setupComponent,
renderComponentRoot,
normalizeVNode
normalizeVNode,
pushWarningContext,
popWarningContext
} = Vue.ssrUtils;
function createBuffer() {
let appendable = false;
@@ -343,9 +357,9 @@ function createBuffer() {
const isStringItem = shared.isString(item);
if (appendable && isStringItem) {
buffer[buffer.length - 1] += item;
} else {
buffer.push(item);
return;
}
buffer.push(item);
appendable = isStringItem;
if (shared.isPromise(item) || shared.isArray(item) && item.hasAsync) {
buffer.hasAsync = true;
@@ -354,23 +368,27 @@ function createBuffer() {
};
}
function renderComponentVNode(vnode, parentComponent = null, slotScopeId) {
const instance = createComponentInstance(vnode, parentComponent, null);
const instance = vnode.component = createComponentInstance(
vnode,
parentComponent,
null
);
const res = setupComponent(
instance,
true
/* isSSR */
);
const hasAsyncSetup = shared.isPromise(res);
const prefetches = instance.sp;
let prefetches = instance.sp;
if (hasAsyncSetup || prefetches) {
let p = hasAsyncSetup ? res : Promise.resolve();
if (prefetches) {
p = p.then(
() => Promise.all(
const p = Promise.resolve(res).then(() => {
if (hasAsyncSetup) prefetches = instance.sp;
if (prefetches) {
return Promise.all(
prefetches.map((prefetch) => prefetch.call(instance.proxy))
)
).catch(shared.NOOP);
}
);
}
}).catch(shared.NOOP);
return p.then(() => renderComponentSubTree(instance, slotScopeId));
} else {
return renderComponentSubTree(instance, slotScopeId);
@@ -393,12 +411,6 @@ function renderComponentSubTree(instance, slotScopeId) {
if ((!instance.render || instance.render === shared.NOOP) && !instance.ssrRender && !comp.ssrRender && shared.isString(comp.template)) {
comp.ssrRender = ssrCompile(comp.template, instance);
}
for (const e of instance.scope.effects) {
if (e.computed) {
e.computed._dirty = true;
e.computed._cacheable = true;
}
}
const ssrRender = instance.ssrRender || comp.ssrRender;
if (ssrRender) {
let attrs = instance.inheritAttrs !== false ? instance.attrs : void 0;
@@ -421,9 +433,11 @@ function renderComponentSubTree(instance, slotScopeId) {
}
}
if (slotScopeId) {
if (!hasCloned)
attrs = { ...attrs };
attrs[slotScopeId.trim()] = "";
if (!hasCloned) attrs = { ...attrs };
const slotScopeIdList = slotScopeId.trim().split(" ");
for (let i = 0; i < slotScopeIdList.length; i++) {
attrs[slotScopeIdList[i]] = "";
}
}
const prev = setCurrentRenderingInstance(instance);
try {
@@ -457,7 +471,10 @@ function renderComponentSubTree(instance, slotScopeId) {
return getBuffer();
}
function renderVNode(push, vnode, parentComponent, slotScopeId) {
const { type, shapeFlag, children } = vnode;
const { type, shapeFlag, children, dirs, props } = vnode;
if (dirs) {
vnode.props = applySSRDirectives(vnode, props, dirs);
}
switch (type) {
case Vue.Text:
push(shared.escapeHtml(children));
@@ -508,11 +525,8 @@ function renderVNodeChildren(push, children, parentComponent, slotScopeId) {
}
function renderElementVNode(push, vnode, parentComponent, slotScopeId) {
const tag = vnode.type;
let { props, children, shapeFlag, scopeId, dirs } = vnode;
let { props, children, shapeFlag, scopeId } = vnode;
let openTag = `<${tag}`;
if (dirs) {
props = applySSRDirectives(vnode, props, dirs);
}
if (props) {
openTag += ssrRenderAttrs(props, tag);
}
@@ -570,8 +584,7 @@ function applySSRDirectives(vnode, rawProps, dirs) {
} = binding;
if (getSSRProps) {
const props = getSSRProps(binding, vnode);
if (props)
toMerge.push(props);
if (props) toMerge.push(props);
}
}
return Vue.mergeProps(rawProps || {}, ...toMerge);
@@ -608,24 +621,36 @@ function renderTeleportVNode(push, vnode, parentComponent, slotScopeId) {
}
const { isVNode: isVNode$1 } = Vue.ssrUtils;
async function unrollBuffer$1(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$1(item);
}
}
return ret;
} else {
return unrollBufferSync$1(buffer);
function nestedUnrollBuffer(buffer, parentRet, startIndex) {
if (!buffer.hasAsync) {
return parentRet + unrollBufferSync$1(buffer);
}
let ret = parentRet;
for (let i = startIndex; i < buffer.length; i += 1) {
const item = buffer[i];
if (shared.isString(item)) {
ret += item;
continue;
}
if (shared.isPromise(item)) {
return item.then((nestedItem) => {
buffer[i] = nestedItem;
return nestedUnrollBuffer(buffer, ret, i);
});
}
const result = nestedUnrollBuffer(item, ret, 0);
if (shared.isPromise(result)) {
return result.then((nestedItem) => {
buffer[i] = nestedItem;
return nestedUnrollBuffer(buffer, "", i);
});
}
ret = result;
}
return ret;
}
function unrollBuffer$1(buffer) {
return nestedUnrollBuffer(buffer, "", 0);
}
function unrollBufferSync$1(buffer) {
let ret = "";
@@ -759,8 +784,7 @@ function renderToWebStream(input, context = {}) {
start(controller) {
renderToSimpleStream(input, context, {
push(content) {
if (cancelled)
return;
if (cancelled) return;
if (content != null) {
controller.enqueue(encoder.encode(content));
} else {
+3 -7
View File
@@ -1,7 +1,5 @@
/// <reference types="node" />
import { VNode, ComponentInternalInstance, App, Slots, Component } from 'vue';
import { VNode, ComponentInternalInstance, App, Slots, Component, ComponentPublicInstance, Directive } from 'vue';
import { Readable, Writable } from 'node:stream';
import { ComponentPublicInstance, Directive } from '@vue/runtime-core';
export { includeBooleanAttr as ssrIncludeBooleanAttr } from '@vue/shared';
type SSRBuffer = SSRBufferItem[] & {
@@ -59,11 +57,9 @@ export declare const ssrLooseEqual: (a: unknown, b: unknown) => boolean;
export declare function ssrLooseContain(arr: unknown[], value: unknown): boolean;
export declare function ssrRenderDynamicModel(type: unknown, model: unknown, value: unknown): string;
export declare function ssrGetDynamicModelProps(existingProps: any, model: unknown): {
checked: boolean;
value?: undefined;
checked: true;
} | {
value: unknown;
checked?: undefined;
value: any;
} | null;
export { renderVNode as ssrRenderVNode };
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
+274 -85
View File
@@ -1,13 +1,13 @@
/**
* @vue/server-renderer v3.4.15
* @vue/server-renderer v3.5.13
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT
**/
import { createVNode, ssrContextKey, warn as warn$2, Fragment, Static, Comment, Text, mergeProps, ssrUtils, createApp, initDirectivesForSSR } from 'vue';
import { makeMap, isOn, isRenderableAttrValue, isSVGTag, propsToAttrMap, isBooleanAttr, includeBooleanAttr, isSSRSafeAttrName, escapeHtml, normalizeClass, isString, normalizeStyle, stringifyStyle, isArray, toDisplayString, isFunction, getGlobalThis, NOOP, isObject, looseEqual, looseIndexOf, isPromise, escapeHtmlComment, isVoidTag } from '@vue/shared';
import { createVNode, ssrUtils, ssrContextKey, warn as warn$2, Fragment, Static, Comment, Text, mergeProps, createApp, initDirectivesForSSR } from 'vue';
import { isOn, isRenderableAttrValue, isSVGTag, propsToAttrMap, isBooleanAttr, includeBooleanAttr, isSSRSafeAttrName, escapeHtml, normalizeClass, isString, normalizeStyle, stringifyStyle, makeMap, isArray, toDisplayString, extend, isFunction, EMPTY_OBJ, getGlobalThis, NOOP, isObject, looseEqual, looseIndexOf, isPromise, escapeHtmlComment, isVoidTag } from '@vue/shared';
export { includeBooleanAttr as ssrIncludeBooleanAttr } from '@vue/shared';
const shouldIgnoreProp = makeMap(
const shouldIgnoreProp = /* @__PURE__ */ makeMap(
`,key,ref,innerHTML,textContent,ref_key,ref_for`
);
function ssrRenderAttrs(props, tag) {
@@ -21,6 +21,8 @@ function ssrRenderAttrs(props, tag) {
ret += ` class="${ssrRenderClass(value)}"`;
} else if (key === "style") {
ret += ` style="${ssrRenderStyle(value)}"`;
} else if (key === "className") {
ret += ` class="${String(value)}"`;
} else {
ret += ssrRenderDynamicAttr(key, value, tag);
}
@@ -71,6 +73,7 @@ function ssrRenderComponent(comp, props = null, children = null, parentComponent
);
}
const { ensureValidVNode } = ssrUtils;
function ssrRenderSlot(slots, slotName, slotProps, fallbackRenderFn, push, parentComponent, slotScopeId) {
push(`<!--[-->`);
ssrRenderSlotInner(
@@ -98,7 +101,17 @@ function ssrRenderSlotInner(slots, slotName, slotProps, fallbackRenderFn, push,
slotScopeId ? " " + slotScopeId : ""
);
if (isArray(ret)) {
renderVNodeChildren(push, ret, parentComponent, slotScopeId);
const validSlotContent = ensureValidVNode(ret);
if (validSlotContent) {
renderVNodeChildren(
push,
validSlotContent,
parentComponent,
slotScopeId
);
} else if (fallbackRenderFn) {
fallbackRenderFn();
}
} else {
let isEmptySlot = true;
if (transition) {
@@ -131,13 +144,11 @@ function ssrRenderSlotInner(slots, slotName, slotProps, fallbackRenderFn, push,
fallbackRenderFn();
}
}
const commentTestRE = /^<!--.*-->$/s;
const commentTestRE = /^<!--[\s\S]*-->$/;
const commentRE = /<!--[^]*?-->/gm;
function isComment(item) {
if (typeof item !== "string" || !commentTestRE.test(item))
return false;
if (item.length <= 8)
return true;
if (typeof item !== "string" || !commentTestRE.test(item)) return false;
if (item.length <= 8) return true;
return !item.replace(commentRE, "").trim();
}
@@ -150,9 +161,10 @@ function ssrRenderTeleport(parentPush, contentRenderFn, target, disabled, parent
let teleportContent;
if (disabled) {
contentRenderFn(parentPush);
teleportContent = `<!--teleport anchor-->`;
teleportContent = `<!--teleport start anchor--><!--teleport anchor-->`;
} else {
const { getBuffer, push } = createBuffer();
push(`<!--teleport start anchor-->`);
contentRenderFn(push);
push(`<!--teleport anchor-->`);
teleportContent = getBuffer();
@@ -165,6 +177,37 @@ function ssrInterpolate(value) {
return escapeHtml(toDisplayString(value));
}
let activeSub;
let batchDepth = 0;
let batchedSub;
function startBatch() {
batchDepth++;
}
function endBatch() {
if (--batchDepth > 0) {
return;
}
let error;
while (batchedSub) {
let e = batchedSub;
batchedSub = void 0;
while (e) {
const next = e.next;
e.next = void 0;
e.flags &= ~8;
if (e.flags & 1) {
try {
;
e.trigger();
} catch (err) {
if (!error) error = err;
}
}
e = next;
}
}
if (error) throw error;
}
let shouldTrack = true;
const trackStack = [];
function pauseTracking() {
@@ -176,23 +219,125 @@ function resetTracking() {
shouldTrack = last === void 0 ? true : last;
}
class Dep {
constructor(computed) {
this.computed = computed;
this.version = 0;
/**
* Link between this dep and the current active effect
*/
this.activeLink = void 0;
/**
* Doubly linked list representing the subscribing effects (tail)
*/
this.subs = void 0;
/**
* For object property deps cleanup
*/
this.map = void 0;
this.key = void 0;
/**
* Subscriber counter
*/
this.sc = 0;
if (!!(process.env.NODE_ENV !== "production")) {
this.subsHead = void 0;
}
}
track(debugInfo) {
{
return;
}
}
trigger(debugInfo) {
this.version++;
this.notify(debugInfo);
}
notify(debugInfo) {
startBatch();
try {
if (!!(process.env.NODE_ENV !== "production")) {
for (let head = this.subsHead; head; head = head.nextSub) {
if (head.sub.onTrigger && !(head.sub.flags & 8)) {
head.sub.onTrigger(
extend(
{
effect: head.sub
},
debugInfo
)
);
}
}
}
for (let link = this.subs; link; link = link.prevSub) {
if (link.sub.notify()) {
;
link.sub.dep.notify();
}
}
} finally {
endBatch();
}
}
}
const targetMap = /* @__PURE__ */ new WeakMap();
Symbol(
!!(process.env.NODE_ENV !== "production") ? "Object iterate" : ""
);
Symbol(
!!(process.env.NODE_ENV !== "production") ? "Map keys iterate" : ""
);
Symbol(
!!(process.env.NODE_ENV !== "production") ? "Array iterate" : ""
);
function track(target, type, key) {
if (shouldTrack && activeSub) {
let depsMap = targetMap.get(target);
if (!depsMap) {
targetMap.set(target, depsMap = /* @__PURE__ */ new Map());
}
let dep = depsMap.get(key);
if (!dep) {
depsMap.set(key, dep = new Dep());
dep.map = depsMap;
dep.key = key;
}
if (!!(process.env.NODE_ENV !== "production")) {
dep.track({
target,
type,
key
});
} else {
dep.track();
}
}
}
function isProxy(value) {
return value ? !!value["__v_raw"] : false;
}
function toRaw(observed) {
const raw = observed && observed["__v_raw"];
return raw ? toRaw(raw) : observed;
}
function isRef(r) {
return !!(r && r.__v_isRef === true);
return r ? r["__v_isRef"] === true : false;
}
const stack = [];
function pushWarningContext(vnode) {
function pushWarningContext$1(vnode) {
stack.push(vnode);
}
function popWarningContext() {
function popWarningContext$1() {
stack.pop();
}
let isWarning = false;
function warn$1(msg, ...args) {
if (isWarning) return;
isWarning = true;
pauseTracking();
const instance = stack.length ? stack[stack.length - 1].component : null;
const appWarnHandler = instance && instance.appContext.config.warnHandler;
@@ -203,7 +348,11 @@ function warn$1(msg, ...args) {
instance,
11,
[
msg + args.join(""),
// eslint-disable-next-line no-restricted-syntax
msg + args.map((a) => {
var _a, _b;
return (_b = (_a = a.toString) == null ? void 0 : _a.call(a)) != null ? _b : JSON.stringify(a);
}).join(""),
instance && instance.proxy,
trace.map(
({ vnode }) => `at <${formatComponentName(instance, vnode.type)}>`
@@ -221,6 +370,7 @@ function warn$1(msg, ...args) {
console.warn(...warnArgs);
}
resetTracking();
isWarning = false;
}
function getComponentTrace() {
let currentVNode = stack[stack.length - 1];
@@ -319,19 +469,20 @@ const ErrorTypeStrings = {
[11]: "app warnHandler",
[12]: "ref function",
[13]: "async component loader",
[14]: "scheduler flush. This is likely a Vue internals bug. Please open an issue at https://github.com/vuejs/core ."
[14]: "scheduler flush",
[15]: "component update",
[16]: "app unmount cleanup function"
};
function callWithErrorHandling(fn, instance, type, args) {
let res;
try {
res = args ? fn(...args) : fn();
return 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;
const { errorHandler, throwUnhandledErrorInProduction } = instance && instance.appContext.config || EMPTY_OBJ;
if (instance) {
let cur = instance.parent;
const exposedInstance = instance.proxy;
@@ -347,34 +498,36 @@ function handleError(err, instance, type, throwInDev = true) {
}
cur = cur.parent;
}
const appErrorHandler = instance.appContext.config.errorHandler;
if (appErrorHandler) {
callWithErrorHandling(
appErrorHandler,
null,
10,
[err, exposedInstance, errorInfo]
);
if (errorHandler) {
pauseTracking();
callWithErrorHandling(errorHandler, null, 10, [
err,
exposedInstance,
errorInfo
]);
resetTracking();
return;
}
}
logError(err, type, contextVNode, throwInDev);
logError(err, type, contextVNode, throwInDev, throwUnhandledErrorInProduction);
}
function logError(err, type, contextVNode, throwInDev = true) {
function logError(err, type, contextVNode, throwInDev = true, throwInProd = false) {
if (!!(process.env.NODE_ENV !== "production")) {
const info = ErrorTypeStrings[type];
if (contextVNode) {
pushWarningContext(contextVNode);
pushWarningContext$1(contextVNode);
}
warn$1(`Unhandled error${info ? ` during execution of ${info}` : ``}`);
if (contextVNode) {
popWarningContext();
popWarningContext$1();
}
if (throwInDev) {
throw err;
} else {
console.error(err);
}
} else if (throwInProd) {
throw err;
} else {
console.error(err);
}
@@ -395,6 +548,7 @@ function setDevtoolsHook(hook, target) {
// (#4815)
typeof window !== "undefined" && // some envs mock window but not fully
window.HTMLElement && // also exclude jsdom
// eslint-disable-next-line no-restricted-syntax
!((_b = (_a = window.navigator) == null ? void 0 : _a.userAgent) == null ? void 0 : _b.includes("jsdom"))
) {
const replay = target.__VUE_DEVTOOLS_HOOK_REPLAY__ = target.__VUE_DEVTOOLS_HOOK_REPLAY__ || [];
@@ -416,14 +570,11 @@ function setDevtoolsHook(hook, target) {
const g = getGlobalThis();
const registerGlobalSetter = (key, setter) => {
let setters;
if (!(setters = g[key]))
setters = g[key] = [];
if (!(setters = g[key])) setters = g[key] = [];
setters.push(setter);
return (v) => {
if (setters.length > 1)
setters.forEach((set) => set(v));
else
setters[0](v);
if (setters.length > 1) setters.forEach((set) => set(v));
else setters[0](v);
};
};
registerGlobalSetter(
@@ -435,6 +586,25 @@ function setDevtoolsHook(hook, target) {
(v) => v
);
}
!!(process.env.NODE_ENV !== "production") ? {
get(target, key) {
track(target, "get", "");
return target[key];
},
set() {
warn$1(`setupContext.attrs is readonly.`);
return false;
},
deleteProperty() {
warn$1(`setupContext.attrs is readonly.`);
return false;
}
} : {
get(target, key) {
track(target, "get", "");
return target[key];
}
};
const classifyRE = /(?:^|[-_])(\w)/g;
const classify = (str) => str.replace(classifyRE, (c) => c.toUpperCase()).replace(/[-_]/g, "");
function getComponentName(Component, includeInferred = true) {
@@ -462,6 +632,9 @@ function formatComponentName(instance, Component, isRoot = false) {
}
return name ? classify(name) : isRoot ? `App` : `Anonymous`;
}
function isClassComponent(value) {
return isFunction(value) && "__vccOpts" in value;
}
const warn = !!(process.env.NODE_ENV !== "production") ? warn$1 : NOOP;
!!(process.env.NODE_ENV !== "production") || true ? devtools : void 0;
@@ -509,7 +682,7 @@ function ssrGetDirectiveProps(instance, dir, value, arg, modifiers = {}) {
return dir.getSSRProps(
{
dir,
instance,
instance: ssrUtils.getComponentPublicInstance(instance.$),
value,
oldValue: void 0,
arg,
@@ -560,7 +733,9 @@ const {
setCurrentRenderingInstance,
setupComponent,
renderComponentRoot,
normalizeVNode
normalizeVNode,
pushWarningContext,
popWarningContext
} = ssrUtils;
function createBuffer() {
let appendable = false;
@@ -573,9 +748,9 @@ function createBuffer() {
const isStringItem = isString(item);
if (appendable && isStringItem) {
buffer[buffer.length - 1] += item;
} else {
buffer.push(item);
return;
}
buffer.push(item);
appendable = isStringItem;
if (isPromise(item) || isArray(item) && item.hasAsync) {
buffer.hasAsync = true;
@@ -584,29 +759,36 @@ function createBuffer() {
};
}
function renderComponentVNode(vnode, parentComponent = null, slotScopeId) {
const instance = createComponentInstance(vnode, parentComponent, null);
const instance = vnode.component = createComponentInstance(
vnode,
parentComponent,
null
);
if (!!(process.env.NODE_ENV !== "production")) pushWarningContext(vnode);
const res = setupComponent(
instance,
true
/* isSSR */
);
if (!!(process.env.NODE_ENV !== "production")) popWarningContext();
const hasAsyncSetup = isPromise(res);
const prefetches = instance.sp;
let prefetches = instance.sp;
if (hasAsyncSetup || prefetches) {
let p = hasAsyncSetup ? res : Promise.resolve();
if (prefetches) {
p = p.then(
() => Promise.all(
const p = Promise.resolve(res).then(() => {
if (hasAsyncSetup) prefetches = instance.sp;
if (prefetches) {
return Promise.all(
prefetches.map((prefetch) => prefetch.call(instance.proxy))
)
).catch(NOOP);
}
);
}
}).catch(NOOP);
return p.then(() => renderComponentSubTree(instance, slotScopeId));
} else {
return renderComponentSubTree(instance, slotScopeId);
}
}
function renderComponentSubTree(instance, slotScopeId) {
if (!!(process.env.NODE_ENV !== "production")) pushWarningContext(instance.vnode);
const comp = instance.type;
const { getBuffer, push } = createBuffer();
if (isFunction(comp)) {
@@ -623,12 +805,6 @@ function renderComponentSubTree(instance, slotScopeId) {
if ((!instance.render || instance.render === NOOP) && !instance.ssrRender && !comp.ssrRender && isString(comp.template)) {
comp.ssrRender = ssrCompile(comp.template);
}
for (const e of instance.scope.effects) {
if (e.computed) {
e.computed._dirty = true;
e.computed._cacheable = true;
}
}
const ssrRender = instance.ssrRender || comp.ssrRender;
if (ssrRender) {
let attrs = instance.inheritAttrs !== false ? instance.attrs : void 0;
@@ -651,9 +827,11 @@ function renderComponentSubTree(instance, slotScopeId) {
}
}
if (slotScopeId) {
if (!hasCloned)
attrs = { ...attrs };
attrs[slotScopeId.trim()] = "";
if (!hasCloned) attrs = { ...attrs };
const slotScopeIdList = slotScopeId.trim().split(" ");
for (let i = 0; i < slotScopeIdList.length; i++) {
attrs[slotScopeIdList[i]] = "";
}
}
const prev = setCurrentRenderingInstance(instance);
try {
@@ -684,10 +862,14 @@ function renderComponentSubTree(instance, slotScopeId) {
push(`<!---->`);
}
}
if (!!(process.env.NODE_ENV !== "production")) popWarningContext();
return getBuffer();
}
function renderVNode(push, vnode, parentComponent, slotScopeId) {
const { type, shapeFlag, children } = vnode;
const { type, shapeFlag, children, dirs, props } = vnode;
if (dirs) {
vnode.props = applySSRDirectives(vnode, props, dirs);
}
switch (type) {
case Text:
push(escapeHtml(children));
@@ -738,11 +920,8 @@ function renderVNodeChildren(push, children, parentComponent, slotScopeId) {
}
function renderElementVNode(push, vnode, parentComponent, slotScopeId) {
const tag = vnode.type;
let { props, children, shapeFlag, scopeId, dirs } = vnode;
let { props, children, shapeFlag, scopeId } = vnode;
let openTag = `<${tag}`;
if (dirs) {
props = applySSRDirectives(vnode, props, dirs);
}
if (props) {
openTag += ssrRenderAttrs(props, tag);
}
@@ -800,8 +979,7 @@ function applySSRDirectives(vnode, rawProps, dirs) {
} = binding;
if (getSSRProps) {
const props = getSSRProps(binding, vnode);
if (props)
toMerge.push(props);
if (props) toMerge.push(props);
}
}
return mergeProps(rawProps || {}, ...toMerge);
@@ -838,24 +1016,36 @@ function renderTeleportVNode(push, vnode, parentComponent, slotScopeId) {
}
const { isVNode: isVNode$1 } = ssrUtils;
async function unrollBuffer$1(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$1(item);
}
}
return ret;
} else {
return unrollBufferSync$1(buffer);
function nestedUnrollBuffer(buffer, parentRet, startIndex) {
if (!buffer.hasAsync) {
return parentRet + unrollBufferSync$1(buffer);
}
let ret = parentRet;
for (let i = startIndex; i < buffer.length; i += 1) {
const item = buffer[i];
if (isString(item)) {
ret += item;
continue;
}
if (isPromise(item)) {
return item.then((nestedItem) => {
buffer[i] = nestedItem;
return nestedUnrollBuffer(buffer, ret, i);
});
}
const result = nestedUnrollBuffer(item, ret, 0);
if (isPromise(result)) {
return result.then((nestedItem) => {
buffer[i] = nestedItem;
return nestedUnrollBuffer(buffer, "", i);
});
}
ret = result;
}
return ret;
}
function unrollBuffer$1(buffer) {
return nestedUnrollBuffer(buffer, "", 0);
}
function unrollBufferSync$1(buffer) {
let ret = "";
@@ -986,8 +1176,7 @@ function renderToWebStream(input, context = {}) {
start(controller) {
renderToSimpleStream(input, context, {
push(content) {
if (cancelled)
return;
if (cancelled) return;
if (content != null) {
controller.enqueue(encoder.encode(content));
} else {
+4 -4
View File
@@ -1,6 +1,6 @@
{
"name": "@vue/server-renderer",
"version": "3.4.15",
"version": "3.5.13",
"description": "@vue/server-renderer",
"main": "index.js",
"module": "dist/server-renderer.esm-bundler.js",
@@ -46,10 +46,10 @@
},
"homepage": "https://github.com/vuejs/core/tree/main/packages/server-renderer#readme",
"peerDependencies": {
"vue": "3.4.15"
"vue": "3.5.13"
},
"dependencies": {
"@vue/compiler-ssr": "3.4.15",
"@vue/shared": "3.4.15"
"@vue/shared": "3.5.13",
"@vue/compiler-ssr": "3.5.13"
}
}
+65 -32
View File
@@ -1,5 +1,5 @@
/**
* @vue/shared v3.4.15
* @vue/shared v3.5.13
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT
**/
@@ -7,9 +7,12 @@
Object.defineProperty(exports, '__esModule', { value: true });
function makeMap(str, expectsLowerCase) {
const set = new Set(str.split(","));
return expectsLowerCase ? (val) => set.has(val.toLowerCase()) : (val) => set.has(val);
/*! #__NO_SIDE_EFFECTS__ */
// @__NO_SIDE_EFFECTS__
function makeMap(str) {
const map = /* @__PURE__ */ Object.create(null);
for (const key of str.split(",")) map[key] = 1;
return (val) => val in map;
}
const EMPTY_OBJ = Object.freeze({}) ;
@@ -63,9 +66,11 @@ const cacheStringFunction = (fn) => {
};
};
const camelizeRE = /-(\w)/g;
const camelize = cacheStringFunction((str) => {
return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
});
const camelize = cacheStringFunction(
(str) => {
return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
}
);
const hyphenateRE = /\B([A-Z])/g;
const hyphenate = cacheStringFunction(
(str) => str.replace(hyphenateRE, "-$1").toLowerCase()
@@ -73,20 +78,23 @@ const hyphenate = cacheStringFunction(
const capitalize = cacheStringFunction((str) => {
return str.charAt(0).toUpperCase() + str.slice(1);
});
const toHandlerKey = cacheStringFunction((str) => {
const s = str ? `on${capitalize(str)}` : ``;
return s;
});
const toHandlerKey = cacheStringFunction(
(str) => {
const s = str ? `on${capitalize(str)}` : ``;
return s;
}
);
const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
const invokeArrayFns = (fns, arg) => {
const invokeArrayFns = (fns, ...arg) => {
for (let i = 0; i < fns.length; i++) {
fns[i](arg);
fns[i](...arg);
}
};
const def = (obj, key, value) => {
const def = (obj, key, value, writable = false) => {
Object.defineProperty(obj, key, {
configurable: true,
enumerable: false,
writable,
value
});
};
@@ -106,6 +114,12 @@ 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)}]`;
}
function genCacheKey(source, options) {
return source + JSON.stringify(
options,
(_, val) => typeof val === "function" ? val.toString() : val
);
}
const PatchFlags = {
"TEXT": 1,
@@ -132,8 +146,8 @@ const PatchFlags = {
"1024": "DYNAMIC_SLOTS",
"DEV_ROOT_FRAGMENT": 2048,
"2048": "DEV_ROOT_FRAGMENT",
"HOISTED": -1,
"-1": "HOISTED",
"CACHED": -1,
"-1": "CACHED",
"BAIL": -2,
"-2": "BAIL"
};
@@ -193,12 +207,15 @@ const slotFlagsText = {
[3]: "FORWARDED"
};
const GLOBALS_ALLOWED = "Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console,Error";
const GLOBALS_ALLOWED = "Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console,Error,Symbol";
const isGloballyAllowed = /* @__PURE__ */ makeMap(GLOBALS_ALLOWED);
const isGloballyWhitelisted = isGloballyAllowed;
const range = 2;
function generateCodeFrame(source, start = 0, end = source.length) {
start = Math.max(0, Math.min(start, source.length));
end = Math.max(0, Math.min(end, source.length));
if (start > end) return "";
let lines = source.split(/(\r?\n)/);
const newlineSequences = lines.filter((_, idx) => idx % 2 === 1);
lines = lines.filter((_, idx) => idx % 2 === 0);
@@ -208,8 +225,7 @@ function generateCodeFrame(source, start = 0, end = source.length) {
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;
if (j < 0 || j >= lines.length) continue;
const line = j + 1;
res.push(
`${line}${" ".repeat(Math.max(3 - String(line).length, 0))}| ${lines[j]}`
@@ -268,14 +284,13 @@ function parseStringStyle(cssText) {
return ret;
}
function stringifyStyle(styles) {
if (!styles) return "";
if (isString(styles)) return 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") {
const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key);
ret += `${normalizedKey}:${value};`;
}
}
@@ -302,8 +317,7 @@ function normalizeClass(value) {
return res.trim();
}
function normalizeProps(props) {
if (!props)
return null;
if (!props) return null;
let { class: klass, style } = props;
if (klass && !isString(klass)) {
props.class = normalizeClass(klass);
@@ -355,6 +369,9 @@ const isKnownHtmlAttr = /* @__PURE__ */ makeMap(
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,xmlns:xlink,xml:base,xml:lang,xml:space,y,y1,y2,yChannelSelector,z,zoomAndPan`
);
const isKnownMathMLAttr = /* @__PURE__ */ makeMap(
`accent,accentunder,actiontype,align,alignmentscope,altimg,altimg-height,altimg-valign,altimg-width,alttext,bevelled,close,columnsalign,columnlines,columnspan,denomalign,depth,dir,display,displaystyle,encoding,equalcolumns,equalrows,fence,fontstyle,fontweight,form,frame,framespacing,groupalign,height,href,id,indentalign,indentalignfirst,indentalignlast,indentshift,indentshiftfirst,indentshiftlast,indextype,justify,largetop,largeop,lquote,lspace,mathbackground,mathcolor,mathsize,mathvariant,maxsize,minlabelspacing,mode,other,overflow,position,rowalign,rowlines,rowspan,rquote,rspace,scriptlevel,scriptminsize,scriptsizemultiplier,selection,separator,separators,shift,side,src,stackalign,stretchy,subscriptshift,superscriptshift,symmetric,voffset,width,widths,xlink:href,xlink:show,xlink:type,xmlns`
);
function isRenderableAttrValue(value) {
if (value == null) {
return false;
@@ -406,10 +423,16 @@ const commentStripRE = /^-?>|<!--|-->|--!>|<!-$/g;
function escapeHtmlComment(src) {
return src.replace(commentStripRE, "");
}
const cssVarNameEscapeSymbolsRE = /[ !"#$%&'()*+,./:;<=>?@[\\\]^`{|}~]/g;
function getEscapedCssVarName(key, doubleEscape) {
return key.replace(
cssVarNameEscapeSymbolsRE,
(s) => doubleEscape ? s === '"' ? '\\\\\\"' : `\\\\${s}` : `\\${s}`
);
}
function looseCompareArrays(a, b) {
if (a.length !== b.length)
return false;
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]);
@@ -417,8 +440,7 @@ function looseCompareArrays(a, b) {
return equal;
}
function looseEqual(a, b) {
if (a === b)
return true;
if (a === b) return true;
let aValidType = isDate(a);
let bValidType = isDate(b);
if (aValidType || bValidType) {
@@ -459,11 +481,14 @@ function looseIndexOf(arr, val) {
return arr.findIndex((item) => looseEqual(item, val));
}
const isRef = (val) => {
return !!(val && val["__v_isRef"] === true);
};
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);
return isString(val) ? val : val == null ? "" : isArray(val) || isObject(val) && (val.toString === objectToString || !isFunction(val.toString)) ? isRef(val) ? toDisplayString(val.value) : JSON.stringify(val, replacer, 2) : String(val);
};
const replacer = (_key, val) => {
if (val && val.__v_isRef) {
if (isRef(val)) {
return replacer(_key, val.value);
} else if (isMap(val)) {
return {
@@ -488,7 +513,11 @@ const replacer = (_key, val) => {
};
const stringifySymbol = (v, i = "") => {
var _a;
return isSymbol(v) ? `Symbol(${(_a = v.description) != null ? _a : i})` : v;
return (
// Symbol.description in es2019+ so we need to cast here to pass
// the lib: es2016 check
isSymbol(v) ? `Symbol(${(_a = v.description) != null ? _a : i})` : v
);
};
exports.EMPTY_ARR = EMPTY_ARR;
@@ -501,12 +530,15 @@ exports.ShapeFlags = ShapeFlags;
exports.SlotFlags = SlotFlags;
exports.camelize = camelize;
exports.capitalize = capitalize;
exports.cssVarNameEscapeSymbolsRE = cssVarNameEscapeSymbolsRE;
exports.def = def;
exports.escapeHtml = escapeHtml;
exports.escapeHtmlComment = escapeHtmlComment;
exports.extend = extend;
exports.genCacheKey = genCacheKey;
exports.genPropsAccessExp = genPropsAccessExp;
exports.generateCodeFrame = generateCodeFrame;
exports.getEscapedCssVarName = getEscapedCssVarName;
exports.getGlobalThis = getGlobalThis;
exports.hasChanged = hasChanged;
exports.hasOwn = hasOwn;
@@ -523,6 +555,7 @@ exports.isGloballyWhitelisted = isGloballyWhitelisted;
exports.isHTMLTag = isHTMLTag;
exports.isIntegerKey = isIntegerKey;
exports.isKnownHtmlAttr = isKnownHtmlAttr;
exports.isKnownMathMLAttr = isKnownMathMLAttr;
exports.isKnownSvgAttr = isKnownSvgAttr;
exports.isMap = isMap;
exports.isMathMLTag = isMathMLTag;
+65 -32
View File
@@ -1,5 +1,5 @@
/**
* @vue/shared v3.4.15
* @vue/shared v3.5.13
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT
**/
@@ -7,9 +7,12 @@
Object.defineProperty(exports, '__esModule', { value: true });
function makeMap(str, expectsLowerCase) {
const set = new Set(str.split(","));
return expectsLowerCase ? (val) => set.has(val.toLowerCase()) : (val) => set.has(val);
/*! #__NO_SIDE_EFFECTS__ */
// @__NO_SIDE_EFFECTS__
function makeMap(str) {
const map = /* @__PURE__ */ Object.create(null);
for (const key of str.split(",")) map[key] = 1;
return (val) => val in map;
}
const EMPTY_OBJ = {};
@@ -63,9 +66,11 @@ const cacheStringFunction = (fn) => {
};
};
const camelizeRE = /-(\w)/g;
const camelize = cacheStringFunction((str) => {
return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
});
const camelize = cacheStringFunction(
(str) => {
return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
}
);
const hyphenateRE = /\B([A-Z])/g;
const hyphenate = cacheStringFunction(
(str) => str.replace(hyphenateRE, "-$1").toLowerCase()
@@ -73,20 +78,23 @@ const hyphenate = cacheStringFunction(
const capitalize = cacheStringFunction((str) => {
return str.charAt(0).toUpperCase() + str.slice(1);
});
const toHandlerKey = cacheStringFunction((str) => {
const s = str ? `on${capitalize(str)}` : ``;
return s;
});
const toHandlerKey = cacheStringFunction(
(str) => {
const s = str ? `on${capitalize(str)}` : ``;
return s;
}
);
const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
const invokeArrayFns = (fns, arg) => {
const invokeArrayFns = (fns, ...arg) => {
for (let i = 0; i < fns.length; i++) {
fns[i](arg);
fns[i](...arg);
}
};
const def = (obj, key, value) => {
const def = (obj, key, value, writable = false) => {
Object.defineProperty(obj, key, {
configurable: true,
enumerable: false,
writable,
value
});
};
@@ -106,6 +114,12 @@ 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)}]`;
}
function genCacheKey(source, options) {
return source + JSON.stringify(
options,
(_, val) => typeof val === "function" ? val.toString() : val
);
}
const PatchFlags = {
"TEXT": 1,
@@ -132,8 +146,8 @@ const PatchFlags = {
"1024": "DYNAMIC_SLOTS",
"DEV_ROOT_FRAGMENT": 2048,
"2048": "DEV_ROOT_FRAGMENT",
"HOISTED": -1,
"-1": "HOISTED",
"CACHED": -1,
"-1": "CACHED",
"BAIL": -2,
"-2": "BAIL"
};
@@ -193,12 +207,15 @@ const slotFlagsText = {
[3]: "FORWARDED"
};
const GLOBALS_ALLOWED = "Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console,Error";
const GLOBALS_ALLOWED = "Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console,Error,Symbol";
const isGloballyAllowed = /* @__PURE__ */ makeMap(GLOBALS_ALLOWED);
const isGloballyWhitelisted = isGloballyAllowed;
const range = 2;
function generateCodeFrame(source, start = 0, end = source.length) {
start = Math.max(0, Math.min(start, source.length));
end = Math.max(0, Math.min(end, source.length));
if (start > end) return "";
let lines = source.split(/(\r?\n)/);
const newlineSequences = lines.filter((_, idx) => idx % 2 === 1);
lines = lines.filter((_, idx) => idx % 2 === 0);
@@ -208,8 +225,7 @@ function generateCodeFrame(source, start = 0, end = source.length) {
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;
if (j < 0 || j >= lines.length) continue;
const line = j + 1;
res.push(
`${line}${" ".repeat(Math.max(3 - String(line).length, 0))}| ${lines[j]}`
@@ -268,14 +284,13 @@ function parseStringStyle(cssText) {
return ret;
}
function stringifyStyle(styles) {
if (!styles) return "";
if (isString(styles)) return 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") {
const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key);
ret += `${normalizedKey}:${value};`;
}
}
@@ -302,8 +317,7 @@ function normalizeClass(value) {
return res.trim();
}
function normalizeProps(props) {
if (!props)
return null;
if (!props) return null;
let { class: klass, style } = props;
if (klass && !isString(klass)) {
props.class = normalizeClass(klass);
@@ -355,6 +369,9 @@ const isKnownHtmlAttr = /* @__PURE__ */ makeMap(
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,xmlns:xlink,xml:base,xml:lang,xml:space,y,y1,y2,yChannelSelector,z,zoomAndPan`
);
const isKnownMathMLAttr = /* @__PURE__ */ makeMap(
`accent,accentunder,actiontype,align,alignmentscope,altimg,altimg-height,altimg-valign,altimg-width,alttext,bevelled,close,columnsalign,columnlines,columnspan,denomalign,depth,dir,display,displaystyle,encoding,equalcolumns,equalrows,fence,fontstyle,fontweight,form,frame,framespacing,groupalign,height,href,id,indentalign,indentalignfirst,indentalignlast,indentshift,indentshiftfirst,indentshiftlast,indextype,justify,largetop,largeop,lquote,lspace,mathbackground,mathcolor,mathsize,mathvariant,maxsize,minlabelspacing,mode,other,overflow,position,rowalign,rowlines,rowspan,rquote,rspace,scriptlevel,scriptminsize,scriptsizemultiplier,selection,separator,separators,shift,side,src,stackalign,stretchy,subscriptshift,superscriptshift,symmetric,voffset,width,widths,xlink:href,xlink:show,xlink:type,xmlns`
);
function isRenderableAttrValue(value) {
if (value == null) {
return false;
@@ -406,10 +423,16 @@ const commentStripRE = /^-?>|<!--|-->|--!>|<!-$/g;
function escapeHtmlComment(src) {
return src.replace(commentStripRE, "");
}
const cssVarNameEscapeSymbolsRE = /[ !"#$%&'()*+,./:;<=>?@[\\\]^`{|}~]/g;
function getEscapedCssVarName(key, doubleEscape) {
return key.replace(
cssVarNameEscapeSymbolsRE,
(s) => doubleEscape ? s === '"' ? '\\\\\\"' : `\\\\${s}` : `\\${s}`
);
}
function looseCompareArrays(a, b) {
if (a.length !== b.length)
return false;
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]);
@@ -417,8 +440,7 @@ function looseCompareArrays(a, b) {
return equal;
}
function looseEqual(a, b) {
if (a === b)
return true;
if (a === b) return true;
let aValidType = isDate(a);
let bValidType = isDate(b);
if (aValidType || bValidType) {
@@ -459,11 +481,14 @@ function looseIndexOf(arr, val) {
return arr.findIndex((item) => looseEqual(item, val));
}
const isRef = (val) => {
return !!(val && val["__v_isRef"] === true);
};
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);
return isString(val) ? val : val == null ? "" : isArray(val) || isObject(val) && (val.toString === objectToString || !isFunction(val.toString)) ? isRef(val) ? toDisplayString(val.value) : JSON.stringify(val, replacer, 2) : String(val);
};
const replacer = (_key, val) => {
if (val && val.__v_isRef) {
if (isRef(val)) {
return replacer(_key, val.value);
} else if (isMap(val)) {
return {
@@ -488,7 +513,11 @@ const replacer = (_key, val) => {
};
const stringifySymbol = (v, i = "") => {
var _a;
return isSymbol(v) ? `Symbol(${(_a = v.description) != null ? _a : i})` : v;
return (
// Symbol.description in es2019+ so we need to cast here to pass
// the lib: es2016 check
isSymbol(v) ? `Symbol(${(_a = v.description) != null ? _a : i})` : v
);
};
exports.EMPTY_ARR = EMPTY_ARR;
@@ -501,12 +530,15 @@ exports.ShapeFlags = ShapeFlags;
exports.SlotFlags = SlotFlags;
exports.camelize = camelize;
exports.capitalize = capitalize;
exports.cssVarNameEscapeSymbolsRE = cssVarNameEscapeSymbolsRE;
exports.def = def;
exports.escapeHtml = escapeHtml;
exports.escapeHtmlComment = escapeHtmlComment;
exports.extend = extend;
exports.genCacheKey = genCacheKey;
exports.genPropsAccessExp = genPropsAccessExp;
exports.generateCodeFrame = generateCodeFrame;
exports.getEscapedCssVarName = getEscapedCssVarName;
exports.getGlobalThis = getGlobalThis;
exports.hasChanged = hasChanged;
exports.hasOwn = hasOwn;
@@ -523,6 +555,7 @@ exports.isGloballyWhitelisted = isGloballyWhitelisted;
exports.isHTMLTag = isHTMLTag;
exports.isIntegerKey = isIntegerKey;
exports.isKnownHtmlAttr = isKnownHtmlAttr;
exports.isKnownMathMLAttr = isKnownMathMLAttr;
exports.isKnownSvgAttr = isKnownSvgAttr;
exports.isMap = isMap;
exports.isMathMLTag = isMathMLTag;
+29 -24
View File
@@ -5,7 +5,8 @@
* \/\*#\_\_PURE\_\_\*\/
* So that rollup can tree-shake them if necessary.
*/
export declare function makeMap(str: string, expectsLowerCase?: boolean): (key: string) => boolean;
/*! #__NO_SIDE_EFFECTS__ */
export declare function makeMap(str: string): (key: string) => boolean;
export declare const EMPTY_OBJ: {
readonly [key: string]: any;
@@ -17,16 +18,11 @@ export declare const NOOP: () => void;
*/
export declare const NO: () => boolean;
export declare const isOn: (key: string) => boolean;
export declare const isModelListener: (key: string) => boolean;
export declare const extend: {
<T extends {}, U>(target: T, source: U): T & U;
<T_1 extends {}, U_1, V>(target: T_1, source1: U_1, source2: V): T_1 & U_1 & V;
<T_2 extends {}, 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 const isModelListener: (key: string) => key is `onUpdate:${string}`;
export declare const extend: typeof Object.assign;
export declare const remove: <T>(arr: T[], el: T) => void;
export declare const hasOwn: (val: object, key: string | symbol) => key is never;
export declare const isArray: (arg: any) => arg is any[];
export declare const hasOwn: (val: object, key: string | symbol) => key is keyof typeof val;
export declare const isArray: typeof Array.isArray;
export declare const isMap: (val: unknown) => val is Map<any, any>;
export declare const isSet: (val: unknown) => val is Set<any>;
export declare const isDate: (val: unknown) => val is Date;
@@ -36,7 +32,7 @@ export declare const isString: (val: unknown) => val is string;
export declare const isSymbol: (val: unknown) => val is symbol;
export declare const isObject: (val: unknown) => val is Record<any, any>;
export declare const isPromise: <T = any>(val: unknown) => val is Promise<T>;
export declare const objectToString: () => string;
export declare const objectToString: typeof Object.prototype.toString;
export declare const toTypeString: (value: unknown) => string;
export declare const toRawType: (value: unknown) => string;
export declare const isPlainObject: (val: unknown) => val is object;
@@ -58,10 +54,10 @@ export declare const capitalize: <T extends string>(str: T) => Capitalize<T>;
/**
* @private
*/
export declare const toHandlerKey: <T extends string>(str: T) => T extends "" ? "" : `on${Capitalize<T>}`;
export declare const toHandlerKey: <T extends string>(str: T) => T extends '' ? '' : `on${Capitalize<T>}`;
export declare const hasChanged: (value: any, oldValue: any) => boolean;
export declare const invokeArrayFns: (fns: Function[], arg?: any) => void;
export declare const def: (obj: object, key: string | symbol, value: any) => void;
export declare const invokeArrayFns: (fns: Function[], ...arg: any[]) => void;
export declare const def: (obj: object, key: string | symbol, value: any, writable?: boolean) => void;
/**
* "123-foo" will be parsed to 123
* This is used for the .number modifier in v-model
@@ -74,6 +70,7 @@ export declare const looseToNumber: (val: any) => any;
export declare const toNumber: (val: any) => any;
export declare const getGlobalThis: () => any;
export declare function genPropsAccessExp(name: string): string;
export declare function genCacheKey(source: string, options: any): string;
/**
* Patch flags are optimization hints generated by the compiler.
@@ -173,10 +170,10 @@ export declare enum PatchFlags {
* flag, simply check patchFlag === FLAG.
*/
/**
* Indicates a hoisted static vnode. This is a hint for hydration to skip
* Indicates a cached static vnode. This is also a hint for hydration to skip
* the entire sub tree since static content never needs to be updated.
*/
HOISTED = -1,
CACHED = -1,
/**
* A special flag that indicates that the diffing algorithm should bail out
* of optimized mode. For example, on block fragments created by renderSlot()
@@ -229,11 +226,7 @@ export declare enum SlotFlags {
/**
* Dev only
*/
export declare const slotFlagsText: {
1: string;
2: string;
3: string;
};
export declare const slotFlagsText: Record<SlotFlags, string>;
export declare const isGloballyAllowed: (key: string) => boolean;
/** @deprecated use `isGloballyAllowed` instead */
@@ -292,6 +285,10 @@ 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;
/**
* Generated from https://developer.mozilla.org/en-US/docs/Web/MathML/Attribute
*/
export declare const isKnownMathMLAttr: (key: string) => boolean;
/**
* Shared between server-renderer and runtime-core hydration logic
*/
@@ -299,6 +296,8 @@ export declare function isRenderableAttrValue(value: unknown): boolean;
export declare function escapeHtml(string: unknown): string;
export declare function escapeHtmlComment(src: string): string;
export declare const cssVarNameEscapeSymbolsRE: RegExp;
export declare function getEscapedCssVarName(key: string, doubleEscape: boolean): string;
export declare function looseEqual(a: any, b: any): boolean;
export declare function looseIndexOf(arr: any[], val: any): number;
@@ -317,7 +316,13 @@ export type LooseRequired<T> = {
[P in keyof (T & Required<T>)]: T[P];
};
export type IfAny<T, Y, N> = 0 extends 1 & T ? Y : N;
export type Awaited<T> = T extends null | undefined ? T : T extends object & {
then(onfulfilled: infer F, ...args: infer _): any;
} ? F extends (value: infer V, ...args: infer _) => any ? Awaited<V> : never : T;
export type IsKeyValues<T, K = string> = IfAny<T, false, T extends object ? (keyof T extends K ? true : false) : false>;
/**
* Utility for extracting the parameters from a function overload (for typed emits)
* https://github.com/microsoft/TypeScript/issues/32164#issuecomment-1146737709
*/
export type OverloadParameters<T extends (...args: any[]) => any> = Parameters<OverloadUnion<T>>;
type OverloadProps<TOverload> = Pick<TOverload, keyof TOverload>;
type OverloadUnionRecursive<TOverload, TPartialOverload = unknown> = TOverload extends (...args: infer TArgs) => infer TReturn ? TPartialOverload extends TOverload ? never : OverloadUnionRecursive<TPartialOverload & TOverload, TPartialOverload & ((...args: TArgs) => TReturn) & OverloadProps<TOverload>> | ((...args: TArgs) => TReturn) : never;
type OverloadUnion<TOverload extends (...args: any[]) => any> = Exclude<OverloadUnionRecursive<(() => never) & TOverload>, TOverload extends () => never ? never : () => never>;
+62 -33
View File
@@ -1,11 +1,14 @@
/**
* @vue/shared v3.4.15
* @vue/shared v3.5.13
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT
**/
function makeMap(str, expectsLowerCase) {
const set = new Set(str.split(","));
return expectsLowerCase ? (val) => set.has(val.toLowerCase()) : (val) => set.has(val);
/*! #__NO_SIDE_EFFECTS__ */
// @__NO_SIDE_EFFECTS__
function makeMap(str) {
const map = /* @__PURE__ */ Object.create(null);
for (const key of str.split(",")) map[key] = 1;
return (val) => val in map;
}
const EMPTY_OBJ = !!(process.env.NODE_ENV !== "production") ? Object.freeze({}) : {};
@@ -59,9 +62,11 @@ const cacheStringFunction = (fn) => {
};
};
const camelizeRE = /-(\w)/g;
const camelize = cacheStringFunction((str) => {
return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
});
const camelize = cacheStringFunction(
(str) => {
return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
}
);
const hyphenateRE = /\B([A-Z])/g;
const hyphenate = cacheStringFunction(
(str) => str.replace(hyphenateRE, "-$1").toLowerCase()
@@ -69,20 +74,23 @@ const hyphenate = cacheStringFunction(
const capitalize = cacheStringFunction((str) => {
return str.charAt(0).toUpperCase() + str.slice(1);
});
const toHandlerKey = cacheStringFunction((str) => {
const s = str ? `on${capitalize(str)}` : ``;
return s;
});
const toHandlerKey = cacheStringFunction(
(str) => {
const s = str ? `on${capitalize(str)}` : ``;
return s;
}
);
const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
const invokeArrayFns = (fns, arg) => {
const invokeArrayFns = (fns, ...arg) => {
for (let i = 0; i < fns.length; i++) {
fns[i](arg);
fns[i](...arg);
}
};
const def = (obj, key, value) => {
const def = (obj, key, value, writable = false) => {
Object.defineProperty(obj, key, {
configurable: true,
enumerable: false,
writable,
value
});
};
@@ -102,6 +110,12 @@ 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)}]`;
}
function genCacheKey(source, options) {
return source + JSON.stringify(
options,
(_, val) => typeof val === "function" ? val.toString() : val
);
}
const PatchFlags = {
"TEXT": 1,
@@ -128,8 +142,8 @@ const PatchFlags = {
"1024": "DYNAMIC_SLOTS",
"DEV_ROOT_FRAGMENT": 2048,
"2048": "DEV_ROOT_FRAGMENT",
"HOISTED": -1,
"-1": "HOISTED",
"CACHED": -1,
"-1": "CACHED",
"BAIL": -2,
"-2": "BAIL"
};
@@ -189,12 +203,15 @@ const slotFlagsText = {
[3]: "FORWARDED"
};
const GLOBALS_ALLOWED = "Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console,Error";
const GLOBALS_ALLOWED = "Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console,Error,Symbol";
const isGloballyAllowed = /* @__PURE__ */ makeMap(GLOBALS_ALLOWED);
const isGloballyWhitelisted = isGloballyAllowed;
const range = 2;
function generateCodeFrame(source, start = 0, end = source.length) {
start = Math.max(0, Math.min(start, source.length));
end = Math.max(0, Math.min(end, source.length));
if (start > end) return "";
let lines = source.split(/(\r?\n)/);
const newlineSequences = lines.filter((_, idx) => idx % 2 === 1);
lines = lines.filter((_, idx) => idx % 2 === 0);
@@ -204,8 +221,7 @@ function generateCodeFrame(source, start = 0, end = source.length) {
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;
if (j < 0 || j >= lines.length) continue;
const line = j + 1;
res.push(
`${line}${" ".repeat(Math.max(3 - String(line).length, 0))}| ${lines[j]}`
@@ -264,14 +280,13 @@ function parseStringStyle(cssText) {
return ret;
}
function stringifyStyle(styles) {
if (!styles) return "";
if (isString(styles)) return 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") {
const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key);
ret += `${normalizedKey}:${value};`;
}
}
@@ -298,8 +313,7 @@ function normalizeClass(value) {
return res.trim();
}
function normalizeProps(props) {
if (!props)
return null;
if (!props) return null;
let { class: klass, style } = props;
if (klass && !isString(klass)) {
props.class = normalizeClass(klass);
@@ -351,6 +365,9 @@ const isKnownHtmlAttr = /* @__PURE__ */ makeMap(
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,xmlns:xlink,xml:base,xml:lang,xml:space,y,y1,y2,yChannelSelector,z,zoomAndPan`
);
const isKnownMathMLAttr = /* @__PURE__ */ makeMap(
`accent,accentunder,actiontype,align,alignmentscope,altimg,altimg-height,altimg-valign,altimg-width,alttext,bevelled,close,columnsalign,columnlines,columnspan,denomalign,depth,dir,display,displaystyle,encoding,equalcolumns,equalrows,fence,fontstyle,fontweight,form,frame,framespacing,groupalign,height,href,id,indentalign,indentalignfirst,indentalignlast,indentshift,indentshiftfirst,indentshiftlast,indextype,justify,largetop,largeop,lquote,lspace,mathbackground,mathcolor,mathsize,mathvariant,maxsize,minlabelspacing,mode,other,overflow,position,rowalign,rowlines,rowspan,rquote,rspace,scriptlevel,scriptminsize,scriptsizemultiplier,selection,separator,separators,shift,side,src,stackalign,stretchy,subscriptshift,superscriptshift,symmetric,voffset,width,widths,xlink:href,xlink:show,xlink:type,xmlns`
);
function isRenderableAttrValue(value) {
if (value == null) {
return false;
@@ -402,10 +419,16 @@ const commentStripRE = /^-?>|<!--|-->|--!>|<!-$/g;
function escapeHtmlComment(src) {
return src.replace(commentStripRE, "");
}
const cssVarNameEscapeSymbolsRE = /[ !"#$%&'()*+,./:;<=>?@[\\\]^`{|}~]/g;
function getEscapedCssVarName(key, doubleEscape) {
return key.replace(
cssVarNameEscapeSymbolsRE,
(s) => doubleEscape ? s === '"' ? '\\\\\\"' : `\\\\${s}` : `\\${s}`
);
}
function looseCompareArrays(a, b) {
if (a.length !== b.length)
return false;
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]);
@@ -413,8 +436,7 @@ function looseCompareArrays(a, b) {
return equal;
}
function looseEqual(a, b) {
if (a === b)
return true;
if (a === b) return true;
let aValidType = isDate(a);
let bValidType = isDate(b);
if (aValidType || bValidType) {
@@ -455,11 +477,14 @@ function looseIndexOf(arr, val) {
return arr.findIndex((item) => looseEqual(item, val));
}
const isRef = (val) => {
return !!(val && val["__v_isRef"] === true);
};
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);
return isString(val) ? val : val == null ? "" : isArray(val) || isObject(val) && (val.toString === objectToString || !isFunction(val.toString)) ? isRef(val) ? toDisplayString(val.value) : JSON.stringify(val, replacer, 2) : String(val);
};
const replacer = (_key, val) => {
if (val && val.__v_isRef) {
if (isRef(val)) {
return replacer(_key, val.value);
} else if (isMap(val)) {
return {
@@ -484,7 +509,11 @@ const replacer = (_key, val) => {
};
const stringifySymbol = (v, i = "") => {
var _a;
return isSymbol(v) ? `Symbol(${(_a = v.description) != null ? _a : i})` : v;
return (
// Symbol.description in es2019+ so we need to cast here to pass
// the lib: es2016 check
isSymbol(v) ? `Symbol(${(_a = v.description) != null ? _a : i})` : v
);
};
export { EMPTY_ARR, EMPTY_OBJ, NO, NOOP, PatchFlagNames, PatchFlags, ShapeFlags, SlotFlags, camelize, capitalize, def, escapeHtml, escapeHtmlComment, extend, genPropsAccessExp, generateCodeFrame, getGlobalThis, hasChanged, hasOwn, hyphenate, includeBooleanAttr, invokeArrayFns, isArray, isBooleanAttr, isBuiltInDirective, isDate, isFunction, isGloballyAllowed, isGloballyWhitelisted, isHTMLTag, isIntegerKey, isKnownHtmlAttr, isKnownSvgAttr, isMap, isMathMLTag, isModelListener, isObject, isOn, isPlainObject, isPromise, isRegExp, isRenderableAttrValue, isReservedProp, isSSRSafeAttrName, isSVGTag, isSet, isSpecialBooleanAttr, isString, isSymbol, isVoidTag, looseEqual, looseIndexOf, looseToNumber, makeMap, normalizeClass, normalizeProps, normalizeStyle, objectToString, parseStringStyle, propsToAttrMap, remove, slotFlagsText, stringifyStyle, toDisplayString, toHandlerKey, toNumber, toRawType, toTypeString };
export { EMPTY_ARR, EMPTY_OBJ, NO, NOOP, PatchFlagNames, PatchFlags, ShapeFlags, SlotFlags, camelize, capitalize, cssVarNameEscapeSymbolsRE, def, escapeHtml, escapeHtmlComment, extend, genCacheKey, genPropsAccessExp, generateCodeFrame, getEscapedCssVarName, getGlobalThis, hasChanged, hasOwn, hyphenate, includeBooleanAttr, invokeArrayFns, isArray, isBooleanAttr, isBuiltInDirective, isDate, isFunction, isGloballyAllowed, isGloballyWhitelisted, isHTMLTag, isIntegerKey, isKnownHtmlAttr, isKnownMathMLAttr, isKnownSvgAttr, isMap, isMathMLTag, isModelListener, isObject, isOn, isPlainObject, isPromise, isRegExp, isRenderableAttrValue, isReservedProp, isSSRSafeAttrName, isSVGTag, isSet, isSpecialBooleanAttr, isString, isSymbol, isVoidTag, looseEqual, looseIndexOf, looseToNumber, makeMap, normalizeClass, normalizeProps, normalizeStyle, objectToString, parseStringStyle, propsToAttrMap, remove, slotFlagsText, stringifyStyle, toDisplayString, toHandlerKey, toNumber, toRawType, toTypeString };
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@vue/shared",
"version": "3.4.15",
"version": "3.5.13",
"description": "internal utils shared across @vue packages",
"main": "index.js",
"module": "dist/shared.esm-bundler.js",