解决在小程序环境下无法链接到mqtt导致获取不到最新数据,解决方法降级mqtt版本到2.8.9

This commit is contained in:
1 2025-07-08 17:21:25 +08:00
parent a5a795268c
commit 25ce93b5cc
284 changed files with 35394 additions and 52811 deletions

View File

@ -34,4 +34,26 @@ const CONFIG = {
xinzhiKey, xinzhiKey,
} }
} }
// const CONFIG = {
// // 开发环境配置
// development: {
// officialWebUrl: 'https://iot.iot-xcwl.cn/',
// baseUrl: 'https://iot.iot-xcwl.cn/prod-api/',
// mqttServer: protocalProd + 'iot.iot-xcwl.cn/mqtt',
// decoderUrl: 'https://iot.iot-xcwl.cn/',
// qqmapKey,
// xinzhiKey,
// },
// // 生产环境配置
// production: {
// officialWebUrl: 'https://iot.iot-xcwl.cn/',
// baseUrl: 'https://iot.iot-xcwl.cn/prod-api/',
// mqttServer: protocalProd + 'iot.iot-xcwl.cn/mqtt',
// decoderUrl: 'https://iot.iot-xcwl.cn/',
// qqmapKey,
// xinzhiKey,
// }
// }
export default CONFIG[process.env.NODE_ENV]; export default CONFIG[process.env.NODE_ENV];

487
node_modules/.package-lock.json generated vendored

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{ {
"name": "@babel/helper-string-parser", "name": "@babel/helper-string-parser",
"version": "7.25.9", "version": "7.27.1",
"description": "A utility package to parse strings", "description": "A utility package to parse strings",
"repository": { "repository": {
"type": "git", "type": "git",

View File

@ -1,6 +1,6 @@
{ {
"name": "@babel/helper-validator-identifier", "name": "@babel/helper-validator-identifier",
"version": "7.25.9", "version": "7.27.1",
"description": "Validate identifier/keywords name", "description": "Validate identifier/keywords name",
"repository": { "repository": {
"type": "git", "type": "git",

View File

@ -1,5 +1,5 @@
#!/usr/bin/env node #!/usr/bin/env node
/* eslint no-var: 0 */ /* eslint-disable no-var, unicorn/prefer-node-protocol */
var parser = require(".."); var parser = require("..");
var fs = require("fs"); var fs = require("fs");

View File

@ -1,5 +0,0 @@
try {
module.exports = require("./lib/index.cjs");
} catch {
module.exports = require("./lib/index.js");
}

7470
node_modules/@babel/parser/lib/index.js generated vendored

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
{ {
"name": "@babel/parser", "name": "@babel/parser",
"version": "7.27.0", "version": "7.28.0",
"description": "A JavaScript parser", "description": "A JavaScript parser",
"author": "The Babel Team (https://babel.dev/team)", "author": "The Babel Team (https://babel.dev/team)",
"homepage": "https://babel.dev/docs/en/next/babel-parser", "homepage": "https://babel.dev/docs/en/next/babel-parser",
@ -35,14 +35,14 @@
}, },
"# dependencies": "This package doesn't actually have runtime dependencies. @babel/types is only needed for type definitions.", "# dependencies": "This package doesn't actually have runtime dependencies. @babel/types is only needed for type definitions.",
"dependencies": { "dependencies": {
"@babel/types": "^7.27.0" "@babel/types": "^7.28.0"
}, },
"devDependencies": { "devDependencies": {
"@babel/code-frame": "^7.26.2", "@babel/code-frame": "^7.27.1",
"@babel/helper-check-duplicate-nodes": "^7.25.9", "@babel/helper-check-duplicate-nodes": "^7.27.1",
"@babel/helper-fixtures": "^7.26.0", "@babel/helper-fixtures": "^7.28.0",
"@babel/helper-string-parser": "^7.25.9", "@babel/helper-string-parser": "^7.27.1",
"@babel/helper-validator-identifier": "^7.25.9", "@babel/helper-validator-identifier": "^7.27.1",
"charcodes": "^0.2.0" "charcodes": "^0.2.0"
}, },
"bin": "./bin/babel-parser.js", "bin": "./bin/babel-parser.js",

View File

@ -22,7 +22,7 @@ type Plugin$1 =
| "deprecatedImportAssert" | "deprecatedImportAssert"
| "doExpressions" | "doExpressions"
| IF_BABEL_7<"dynamicImport"> | IF_BABEL_7<"dynamicImport">
| "explicitResourceManagement" | IF_BABEL_7<"explicitResourceManagement">
| "exportDefaultFrom" | "exportDefaultFrom"
| IF_BABEL_7<"exportNamespaceFrom"> | IF_BABEL_7<"exportNamespaceFrom">
| "flow" | "flow"
@ -54,6 +54,7 @@ type Plugin$1 =
type ParserPluginWithOptions = type ParserPluginWithOptions =
| ["decorators", DecoratorsPluginOptions] | ["decorators", DecoratorsPluginOptions]
| ["discardBinding", { syntaxType: "void" }]
| ["estree", { classFeatures?: boolean }] | ["estree", { classFeatures?: boolean }]
| IF_BABEL_7<["importAttributes", { deprecatedAssertSyntax: boolean }]> | IF_BABEL_7<["importAttributes", { deprecatedAssertSyntax: boolean }]>
| IF_BABEL_7<["moduleAttributes", { version: "may-2020" }]> | IF_BABEL_7<["moduleAttributes", { version: "may-2020" }]>
@ -97,6 +98,7 @@ interface TypeScriptPluginOptions {
type Plugin = PluginConfig; type Plugin = PluginConfig;
type SourceType = "script" | "commonjs" | "module" | "unambiguous";
interface Options { interface Options {
/** /**
* By default, import and export declarations can only appear at a program's top level. * By default, import and export declarations can only appear at a program's top level.
@ -152,12 +154,14 @@ interface Options {
errorRecovery?: boolean; errorRecovery?: boolean;
/** /**
* Indicate the mode the code should be parsed in. * Indicate the mode the code should be parsed in.
* Can be one of "script", "module", or "unambiguous". Defaults to "script". * Can be one of "script", "commonjs", "module", or "unambiguous". Defaults to "script".
* "unambiguous" will make @babel/parser attempt to guess, based on the presence * "unambiguous" will make @babel/parser attempt to guess, based on the presence
* of ES6 import or export statements. * of ES6 import or export statements.
* Files with ES6 imports and exports are considered "module" and are otherwise "script". * Files with ES6 imports and exports are considered "module" and are otherwise "script".
*
* Use "commonjs" to parse code that is intended to be run in a CommonJS environment such as Node.js.
*/ */
sourceType?: "script" | "module" | "unambiguous"; sourceType?: SourceType;
/** /**
* Correlate output AST nodes with their source filename. * Correlate output AST nodes with their source filename.
* Useful when generating code and source maps from the ASTs of multiple input files. * Useful when generating code and source maps from the ASTs of multiple input files.

View File

@ -97,6 +97,7 @@ exports.assertForXStatement = assertForXStatement;
exports.assertFunction = assertFunction; exports.assertFunction = assertFunction;
exports.assertFunctionDeclaration = assertFunctionDeclaration; exports.assertFunctionDeclaration = assertFunctionDeclaration;
exports.assertFunctionExpression = assertFunctionExpression; exports.assertFunctionExpression = assertFunctionExpression;
exports.assertFunctionParameter = assertFunctionParameter;
exports.assertFunctionParent = assertFunctionParent; exports.assertFunctionParent = assertFunctionParent;
exports.assertFunctionTypeAnnotation = assertFunctionTypeAnnotation; exports.assertFunctionTypeAnnotation = assertFunctionTypeAnnotation;
exports.assertFunctionTypeParam = assertFunctionTypeParam; exports.assertFunctionTypeParam = assertFunctionTypeParam;
@ -304,6 +305,7 @@ exports.assertV8IntrinsicIdentifier = assertV8IntrinsicIdentifier;
exports.assertVariableDeclaration = assertVariableDeclaration; exports.assertVariableDeclaration = assertVariableDeclaration;
exports.assertVariableDeclarator = assertVariableDeclarator; exports.assertVariableDeclarator = assertVariableDeclarator;
exports.assertVariance = assertVariance; exports.assertVariance = assertVariance;
exports.assertVoidPattern = assertVoidPattern;
exports.assertVoidTypeAnnotation = assertVoidTypeAnnotation; exports.assertVoidTypeAnnotation = assertVoidTypeAnnotation;
exports.assertWhile = assertWhile; exports.assertWhile = assertWhile;
exports.assertWhileStatement = assertWhileStatement; exports.assertWhileStatement = assertWhileStatement;
@ -871,6 +873,9 @@ function assertPipelineBareFunction(node, opts) {
function assertPipelinePrimaryTopicReference(node, opts) { function assertPipelinePrimaryTopicReference(node, opts) {
assert("PipelinePrimaryTopicReference", node, opts); assert("PipelinePrimaryTopicReference", node, opts);
} }
function assertVoidPattern(node, opts) {
assert("VoidPattern", node, opts);
}
function assertTSParameterProperty(node, opts) { function assertTSParameterProperty(node, opts) {
assert("TSParameterProperty", node, opts); assert("TSParameterProperty", node, opts);
} }
@ -1129,6 +1134,9 @@ function assertPureish(node, opts) {
function assertDeclaration(node, opts) { function assertDeclaration(node, opts) {
assert("Declaration", node, opts); assert("Declaration", node, opts);
} }
function assertFunctionParameter(node, opts) {
assert("FunctionParameter", node, opts);
}
function assertPatternLike(node, opts) { function assertPatternLike(node, opts) {
assert("PatternLike", node, opts); assert("PatternLike", node, opts);
} }

File diff suppressed because one or more lines are too long

View File

@ -1,3 +1,3 @@
"use strict";
//# sourceMappingURL=index.js.map //# sourceMappingURL=index.js.map

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -255,6 +255,7 @@ exports.v8IntrinsicIdentifier = v8IntrinsicIdentifier;
exports.variableDeclaration = variableDeclaration; exports.variableDeclaration = variableDeclaration;
exports.variableDeclarator = variableDeclarator; exports.variableDeclarator = variableDeclarator;
exports.variance = variance; exports.variance = variance;
exports.voidPattern = voidPattern;
exports.voidTypeAnnotation = voidTypeAnnotation; exports.voidTypeAnnotation = voidTypeAnnotation;
exports.whileStatement = whileStatement; exports.whileStatement = whileStatement;
exports.withStatement = withStatement; exports.withStatement = withStatement;
@ -268,6 +269,18 @@ const {
const { const {
NODE_FIELDS NODE_FIELDS
} = utils; } = utils;
function bigIntLiteral(value) {
if (typeof value === "bigint") {
value = value.toString();
}
const node = {
type: "BigIntLiteral",
value
};
const defs = NODE_FIELDS.BigIntLiteral;
validate(defs.value, node, "value", value);
return node;
}
function arrayExpression(elements = []) { function arrayExpression(elements = []) {
const node = { const node = {
type: "ArrayExpression", type: "ArrayExpression",
@ -1127,15 +1140,6 @@ function _import() {
type: "Import" type: "Import"
}; };
} }
function bigIntLiteral(value) {
const node = {
type: "BigIntLiteral",
value
};
const defs = NODE_FIELDS.BigIntLiteral;
validate(defs.value, node, "value", value);
return node;
}
function exportNamespaceSpecifier(exported) { function exportNamespaceSpecifier(exported) {
const node = { const node = {
type: "ExportNamespaceSpecifier", type: "ExportNamespaceSpecifier",
@ -2211,6 +2215,11 @@ function pipelinePrimaryTopicReference() {
type: "PipelinePrimaryTopicReference" type: "PipelinePrimaryTopicReference"
}; };
} }
function voidPattern() {
return {
type: "VoidPattern"
};
}
function tsParameterProperty(parameter) { function tsParameterProperty(parameter) {
const node = { const node = {
type: "TSParameterProperty", type: "TSParameterProperty",
@ -2567,14 +2576,15 @@ function tsParenthesizedType(typeAnnotation) {
validate(defs.typeAnnotation, node, "typeAnnotation", typeAnnotation, 1); validate(defs.typeAnnotation, node, "typeAnnotation", typeAnnotation, 1);
return node; return node;
} }
function tsTypeOperator(typeAnnotation) { function tsTypeOperator(typeAnnotation, operator) {
const node = { const node = {
type: "TSTypeOperator", type: "TSTypeOperator",
typeAnnotation, typeAnnotation,
operator: null operator
}; };
const defs = NODE_FIELDS.TSTypeOperator; const defs = NODE_FIELDS.TSTypeOperator;
validate(defs.typeAnnotation, node, "typeAnnotation", typeAnnotation, 1); validate(defs.typeAnnotation, node, "typeAnnotation", typeAnnotation, 1);
validate(defs.operator, node, "operator", operator);
return node; return node;
} }
function tsIndexedAccessType(objectType, indexType) { function tsIndexedAccessType(objectType, indexType) {

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -3,7 +3,7 @@
Object.defineProperty(exports, "__esModule", { Object.defineProperty(exports, "__esModule", {
value: true value: true
}); });
exports.WHILE_TYPES = exports.USERWHITESPACABLE_TYPES = exports.UNARYLIKE_TYPES = exports.TYPESCRIPT_TYPES = exports.TSTYPE_TYPES = exports.TSTYPEELEMENT_TYPES = exports.TSENTITYNAME_TYPES = exports.TSBASETYPE_TYPES = exports.TERMINATORLESS_TYPES = exports.STATEMENT_TYPES = exports.STANDARDIZED_TYPES = exports.SCOPABLE_TYPES = exports.PUREISH_TYPES = exports.PROPERTY_TYPES = exports.PRIVATE_TYPES = exports.PATTERN_TYPES = exports.PATTERNLIKE_TYPES = exports.OBJECTMEMBER_TYPES = exports.MODULESPECIFIER_TYPES = exports.MODULEDECLARATION_TYPES = exports.MISCELLANEOUS_TYPES = exports.METHOD_TYPES = exports.LVAL_TYPES = exports.LOOP_TYPES = exports.LITERAL_TYPES = exports.JSX_TYPES = exports.IMPORTOREXPORTDECLARATION_TYPES = exports.IMMUTABLE_TYPES = exports.FUNCTION_TYPES = exports.FUNCTIONPARENT_TYPES = exports.FOR_TYPES = exports.FORXSTATEMENT_TYPES = exports.FLOW_TYPES = exports.FLOWTYPE_TYPES = exports.FLOWPREDICATE_TYPES = exports.FLOWDECLARATION_TYPES = exports.FLOWBASEANNOTATION_TYPES = exports.EXPRESSION_TYPES = exports.EXPRESSIONWRAPPER_TYPES = exports.EXPORTDECLARATION_TYPES = exports.ENUMMEMBER_TYPES = exports.ENUMBODY_TYPES = exports.DECLARATION_TYPES = exports.CONDITIONAL_TYPES = exports.COMPLETIONSTATEMENT_TYPES = exports.CLASS_TYPES = exports.BLOCK_TYPES = exports.BLOCKPARENT_TYPES = exports.BINARY_TYPES = exports.ACCESSOR_TYPES = void 0; exports.WHILE_TYPES = exports.USERWHITESPACABLE_TYPES = exports.UNARYLIKE_TYPES = exports.TYPESCRIPT_TYPES = exports.TSTYPE_TYPES = exports.TSTYPEELEMENT_TYPES = exports.TSENTITYNAME_TYPES = exports.TSBASETYPE_TYPES = exports.TERMINATORLESS_TYPES = exports.STATEMENT_TYPES = exports.STANDARDIZED_TYPES = exports.SCOPABLE_TYPES = exports.PUREISH_TYPES = exports.PROPERTY_TYPES = exports.PRIVATE_TYPES = exports.PATTERN_TYPES = exports.PATTERNLIKE_TYPES = exports.OBJECTMEMBER_TYPES = exports.MODULESPECIFIER_TYPES = exports.MODULEDECLARATION_TYPES = exports.MISCELLANEOUS_TYPES = exports.METHOD_TYPES = exports.LVAL_TYPES = exports.LOOP_TYPES = exports.LITERAL_TYPES = exports.JSX_TYPES = exports.IMPORTOREXPORTDECLARATION_TYPES = exports.IMMUTABLE_TYPES = exports.FUNCTION_TYPES = exports.FUNCTIONPARENT_TYPES = exports.FUNCTIONPARAMETER_TYPES = exports.FOR_TYPES = exports.FORXSTATEMENT_TYPES = exports.FLOW_TYPES = exports.FLOWTYPE_TYPES = exports.FLOWPREDICATE_TYPES = exports.FLOWDECLARATION_TYPES = exports.FLOWBASEANNOTATION_TYPES = exports.EXPRESSION_TYPES = exports.EXPRESSIONWRAPPER_TYPES = exports.EXPORTDECLARATION_TYPES = exports.ENUMMEMBER_TYPES = exports.ENUMBODY_TYPES = exports.DECLARATION_TYPES = exports.CONDITIONAL_TYPES = exports.COMPLETIONSTATEMENT_TYPES = exports.CLASS_TYPES = exports.BLOCK_TYPES = exports.BLOCKPARENT_TYPES = exports.BINARY_TYPES = exports.ACCESSOR_TYPES = void 0;
var _index = require("../../definitions/index.js"); var _index = require("../../definitions/index.js");
const STANDARDIZED_TYPES = exports.STANDARDIZED_TYPES = _index.FLIPPED_ALIAS_KEYS["Standardized"]; const STANDARDIZED_TYPES = exports.STANDARDIZED_TYPES = _index.FLIPPED_ALIAS_KEYS["Standardized"];
const EXPRESSION_TYPES = exports.EXPRESSION_TYPES = _index.FLIPPED_ALIAS_KEYS["Expression"]; const EXPRESSION_TYPES = exports.EXPRESSION_TYPES = _index.FLIPPED_ALIAS_KEYS["Expression"];
@ -24,6 +24,7 @@ const FUNCTION_TYPES = exports.FUNCTION_TYPES = _index.FLIPPED_ALIAS_KEYS["Funct
const FUNCTIONPARENT_TYPES = exports.FUNCTIONPARENT_TYPES = _index.FLIPPED_ALIAS_KEYS["FunctionParent"]; const FUNCTIONPARENT_TYPES = exports.FUNCTIONPARENT_TYPES = _index.FLIPPED_ALIAS_KEYS["FunctionParent"];
const PUREISH_TYPES = exports.PUREISH_TYPES = _index.FLIPPED_ALIAS_KEYS["Pureish"]; const PUREISH_TYPES = exports.PUREISH_TYPES = _index.FLIPPED_ALIAS_KEYS["Pureish"];
const DECLARATION_TYPES = exports.DECLARATION_TYPES = _index.FLIPPED_ALIAS_KEYS["Declaration"]; const DECLARATION_TYPES = exports.DECLARATION_TYPES = _index.FLIPPED_ALIAS_KEYS["Declaration"];
const FUNCTIONPARAMETER_TYPES = exports.FUNCTIONPARAMETER_TYPES = _index.FLIPPED_ALIAS_KEYS["FunctionParameter"];
const PATTERNLIKE_TYPES = exports.PATTERNLIKE_TYPES = _index.FLIPPED_ALIAS_KEYS["PatternLike"]; const PATTERNLIKE_TYPES = exports.PATTERNLIKE_TYPES = _index.FLIPPED_ALIAS_KEYS["PatternLike"];
const LVAL_TYPES = exports.LVAL_TYPES = _index.FLIPPED_ALIAS_KEYS["LVal"]; const LVAL_TYPES = exports.LVAL_TYPES = _index.FLIPPED_ALIAS_KEYS["LVal"];
const TSENTITYNAME_TYPES = exports.TSENTITYNAME_TYPES = _index.FLIPPED_ALIAS_KEYS["TSEntityName"]; const TSENTITYNAME_TYPES = exports.TSENTITYNAME_TYPES = _index.FLIPPED_ALIAS_KEYS["TSEntityName"];

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -15,6 +15,7 @@ function toExpression(node) {
} }
if ((0, _index.isClass)(node)) { if ((0, _index.isClass)(node)) {
node.type = "ClassExpression"; node.type = "ClassExpression";
node.abstract = false;
} else if ((0, _index.isFunction)(node)) { } else if ((0, _index.isFunction)(node)) {
node.type = "FunctionExpression"; node.type = "FunctionExpression";
} }

View File

@ -1 +1 @@
{"version":3,"names":["_index","require","_default","exports","default","toExpression","node","isExpressionStatement","expression","isExpression","isClass","type","isFunction","Error"],"sources":["../../src/converters/toExpression.ts"],"sourcesContent":["import {\n isExpression,\n isFunction,\n isClass,\n isExpressionStatement,\n} from \"../validators/generated/index.ts\";\nimport type * as t from \"../index.ts\";\n\nexport default toExpression as {\n (node: t.Function): t.FunctionExpression;\n (node: t.Class): t.ClassExpression;\n (\n node: t.ExpressionStatement | t.Expression | t.Class | t.Function,\n ): t.Expression;\n};\n\nfunction toExpression(\n node: t.ExpressionStatement | t.Expression | t.Class | t.Function,\n): t.Expression {\n if (isExpressionStatement(node)) {\n node = node.expression;\n }\n\n // return unmodified node\n // important for things like ArrowFunctions where\n // type change from ArrowFunction to FunctionExpression\n // produces bugs like -> `()=>a` to `function () a`\n // without generating a BlockStatement for it\n // ref: https://github.com/babel/babili/issues/130\n if (isExpression(node)) {\n return node;\n }\n\n // convert all classes and functions\n // ClassDeclaration -> ClassExpression\n // FunctionDeclaration, ObjectMethod, ClassMethod -> FunctionExpression\n if (isClass(node)) {\n // @ts-expect-error todo(flow->ts): avoid type unsafe mutations\n node.type = \"ClassExpression\";\n } else if (isFunction(node)) {\n // @ts-expect-error todo(flow->ts): avoid type unsafe mutations\n node.type = \"FunctionExpression\";\n }\n\n // if it's still not an expression\n if (!isExpression(node)) {\n throw new Error(`cannot turn ${node.type} to an expression`);\n }\n\n return node;\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAK0C,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAG3BC,YAAY;AAQ3B,SAASA,YAAYA,CACnBC,IAAiE,EACnD;EACd,IAAI,IAAAC,4BAAqB,EAACD,IAAI,CAAC,EAAE;IAC/BA,IAAI,GAAGA,IAAI,CAACE,UAAU;EACxB;EAQA,IAAI,IAAAC,mBAAY,EAACH,IAAI,CAAC,EAAE;IACtB,OAAOA,IAAI;EACb;EAKA,IAAI,IAAAI,cAAO,EAACJ,IAAI,CAAC,EAAE;IAEjBA,IAAI,CAACK,IAAI,GAAG,iBAAiB;EAC/B,CAAC,MAAM,IAAI,IAAAC,iBAAU,EAACN,IAAI,CAAC,EAAE;IAE3BA,IAAI,CAACK,IAAI,GAAG,oBAAoB;EAClC;EAGA,IAAI,CAAC,IAAAF,mBAAY,EAACH,IAAI,CAAC,EAAE;IACvB,MAAM,IAAIO,KAAK,CAAC,eAAeP,IAAI,CAACK,IAAI,mBAAmB,CAAC;EAC9D;EAEA,OAAOL,IAAI;AACb","ignoreList":[]} {"version":3,"names":["_index","require","_default","exports","default","toExpression","node","isExpressionStatement","expression","isExpression","isClass","type","abstract","isFunction","Error"],"sources":["../../src/converters/toExpression.ts"],"sourcesContent":["import {\n isExpression,\n isFunction,\n isClass,\n isExpressionStatement,\n} from \"../validators/generated/index.ts\";\nimport type * as t from \"../index.ts\";\n\nexport default toExpression as {\n (node: t.Function): t.FunctionExpression;\n (node: t.Class): t.ClassExpression;\n (\n node: t.ExpressionStatement | t.Expression | t.Class | t.Function,\n ): t.Expression;\n};\n\nfunction toExpression(\n node: t.ExpressionStatement | t.Expression | t.Class | t.Function,\n): t.Expression {\n if (isExpressionStatement(node)) {\n node = node.expression;\n }\n\n // return unmodified node\n // important for things like ArrowFunctions where\n // type change from ArrowFunction to FunctionExpression\n // produces bugs like -> `()=>a` to `function () a`\n // without generating a BlockStatement for it\n // ref: https://github.com/babel/babili/issues/130\n if (isExpression(node)) {\n return node;\n }\n\n // convert all classes and functions\n // ClassDeclaration -> ClassExpression\n // FunctionDeclaration, ObjectMethod, ClassMethod -> FunctionExpression\n if (isClass(node)) {\n // @ts-expect-error todo(flow->ts): avoid type unsafe mutations\n node.type = \"ClassExpression\";\n // abstract modifiers are only allowed on class declarations\n node.abstract = false;\n } else if (isFunction(node)) {\n // @ts-expect-error todo(flow->ts): avoid type unsafe mutations\n node.type = \"FunctionExpression\";\n }\n\n // if it's still not an expression\n if (!isExpression(node)) {\n throw new Error(`cannot turn ${node.type} to an expression`);\n }\n\n return node;\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAK0C,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAG3BC,YAAY;AAQ3B,SAASA,YAAYA,CACnBC,IAAiE,EACnD;EACd,IAAI,IAAAC,4BAAqB,EAACD,IAAI,CAAC,EAAE;IAC/BA,IAAI,GAAGA,IAAI,CAACE,UAAU;EACxB;EAQA,IAAI,IAAAC,mBAAY,EAACH,IAAI,CAAC,EAAE;IACtB,OAAOA,IAAI;EACb;EAKA,IAAI,IAAAI,cAAO,EAACJ,IAAI,CAAC,EAAE;IAEjBA,IAAI,CAACK,IAAI,GAAG,iBAAiB;IAE7BL,IAAI,CAACM,QAAQ,GAAG,KAAK;EACvB,CAAC,MAAM,IAAI,IAAAC,iBAAU,EAACP,IAAI,CAAC,EAAE;IAE3BA,IAAI,CAACK,IAAI,GAAG,oBAAoB;EAClC;EAGA,IAAI,CAAC,IAAAF,mBAAY,EAACH,IAAI,CAAC,EAAE;IACvB,MAAM,IAAIQ,KAAK,CAAC,eAAeR,IAAI,CAACK,IAAI,mBAAmB,CAAC;EAC9D;EAEA,OAAOL,IAAI;AACb","ignoreList":[]}

View File

@ -50,7 +50,11 @@ function valueToNode(value) {
return result; return result;
} }
if (typeof value === "bigint") { if (typeof value === "bigint") {
return (0, _index.bigIntLiteral)(value.toString()); if (value < 0) {
return (0, _index.unaryExpression)("-", (0, _index.bigIntLiteral)(-value));
} else {
return (0, _index.bigIntLiteral)(value);
}
} }
if (isRegExp(value)) { if (isRegExp(value)) {
const pattern = value.source; const pattern = value.source;

File diff suppressed because one or more lines are too long

View File

@ -32,11 +32,11 @@ defineType("AssignmentExpression", {
validator(node, key, val); validator(node, key, val);
}; };
}(), { }(), {
type: "string" oneOf: _index.ASSIGNMENT_OPERATORS
}) })
}, },
left: { left: {
validate: !process.env.BABEL_TYPES_8_BREAKING ? (0, _utils.assertNodeType)("LVal", "OptionalMemberExpression") : (0, _utils.assertNodeType)("Identifier", "MemberExpression", "OptionalMemberExpression", "ArrayPattern", "ObjectPattern", "TSAsExpression", "TSSatisfiesExpression", "TSTypeAssertion", "TSNonNullExpression") validate: !process.env.BABEL_TYPES_8_BREAKING ? (0, _utils.assertNodeType)("LVal") : (0, _utils.assertNodeType)("Identifier", "MemberExpression", "OptionalMemberExpression", "ArrayPattern", "ObjectPattern", "TSAsExpression", "TSSatisfiesExpression", "TSTypeAssertion", "TSNonNullExpression")
}, },
right: { right: {
validate: (0, _utils.assertNodeType)("Expression") validate: (0, _utils.assertNodeType)("Expression")
@ -119,7 +119,7 @@ defineType("BreakStatement", {
aliases: ["Statement", "Terminatorless", "CompletionStatement"] aliases: ["Statement", "Terminatorless", "CompletionStatement"]
}); });
defineType("CallExpression", { defineType("CallExpression", {
visitor: ["callee", "arguments", "typeParameters", "typeArguments"], visitor: ["callee", "typeParameters", "typeArguments", "arguments"],
builder: ["callee", "arguments"], builder: ["callee", "arguments"],
aliases: ["Expression"], aliases: ["Expression"],
fields: Object.assign({ fields: Object.assign({
@ -131,7 +131,7 @@ defineType("CallExpression", {
validate: (0, _utils.assertNodeType)("TypeParameterInstantiation"), validate: (0, _utils.assertNodeType)("TypeParameterInstantiation"),
optional: true optional: true
} }
}, { }, process.env.BABEL_TYPES_8_BREAKING ? {} : {
optional: { optional: {
validate: (0, _utils.assertValueType)("boolean"), validate: (0, _utils.assertValueType)("boolean"),
optional: true optional: true
@ -140,11 +140,6 @@ defineType("CallExpression", {
validate: (0, _utils.assertNodeType)("TSTypeParameterInstantiation"), validate: (0, _utils.assertNodeType)("TSTypeParameterInstantiation"),
optional: true optional: true
} }
}, process.env.BABEL_TYPES_8_BREAKING ? {} : {
optional: {
validate: (0, _utils.assertValueType)("boolean"),
optional: true
}
}) })
}); });
defineType("CatchClause", { defineType("CatchClause", {
@ -273,7 +268,7 @@ defineType("ForStatement", {
} }
}); });
const functionCommon = () => ({ const functionCommon = () => ({
params: (0, _utils.validateArrayOfType)("Identifier", "Pattern", "RestElement"), params: (0, _utils.validateArrayOfType)("FunctionParameter"),
generator: { generator: {
default: false default: false
}, },
@ -361,7 +356,7 @@ exports.patternLikeCommon = patternLikeCommon;
defineType("Identifier", { defineType("Identifier", {
builder: ["name"], builder: ["name"],
visitor: ["typeAnnotation", "decorators"], visitor: ["typeAnnotation", "decorators"],
aliases: ["Expression", "PatternLike", "LVal", "TSEntityName"], aliases: ["Expression", "FunctionParameter", "PatternLike", "LVal", "TSEntityName"],
fields: Object.assign({}, patternLikeCommon(), { fields: Object.assign({}, patternLikeCommon(), {
name: { name: {
validate: process.env.BABEL_TYPES_8_BREAKING ? (0, _utils.chain)((0, _utils.assertValueType)("string"), Object.assign(function (node, key, val) { validate: process.env.BABEL_TYPES_8_BREAKING ? (0, _utils.chain)((0, _utils.assertValueType)("string"), Object.assign(function (node, key, val) {
@ -508,7 +503,7 @@ defineType("LogicalExpression", {
defineType("MemberExpression", { defineType("MemberExpression", {
builder: ["object", "property", "computed", ...(!process.env.BABEL_TYPES_8_BREAKING ? ["optional"] : [])], builder: ["object", "property", "computed", ...(!process.env.BABEL_TYPES_8_BREAKING ? ["optional"] : [])],
visitor: ["object", "property"], visitor: ["object", "property"],
aliases: ["Expression", "LVal"], aliases: ["Expression", "LVal", "PatternLike"],
fields: Object.assign({ fields: Object.assign({
object: { object: {
validate: (0, _utils.assertNodeType)("Expression", "Super") validate: (0, _utils.assertNodeType)("Expression", "Super")
@ -641,7 +636,7 @@ defineType("ObjectProperty", {
optional: true optional: true
} }
}, },
visitor: ["key", "value", "decorators"], visitor: ["decorators", "key", "value"],
aliases: ["UserWhitespacable", "Property", "ObjectMember"], aliases: ["UserWhitespacable", "Property", "ObjectMember"],
validate: !process.env.BABEL_TYPES_8_BREAKING ? undefined : function () { validate: !process.env.BABEL_TYPES_8_BREAKING ? undefined : function () {
const pattern = (0, _utils.assertNodeType)("Identifier", "Pattern", "TSAsExpression", "TSSatisfiesExpression", "TSNonNullExpression", "TSTypeAssertion"); const pattern = (0, _utils.assertNodeType)("Identifier", "Pattern", "TSAsExpression", "TSSatisfiesExpression", "TSNonNullExpression", "TSTypeAssertion");
@ -655,11 +650,11 @@ defineType("ObjectProperty", {
defineType("RestElement", { defineType("RestElement", {
visitor: ["argument", "typeAnnotation"], visitor: ["argument", "typeAnnotation"],
builder: ["argument"], builder: ["argument"],
aliases: ["LVal", "PatternLike"], aliases: ["FunctionParameter", "PatternLike", "LVal"],
deprecatedAlias: "RestProperty", deprecatedAlias: "RestProperty",
fields: Object.assign({}, patternLikeCommon(), { fields: Object.assign({}, patternLikeCommon(), {
argument: { argument: {
validate: !process.env.BABEL_TYPES_8_BREAKING ? (0, _utils.assertNodeType)("LVal") : (0, _utils.assertNodeType)("Identifier", "ArrayPattern", "ObjectPattern", "MemberExpression", "TSAsExpression", "TSSatisfiesExpression", "TSTypeAssertion", "TSNonNullExpression") validate: !process.env.BABEL_TYPES_8_BREAKING ? (0, _utils.assertNodeType)("Identifier", "ArrayPattern", "ObjectPattern", "MemberExpression", "TSAsExpression", "TSSatisfiesExpression", "TSTypeAssertion", "TSNonNullExpression", "RestElement", "AssignmentPattern") : (0, _utils.assertNodeType)("Identifier", "ArrayPattern", "ObjectPattern", "MemberExpression", "TSAsExpression", "TSSatisfiesExpression", "TSTypeAssertion", "TSNonNullExpression")
} }
}), }),
validate: process.env.BABEL_TYPES_8_BREAKING ? function (parent, key) { validate: process.env.BABEL_TYPES_8_BREAKING ? function (parent, key) {
@ -799,18 +794,32 @@ defineType("VariableDeclaration", {
declarations: (0, _utils.validateArrayOfType)("VariableDeclarator") declarations: (0, _utils.validateArrayOfType)("VariableDeclarator")
}, },
validate: process.env.BABEL_TYPES_8_BREAKING ? (() => { validate: process.env.BABEL_TYPES_8_BREAKING ? (() => {
const withoutInit = (0, _utils.assertNodeType)("Identifier"); const withoutInit = (0, _utils.assertNodeType)("Identifier", "Placeholder");
const constOrLetOrVar = (0, _utils.assertNodeType)("Identifier", "ArrayPattern", "ObjectPattern", "Placeholder");
const usingOrAwaitUsing = (0, _utils.assertNodeType)("Identifier", "VoidPattern", "Placeholder");
return function (parent, key, node) { return function (parent, key, node) {
if ((0, _is.default)("ForXStatement", parent, { const {
kind,
declarations
} = node;
const parentIsForX = (0, _is.default)("ForXStatement", parent, {
left: node left: node
})) { });
if (node.declarations.length !== 1) { if (parentIsForX) {
if (declarations.length !== 1) {
throw new TypeError(`Exactly one VariableDeclarator is required in the VariableDeclaration of a ${parent.type}`); throw new TypeError(`Exactly one VariableDeclarator is required in the VariableDeclaration of a ${parent.type}`);
} }
} else { }
node.declarations.forEach(decl => { for (const decl of declarations) {
if (!decl.init) withoutInit(decl, "id", decl.id); if (kind === "const" || kind === "let" || kind === "var") {
}); if (!parentIsForX && !decl.init) {
withoutInit(decl, "id", decl.id);
} else {
constOrLetOrVar(decl, "id", decl.id);
}
} else {
usingOrAwaitUsing(decl, "id", decl.id);
}
} }
}; };
})() : undefined })() : undefined
@ -819,7 +828,7 @@ defineType("VariableDeclarator", {
visitor: ["id", "init"], visitor: ["id", "init"],
fields: { fields: {
id: { id: {
validate: !process.env.BABEL_TYPES_8_BREAKING ? (0, _utils.assertNodeType)("LVal") : (0, _utils.assertNodeType)("Identifier", "ArrayPattern", "ObjectPattern") validate: !process.env.BABEL_TYPES_8_BREAKING ? (0, _utils.assertNodeType)("LVal", "VoidPattern") : (0, _utils.assertNodeType)("Identifier", "ArrayPattern", "ObjectPattern", "VoidPattern")
}, },
definite: { definite: {
optional: true, optional: true,
@ -858,7 +867,7 @@ defineType("WithStatement", {
defineType("AssignmentPattern", { defineType("AssignmentPattern", {
visitor: ["left", "right", "decorators"], visitor: ["left", "right", "decorators"],
builder: ["left", "right"], builder: ["left", "right"],
aliases: ["Pattern", "PatternLike", "LVal"], aliases: ["FunctionParameter", "Pattern", "PatternLike", "LVal"],
fields: Object.assign({}, patternLikeCommon(), { fields: Object.assign({}, patternLikeCommon(), {
left: { left: {
validate: (0, _utils.assertNodeType)("Identifier", "ObjectPattern", "ArrayPattern", "MemberExpression", "TSAsExpression", "TSSatisfiesExpression", "TSTypeAssertion", "TSNonNullExpression") validate: (0, _utils.assertNodeType)("Identifier", "ObjectPattern", "ArrayPattern", "MemberExpression", "TSAsExpression", "TSSatisfiesExpression", "TSTypeAssertion", "TSNonNullExpression")
@ -875,10 +884,10 @@ defineType("AssignmentPattern", {
defineType("ArrayPattern", { defineType("ArrayPattern", {
visitor: ["elements", "typeAnnotation"], visitor: ["elements", "typeAnnotation"],
builder: ["elements"], builder: ["elements"],
aliases: ["Pattern", "PatternLike", "LVal"], aliases: ["FunctionParameter", "Pattern", "PatternLike", "LVal"],
fields: Object.assign({}, patternLikeCommon(), { fields: Object.assign({}, patternLikeCommon(), {
elements: { elements: {
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeOrValueType)("null", "PatternLike", "LVal"))) validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeOrValueType)("null", "PatternLike")))
} }
}) })
}); });
@ -1028,7 +1037,7 @@ defineType("ExportDefaultDeclaration", {
}); });
defineType("ExportNamedDeclaration", { defineType("ExportNamedDeclaration", {
builder: ["declaration", "specifiers", "source"], builder: ["declaration", "specifiers", "source"],
visitor: process.env ? ["declaration", "specifiers", "source", "attributes"] : ["declaration", "specifiers", "source", "attributes", "assertions"], visitor: ["declaration", "specifiers", "source", "attributes", "assertions"],
aliases: ["Statement", "Declaration", "ImportOrExportDeclaration", "ExportDeclaration"], aliases: ["Statement", "Declaration", "ImportOrExportDeclaration", "ExportDeclaration"],
fields: Object.assign({ fields: Object.assign({
declaration: { declaration: {
@ -1258,7 +1267,7 @@ const classMethodOrPropertyCommon = () => ({
}); });
exports.classMethodOrPropertyCommon = classMethodOrPropertyCommon; exports.classMethodOrPropertyCommon = classMethodOrPropertyCommon;
const classMethodOrDeclareMethodCommon = () => Object.assign({}, functionCommon(), classMethodOrPropertyCommon(), { const classMethodOrDeclareMethodCommon = () => Object.assign({}, functionCommon(), classMethodOrPropertyCommon(), {
params: (0, _utils.validateArrayOfType)("Identifier", "Pattern", "RestElement", "TSParameterProperty"), params: (0, _utils.validateArrayOfType)("FunctionParameter", "TSParameterProperty"),
kind: { kind: {
validate: (0, _utils.assertOneOf)("get", "set", "method", "constructor"), validate: (0, _utils.assertOneOf)("get", "set", "method", "constructor"),
default: "method" default: "method"
@ -1284,9 +1293,9 @@ defineType("ClassMethod", {
}) })
}); });
defineType("ObjectPattern", { defineType("ObjectPattern", {
visitor: ["properties", "typeAnnotation", "decorators"], visitor: ["decorators", "properties", "typeAnnotation"],
builder: ["properties"], builder: ["properties"],
aliases: ["Pattern", "PatternLike", "LVal"], aliases: ["FunctionParameter", "Pattern", "PatternLike", "LVal"],
fields: Object.assign({}, patternLikeCommon(), { fields: Object.assign({}, patternLikeCommon(), {
properties: (0, _utils.validateArrayOfType)("RestElement", "ObjectProperty") properties: (0, _utils.validateArrayOfType)("RestElement", "ObjectProperty")
}) })
@ -1431,7 +1440,7 @@ defineType("ExportNamespaceSpecifier", {
defineType("OptionalMemberExpression", { defineType("OptionalMemberExpression", {
builder: ["object", "property", "computed", "optional"], builder: ["object", "property", "computed", "optional"],
visitor: ["object", "property"], visitor: ["object", "property"],
aliases: ["Expression"], aliases: ["Expression", "LVal"],
fields: { fields: {
object: { object: {
validate: (0, _utils.assertNodeType)("Expression") validate: (0, _utils.assertNodeType)("Expression")
@ -1458,7 +1467,7 @@ defineType("OptionalMemberExpression", {
} }
}); });
defineType("OptionalCallExpression", { defineType("OptionalCallExpression", {
visitor: ["callee", "arguments", "typeParameters", "typeArguments"], visitor: ["callee", "typeParameters", "typeArguments", "arguments"],
builder: ["callee", "arguments", "optional"], builder: ["callee", "arguments", "optional"],
aliases: ["Expression"], aliases: ["Expression"],
fields: Object.assign({ fields: Object.assign({

File diff suppressed because one or more lines are too long

View File

@ -119,5 +119,8 @@ var _utils = require("./utils.js");
(0, _utils.default)("PipelinePrimaryTopicReference", { (0, _utils.default)("PipelinePrimaryTopicReference", {
aliases: ["Expression"] aliases: ["Expression"]
}); });
(0, _utils.default)("VoidPattern", {
aliases: ["Pattern", "PatternLike", "FunctionParameter"]
});
//# sourceMappingURL=experimental.js.map //# sourceMappingURL=experimental.js.map

File diff suppressed because one or more lines are too long

View File

@ -241,8 +241,11 @@ defineType("TSParenthesizedType", {
defineType("TSTypeOperator", { defineType("TSTypeOperator", {
aliases: ["TSType"], aliases: ["TSType"],
visitor: ["typeAnnotation"], visitor: ["typeAnnotation"],
builder: ["typeAnnotation", "operator"],
fields: { fields: {
operator: (0, _utils.validate)((0, _utils.assertValueType)("string")), operator: {
validate: (0, _utils.assertValueType)("string")
},
typeAnnotation: (0, _utils.validateType)("TSType") typeAnnotation: (0, _utils.validateType)("TSType")
} }
}); });
@ -425,7 +428,7 @@ defineType("TSImportType", {
qualifier: (0, _utils.validateOptionalType)("TSEntityName"), qualifier: (0, _utils.validateOptionalType)("TSEntityName"),
["typeParameters"]: (0, _utils.validateOptionalType)("TSTypeParameterInstantiation"), ["typeParameters"]: (0, _utils.validateOptionalType)("TSTypeParameterInstantiation"),
options: { options: {
validate: (0, _utils.assertNodeType)("Expression"), validate: (0, _utils.assertNodeType)("ObjectExpression"),
optional: true optional: true
} }
} }

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -46,7 +46,7 @@ declare class BabelNodeArrayExpression extends BabelNode {
declare class BabelNodeAssignmentExpression extends BabelNode { declare class BabelNodeAssignmentExpression extends BabelNode {
type: "AssignmentExpression"; type: "AssignmentExpression";
operator: string; operator: string;
left: BabelNodeLVal | BabelNodeOptionalMemberExpression; left: BabelNodeLVal;
right: BabelNodeExpression; right: BabelNodeExpression;
} }
@ -154,7 +154,7 @@ declare class BabelNodeForStatement extends BabelNode {
declare class BabelNodeFunctionDeclaration extends BabelNode { declare class BabelNodeFunctionDeclaration extends BabelNode {
type: "FunctionDeclaration"; type: "FunctionDeclaration";
id?: BabelNodeIdentifier; id?: BabelNodeIdentifier;
params: Array<BabelNodeIdentifier | BabelNodePattern | BabelNodeRestElement>; params: Array<BabelNodeFunctionParameter>;
body: BabelNodeBlockStatement; body: BabelNodeBlockStatement;
generator?: boolean; generator?: boolean;
async?: boolean; async?: boolean;
@ -167,7 +167,7 @@ declare class BabelNodeFunctionDeclaration extends BabelNode {
declare class BabelNodeFunctionExpression extends BabelNode { declare class BabelNodeFunctionExpression extends BabelNode {
type: "FunctionExpression"; type: "FunctionExpression";
id?: BabelNodeIdentifier; id?: BabelNodeIdentifier;
params: Array<BabelNodeIdentifier | BabelNodePattern | BabelNodeRestElement>; params: Array<BabelNodeFunctionParameter>;
body: BabelNodeBlockStatement; body: BabelNodeBlockStatement;
generator?: boolean; generator?: boolean;
async?: boolean; async?: boolean;
@ -263,7 +263,7 @@ declare class BabelNodeObjectMethod extends BabelNode {
type: "ObjectMethod"; type: "ObjectMethod";
kind?: "method" | "get" | "set"; kind?: "method" | "get" | "set";
key: BabelNodeExpression | BabelNodeIdentifier | BabelNodeStringLiteral | BabelNodeNumericLiteral | BabelNodeBigIntLiteral; key: BabelNodeExpression | BabelNodeIdentifier | BabelNodeStringLiteral | BabelNodeNumericLiteral | BabelNodeBigIntLiteral;
params: Array<BabelNodeIdentifier | BabelNodePattern | BabelNodeRestElement>; params: Array<BabelNodeFunctionParameter>;
body: BabelNodeBlockStatement; body: BabelNodeBlockStatement;
computed?: boolean; computed?: boolean;
generator?: boolean; generator?: boolean;
@ -284,7 +284,7 @@ declare class BabelNodeObjectProperty extends BabelNode {
declare class BabelNodeRestElement extends BabelNode { declare class BabelNodeRestElement extends BabelNode {
type: "RestElement"; type: "RestElement";
argument: BabelNodeLVal; argument: BabelNodeIdentifier | BabelNodeArrayPattern | BabelNodeObjectPattern | BabelNodeMemberExpression | BabelNodeTSAsExpression | BabelNodeTSSatisfiesExpression | BabelNodeTSTypeAssertion | BabelNodeTSNonNullExpression | BabelNodeRestElement | BabelNodeAssignmentPattern;
decorators?: Array<BabelNodeDecorator>; decorators?: Array<BabelNodeDecorator>;
optional?: boolean; optional?: boolean;
typeAnnotation?: BabelNodeTypeAnnotation | BabelNodeTSTypeAnnotation | BabelNodeNoop; typeAnnotation?: BabelNodeTypeAnnotation | BabelNodeTSTypeAnnotation | BabelNodeNoop;
@ -356,7 +356,7 @@ declare class BabelNodeVariableDeclaration extends BabelNode {
declare class BabelNodeVariableDeclarator extends BabelNode { declare class BabelNodeVariableDeclarator extends BabelNode {
type: "VariableDeclarator"; type: "VariableDeclarator";
id: BabelNodeLVal; id: BabelNodeLVal | BabelNodeVoidPattern;
init?: BabelNodeExpression; init?: BabelNodeExpression;
definite?: boolean; definite?: boolean;
} }
@ -384,7 +384,7 @@ declare class BabelNodeAssignmentPattern extends BabelNode {
declare class BabelNodeArrayPattern extends BabelNode { declare class BabelNodeArrayPattern extends BabelNode {
type: "ArrayPattern"; type: "ArrayPattern";
elements: Array<null | BabelNodePatternLike | BabelNodeLVal>; elements: Array<null | BabelNodePatternLike>;
decorators?: Array<BabelNodeDecorator>; decorators?: Array<BabelNodeDecorator>;
optional?: boolean; optional?: boolean;
typeAnnotation?: BabelNodeTypeAnnotation | BabelNodeTSTypeAnnotation | BabelNodeNoop; typeAnnotation?: BabelNodeTypeAnnotation | BabelNodeTSTypeAnnotation | BabelNodeNoop;
@ -392,7 +392,7 @@ declare class BabelNodeArrayPattern extends BabelNode {
declare class BabelNodeArrowFunctionExpression extends BabelNode { declare class BabelNodeArrowFunctionExpression extends BabelNode {
type: "ArrowFunctionExpression"; type: "ArrowFunctionExpression";
params: Array<BabelNodeIdentifier | BabelNodePattern | BabelNodeRestElement>; params: Array<BabelNodeFunctionParameter>;
body: BabelNodeBlockStatement | BabelNodeExpression; body: BabelNodeBlockStatement | BabelNodeExpression;
async?: boolean; async?: boolean;
expression: boolean; expression: boolean;
@ -514,7 +514,7 @@ declare class BabelNodeClassMethod extends BabelNode {
type: "ClassMethod"; type: "ClassMethod";
kind?: "get" | "set" | "method" | "constructor"; kind?: "get" | "set" | "method" | "constructor";
key: BabelNodeIdentifier | BabelNodeStringLiteral | BabelNodeNumericLiteral | BabelNodeBigIntLiteral | BabelNodeExpression; key: BabelNodeIdentifier | BabelNodeStringLiteral | BabelNodeNumericLiteral | BabelNodeBigIntLiteral | BabelNodeExpression;
params: Array<BabelNodeIdentifier | BabelNodePattern | BabelNodeRestElement | BabelNodeTSParameterProperty>; params: Array<BabelNodeFunctionParameter | BabelNodeTSParameterProperty>;
body: BabelNodeBlockStatement; body: BabelNodeBlockStatement;
computed?: boolean; computed?: boolean;
generator?: boolean; generator?: boolean;
@ -657,7 +657,7 @@ declare class BabelNodeClassPrivateMethod extends BabelNode {
type: "ClassPrivateMethod"; type: "ClassPrivateMethod";
kind?: "get" | "set" | "method"; kind?: "get" | "set" | "method";
key: BabelNodePrivateName; key: BabelNodePrivateName;
params: Array<BabelNodeIdentifier | BabelNodePattern | BabelNodeRestElement | BabelNodeTSParameterProperty>; params: Array<BabelNodeFunctionParameter | BabelNodeTSParameterProperty>;
body: BabelNodeBlockStatement; body: BabelNodeBlockStatement;
abstract?: boolean; abstract?: boolean;
access?: "public" | "private" | "protected"; access?: "public" | "private" | "protected";
@ -1237,6 +1237,10 @@ declare class BabelNodePipelinePrimaryTopicReference extends BabelNode {
type: "PipelinePrimaryTopicReference"; type: "PipelinePrimaryTopicReference";
} }
declare class BabelNodeVoidPattern extends BabelNode {
type: "VoidPattern";
}
declare class BabelNodeTSParameterProperty extends BabelNode { declare class BabelNodeTSParameterProperty extends BabelNode {
type: "TSParameterProperty"; type: "TSParameterProperty";
parameter: BabelNodeIdentifier | BabelNodeAssignmentPattern; parameter: BabelNodeIdentifier | BabelNodeAssignmentPattern;
@ -1250,7 +1254,7 @@ declare class BabelNodeTSDeclareFunction extends BabelNode {
type: "TSDeclareFunction"; type: "TSDeclareFunction";
id?: BabelNodeIdentifier; id?: BabelNodeIdentifier;
typeParameters?: BabelNodeTSTypeParameterDeclaration | BabelNodeNoop; typeParameters?: BabelNodeTSTypeParameterDeclaration | BabelNodeNoop;
params: Array<BabelNodeIdentifier | BabelNodePattern | BabelNodeRestElement>; params: Array<BabelNodeFunctionParameter>;
returnType?: BabelNodeTSTypeAnnotation | BabelNodeNoop; returnType?: BabelNodeTSTypeAnnotation | BabelNodeNoop;
async?: boolean; async?: boolean;
declare?: boolean; declare?: boolean;
@ -1262,7 +1266,7 @@ declare class BabelNodeTSDeclareMethod extends BabelNode {
decorators?: Array<BabelNodeDecorator>; decorators?: Array<BabelNodeDecorator>;
key: BabelNodeIdentifier | BabelNodeStringLiteral | BabelNodeNumericLiteral | BabelNodeBigIntLiteral | BabelNodeExpression; key: BabelNodeIdentifier | BabelNodeStringLiteral | BabelNodeNumericLiteral | BabelNodeBigIntLiteral | BabelNodeExpression;
typeParameters?: BabelNodeTSTypeParameterDeclaration | BabelNodeNoop; typeParameters?: BabelNodeTSTypeParameterDeclaration | BabelNodeNoop;
params: Array<BabelNodeIdentifier | BabelNodePattern | BabelNodeRestElement | BabelNodeTSParameterProperty>; params: Array<BabelNodeFunctionParameter | BabelNodeTSParameterProperty>;
returnType?: BabelNodeTSTypeAnnotation | BabelNodeNoop; returnType?: BabelNodeTSTypeAnnotation | BabelNodeNoop;
abstract?: boolean; abstract?: boolean;
access?: "public" | "private" | "protected"; access?: "public" | "private" | "protected";
@ -1595,7 +1599,7 @@ declare class BabelNodeTSImportType extends BabelNode {
argument: BabelNodeStringLiteral; argument: BabelNodeStringLiteral;
qualifier?: BabelNodeTSEntityName; qualifier?: BabelNodeTSEntityName;
typeParameters?: BabelNodeTSTypeParameterInstantiation; typeParameters?: BabelNodeTSTypeParameterInstantiation;
options?: BabelNodeExpression; options?: BabelNodeObjectExpression;
} }
declare class BabelNodeTSImportEqualsDeclaration extends BabelNode { declare class BabelNodeTSImportEqualsDeclaration extends BabelNode {
@ -1667,8 +1671,9 @@ type BabelNodeFunction = BabelNodeFunctionDeclaration | BabelNodeFunctionExpress
type BabelNodeFunctionParent = BabelNodeFunctionDeclaration | BabelNodeFunctionExpression | BabelNodeObjectMethod | BabelNodeArrowFunctionExpression | BabelNodeClassMethod | BabelNodeClassPrivateMethod | BabelNodeStaticBlock | BabelNodeTSModuleBlock; type BabelNodeFunctionParent = BabelNodeFunctionDeclaration | BabelNodeFunctionExpression | BabelNodeObjectMethod | BabelNodeArrowFunctionExpression | BabelNodeClassMethod | BabelNodeClassPrivateMethod | BabelNodeStaticBlock | BabelNodeTSModuleBlock;
type BabelNodePureish = BabelNodeFunctionDeclaration | BabelNodeFunctionExpression | BabelNodeStringLiteral | BabelNodeNumericLiteral | BabelNodeNullLiteral | BabelNodeBooleanLiteral | BabelNodeRegExpLiteral | BabelNodeArrowFunctionExpression | BabelNodeBigIntLiteral | BabelNodeDecimalLiteral; type BabelNodePureish = BabelNodeFunctionDeclaration | BabelNodeFunctionExpression | BabelNodeStringLiteral | BabelNodeNumericLiteral | BabelNodeNullLiteral | BabelNodeBooleanLiteral | BabelNodeRegExpLiteral | BabelNodeArrowFunctionExpression | BabelNodeBigIntLiteral | BabelNodeDecimalLiteral;
type BabelNodeDeclaration = BabelNodeFunctionDeclaration | BabelNodeVariableDeclaration | BabelNodeClassDeclaration | BabelNodeExportAllDeclaration | BabelNodeExportDefaultDeclaration | BabelNodeExportNamedDeclaration | BabelNodeImportDeclaration | BabelNodeDeclareClass | BabelNodeDeclareFunction | BabelNodeDeclareInterface | BabelNodeDeclareModule | BabelNodeDeclareModuleExports | BabelNodeDeclareTypeAlias | BabelNodeDeclareOpaqueType | BabelNodeDeclareVariable | BabelNodeDeclareExportDeclaration | BabelNodeDeclareExportAllDeclaration | BabelNodeInterfaceDeclaration | BabelNodeOpaqueType | BabelNodeTypeAlias | BabelNodeEnumDeclaration | BabelNodeTSDeclareFunction | BabelNodeTSInterfaceDeclaration | BabelNodeTSTypeAliasDeclaration | BabelNodeTSEnumDeclaration | BabelNodeTSModuleDeclaration | BabelNodeTSImportEqualsDeclaration; type BabelNodeDeclaration = BabelNodeFunctionDeclaration | BabelNodeVariableDeclaration | BabelNodeClassDeclaration | BabelNodeExportAllDeclaration | BabelNodeExportDefaultDeclaration | BabelNodeExportNamedDeclaration | BabelNodeImportDeclaration | BabelNodeDeclareClass | BabelNodeDeclareFunction | BabelNodeDeclareInterface | BabelNodeDeclareModule | BabelNodeDeclareModuleExports | BabelNodeDeclareTypeAlias | BabelNodeDeclareOpaqueType | BabelNodeDeclareVariable | BabelNodeDeclareExportDeclaration | BabelNodeDeclareExportAllDeclaration | BabelNodeInterfaceDeclaration | BabelNodeOpaqueType | BabelNodeTypeAlias | BabelNodeEnumDeclaration | BabelNodeTSDeclareFunction | BabelNodeTSInterfaceDeclaration | BabelNodeTSTypeAliasDeclaration | BabelNodeTSEnumDeclaration | BabelNodeTSModuleDeclaration | BabelNodeTSImportEqualsDeclaration;
type BabelNodePatternLike = BabelNodeIdentifier | BabelNodeRestElement | BabelNodeAssignmentPattern | BabelNodeArrayPattern | BabelNodeObjectPattern | BabelNodeTSAsExpression | BabelNodeTSSatisfiesExpression | BabelNodeTSTypeAssertion | BabelNodeTSNonNullExpression; type BabelNodeFunctionParameter = BabelNodeIdentifier | BabelNodeRestElement | BabelNodeAssignmentPattern | BabelNodeArrayPattern | BabelNodeObjectPattern | BabelNodeVoidPattern;
type BabelNodeLVal = BabelNodeIdentifier | BabelNodeMemberExpression | BabelNodeRestElement | BabelNodeAssignmentPattern | BabelNodeArrayPattern | BabelNodeObjectPattern | BabelNodeTSParameterProperty | BabelNodeTSAsExpression | BabelNodeTSSatisfiesExpression | BabelNodeTSTypeAssertion | BabelNodeTSNonNullExpression; type BabelNodePatternLike = BabelNodeIdentifier | BabelNodeMemberExpression | BabelNodeRestElement | BabelNodeAssignmentPattern | BabelNodeArrayPattern | BabelNodeObjectPattern | BabelNodeVoidPattern | BabelNodeTSAsExpression | BabelNodeTSSatisfiesExpression | BabelNodeTSTypeAssertion | BabelNodeTSNonNullExpression;
type BabelNodeLVal = BabelNodeIdentifier | BabelNodeMemberExpression | BabelNodeRestElement | BabelNodeAssignmentPattern | BabelNodeArrayPattern | BabelNodeObjectPattern | BabelNodeOptionalMemberExpression | BabelNodeTSParameterProperty | BabelNodeTSAsExpression | BabelNodeTSSatisfiesExpression | BabelNodeTSTypeAssertion | BabelNodeTSNonNullExpression;
type BabelNodeTSEntityName = BabelNodeIdentifier | BabelNodeTSQualifiedName; type BabelNodeTSEntityName = BabelNodeIdentifier | BabelNodeTSQualifiedName;
type BabelNodeLiteral = BabelNodeStringLiteral | BabelNodeNumericLiteral | BabelNodeNullLiteral | BabelNodeBooleanLiteral | BabelNodeRegExpLiteral | BabelNodeTemplateLiteral | BabelNodeBigIntLiteral | BabelNodeDecimalLiteral; type BabelNodeLiteral = BabelNodeStringLiteral | BabelNodeNumericLiteral | BabelNodeNullLiteral | BabelNodeBooleanLiteral | BabelNodeRegExpLiteral | BabelNodeTemplateLiteral | BabelNodeBigIntLiteral | BabelNodeDecimalLiteral;
type BabelNodeImmutable = BabelNodeStringLiteral | BabelNodeNumericLiteral | BabelNodeNullLiteral | BabelNodeBooleanLiteral | BabelNodeBigIntLiteral | BabelNodeJSXAttribute | BabelNodeJSXClosingElement | BabelNodeJSXElement | BabelNodeJSXExpressionContainer | BabelNodeJSXSpreadChild | BabelNodeJSXOpeningElement | BabelNodeJSXText | BabelNodeJSXFragment | BabelNodeJSXOpeningFragment | BabelNodeJSXClosingFragment | BabelNodeDecimalLiteral; type BabelNodeImmutable = BabelNodeStringLiteral | BabelNodeNumericLiteral | BabelNodeNullLiteral | BabelNodeBooleanLiteral | BabelNodeBigIntLiteral | BabelNodeJSXAttribute | BabelNodeJSXClosingElement | BabelNodeJSXElement | BabelNodeJSXExpressionContainer | BabelNodeJSXSpreadChild | BabelNodeJSXOpeningElement | BabelNodeJSXText | BabelNodeJSXFragment | BabelNodeJSXOpeningFragment | BabelNodeJSXClosingFragment | BabelNodeDecimalLiteral;
@ -1677,7 +1682,7 @@ type BabelNodeMethod = BabelNodeObjectMethod | BabelNodeClassMethod | BabelNodeC
type BabelNodeObjectMember = BabelNodeObjectMethod | BabelNodeObjectProperty; type BabelNodeObjectMember = BabelNodeObjectMethod | BabelNodeObjectProperty;
type BabelNodeProperty = BabelNodeObjectProperty | BabelNodeClassProperty | BabelNodeClassAccessorProperty | BabelNodeClassPrivateProperty; type BabelNodeProperty = BabelNodeObjectProperty | BabelNodeClassProperty | BabelNodeClassAccessorProperty | BabelNodeClassPrivateProperty;
type BabelNodeUnaryLike = BabelNodeUnaryExpression | BabelNodeSpreadElement; type BabelNodeUnaryLike = BabelNodeUnaryExpression | BabelNodeSpreadElement;
type BabelNodePattern = BabelNodeAssignmentPattern | BabelNodeArrayPattern | BabelNodeObjectPattern; type BabelNodePattern = BabelNodeAssignmentPattern | BabelNodeArrayPattern | BabelNodeObjectPattern | BabelNodeVoidPattern;
type BabelNodeClass = BabelNodeClassExpression | BabelNodeClassDeclaration; type BabelNodeClass = BabelNodeClassExpression | BabelNodeClassDeclaration;
type BabelNodeImportOrExportDeclaration = BabelNodeExportAllDeclaration | BabelNodeExportDefaultDeclaration | BabelNodeExportNamedDeclaration | BabelNodeImportDeclaration; type BabelNodeImportOrExportDeclaration = BabelNodeExportAllDeclaration | BabelNodeExportDefaultDeclaration | BabelNodeExportNamedDeclaration | BabelNodeImportDeclaration;
type BabelNodeExportDeclaration = BabelNodeExportAllDeclaration | BabelNodeExportDefaultDeclaration | BabelNodeExportNamedDeclaration; type BabelNodeExportDeclaration = BabelNodeExportAllDeclaration | BabelNodeExportDefaultDeclaration | BabelNodeExportNamedDeclaration;
@ -1701,7 +1706,7 @@ type BabelNodeModuleDeclaration = BabelNodeExportAllDeclaration | BabelNodeExpor
declare module "@babel/types" { declare module "@babel/types" {
declare export function arrayExpression(elements?: Array<null | BabelNodeExpression | BabelNodeSpreadElement>): BabelNodeArrayExpression; declare export function arrayExpression(elements?: Array<null | BabelNodeExpression | BabelNodeSpreadElement>): BabelNodeArrayExpression;
declare export function assignmentExpression(operator: string, left: BabelNodeLVal | BabelNodeOptionalMemberExpression, right: BabelNodeExpression): BabelNodeAssignmentExpression; declare export function assignmentExpression(operator: string, left: BabelNodeLVal, right: BabelNodeExpression): BabelNodeAssignmentExpression;
declare export function binaryExpression(operator: "+" | "-" | "/" | "%" | "*" | "**" | "&" | "|" | ">>" | ">>>" | "<<" | "^" | "==" | "===" | "!=" | "!==" | "in" | "instanceof" | ">" | "<" | ">=" | "<=" | "|>", left: BabelNodeExpression | BabelNodePrivateName, right: BabelNodeExpression): BabelNodeBinaryExpression; declare export function binaryExpression(operator: "+" | "-" | "/" | "%" | "*" | "**" | "&" | "|" | ">>" | ">>>" | "<<" | "^" | "==" | "===" | "!=" | "!==" | "in" | "instanceof" | ">" | "<" | ">=" | "<=" | "|>", left: BabelNodeExpression | BabelNodePrivateName, right: BabelNodeExpression): BabelNodeBinaryExpression;
declare export function interpreterDirective(value: string): BabelNodeInterpreterDirective; declare export function interpreterDirective(value: string): BabelNodeInterpreterDirective;
declare export function directive(value: BabelNodeDirectiveLiteral): BabelNodeDirective; declare export function directive(value: BabelNodeDirectiveLiteral): BabelNodeDirective;
@ -1719,8 +1724,8 @@ declare module "@babel/types" {
declare export function file(program: BabelNodeProgram, comments?: Array<BabelNodeCommentBlock | BabelNodeCommentLine>, tokens?: Array<any>): BabelNodeFile; declare export function file(program: BabelNodeProgram, comments?: Array<BabelNodeCommentBlock | BabelNodeCommentLine>, tokens?: Array<any>): BabelNodeFile;
declare export function forInStatement(left: BabelNodeVariableDeclaration | BabelNodeLVal, right: BabelNodeExpression, body: BabelNodeStatement): BabelNodeForInStatement; declare export function forInStatement(left: BabelNodeVariableDeclaration | BabelNodeLVal, right: BabelNodeExpression, body: BabelNodeStatement): BabelNodeForInStatement;
declare export function forStatement(init?: BabelNodeVariableDeclaration | BabelNodeExpression, test?: BabelNodeExpression, update?: BabelNodeExpression, body: BabelNodeStatement): BabelNodeForStatement; declare export function forStatement(init?: BabelNodeVariableDeclaration | BabelNodeExpression, test?: BabelNodeExpression, update?: BabelNodeExpression, body: BabelNodeStatement): BabelNodeForStatement;
declare export function functionDeclaration(id?: BabelNodeIdentifier, params: Array<BabelNodeIdentifier | BabelNodePattern | BabelNodeRestElement>, body: BabelNodeBlockStatement, generator?: boolean, async?: boolean): BabelNodeFunctionDeclaration; declare export function functionDeclaration(id?: BabelNodeIdentifier, params: Array<BabelNodeFunctionParameter>, body: BabelNodeBlockStatement, generator?: boolean, async?: boolean): BabelNodeFunctionDeclaration;
declare export function functionExpression(id?: BabelNodeIdentifier, params: Array<BabelNodeIdentifier | BabelNodePattern | BabelNodeRestElement>, body: BabelNodeBlockStatement, generator?: boolean, async?: boolean): BabelNodeFunctionExpression; declare export function functionExpression(id?: BabelNodeIdentifier, params: Array<BabelNodeFunctionParameter>, body: BabelNodeBlockStatement, generator?: boolean, async?: boolean): BabelNodeFunctionExpression;
declare export function identifier(name: string): BabelNodeIdentifier; declare export function identifier(name: string): BabelNodeIdentifier;
declare export function ifStatement(test: BabelNodeExpression, consequent: BabelNodeStatement, alternate?: BabelNodeStatement): BabelNodeIfStatement; declare export function ifStatement(test: BabelNodeExpression, consequent: BabelNodeStatement, alternate?: BabelNodeStatement): BabelNodeIfStatement;
declare export function labeledStatement(label: BabelNodeIdentifier, body: BabelNodeStatement): BabelNodeLabeledStatement; declare export function labeledStatement(label: BabelNodeIdentifier, body: BabelNodeStatement): BabelNodeLabeledStatement;
@ -1734,9 +1739,9 @@ declare module "@babel/types" {
declare export function newExpression(callee: BabelNodeExpression | BabelNodeSuper | BabelNodeV8IntrinsicIdentifier, _arguments: Array<BabelNodeExpression | BabelNodeSpreadElement | BabelNodeArgumentPlaceholder>): BabelNodeNewExpression; declare export function newExpression(callee: BabelNodeExpression | BabelNodeSuper | BabelNodeV8IntrinsicIdentifier, _arguments: Array<BabelNodeExpression | BabelNodeSpreadElement | BabelNodeArgumentPlaceholder>): BabelNodeNewExpression;
declare export function program(body: Array<BabelNodeStatement>, directives?: Array<BabelNodeDirective>, sourceType?: "script" | "module", interpreter?: BabelNodeInterpreterDirective): BabelNodeProgram; declare export function program(body: Array<BabelNodeStatement>, directives?: Array<BabelNodeDirective>, sourceType?: "script" | "module", interpreter?: BabelNodeInterpreterDirective): BabelNodeProgram;
declare export function objectExpression(properties: Array<BabelNodeObjectMethod | BabelNodeObjectProperty | BabelNodeSpreadElement>): BabelNodeObjectExpression; declare export function objectExpression(properties: Array<BabelNodeObjectMethod | BabelNodeObjectProperty | BabelNodeSpreadElement>): BabelNodeObjectExpression;
declare export function objectMethod(kind?: "method" | "get" | "set", key: BabelNodeExpression | BabelNodeIdentifier | BabelNodeStringLiteral | BabelNodeNumericLiteral | BabelNodeBigIntLiteral, params: Array<BabelNodeIdentifier | BabelNodePattern | BabelNodeRestElement>, body: BabelNodeBlockStatement, computed?: boolean, generator?: boolean, async?: boolean): BabelNodeObjectMethod; declare export function objectMethod(kind?: "method" | "get" | "set", key: BabelNodeExpression | BabelNodeIdentifier | BabelNodeStringLiteral | BabelNodeNumericLiteral | BabelNodeBigIntLiteral, params: Array<BabelNodeFunctionParameter>, body: BabelNodeBlockStatement, computed?: boolean, generator?: boolean, async?: boolean): BabelNodeObjectMethod;
declare export function objectProperty(key: BabelNodeExpression | BabelNodeIdentifier | BabelNodeStringLiteral | BabelNodeNumericLiteral | BabelNodeBigIntLiteral | BabelNodeDecimalLiteral | BabelNodePrivateName, value: BabelNodeExpression | BabelNodePatternLike, computed?: boolean, shorthand?: boolean, decorators?: Array<BabelNodeDecorator>): BabelNodeObjectProperty; declare export function objectProperty(key: BabelNodeExpression | BabelNodeIdentifier | BabelNodeStringLiteral | BabelNodeNumericLiteral | BabelNodeBigIntLiteral | BabelNodeDecimalLiteral | BabelNodePrivateName, value: BabelNodeExpression | BabelNodePatternLike, computed?: boolean, shorthand?: boolean, decorators?: Array<BabelNodeDecorator>): BabelNodeObjectProperty;
declare export function restElement(argument: BabelNodeLVal): BabelNodeRestElement; declare export function restElement(argument: BabelNodeIdentifier | BabelNodeArrayPattern | BabelNodeObjectPattern | BabelNodeMemberExpression | BabelNodeTSAsExpression | BabelNodeTSSatisfiesExpression | BabelNodeTSTypeAssertion | BabelNodeTSNonNullExpression | BabelNodeRestElement | BabelNodeAssignmentPattern): BabelNodeRestElement;
declare export function returnStatement(argument?: BabelNodeExpression): BabelNodeReturnStatement; declare export function returnStatement(argument?: BabelNodeExpression): BabelNodeReturnStatement;
declare export function sequenceExpression(expressions: Array<BabelNodeExpression>): BabelNodeSequenceExpression; declare export function sequenceExpression(expressions: Array<BabelNodeExpression>): BabelNodeSequenceExpression;
declare export function parenthesizedExpression(expression: BabelNodeExpression): BabelNodeParenthesizedExpression; declare export function parenthesizedExpression(expression: BabelNodeExpression): BabelNodeParenthesizedExpression;
@ -1748,12 +1753,12 @@ declare module "@babel/types" {
declare export function unaryExpression(operator: "void" | "throw" | "delete" | "!" | "+" | "-" | "~" | "typeof", argument: BabelNodeExpression, prefix?: boolean): BabelNodeUnaryExpression; declare export function unaryExpression(operator: "void" | "throw" | "delete" | "!" | "+" | "-" | "~" | "typeof", argument: BabelNodeExpression, prefix?: boolean): BabelNodeUnaryExpression;
declare export function updateExpression(operator: "++" | "--", argument: BabelNodeExpression, prefix?: boolean): BabelNodeUpdateExpression; declare export function updateExpression(operator: "++" | "--", argument: BabelNodeExpression, prefix?: boolean): BabelNodeUpdateExpression;
declare export function variableDeclaration(kind: "var" | "let" | "const" | "using" | "await using", declarations: Array<BabelNodeVariableDeclarator>): BabelNodeVariableDeclaration; declare export function variableDeclaration(kind: "var" | "let" | "const" | "using" | "await using", declarations: Array<BabelNodeVariableDeclarator>): BabelNodeVariableDeclaration;
declare export function variableDeclarator(id: BabelNodeLVal, init?: BabelNodeExpression): BabelNodeVariableDeclarator; declare export function variableDeclarator(id: BabelNodeLVal | BabelNodeVoidPattern, init?: BabelNodeExpression): BabelNodeVariableDeclarator;
declare export function whileStatement(test: BabelNodeExpression, body: BabelNodeStatement): BabelNodeWhileStatement; declare export function whileStatement(test: BabelNodeExpression, body: BabelNodeStatement): BabelNodeWhileStatement;
declare export function withStatement(object: BabelNodeExpression, body: BabelNodeStatement): BabelNodeWithStatement; declare export function withStatement(object: BabelNodeExpression, body: BabelNodeStatement): BabelNodeWithStatement;
declare export function assignmentPattern(left: BabelNodeIdentifier | BabelNodeObjectPattern | BabelNodeArrayPattern | BabelNodeMemberExpression | BabelNodeTSAsExpression | BabelNodeTSSatisfiesExpression | BabelNodeTSTypeAssertion | BabelNodeTSNonNullExpression, right: BabelNodeExpression): BabelNodeAssignmentPattern; declare export function assignmentPattern(left: BabelNodeIdentifier | BabelNodeObjectPattern | BabelNodeArrayPattern | BabelNodeMemberExpression | BabelNodeTSAsExpression | BabelNodeTSSatisfiesExpression | BabelNodeTSTypeAssertion | BabelNodeTSNonNullExpression, right: BabelNodeExpression): BabelNodeAssignmentPattern;
declare export function arrayPattern(elements: Array<null | BabelNodePatternLike | BabelNodeLVal>): BabelNodeArrayPattern; declare export function arrayPattern(elements: Array<null | BabelNodePatternLike>): BabelNodeArrayPattern;
declare export function arrowFunctionExpression(params: Array<BabelNodeIdentifier | BabelNodePattern | BabelNodeRestElement>, body: BabelNodeBlockStatement | BabelNodeExpression, async?: boolean): BabelNodeArrowFunctionExpression; declare export function arrowFunctionExpression(params: Array<BabelNodeFunctionParameter>, body: BabelNodeBlockStatement | BabelNodeExpression, async?: boolean): BabelNodeArrowFunctionExpression;
declare export function classBody(body: Array<BabelNodeClassMethod | BabelNodeClassPrivateMethod | BabelNodeClassProperty | BabelNodeClassPrivateProperty | BabelNodeClassAccessorProperty | BabelNodeTSDeclareMethod | BabelNodeTSIndexSignature | BabelNodeStaticBlock>): BabelNodeClassBody; declare export function classBody(body: Array<BabelNodeClassMethod | BabelNodeClassPrivateMethod | BabelNodeClassProperty | BabelNodeClassPrivateProperty | BabelNodeClassAccessorProperty | BabelNodeTSDeclareMethod | BabelNodeTSIndexSignature | BabelNodeStaticBlock>): BabelNodeClassBody;
declare export function classExpression(id?: BabelNodeIdentifier, superClass?: BabelNodeExpression, body: BabelNodeClassBody, decorators?: Array<BabelNodeDecorator>): BabelNodeClassExpression; declare export function classExpression(id?: BabelNodeIdentifier, superClass?: BabelNodeExpression, body: BabelNodeClassBody, decorators?: Array<BabelNodeDecorator>): BabelNodeClassExpression;
declare export function classDeclaration(id?: BabelNodeIdentifier, superClass?: BabelNodeExpression, body: BabelNodeClassBody, decorators?: Array<BabelNodeDecorator>): BabelNodeClassDeclaration; declare export function classDeclaration(id?: BabelNodeIdentifier, superClass?: BabelNodeExpression, body: BabelNodeClassBody, decorators?: Array<BabelNodeDecorator>): BabelNodeClassDeclaration;
@ -1768,7 +1773,7 @@ declare module "@babel/types" {
declare export function importSpecifier(local: BabelNodeIdentifier, imported: BabelNodeIdentifier | BabelNodeStringLiteral): BabelNodeImportSpecifier; declare export function importSpecifier(local: BabelNodeIdentifier, imported: BabelNodeIdentifier | BabelNodeStringLiteral): BabelNodeImportSpecifier;
declare export function importExpression(source: BabelNodeExpression, options?: BabelNodeExpression): BabelNodeImportExpression; declare export function importExpression(source: BabelNodeExpression, options?: BabelNodeExpression): BabelNodeImportExpression;
declare export function metaProperty(meta: BabelNodeIdentifier, property: BabelNodeIdentifier): BabelNodeMetaProperty; declare export function metaProperty(meta: BabelNodeIdentifier, property: BabelNodeIdentifier): BabelNodeMetaProperty;
declare export function classMethod(kind?: "get" | "set" | "method" | "constructor", key: BabelNodeIdentifier | BabelNodeStringLiteral | BabelNodeNumericLiteral | BabelNodeBigIntLiteral | BabelNodeExpression, params: Array<BabelNodeIdentifier | BabelNodePattern | BabelNodeRestElement | BabelNodeTSParameterProperty>, body: BabelNodeBlockStatement, computed?: boolean, _static?: boolean, generator?: boolean, async?: boolean): BabelNodeClassMethod; declare export function classMethod(kind?: "get" | "set" | "method" | "constructor", key: BabelNodeIdentifier | BabelNodeStringLiteral | BabelNodeNumericLiteral | BabelNodeBigIntLiteral | BabelNodeExpression, params: Array<BabelNodeFunctionParameter | BabelNodeTSParameterProperty>, body: BabelNodeBlockStatement, computed?: boolean, _static?: boolean, generator?: boolean, async?: boolean): BabelNodeClassMethod;
declare export function objectPattern(properties: Array<BabelNodeRestElement | BabelNodeObjectProperty>): BabelNodeObjectPattern; declare export function objectPattern(properties: Array<BabelNodeRestElement | BabelNodeObjectProperty>): BabelNodeObjectPattern;
declare export function spreadElement(argument: BabelNodeExpression): BabelNodeSpreadElement; declare export function spreadElement(argument: BabelNodeExpression): BabelNodeSpreadElement;
declare function _super(): BabelNodeSuper; declare function _super(): BabelNodeSuper;
@ -1787,7 +1792,7 @@ declare module "@babel/types" {
declare export function classProperty(key: BabelNodeIdentifier | BabelNodeStringLiteral | BabelNodeNumericLiteral | BabelNodeBigIntLiteral | BabelNodeExpression, value?: BabelNodeExpression, typeAnnotation?: BabelNodeTypeAnnotation | BabelNodeTSTypeAnnotation | BabelNodeNoop, decorators?: Array<BabelNodeDecorator>, computed?: boolean, _static?: boolean): BabelNodeClassProperty; declare export function classProperty(key: BabelNodeIdentifier | BabelNodeStringLiteral | BabelNodeNumericLiteral | BabelNodeBigIntLiteral | BabelNodeExpression, value?: BabelNodeExpression, typeAnnotation?: BabelNodeTypeAnnotation | BabelNodeTSTypeAnnotation | BabelNodeNoop, decorators?: Array<BabelNodeDecorator>, computed?: boolean, _static?: boolean): BabelNodeClassProperty;
declare export function classAccessorProperty(key: BabelNodeIdentifier | BabelNodeStringLiteral | BabelNodeNumericLiteral | BabelNodeBigIntLiteral | BabelNodeExpression | BabelNodePrivateName, value?: BabelNodeExpression, typeAnnotation?: BabelNodeTypeAnnotation | BabelNodeTSTypeAnnotation | BabelNodeNoop, decorators?: Array<BabelNodeDecorator>, computed?: boolean, _static?: boolean): BabelNodeClassAccessorProperty; declare export function classAccessorProperty(key: BabelNodeIdentifier | BabelNodeStringLiteral | BabelNodeNumericLiteral | BabelNodeBigIntLiteral | BabelNodeExpression | BabelNodePrivateName, value?: BabelNodeExpression, typeAnnotation?: BabelNodeTypeAnnotation | BabelNodeTSTypeAnnotation | BabelNodeNoop, decorators?: Array<BabelNodeDecorator>, computed?: boolean, _static?: boolean): BabelNodeClassAccessorProperty;
declare export function classPrivateProperty(key: BabelNodePrivateName, value?: BabelNodeExpression, decorators?: Array<BabelNodeDecorator>, _static?: boolean): BabelNodeClassPrivateProperty; declare export function classPrivateProperty(key: BabelNodePrivateName, value?: BabelNodeExpression, decorators?: Array<BabelNodeDecorator>, _static?: boolean): BabelNodeClassPrivateProperty;
declare export function classPrivateMethod(kind?: "get" | "set" | "method", key: BabelNodePrivateName, params: Array<BabelNodeIdentifier | BabelNodePattern | BabelNodeRestElement | BabelNodeTSParameterProperty>, body: BabelNodeBlockStatement, _static?: boolean): BabelNodeClassPrivateMethod; declare export function classPrivateMethod(kind?: "get" | "set" | "method", key: BabelNodePrivateName, params: Array<BabelNodeFunctionParameter | BabelNodeTSParameterProperty>, body: BabelNodeBlockStatement, _static?: boolean): BabelNodeClassPrivateMethod;
declare export function privateName(id: BabelNodeIdentifier): BabelNodePrivateName; declare export function privateName(id: BabelNodeIdentifier): BabelNodePrivateName;
declare export function staticBlock(body: Array<BabelNodeStatement>): BabelNodeStaticBlock; declare export function staticBlock(body: Array<BabelNodeStatement>): BabelNodeStaticBlock;
declare export function importAttribute(key: BabelNodeIdentifier | BabelNodeStringLiteral, value: BabelNodeStringLiteral): BabelNodeImportAttribute; declare export function importAttribute(key: BabelNodeIdentifier | BabelNodeStringLiteral, value: BabelNodeStringLiteral): BabelNodeImportAttribute;
@ -1887,9 +1892,10 @@ declare module "@babel/types" {
declare export function pipelineTopicExpression(expression: BabelNodeExpression): BabelNodePipelineTopicExpression; declare export function pipelineTopicExpression(expression: BabelNodeExpression): BabelNodePipelineTopicExpression;
declare export function pipelineBareFunction(callee: BabelNodeExpression): BabelNodePipelineBareFunction; declare export function pipelineBareFunction(callee: BabelNodeExpression): BabelNodePipelineBareFunction;
declare export function pipelinePrimaryTopicReference(): BabelNodePipelinePrimaryTopicReference; declare export function pipelinePrimaryTopicReference(): BabelNodePipelinePrimaryTopicReference;
declare export function voidPattern(): BabelNodeVoidPattern;
declare export function tsParameterProperty(parameter: BabelNodeIdentifier | BabelNodeAssignmentPattern): BabelNodeTSParameterProperty; declare export function tsParameterProperty(parameter: BabelNodeIdentifier | BabelNodeAssignmentPattern): BabelNodeTSParameterProperty;
declare export function tsDeclareFunction(id?: BabelNodeIdentifier, typeParameters?: BabelNodeTSTypeParameterDeclaration | BabelNodeNoop, params: Array<BabelNodeIdentifier | BabelNodePattern | BabelNodeRestElement>, returnType?: BabelNodeTSTypeAnnotation | BabelNodeNoop): BabelNodeTSDeclareFunction; declare export function tsDeclareFunction(id?: BabelNodeIdentifier, typeParameters?: BabelNodeTSTypeParameterDeclaration | BabelNodeNoop, params: Array<BabelNodeFunctionParameter>, returnType?: BabelNodeTSTypeAnnotation | BabelNodeNoop): BabelNodeTSDeclareFunction;
declare export function tsDeclareMethod(decorators?: Array<BabelNodeDecorator>, key: BabelNodeIdentifier | BabelNodeStringLiteral | BabelNodeNumericLiteral | BabelNodeBigIntLiteral | BabelNodeExpression, typeParameters?: BabelNodeTSTypeParameterDeclaration | BabelNodeNoop, params: Array<BabelNodeIdentifier | BabelNodePattern | BabelNodeRestElement | BabelNodeTSParameterProperty>, returnType?: BabelNodeTSTypeAnnotation | BabelNodeNoop): BabelNodeTSDeclareMethod; declare export function tsDeclareMethod(decorators?: Array<BabelNodeDecorator>, key: BabelNodeIdentifier | BabelNodeStringLiteral | BabelNodeNumericLiteral | BabelNodeBigIntLiteral | BabelNodeExpression, typeParameters?: BabelNodeTSTypeParameterDeclaration | BabelNodeNoop, params: Array<BabelNodeFunctionParameter | BabelNodeTSParameterProperty>, returnType?: BabelNodeTSTypeAnnotation | BabelNodeNoop): BabelNodeTSDeclareMethod;
declare export function tsQualifiedName(left: BabelNodeTSEntityName, right: BabelNodeIdentifier): BabelNodeTSQualifiedName; declare export function tsQualifiedName(left: BabelNodeTSEntityName, right: BabelNodeIdentifier): BabelNodeTSQualifiedName;
declare export function tsCallSignatureDeclaration(typeParameters?: BabelNodeTSTypeParameterDeclaration, parameters: Array<BabelNodeArrayPattern | BabelNodeIdentifier | BabelNodeObjectPattern | BabelNodeRestElement>, typeAnnotation?: BabelNodeTSTypeAnnotation): BabelNodeTSCallSignatureDeclaration; declare export function tsCallSignatureDeclaration(typeParameters?: BabelNodeTSTypeParameterDeclaration, parameters: Array<BabelNodeArrayPattern | BabelNodeIdentifier | BabelNodeObjectPattern | BabelNodeRestElement>, typeAnnotation?: BabelNodeTSTypeAnnotation): BabelNodeTSCallSignatureDeclaration;
declare export function tsConstructSignatureDeclaration(typeParameters?: BabelNodeTSTypeParameterDeclaration, parameters: Array<BabelNodeArrayPattern | BabelNodeIdentifier | BabelNodeObjectPattern | BabelNodeRestElement>, typeAnnotation?: BabelNodeTSTypeAnnotation): BabelNodeTSConstructSignatureDeclaration; declare export function tsConstructSignatureDeclaration(typeParameters?: BabelNodeTSTypeParameterDeclaration, parameters: Array<BabelNodeArrayPattern | BabelNodeIdentifier | BabelNodeObjectPattern | BabelNodeRestElement>, typeAnnotation?: BabelNodeTSTypeAnnotation): BabelNodeTSConstructSignatureDeclaration;
@ -1926,7 +1932,7 @@ declare module "@babel/types" {
declare export function tsConditionalType(checkType: BabelNodeTSType, extendsType: BabelNodeTSType, trueType: BabelNodeTSType, falseType: BabelNodeTSType): BabelNodeTSConditionalType; declare export function tsConditionalType(checkType: BabelNodeTSType, extendsType: BabelNodeTSType, trueType: BabelNodeTSType, falseType: BabelNodeTSType): BabelNodeTSConditionalType;
declare export function tsInferType(typeParameter: BabelNodeTSTypeParameter): BabelNodeTSInferType; declare export function tsInferType(typeParameter: BabelNodeTSTypeParameter): BabelNodeTSInferType;
declare export function tsParenthesizedType(typeAnnotation: BabelNodeTSType): BabelNodeTSParenthesizedType; declare export function tsParenthesizedType(typeAnnotation: BabelNodeTSType): BabelNodeTSParenthesizedType;
declare export function tsTypeOperator(typeAnnotation: BabelNodeTSType): BabelNodeTSTypeOperator; declare export function tsTypeOperator(typeAnnotation: BabelNodeTSType, operator: string): BabelNodeTSTypeOperator;
declare export function tsIndexedAccessType(objectType: BabelNodeTSType, indexType: BabelNodeTSType): BabelNodeTSIndexedAccessType; declare export function tsIndexedAccessType(objectType: BabelNodeTSType, indexType: BabelNodeTSType): BabelNodeTSIndexedAccessType;
declare export function tsMappedType(typeParameter: BabelNodeTSTypeParameter, typeAnnotation?: BabelNodeTSType, nameType?: BabelNodeTSType): BabelNodeTSMappedType; declare export function tsMappedType(typeParameter: BabelNodeTSTypeParameter, typeAnnotation?: BabelNodeTSType, nameType?: BabelNodeTSType): BabelNodeTSMappedType;
declare export function tsTemplateLiteralType(quasis: Array<BabelNodeTemplateElement>, types: Array<BabelNodeTSType>): BabelNodeTSTemplateLiteralType; declare export function tsTemplateLiteralType(quasis: Array<BabelNodeTemplateElement>, types: Array<BabelNodeTSType>): BabelNodeTSTemplateLiteralType;
@ -2324,6 +2330,8 @@ declare module "@babel/types" {
declare export function assertPipelineBareFunction(node: ?Object, opts?: ?Object): void declare export function assertPipelineBareFunction(node: ?Object, opts?: ?Object): void
declare export function isPipelinePrimaryTopicReference(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodePipelinePrimaryTopicReference) declare export function isPipelinePrimaryTopicReference(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodePipelinePrimaryTopicReference)
declare export function assertPipelinePrimaryTopicReference(node: ?Object, opts?: ?Object): void declare export function assertPipelinePrimaryTopicReference(node: ?Object, opts?: ?Object): void
declare export function isVoidPattern(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeVoidPattern)
declare export function assertVoidPattern(node: ?Object, opts?: ?Object): void
declare export function isTSParameterProperty(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSParameterProperty) declare export function isTSParameterProperty(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSParameterProperty)
declare export function assertTSParameterProperty(node: ?Object, opts?: ?Object): void declare export function assertTSParameterProperty(node: ?Object, opts?: ?Object): void
declare export function isTSDeclareFunction(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSDeclareFunction) declare export function isTSDeclareFunction(node: ?Object, opts?: ?Object): boolean %checks (node instanceof BabelNodeTSDeclareFunction)
@ -2496,6 +2504,8 @@ declare module "@babel/types" {
declare export function assertPureish(node: ?Object, opts?: ?Object): void declare export function assertPureish(node: ?Object, opts?: ?Object): void
declare export function isDeclaration(node: ?Object, opts?: ?Object): boolean declare export function isDeclaration(node: ?Object, opts?: ?Object): boolean
declare export function assertDeclaration(node: ?Object, opts?: ?Object): void declare export function assertDeclaration(node: ?Object, opts?: ?Object): void
declare export function isFunctionParameter(node: ?Object, opts?: ?Object): boolean
declare export function assertFunctionParameter(node: ?Object, opts?: ?Object): void
declare export function isPatternLike(node: ?Object, opts?: ?Object): boolean declare export function isPatternLike(node: ?Object, opts?: ?Object): boolean
declare export function assertPatternLike(node: ?Object, opts?: ?Object): void declare export function assertPatternLike(node: ?Object, opts?: ?Object): void
declare export function isLVal(node: ?Object, opts?: ?Object): boolean declare export function isLVal(node: ?Object, opts?: ?Object): boolean

View File

@ -5,9 +5,9 @@ Object.defineProperty(exports, "__esModule", {
}); });
exports.default = deprecationWarning; exports.default = deprecationWarning;
const warnings = new Set(); const warnings = new Set();
function deprecationWarning(oldName, newName, prefix = "") { function deprecationWarning(oldName, newName, prefix = "", cacheKey = oldName) {
if (warnings.has(oldName)) return; if (warnings.has(cacheKey)) return;
warnings.add(oldName); warnings.add(cacheKey);
const { const {
internal, internal,
trace trace

View File

@ -1 +1 @@
{"version":3,"names":["warnings","Set","deprecationWarning","oldName","newName","prefix","has","add","internal","trace","captureShortStackTrace","console","warn","skip","length","stackTraceLimit","prepareStackTrace","Error","stackTrace","err","stack","shortStackTrace","slice","test","getFileName","map","frame","join"],"sources":["../../src/utils/deprecationWarning.ts"],"sourcesContent":["const warnings = new Set();\n\nexport default function deprecationWarning(\n oldName: string,\n newName: string,\n prefix: string = \"\",\n) {\n if (warnings.has(oldName)) return;\n warnings.add(oldName);\n\n const { internal, trace } = captureShortStackTrace(1, 2);\n if (internal) {\n // If usage comes from an internal package, there is no point in warning because\n // 1. The new version of the package will already use the new API\n // 2. When the deprecation will become an error (in a future major version), users\n // will have to update every package anyway.\n return;\n }\n console.warn(\n `${prefix}\\`${oldName}\\` has been deprecated, please migrate to \\`${newName}\\`\\n${trace}`,\n );\n}\n\nfunction captureShortStackTrace(skip: number, length: number) {\n const { stackTraceLimit, prepareStackTrace } = Error;\n let stackTrace: NodeJS.CallSite[];\n // We add 1 to also take into account this function.\n Error.stackTraceLimit = 1 + skip + length;\n Error.prepareStackTrace = function (err, stack) {\n stackTrace = stack;\n };\n // eslint-disable-next-line @typescript-eslint/no-unused-expressions\n new Error().stack;\n Error.stackTraceLimit = stackTraceLimit;\n Error.prepareStackTrace = prepareStackTrace;\n\n if (!stackTrace) return { internal: false, trace: \"\" };\n\n const shortStackTrace = stackTrace.slice(1 + skip, 1 + skip + length);\n return {\n internal: /[\\\\/]@babel[\\\\/]/.test(shortStackTrace[1].getFileName()),\n trace: shortStackTrace.map(frame => ` at ${frame}`).join(\"\\n\"),\n };\n}\n"],"mappings":";;;;;;AAAA,MAAMA,QAAQ,GAAG,IAAIC,GAAG,CAAC,CAAC;AAEX,SAASC,kBAAkBA,CACxCC,OAAe,EACfC,OAAe,EACfC,MAAc,GAAG,EAAE,EACnB;EACA,IAAIL,QAAQ,CAACM,GAAG,CAACH,OAAO,CAAC,EAAE;EAC3BH,QAAQ,CAACO,GAAG,CAACJ,OAAO,CAAC;EAErB,MAAM;IAAEK,QAAQ;IAAEC;EAAM,CAAC,GAAGC,sBAAsB,CAAC,CAAC,EAAE,CAAC,CAAC;EACxD,IAAIF,QAAQ,EAAE;IAKZ;EACF;EACAG,OAAO,CAACC,IAAI,CACV,GAAGP,MAAM,KAAKF,OAAO,+CAA+CC,OAAO,OAAOK,KAAK,EACzF,CAAC;AACH;AAEA,SAASC,sBAAsBA,CAACG,IAAY,EAAEC,MAAc,EAAE;EAC5D,MAAM;IAAEC,eAAe;IAAEC;EAAkB,CAAC,GAAGC,KAAK;EACpD,IAAIC,UAA6B;EAEjCD,KAAK,CAACF,eAAe,GAAG,CAAC,GAAGF,IAAI,GAAGC,MAAM;EACzCG,KAAK,CAACD,iBAAiB,GAAG,UAAUG,GAAG,EAAEC,KAAK,EAAE;IAC9CF,UAAU,GAAGE,KAAK;EACpB,CAAC;EAED,IAAIH,KAAK,CAAC,CAAC,CAACG,KAAK;EACjBH,KAAK,CAACF,eAAe,GAAGA,eAAe;EACvCE,KAAK,CAACD,iBAAiB,GAAGA,iBAAiB;EAE3C,IAAI,CAACE,UAAU,EAAE,OAAO;IAAEV,QAAQ,EAAE,KAAK;IAAEC,KAAK,EAAE;EAAG,CAAC;EAEtD,MAAMY,eAAe,GAAGH,UAAU,CAACI,KAAK,CAAC,CAAC,GAAGT,IAAI,EAAE,CAAC,GAAGA,IAAI,GAAGC,MAAM,CAAC;EACrE,OAAO;IACLN,QAAQ,EAAE,kBAAkB,CAACe,IAAI,CAACF,eAAe,CAAC,CAAC,CAAC,CAACG,WAAW,CAAC,CAAC,CAAC;IACnEf,KAAK,EAAEY,eAAe,CAACI,GAAG,CAACC,KAAK,IAAI,UAAUA,KAAK,EAAE,CAAC,CAACC,IAAI,CAAC,IAAI;EAClE,CAAC;AACH","ignoreList":[]} {"version":3,"names":["warnings","Set","deprecationWarning","oldName","newName","prefix","cacheKey","has","add","internal","trace","captureShortStackTrace","console","warn","skip","length","stackTraceLimit","prepareStackTrace","Error","stackTrace","err","stack","shortStackTrace","slice","test","getFileName","map","frame","join"],"sources":["../../src/utils/deprecationWarning.ts"],"sourcesContent":["const warnings = new Set();\n\nexport default function deprecationWarning(\n oldName: string,\n newName: string,\n prefix: string = \"\",\n cacheKey: string = oldName,\n) {\n if (warnings.has(cacheKey)) return;\n warnings.add(cacheKey);\n\n const { internal, trace } = captureShortStackTrace(1, 2);\n if (internal) {\n // If usage comes from an internal package, there is no point in warning because\n // 1. The new version of the package will already use the new API\n // 2. When the deprecation will become an error (in a future major version), users\n // will have to update every package anyway.\n return;\n }\n console.warn(\n `${prefix}\\`${oldName}\\` has been deprecated, please migrate to \\`${newName}\\`\\n${trace}`,\n );\n}\n\nfunction captureShortStackTrace(skip: number, length: number) {\n const { stackTraceLimit, prepareStackTrace } = Error;\n let stackTrace: NodeJS.CallSite[];\n // We add 1 to also take into account this function.\n Error.stackTraceLimit = 1 + skip + length;\n Error.prepareStackTrace = function (err, stack) {\n stackTrace = stack;\n };\n // eslint-disable-next-line @typescript-eslint/no-unused-expressions\n new Error().stack;\n Error.stackTraceLimit = stackTraceLimit;\n Error.prepareStackTrace = prepareStackTrace;\n\n if (!stackTrace) return { internal: false, trace: \"\" };\n\n const shortStackTrace = stackTrace.slice(1 + skip, 1 + skip + length);\n return {\n internal: /[\\\\/]@babel[\\\\/]/.test(shortStackTrace[1].getFileName()),\n trace: shortStackTrace.map(frame => ` at ${frame}`).join(\"\\n\"),\n };\n}\n"],"mappings":";;;;;;AAAA,MAAMA,QAAQ,GAAG,IAAIC,GAAG,CAAC,CAAC;AAEX,SAASC,kBAAkBA,CACxCC,OAAe,EACfC,OAAe,EACfC,MAAc,GAAG,EAAE,EACnBC,QAAgB,GAAGH,OAAO,EAC1B;EACA,IAAIH,QAAQ,CAACO,GAAG,CAACD,QAAQ,CAAC,EAAE;EAC5BN,QAAQ,CAACQ,GAAG,CAACF,QAAQ,CAAC;EAEtB,MAAM;IAAEG,QAAQ;IAAEC;EAAM,CAAC,GAAGC,sBAAsB,CAAC,CAAC,EAAE,CAAC,CAAC;EACxD,IAAIF,QAAQ,EAAE;IAKZ;EACF;EACAG,OAAO,CAACC,IAAI,CACV,GAAGR,MAAM,KAAKF,OAAO,+CAA+CC,OAAO,OAAOM,KAAK,EACzF,CAAC;AACH;AAEA,SAASC,sBAAsBA,CAACG,IAAY,EAAEC,MAAc,EAAE;EAC5D,MAAM;IAAEC,eAAe;IAAEC;EAAkB,CAAC,GAAGC,KAAK;EACpD,IAAIC,UAA6B;EAEjCD,KAAK,CAACF,eAAe,GAAG,CAAC,GAAGF,IAAI,GAAGC,MAAM;EACzCG,KAAK,CAACD,iBAAiB,GAAG,UAAUG,GAAG,EAAEC,KAAK,EAAE;IAC9CF,UAAU,GAAGE,KAAK;EACpB,CAAC;EAED,IAAIH,KAAK,CAAC,CAAC,CAACG,KAAK;EACjBH,KAAK,CAACF,eAAe,GAAGA,eAAe;EACvCE,KAAK,CAACD,iBAAiB,GAAGA,iBAAiB;EAE3C,IAAI,CAACE,UAAU,EAAE,OAAO;IAAEV,QAAQ,EAAE,KAAK;IAAEC,KAAK,EAAE;EAAG,CAAC;EAEtD,MAAMY,eAAe,GAAGH,UAAU,CAACI,KAAK,CAAC,CAAC,GAAGT,IAAI,EAAE,CAAC,GAAGA,IAAI,GAAGC,MAAM,CAAC;EACrE,OAAO;IACLN,QAAQ,EAAE,kBAAkB,CAACe,IAAI,CAACF,eAAe,CAAC,CAAC,CAAC,CAACG,WAAW,CAAC,CAAC,CAAC;IACnEf,KAAK,EAAEY,eAAe,CAACI,GAAG,CAACC,KAAK,IAAI,UAAUA,KAAK,EAAE,CAAC,CAACC,IAAI,CAAC,IAAI;EAClE,CAAC;AACH","ignoreList":[]}

View File

@ -97,6 +97,7 @@ exports.isForXStatement = isForXStatement;
exports.isFunction = isFunction; exports.isFunction = isFunction;
exports.isFunctionDeclaration = isFunctionDeclaration; exports.isFunctionDeclaration = isFunctionDeclaration;
exports.isFunctionExpression = isFunctionExpression; exports.isFunctionExpression = isFunctionExpression;
exports.isFunctionParameter = isFunctionParameter;
exports.isFunctionParent = isFunctionParent; exports.isFunctionParent = isFunctionParent;
exports.isFunctionTypeAnnotation = isFunctionTypeAnnotation; exports.isFunctionTypeAnnotation = isFunctionTypeAnnotation;
exports.isFunctionTypeParam = isFunctionTypeParam; exports.isFunctionTypeParam = isFunctionTypeParam;
@ -304,6 +305,7 @@ exports.isV8IntrinsicIdentifier = isV8IntrinsicIdentifier;
exports.isVariableDeclaration = isVariableDeclaration; exports.isVariableDeclaration = isVariableDeclaration;
exports.isVariableDeclarator = isVariableDeclarator; exports.isVariableDeclarator = isVariableDeclarator;
exports.isVariance = isVariance; exports.isVariance = isVariance;
exports.isVoidPattern = isVoidPattern;
exports.isVoidTypeAnnotation = isVoidTypeAnnotation; exports.isVoidTypeAnnotation = isVoidTypeAnnotation;
exports.isWhile = isWhile; exports.isWhile = isWhile;
exports.isWhileStatement = isWhileStatement; exports.isWhileStatement = isWhileStatement;
@ -1236,6 +1238,11 @@ function isPipelinePrimaryTopicReference(node, opts) {
if (node.type !== "PipelinePrimaryTopicReference") return false; if (node.type !== "PipelinePrimaryTopicReference") return false;
return opts == null || (0, _shallowEqual.default)(node, opts); return opts == null || (0, _shallowEqual.default)(node, opts);
} }
function isVoidPattern(node, opts) {
if (!node) return false;
if (node.type !== "VoidPattern") return false;
return opts == null || (0, _shallowEqual.default)(node, opts);
}
function isTSParameterProperty(node, opts) { function isTSParameterProperty(node, opts) {
if (!node) return false; if (!node) return false;
if (node.type !== "TSParameterProperty") return false; if (node.type !== "TSParameterProperty") return false;
@ -2090,7 +2097,7 @@ function isDeclaration(node, opts) {
} }
return opts == null || (0, _shallowEqual.default)(node, opts); return opts == null || (0, _shallowEqual.default)(node, opts);
} }
function isPatternLike(node, opts) { function isFunctionParameter(node, opts) {
if (!node) return false; if (!node) return false;
switch (node.type) { switch (node.type) {
case "Identifier": case "Identifier":
@ -2098,6 +2105,25 @@ function isPatternLike(node, opts) {
case "AssignmentPattern": case "AssignmentPattern":
case "ArrayPattern": case "ArrayPattern":
case "ObjectPattern": case "ObjectPattern":
case "VoidPattern":
break;
case "Placeholder":
if (node.expectedNode === "Identifier") break;
default:
return false;
}
return opts == null || (0, _shallowEqual.default)(node, opts);
}
function isPatternLike(node, opts) {
if (!node) return false;
switch (node.type) {
case "Identifier":
case "MemberExpression":
case "RestElement":
case "AssignmentPattern":
case "ArrayPattern":
case "ObjectPattern":
case "VoidPattern":
case "TSAsExpression": case "TSAsExpression":
case "TSSatisfiesExpression": case "TSSatisfiesExpression":
case "TSTypeAssertion": case "TSTypeAssertion":
@ -2126,6 +2152,7 @@ function isLVal(node, opts) {
case "AssignmentPattern": case "AssignmentPattern":
case "ArrayPattern": case "ArrayPattern":
case "ObjectPattern": case "ObjectPattern":
case "OptionalMemberExpression":
case "TSParameterProperty": case "TSParameterProperty":
case "TSAsExpression": case "TSAsExpression":
case "TSSatisfiesExpression": case "TSSatisfiesExpression":
@ -2274,6 +2301,7 @@ function isPattern(node, opts) {
case "AssignmentPattern": case "AssignmentPattern":
case "ArrayPattern": case "ArrayPattern":
case "ObjectPattern": case "ObjectPattern":
case "VoidPattern":
break; break;
case "Placeholder": case "Placeholder":
if (node.expectedNode === "Pattern") break; if (node.expectedNode === "Pattern") break;

File diff suppressed because one or more lines are too long

View File

@ -5,12 +5,16 @@ Object.defineProperty(exports, "__esModule", {
}); });
exports.default = matchesPattern; exports.default = matchesPattern;
var _index = require("./generated/index.js"); var _index = require("./generated/index.js");
function isMemberExpressionLike(node) {
return (0, _index.isMemberExpression)(node) || (0, _index.isMetaProperty)(node);
}
function matchesPattern(member, match, allowPartial) { function matchesPattern(member, match, allowPartial) {
if (!(0, _index.isMemberExpression)(member)) return false; if (!isMemberExpressionLike(member)) return false;
const parts = Array.isArray(match) ? match : match.split("."); const parts = Array.isArray(match) ? match : match.split(".");
const nodes = []; const nodes = [];
let node; let node;
for (node = member; (0, _index.isMemberExpression)(node); node = node.object) { for (node = member; isMemberExpressionLike(node); node = (_object = node.object) != null ? _object : node.meta) {
var _object;
nodes.push(node.property); nodes.push(node.property);
} }
nodes.push(node); nodes.push(node);
@ -25,6 +29,10 @@ function matchesPattern(member, match, allowPartial) {
value = node.value; value = node.value;
} else if ((0, _index.isThisExpression)(node)) { } else if ((0, _index.isThisExpression)(node)) {
value = "this"; value = "this";
} else if ((0, _index.isSuper)(node)) {
value = "super";
} else if ((0, _index.isPrivateName)(node)) {
value = "#" + node.id.name;
} else { } else {
return false; return false;
} }

View File

@ -1 +1 @@
{"version":3,"names":["_index","require","matchesPattern","member","match","allowPartial","isMemberExpression","parts","Array","isArray","split","nodes","node","object","push","property","length","i","j","value","isIdentifier","name","isStringLiteral","isThisExpression"],"sources":["../../src/validators/matchesPattern.ts"],"sourcesContent":["import {\n isIdentifier,\n isMemberExpression,\n isStringLiteral,\n isThisExpression,\n} from \"./generated/index.ts\";\nimport type * as t from \"../index.ts\";\n\n/**\n * Determines whether or not the input node `member` matches the\n * input `match`.\n *\n * For example, given the match `React.createClass` it would match the\n * parsed nodes of `React.createClass` and `React[\"createClass\"]`.\n */\nexport default function matchesPattern(\n member: t.Node | null | undefined,\n match: string | string[],\n allowPartial?: boolean,\n): boolean {\n // not a member expression\n if (!isMemberExpression(member)) return false;\n\n const parts = Array.isArray(match) ? match : match.split(\".\");\n const nodes = [];\n\n let node;\n for (node = member; isMemberExpression(node); node = node.object) {\n nodes.push(node.property);\n }\n nodes.push(node);\n\n if (nodes.length < parts.length) return false;\n if (!allowPartial && nodes.length > parts.length) return false;\n\n for (let i = 0, j = nodes.length - 1; i < parts.length; i++, j--) {\n const node = nodes[j];\n let value;\n if (isIdentifier(node)) {\n value = node.name;\n } else if (isStringLiteral(node)) {\n value = node.value;\n } else if (isThisExpression(node)) {\n value = \"this\";\n } else {\n return false;\n }\n\n if (parts[i] !== value) return false;\n }\n\n return true;\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAee,SAASC,cAAcA,CACpCC,MAAiC,EACjCC,KAAwB,EACxBC,YAAsB,EACb;EAET,IAAI,CAAC,IAAAC,yBAAkB,EAACH,MAAM,CAAC,EAAE,OAAO,KAAK;EAE7C,MAAMI,KAAK,GAAGC,KAAK,CAACC,OAAO,CAACL,KAAK,CAAC,GAAGA,KAAK,GAAGA,KAAK,CAACM,KAAK,CAAC,GAAG,CAAC;EAC7D,MAAMC,KAAK,GAAG,EAAE;EAEhB,IAAIC,IAAI;EACR,KAAKA,IAAI,GAAGT,MAAM,EAAE,IAAAG,yBAAkB,EAACM,IAAI,CAAC,EAAEA,IAAI,GAAGA,IAAI,CAACC,MAAM,EAAE;IAChEF,KAAK,CAACG,IAAI,CAACF,IAAI,CAACG,QAAQ,CAAC;EAC3B;EACAJ,KAAK,CAACG,IAAI,CAACF,IAAI,CAAC;EAEhB,IAAID,KAAK,CAACK,MAAM,GAAGT,KAAK,CAACS,MAAM,EAAE,OAAO,KAAK;EAC7C,IAAI,CAACX,YAAY,IAAIM,KAAK,CAACK,MAAM,GAAGT,KAAK,CAACS,MAAM,EAAE,OAAO,KAAK;EAE9D,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEC,CAAC,GAAGP,KAAK,CAACK,MAAM,GAAG,CAAC,EAAEC,CAAC,GAAGV,KAAK,CAACS,MAAM,EAAEC,CAAC,EAAE,EAAEC,CAAC,EAAE,EAAE;IAChE,MAAMN,IAAI,GAAGD,KAAK,CAACO,CAAC,CAAC;IACrB,IAAIC,KAAK;IACT,IAAI,IAAAC,mBAAY,EAACR,IAAI,CAAC,EAAE;MACtBO,KAAK,GAAGP,IAAI,CAACS,IAAI;IACnB,CAAC,MAAM,IAAI,IAAAC,sBAAe,EAACV,IAAI,CAAC,EAAE;MAChCO,KAAK,GAAGP,IAAI,CAACO,KAAK;IACpB,CAAC,MAAM,IAAI,IAAAI,uBAAgB,EAACX,IAAI,CAAC,EAAE;MACjCO,KAAK,GAAG,MAAM;IAChB,CAAC,MAAM;MACL,OAAO,KAAK;IACd;IAEA,IAAIZ,KAAK,CAACU,CAAC,CAAC,KAAKE,KAAK,EAAE,OAAO,KAAK;EACtC;EAEA,OAAO,IAAI;AACb","ignoreList":[]} {"version":3,"names":["_index","require","isMemberExpressionLike","node","isMemberExpression","isMetaProperty","matchesPattern","member","match","allowPartial","parts","Array","isArray","split","nodes","_object","object","meta","push","property","length","i","j","value","isIdentifier","name","isStringLiteral","isThisExpression","isSuper","isPrivateName","id"],"sources":["../../src/validators/matchesPattern.ts"],"sourcesContent":["import {\n isIdentifier,\n isMetaProperty,\n isMemberExpression,\n isPrivateName,\n isStringLiteral,\n isSuper,\n isThisExpression,\n} from \"./generated/index.ts\";\nimport type * as t from \"../index.ts\";\n\nfunction isMemberExpressionLike(\n node: t.Node,\n): node is t.MemberExpression | t.MetaProperty {\n return isMemberExpression(node) || isMetaProperty(node);\n}\n\n/**\n * Determines whether or not the input node `member` matches the\n * input `match`.\n *\n * For example, given the match `React.createClass` it would match the\n * parsed nodes of `React.createClass` and `React[\"createClass\"]`.\n */\nexport default function matchesPattern(\n member: t.Node | null | undefined,\n match: string | string[],\n allowPartial?: boolean,\n): boolean {\n // not a member expression\n if (!isMemberExpressionLike(member)) return false;\n\n const parts = Array.isArray(match) ? match : match.split(\".\");\n const nodes = [];\n\n let node;\n for (\n node = member;\n isMemberExpressionLike(node);\n node = (node as t.MemberExpression).object ?? (node as t.MetaProperty).meta\n ) {\n nodes.push(node.property);\n }\n nodes.push(node);\n\n if (nodes.length < parts.length) return false;\n if (!allowPartial && nodes.length > parts.length) return false;\n\n for (let i = 0, j = nodes.length - 1; i < parts.length; i++, j--) {\n const node = nodes[j];\n let value;\n if (isIdentifier(node)) {\n value = node.name;\n } else if (isStringLiteral(node)) {\n value = node.value;\n } else if (isThisExpression(node)) {\n value = \"this\";\n } else if (isSuper(node)) {\n value = \"super\";\n } else if (isPrivateName(node)) {\n value = \"#\" + node.id.name;\n } else {\n return false;\n }\n\n if (parts[i] !== value) return false;\n }\n\n return true;\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAWA,SAASC,sBAAsBA,CAC7BC,IAAY,EACiC;EAC7C,OAAO,IAAAC,yBAAkB,EAACD,IAAI,CAAC,IAAI,IAAAE,qBAAc,EAACF,IAAI,CAAC;AACzD;AASe,SAASG,cAAcA,CACpCC,MAAiC,EACjCC,KAAwB,EACxBC,YAAsB,EACb;EAET,IAAI,CAACP,sBAAsB,CAACK,MAAM,CAAC,EAAE,OAAO,KAAK;EAEjD,MAAMG,KAAK,GAAGC,KAAK,CAACC,OAAO,CAACJ,KAAK,CAAC,GAAGA,KAAK,GAAGA,KAAK,CAACK,KAAK,CAAC,GAAG,CAAC;EAC7D,MAAMC,KAAK,GAAG,EAAE;EAEhB,IAAIX,IAAI;EACR,KACEA,IAAI,GAAGI,MAAM,EACbL,sBAAsB,CAACC,IAAI,CAAC,EAC5BA,IAAI,IAAAY,OAAA,GAAIZ,IAAI,CAAwBa,MAAM,YAAAD,OAAA,GAAKZ,IAAI,CAAoBc,IAAI,EAC3E;IAAA,IAAAF,OAAA;IACAD,KAAK,CAACI,IAAI,CAACf,IAAI,CAACgB,QAAQ,CAAC;EAC3B;EACAL,KAAK,CAACI,IAAI,CAACf,IAAI,CAAC;EAEhB,IAAIW,KAAK,CAACM,MAAM,GAAGV,KAAK,CAACU,MAAM,EAAE,OAAO,KAAK;EAC7C,IAAI,CAACX,YAAY,IAAIK,KAAK,CAACM,MAAM,GAAGV,KAAK,CAACU,MAAM,EAAE,OAAO,KAAK;EAE9D,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEC,CAAC,GAAGR,KAAK,CAACM,MAAM,GAAG,CAAC,EAAEC,CAAC,GAAGX,KAAK,CAACU,MAAM,EAAEC,CAAC,EAAE,EAAEC,CAAC,EAAE,EAAE;IAChE,MAAMnB,IAAI,GAAGW,KAAK,CAACQ,CAAC,CAAC;IACrB,IAAIC,KAAK;IACT,IAAI,IAAAC,mBAAY,EAACrB,IAAI,CAAC,EAAE;MACtBoB,KAAK,GAAGpB,IAAI,CAACsB,IAAI;IACnB,CAAC,MAAM,IAAI,IAAAC,sBAAe,EAACvB,IAAI,CAAC,EAAE;MAChCoB,KAAK,GAAGpB,IAAI,CAACoB,KAAK;IACpB,CAAC,MAAM,IAAI,IAAAI,uBAAgB,EAACxB,IAAI,CAAC,EAAE;MACjCoB,KAAK,GAAG,MAAM;IAChB,CAAC,MAAM,IAAI,IAAAK,cAAO,EAACzB,IAAI,CAAC,EAAE;MACxBoB,KAAK,GAAG,OAAO;IACjB,CAAC,MAAM,IAAI,IAAAM,oBAAa,EAAC1B,IAAI,CAAC,EAAE;MAC9BoB,KAAK,GAAG,GAAG,GAAGpB,IAAI,CAAC2B,EAAE,CAACL,IAAI;IAC5B,CAAC,MAAM;MACL,OAAO,KAAK;IACd;IAEA,IAAIf,KAAK,CAACW,CAAC,CAAC,KAAKE,KAAK,EAAE,OAAO,KAAK;EACtC;EAEA,OAAO,IAAI;AACb","ignoreList":[]}

View File

@ -1,6 +1,6 @@
{ {
"name": "@babel/types", "name": "@babel/types",
"version": "7.27.0", "version": "7.28.0",
"description": "Babel Types is a Lodash-esque utility library for AST nodes", "description": "Babel Types is a Lodash-esque utility library for AST nodes",
"author": "The Babel Team (https://babel.dev/team)", "author": "The Babel Team (https://babel.dev/team)",
"homepage": "https://babel.dev/docs/en/next/babel-types", "homepage": "https://babel.dev/docs/en/next/babel-types",
@ -16,12 +16,12 @@
}, },
"main": "./lib/index.js", "main": "./lib/index.js",
"dependencies": { "dependencies": {
"@babel/helper-string-parser": "^7.25.9", "@babel/helper-string-parser": "^7.27.1",
"@babel/helper-validator-identifier": "^7.25.9" "@babel/helper-validator-identifier": "^7.27.1"
}, },
"devDependencies": { "devDependencies": {
"@babel/generator": "^7.27.0", "@babel/generator": "^7.28.0",
"@babel/parser": "^7.27.0", "@babel/parser": "^7.28.0",
"glob": "^7.2.0" "glob": "^7.2.0"
}, },
"engines": { "engines": {

View File

@ -1,6 +1,4 @@
The MIT License Copyright 2024 Justin Ridgewell <justin@ridgewell.name>
Copyright (c) 2015 Rich Harris
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal
@ -17,5 +15,5 @@ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
THE SOFTWARE. SOFTWARE.

View File

@ -1,424 +1,423 @@
const comma = ','.charCodeAt(0); // src/vlq.ts
const semicolon = ';'.charCodeAt(0); var comma = ",".charCodeAt(0);
const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; var semicolon = ";".charCodeAt(0);
const intToChar = new Uint8Array(64); // 64 possible chars. var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
const charToInt = new Uint8Array(128); // z is 122 in ASCII var intToChar = new Uint8Array(64);
var charToInt = new Uint8Array(128);
for (let i = 0; i < chars.length; i++) { for (let i = 0; i < chars.length; i++) {
const c = chars.charCodeAt(i); const c = chars.charCodeAt(i);
intToChar[i] = c; intToChar[i] = c;
charToInt[c] = i; charToInt[c] = i;
} }
function decodeInteger(reader, relative) { function decodeInteger(reader, relative) {
let value = 0; let value = 0;
let shift = 0; let shift = 0;
let integer = 0; let integer = 0;
do { do {
const c = reader.next(); const c = reader.next();
integer = charToInt[c]; integer = charToInt[c];
value |= (integer & 31) << shift; value |= (integer & 31) << shift;
shift += 5; shift += 5;
} while (integer & 32); } while (integer & 32);
const shouldNegate = value & 1; const shouldNegate = value & 1;
value >>>= 1; value >>>= 1;
if (shouldNegate) { if (shouldNegate) {
value = -0x80000000 | -value; value = -2147483648 | -value;
} }
return relative + value; return relative + value;
} }
function encodeInteger(builder, num, relative) { function encodeInteger(builder, num, relative) {
let delta = num - relative; let delta = num - relative;
delta = delta < 0 ? (-delta << 1) | 1 : delta << 1; delta = delta < 0 ? -delta << 1 | 1 : delta << 1;
do { do {
let clamped = delta & 0b011111; let clamped = delta & 31;
delta >>>= 5; delta >>>= 5;
if (delta > 0) if (delta > 0) clamped |= 32;
clamped |= 0b100000; builder.write(intToChar[clamped]);
builder.write(intToChar[clamped]); } while (delta > 0);
} while (delta > 0); return num;
return num;
} }
function hasMoreVlq(reader, max) { function hasMoreVlq(reader, max) {
if (reader.pos >= max) if (reader.pos >= max) return false;
return false; return reader.peek() !== comma;
return reader.peek() !== comma;
} }
const bufLength = 1024 * 16; // src/strings.ts
// Provide a fallback for older environments. var bufLength = 1024 * 16;
const td = typeof TextDecoder !== 'undefined' var td = typeof TextDecoder !== "undefined" ? /* @__PURE__ */ new TextDecoder() : typeof Buffer !== "undefined" ? {
? /* #__PURE__ */ new TextDecoder() decode(buf) {
: typeof Buffer !== 'undefined' const out = Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength);
? { return out.toString();
decode(buf) { }
const out = Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength); } : {
return out.toString(); decode(buf) {
}, let out = "";
} for (let i = 0; i < buf.length; i++) {
: { out += String.fromCharCode(buf[i]);
decode(buf) {
let out = '';
for (let i = 0; i < buf.length; i++) {
out += String.fromCharCode(buf[i]);
}
return out;
},
};
class StringWriter {
constructor() {
this.pos = 0;
this.out = '';
this.buffer = new Uint8Array(bufLength);
} }
write(v) { return out;
const { buffer } = this; }
buffer[this.pos++] = v; };
if (this.pos === bufLength) { var StringWriter = class {
this.out += td.decode(buffer); constructor() {
this.pos = 0; this.pos = 0;
} this.out = "";
this.buffer = new Uint8Array(bufLength);
}
write(v) {
const { buffer } = this;
buffer[this.pos++] = v;
if (this.pos === bufLength) {
this.out += td.decode(buffer);
this.pos = 0;
} }
flush() { }
const { buffer, out, pos } = this; flush() {
return pos > 0 ? out + td.decode(buffer.subarray(0, pos)) : out; const { buffer, out, pos } = this;
} return pos > 0 ? out + td.decode(buffer.subarray(0, pos)) : out;
} }
class StringReader { };
constructor(buffer) { var StringReader = class {
this.pos = 0; constructor(buffer) {
this.buffer = buffer; this.pos = 0;
} this.buffer = buffer;
next() { }
return this.buffer.charCodeAt(this.pos++); next() {
} return this.buffer.charCodeAt(this.pos++);
peek() { }
return this.buffer.charCodeAt(this.pos); peek() {
} return this.buffer.charCodeAt(this.pos);
indexOf(char) { }
const { buffer, pos } = this; indexOf(char) {
const idx = buffer.indexOf(char, pos); const { buffer, pos } = this;
return idx === -1 ? buffer.length : idx; const idx = buffer.indexOf(char, pos);
} return idx === -1 ? buffer.length : idx;
} }
};
const EMPTY = []; // src/scopes.ts
var EMPTY = [];
function decodeOriginalScopes(input) { function decodeOriginalScopes(input) {
const { length } = input; const { length } = input;
const reader = new StringReader(input); const reader = new StringReader(input);
const scopes = []; const scopes = [];
const stack = []; const stack = [];
let line = 0; let line = 0;
for (; reader.pos < length; reader.pos++) { for (; reader.pos < length; reader.pos++) {
line = decodeInteger(reader, line); line = decodeInteger(reader, line);
const column = decodeInteger(reader, 0); const column = decodeInteger(reader, 0);
if (!hasMoreVlq(reader, length)) { if (!hasMoreVlq(reader, length)) {
const last = stack.pop(); const last = stack.pop();
last[2] = line; last[2] = line;
last[3] = column; last[3] = column;
continue; continue;
}
const kind = decodeInteger(reader, 0);
const fields = decodeInteger(reader, 0);
const hasName = fields & 0b0001;
const scope = (hasName ? [line, column, 0, 0, kind, decodeInteger(reader, 0)] : [line, column, 0, 0, kind]);
let vars = EMPTY;
if (hasMoreVlq(reader, length)) {
vars = [];
do {
const varsIndex = decodeInteger(reader, 0);
vars.push(varsIndex);
} while (hasMoreVlq(reader, length));
}
scope.vars = vars;
scopes.push(scope);
stack.push(scope);
} }
return scopes; const kind = decodeInteger(reader, 0);
const fields = decodeInteger(reader, 0);
const hasName = fields & 1;
const scope = hasName ? [line, column, 0, 0, kind, decodeInteger(reader, 0)] : [line, column, 0, 0, kind];
let vars = EMPTY;
if (hasMoreVlq(reader, length)) {
vars = [];
do {
const varsIndex = decodeInteger(reader, 0);
vars.push(varsIndex);
} while (hasMoreVlq(reader, length));
}
scope.vars = vars;
scopes.push(scope);
stack.push(scope);
}
return scopes;
} }
function encodeOriginalScopes(scopes) { function encodeOriginalScopes(scopes) {
const writer = new StringWriter(); const writer = new StringWriter();
for (let i = 0; i < scopes.length;) { for (let i = 0; i < scopes.length; ) {
i = _encodeOriginalScopes(scopes, i, writer, [0]); i = _encodeOriginalScopes(scopes, i, writer, [0]);
} }
return writer.flush(); return writer.flush();
} }
function _encodeOriginalScopes(scopes, index, writer, state) { function _encodeOriginalScopes(scopes, index, writer, state) {
const scope = scopes[index]; const scope = scopes[index];
const { 0: startLine, 1: startColumn, 2: endLine, 3: endColumn, 4: kind, vars } = scope; const { 0: startLine, 1: startColumn, 2: endLine, 3: endColumn, 4: kind, vars } = scope;
if (index > 0) if (index > 0) writer.write(comma);
writer.write(comma); state[0] = encodeInteger(writer, startLine, state[0]);
state[0] = encodeInteger(writer, startLine, state[0]); encodeInteger(writer, startColumn, 0);
encodeInteger(writer, startColumn, 0); encodeInteger(writer, kind, 0);
encodeInteger(writer, kind, 0); const fields = scope.length === 6 ? 1 : 0;
const fields = scope.length === 6 ? 0b0001 : 0; encodeInteger(writer, fields, 0);
encodeInteger(writer, fields, 0); if (scope.length === 6) encodeInteger(writer, scope[5], 0);
if (scope.length === 6) for (const v of vars) {
encodeInteger(writer, scope[5], 0); encodeInteger(writer, v, 0);
for (const v of vars) { }
encodeInteger(writer, v, 0); for (index++; index < scopes.length; ) {
const next = scopes[index];
const { 0: l, 1: c } = next;
if (l > endLine || l === endLine && c >= endColumn) {
break;
} }
for (index++; index < scopes.length;) { index = _encodeOriginalScopes(scopes, index, writer, state);
const next = scopes[index]; }
const { 0: l, 1: c } = next; writer.write(comma);
if (l > endLine || (l === endLine && c >= endColumn)) { state[0] = encodeInteger(writer, endLine, state[0]);
break; encodeInteger(writer, endColumn, 0);
} return index;
index = _encodeOriginalScopes(scopes, index, writer, state);
}
writer.write(comma);
state[0] = encodeInteger(writer, endLine, state[0]);
encodeInteger(writer, endColumn, 0);
return index;
} }
function decodeGeneratedRanges(input) { function decodeGeneratedRanges(input) {
const { length } = input; const { length } = input;
const reader = new StringReader(input); const reader = new StringReader(input);
const ranges = []; const ranges = [];
const stack = []; const stack = [];
let genLine = 0; let genLine = 0;
let definitionSourcesIndex = 0; let definitionSourcesIndex = 0;
let definitionScopeIndex = 0; let definitionScopeIndex = 0;
let callsiteSourcesIndex = 0; let callsiteSourcesIndex = 0;
let callsiteLine = 0; let callsiteLine = 0;
let callsiteColumn = 0; let callsiteColumn = 0;
let bindingLine = 0; let bindingLine = 0;
let bindingColumn = 0; let bindingColumn = 0;
do { do {
const semi = reader.indexOf(';'); const semi = reader.indexOf(";");
let genColumn = 0; let genColumn = 0;
for (; reader.pos < semi; reader.pos++) { for (; reader.pos < semi; reader.pos++) {
genColumn = decodeInteger(reader, genColumn); genColumn = decodeInteger(reader, genColumn);
if (!hasMoreVlq(reader, semi)) { if (!hasMoreVlq(reader, semi)) {
const last = stack.pop(); const last = stack.pop();
last[2] = genLine; last[2] = genLine;
last[3] = genColumn; last[3] = genColumn;
continue; continue;
}
const fields = decodeInteger(reader, 0);
const hasDefinition = fields & 1;
const hasCallsite = fields & 2;
const hasScope = fields & 4;
let callsite = null;
let bindings = EMPTY;
let range;
if (hasDefinition) {
const defSourcesIndex = decodeInteger(reader, definitionSourcesIndex);
definitionScopeIndex = decodeInteger(
reader,
definitionSourcesIndex === defSourcesIndex ? definitionScopeIndex : 0
);
definitionSourcesIndex = defSourcesIndex;
range = [genLine, genColumn, 0, 0, defSourcesIndex, definitionScopeIndex];
} else {
range = [genLine, genColumn, 0, 0];
}
range.isScope = !!hasScope;
if (hasCallsite) {
const prevCsi = callsiteSourcesIndex;
const prevLine = callsiteLine;
callsiteSourcesIndex = decodeInteger(reader, callsiteSourcesIndex);
const sameSource = prevCsi === callsiteSourcesIndex;
callsiteLine = decodeInteger(reader, sameSource ? callsiteLine : 0);
callsiteColumn = decodeInteger(
reader,
sameSource && prevLine === callsiteLine ? callsiteColumn : 0
);
callsite = [callsiteSourcesIndex, callsiteLine, callsiteColumn];
}
range.callsite = callsite;
if (hasMoreVlq(reader, semi)) {
bindings = [];
do {
bindingLine = genLine;
bindingColumn = genColumn;
const expressionsCount = decodeInteger(reader, 0);
let expressionRanges;
if (expressionsCount < -1) {
expressionRanges = [[decodeInteger(reader, 0)]];
for (let i = -1; i > expressionsCount; i--) {
const prevBl = bindingLine;
bindingLine = decodeInteger(reader, bindingLine);
bindingColumn = decodeInteger(reader, bindingLine === prevBl ? bindingColumn : 0);
const expression = decodeInteger(reader, 0);
expressionRanges.push([expression, bindingLine, bindingColumn]);
} }
const fields = decodeInteger(reader, 0); } else {
const hasDefinition = fields & 0b0001; expressionRanges = [[expressionsCount]];
const hasCallsite = fields & 0b0010; }
const hasScope = fields & 0b0100; bindings.push(expressionRanges);
let callsite = null; } while (hasMoreVlq(reader, semi));
let bindings = EMPTY; }
let range; range.bindings = bindings;
if (hasDefinition) { ranges.push(range);
const defSourcesIndex = decodeInteger(reader, definitionSourcesIndex); stack.push(range);
definitionScopeIndex = decodeInteger(reader, definitionSourcesIndex === defSourcesIndex ? definitionScopeIndex : 0); }
definitionSourcesIndex = defSourcesIndex; genLine++;
range = [genLine, genColumn, 0, 0, defSourcesIndex, definitionScopeIndex]; reader.pos = semi + 1;
} } while (reader.pos < length);
else { return ranges;
range = [genLine, genColumn, 0, 0];
}
range.isScope = !!hasScope;
if (hasCallsite) {
const prevCsi = callsiteSourcesIndex;
const prevLine = callsiteLine;
callsiteSourcesIndex = decodeInteger(reader, callsiteSourcesIndex);
const sameSource = prevCsi === callsiteSourcesIndex;
callsiteLine = decodeInteger(reader, sameSource ? callsiteLine : 0);
callsiteColumn = decodeInteger(reader, sameSource && prevLine === callsiteLine ? callsiteColumn : 0);
callsite = [callsiteSourcesIndex, callsiteLine, callsiteColumn];
}
range.callsite = callsite;
if (hasMoreVlq(reader, semi)) {
bindings = [];
do {
bindingLine = genLine;
bindingColumn = genColumn;
const expressionsCount = decodeInteger(reader, 0);
let expressionRanges;
if (expressionsCount < -1) {
expressionRanges = [[decodeInteger(reader, 0)]];
for (let i = -1; i > expressionsCount; i--) {
const prevBl = bindingLine;
bindingLine = decodeInteger(reader, bindingLine);
bindingColumn = decodeInteger(reader, bindingLine === prevBl ? bindingColumn : 0);
const expression = decodeInteger(reader, 0);
expressionRanges.push([expression, bindingLine, bindingColumn]);
}
}
else {
expressionRanges = [[expressionsCount]];
}
bindings.push(expressionRanges);
} while (hasMoreVlq(reader, semi));
}
range.bindings = bindings;
ranges.push(range);
stack.push(range);
}
genLine++;
reader.pos = semi + 1;
} while (reader.pos < length);
return ranges;
} }
function encodeGeneratedRanges(ranges) { function encodeGeneratedRanges(ranges) {
if (ranges.length === 0) if (ranges.length === 0) return "";
return ''; const writer = new StringWriter();
const writer = new StringWriter(); for (let i = 0; i < ranges.length; ) {
for (let i = 0; i < ranges.length;) { i = _encodeGeneratedRanges(ranges, i, writer, [0, 0, 0, 0, 0, 0, 0]);
i = _encodeGeneratedRanges(ranges, i, writer, [0, 0, 0, 0, 0, 0, 0]); }
} return writer.flush();
return writer.flush();
} }
function _encodeGeneratedRanges(ranges, index, writer, state) { function _encodeGeneratedRanges(ranges, index, writer, state) {
const range = ranges[index]; const range = ranges[index];
const { 0: startLine, 1: startColumn, 2: endLine, 3: endColumn, isScope, callsite, bindings, } = range; const {
if (state[0] < startLine) { 0: startLine,
catchupLine(writer, state[0], startLine); 1: startColumn,
state[0] = startLine; 2: endLine,
state[1] = 0; 3: endColumn,
isScope,
callsite,
bindings
} = range;
if (state[0] < startLine) {
catchupLine(writer, state[0], startLine);
state[0] = startLine;
state[1] = 0;
} else if (index > 0) {
writer.write(comma);
}
state[1] = encodeInteger(writer, range[1], state[1]);
const fields = (range.length === 6 ? 1 : 0) | (callsite ? 2 : 0) | (isScope ? 4 : 0);
encodeInteger(writer, fields, 0);
if (range.length === 6) {
const { 4: sourcesIndex, 5: scopesIndex } = range;
if (sourcesIndex !== state[2]) {
state[3] = 0;
} }
else if (index > 0) { state[2] = encodeInteger(writer, sourcesIndex, state[2]);
writer.write(comma); state[3] = encodeInteger(writer, scopesIndex, state[3]);
}
if (callsite) {
const { 0: sourcesIndex, 1: callLine, 2: callColumn } = range.callsite;
if (sourcesIndex !== state[4]) {
state[5] = 0;
state[6] = 0;
} else if (callLine !== state[5]) {
state[6] = 0;
} }
state[1] = encodeInteger(writer, range[1], state[1]); state[4] = encodeInteger(writer, sourcesIndex, state[4]);
const fields = (range.length === 6 ? 0b0001 : 0) | (callsite ? 0b0010 : 0) | (isScope ? 0b0100 : 0); state[5] = encodeInteger(writer, callLine, state[5]);
encodeInteger(writer, fields, 0); state[6] = encodeInteger(writer, callColumn, state[6]);
if (range.length === 6) { }
const { 4: sourcesIndex, 5: scopesIndex } = range; if (bindings) {
if (sourcesIndex !== state[2]) { for (const binding of bindings) {
state[3] = 0; if (binding.length > 1) encodeInteger(writer, -binding.length, 0);
} const expression = binding[0][0];
state[2] = encodeInteger(writer, sourcesIndex, state[2]); encodeInteger(writer, expression, 0);
state[3] = encodeInteger(writer, scopesIndex, state[3]); let bindingStartLine = startLine;
let bindingStartColumn = startColumn;
for (let i = 1; i < binding.length; i++) {
const expRange = binding[i];
bindingStartLine = encodeInteger(writer, expRange[1], bindingStartLine);
bindingStartColumn = encodeInteger(writer, expRange[2], bindingStartColumn);
encodeInteger(writer, expRange[0], 0);
}
} }
if (callsite) { }
const { 0: sourcesIndex, 1: callLine, 2: callColumn } = range.callsite; for (index++; index < ranges.length; ) {
if (sourcesIndex !== state[4]) { const next = ranges[index];
state[5] = 0; const { 0: l, 1: c } = next;
state[6] = 0; if (l > endLine || l === endLine && c >= endColumn) {
} break;
else if (callLine !== state[5]) {
state[6] = 0;
}
state[4] = encodeInteger(writer, sourcesIndex, state[4]);
state[5] = encodeInteger(writer, callLine, state[5]);
state[6] = encodeInteger(writer, callColumn, state[6]);
} }
if (bindings) { index = _encodeGeneratedRanges(ranges, index, writer, state);
for (const binding of bindings) { }
if (binding.length > 1) if (state[0] < endLine) {
encodeInteger(writer, -binding.length, 0); catchupLine(writer, state[0], endLine);
const expression = binding[0][0]; state[0] = endLine;
encodeInteger(writer, expression, 0); state[1] = 0;
let bindingStartLine = startLine; } else {
let bindingStartColumn = startColumn; writer.write(comma);
for (let i = 1; i < binding.length; i++) { }
const expRange = binding[i]; state[1] = encodeInteger(writer, endColumn, state[1]);
bindingStartLine = encodeInteger(writer, expRange[1], bindingStartLine); return index;
bindingStartColumn = encodeInteger(writer, expRange[2], bindingStartColumn);
encodeInteger(writer, expRange[0], 0);
}
}
}
for (index++; index < ranges.length;) {
const next = ranges[index];
const { 0: l, 1: c } = next;
if (l > endLine || (l === endLine && c >= endColumn)) {
break;
}
index = _encodeGeneratedRanges(ranges, index, writer, state);
}
if (state[0] < endLine) {
catchupLine(writer, state[0], endLine);
state[0] = endLine;
state[1] = 0;
}
else {
writer.write(comma);
}
state[1] = encodeInteger(writer, endColumn, state[1]);
return index;
} }
function catchupLine(writer, lastLine, line) { function catchupLine(writer, lastLine, line) {
do { do {
writer.write(semicolon); writer.write(semicolon);
} while (++lastLine < line); } while (++lastLine < line);
} }
// src/sourcemap-codec.ts
function decode(mappings) { function decode(mappings) {
const { length } = mappings; const { length } = mappings;
const reader = new StringReader(mappings); const reader = new StringReader(mappings);
const decoded = []; const decoded = [];
let genColumn = 0; let genColumn = 0;
let sourcesIndex = 0; let sourcesIndex = 0;
let sourceLine = 0; let sourceLine = 0;
let sourceColumn = 0; let sourceColumn = 0;
let namesIndex = 0; let namesIndex = 0;
do { do {
const semi = reader.indexOf(';'); const semi = reader.indexOf(";");
const line = []; const line = [];
let sorted = true; let sorted = true;
let lastCol = 0; let lastCol = 0;
genColumn = 0; genColumn = 0;
while (reader.pos < semi) { while (reader.pos < semi) {
let seg; let seg;
genColumn = decodeInteger(reader, genColumn); genColumn = decodeInteger(reader, genColumn);
if (genColumn < lastCol) if (genColumn < lastCol) sorted = false;
sorted = false; lastCol = genColumn;
lastCol = genColumn; if (hasMoreVlq(reader, semi)) {
if (hasMoreVlq(reader, semi)) { sourcesIndex = decodeInteger(reader, sourcesIndex);
sourcesIndex = decodeInteger(reader, sourcesIndex); sourceLine = decodeInteger(reader, sourceLine);
sourceLine = decodeInteger(reader, sourceLine); sourceColumn = decodeInteger(reader, sourceColumn);
sourceColumn = decodeInteger(reader, sourceColumn); if (hasMoreVlq(reader, semi)) {
if (hasMoreVlq(reader, semi)) { namesIndex = decodeInteger(reader, namesIndex);
namesIndex = decodeInteger(reader, namesIndex); seg = [genColumn, sourcesIndex, sourceLine, sourceColumn, namesIndex];
seg = [genColumn, sourcesIndex, sourceLine, sourceColumn, namesIndex]; } else {
} seg = [genColumn, sourcesIndex, sourceLine, sourceColumn];
else {
seg = [genColumn, sourcesIndex, sourceLine, sourceColumn];
}
}
else {
seg = [genColumn];
}
line.push(seg);
reader.pos++;
} }
if (!sorted) } else {
sort(line); seg = [genColumn];
decoded.push(line); }
reader.pos = semi + 1; line.push(seg);
} while (reader.pos <= length); reader.pos++;
return decoded; }
if (!sorted) sort(line);
decoded.push(line);
reader.pos = semi + 1;
} while (reader.pos <= length);
return decoded;
} }
function sort(line) { function sort(line) {
line.sort(sortComparator); line.sort(sortComparator);
} }
function sortComparator(a, b) { function sortComparator(a, b) {
return a[0] - b[0]; return a[0] - b[0];
} }
function encode(decoded) { function encode(decoded) {
const writer = new StringWriter(); const writer = new StringWriter();
let sourcesIndex = 0; let sourcesIndex = 0;
let sourceLine = 0; let sourceLine = 0;
let sourceColumn = 0; let sourceColumn = 0;
let namesIndex = 0; let namesIndex = 0;
for (let i = 0; i < decoded.length; i++) { for (let i = 0; i < decoded.length; i++) {
const line = decoded[i]; const line = decoded[i];
if (i > 0) if (i > 0) writer.write(semicolon);
writer.write(semicolon); if (line.length === 0) continue;
if (line.length === 0) let genColumn = 0;
continue; for (let j = 0; j < line.length; j++) {
let genColumn = 0; const segment = line[j];
for (let j = 0; j < line.length; j++) { if (j > 0) writer.write(comma);
const segment = line[j]; genColumn = encodeInteger(writer, segment[0], genColumn);
if (j > 0) if (segment.length === 1) continue;
writer.write(comma); sourcesIndex = encodeInteger(writer, segment[1], sourcesIndex);
genColumn = encodeInteger(writer, segment[0], genColumn); sourceLine = encodeInteger(writer, segment[2], sourceLine);
if (segment.length === 1) sourceColumn = encodeInteger(writer, segment[3], sourceColumn);
continue; if (segment.length === 4) continue;
sourcesIndex = encodeInteger(writer, segment[1], sourcesIndex); namesIndex = encodeInteger(writer, segment[4], namesIndex);
sourceLine = encodeInteger(writer, segment[2], sourceLine);
sourceColumn = encodeInteger(writer, segment[3], sourceColumn);
if (segment.length === 4)
continue;
namesIndex = encodeInteger(writer, segment[4], namesIndex);
}
} }
return writer.flush(); }
return writer.flush();
} }
export {
export { decode, decodeGeneratedRanges, decodeOriginalScopes, encode, encodeGeneratedRanges, encodeOriginalScopes }; decode,
decodeGeneratedRanges,
decodeOriginalScopes,
encode,
encodeGeneratedRanges,
encodeOriginalScopes
};
//# sourceMappingURL=sourcemap-codec.mjs.map //# sourceMappingURL=sourcemap-codec.mjs.map

File diff suppressed because one or more lines are too long

View File

@ -1,439 +1,452 @@
(function (global, factory) { (function (global, factory, m) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : typeof exports === 'object' && typeof module !== 'undefined' ? factory(module) :
typeof define === 'function' && define.amd ? define(['exports'], factory) : typeof define === 'function' && define.amd ? define(['module'], factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.sourcemapCodec = {})); (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(m = { exports: {} }), global.sourcemapCodec = 'default' in m.exports ? m.exports.default : m.exports);
})(this, (function (exports) { 'use strict'; })(this, (function (module) {
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
const comma = ','.charCodeAt(0); // src/sourcemap-codec.ts
const semicolon = ';'.charCodeAt(0); var sourcemap_codec_exports = {};
const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; __export(sourcemap_codec_exports, {
const intToChar = new Uint8Array(64); // 64 possible chars. decode: () => decode,
const charToInt = new Uint8Array(128); // z is 122 in ASCII decodeGeneratedRanges: () => decodeGeneratedRanges,
for (let i = 0; i < chars.length; i++) { decodeOriginalScopes: () => decodeOriginalScopes,
const c = chars.charCodeAt(i); encode: () => encode,
intToChar[i] = c; encodeGeneratedRanges: () => encodeGeneratedRanges,
charToInt[c] = i; encodeOriginalScopes: () => encodeOriginalScopes
});
module.exports = __toCommonJS(sourcemap_codec_exports);
// src/vlq.ts
var comma = ",".charCodeAt(0);
var semicolon = ";".charCodeAt(0);
var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
var intToChar = new Uint8Array(64);
var charToInt = new Uint8Array(128);
for (let i = 0; i < chars.length; i++) {
const c = chars.charCodeAt(i);
intToChar[i] = c;
charToInt[c] = i;
}
function decodeInteger(reader, relative) {
let value = 0;
let shift = 0;
let integer = 0;
do {
const c = reader.next();
integer = charToInt[c];
value |= (integer & 31) << shift;
shift += 5;
} while (integer & 32);
const shouldNegate = value & 1;
value >>>= 1;
if (shouldNegate) {
value = -2147483648 | -value;
}
return relative + value;
}
function encodeInteger(builder, num, relative) {
let delta = num - relative;
delta = delta < 0 ? -delta << 1 | 1 : delta << 1;
do {
let clamped = delta & 31;
delta >>>= 5;
if (delta > 0) clamped |= 32;
builder.write(intToChar[clamped]);
} while (delta > 0);
return num;
}
function hasMoreVlq(reader, max) {
if (reader.pos >= max) return false;
return reader.peek() !== comma;
}
// src/strings.ts
var bufLength = 1024 * 16;
var td = typeof TextDecoder !== "undefined" ? /* @__PURE__ */ new TextDecoder() : typeof Buffer !== "undefined" ? {
decode(buf) {
const out = Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength);
return out.toString();
}
} : {
decode(buf) {
let out = "";
for (let i = 0; i < buf.length; i++) {
out += String.fromCharCode(buf[i]);
} }
function decodeInteger(reader, relative) { return out;
let value = 0; }
let shift = 0; };
let integer = 0; var StringWriter = class {
constructor() {
this.pos = 0;
this.out = "";
this.buffer = new Uint8Array(bufLength);
}
write(v) {
const { buffer } = this;
buffer[this.pos++] = v;
if (this.pos === bufLength) {
this.out += td.decode(buffer);
this.pos = 0;
}
}
flush() {
const { buffer, out, pos } = this;
return pos > 0 ? out + td.decode(buffer.subarray(0, pos)) : out;
}
};
var StringReader = class {
constructor(buffer) {
this.pos = 0;
this.buffer = buffer;
}
next() {
return this.buffer.charCodeAt(this.pos++);
}
peek() {
return this.buffer.charCodeAt(this.pos);
}
indexOf(char) {
const { buffer, pos } = this;
const idx = buffer.indexOf(char, pos);
return idx === -1 ? buffer.length : idx;
}
};
// src/scopes.ts
var EMPTY = [];
function decodeOriginalScopes(input) {
const { length } = input;
const reader = new StringReader(input);
const scopes = [];
const stack = [];
let line = 0;
for (; reader.pos < length; reader.pos++) {
line = decodeInteger(reader, line);
const column = decodeInteger(reader, 0);
if (!hasMoreVlq(reader, length)) {
const last = stack.pop();
last[2] = line;
last[3] = column;
continue;
}
const kind = decodeInteger(reader, 0);
const fields = decodeInteger(reader, 0);
const hasName = fields & 1;
const scope = hasName ? [line, column, 0, 0, kind, decodeInteger(reader, 0)] : [line, column, 0, 0, kind];
let vars = EMPTY;
if (hasMoreVlq(reader, length)) {
vars = [];
do {
const varsIndex = decodeInteger(reader, 0);
vars.push(varsIndex);
} while (hasMoreVlq(reader, length));
}
scope.vars = vars;
scopes.push(scope);
stack.push(scope);
}
return scopes;
}
function encodeOriginalScopes(scopes) {
const writer = new StringWriter();
for (let i = 0; i < scopes.length; ) {
i = _encodeOriginalScopes(scopes, i, writer, [0]);
}
return writer.flush();
}
function _encodeOriginalScopes(scopes, index, writer, state) {
const scope = scopes[index];
const { 0: startLine, 1: startColumn, 2: endLine, 3: endColumn, 4: kind, vars } = scope;
if (index > 0) writer.write(comma);
state[0] = encodeInteger(writer, startLine, state[0]);
encodeInteger(writer, startColumn, 0);
encodeInteger(writer, kind, 0);
const fields = scope.length === 6 ? 1 : 0;
encodeInteger(writer, fields, 0);
if (scope.length === 6) encodeInteger(writer, scope[5], 0);
for (const v of vars) {
encodeInteger(writer, v, 0);
}
for (index++; index < scopes.length; ) {
const next = scopes[index];
const { 0: l, 1: c } = next;
if (l > endLine || l === endLine && c >= endColumn) {
break;
}
index = _encodeOriginalScopes(scopes, index, writer, state);
}
writer.write(comma);
state[0] = encodeInteger(writer, endLine, state[0]);
encodeInteger(writer, endColumn, 0);
return index;
}
function decodeGeneratedRanges(input) {
const { length } = input;
const reader = new StringReader(input);
const ranges = [];
const stack = [];
let genLine = 0;
let definitionSourcesIndex = 0;
let definitionScopeIndex = 0;
let callsiteSourcesIndex = 0;
let callsiteLine = 0;
let callsiteColumn = 0;
let bindingLine = 0;
let bindingColumn = 0;
do {
const semi = reader.indexOf(";");
let genColumn = 0;
for (; reader.pos < semi; reader.pos++) {
genColumn = decodeInteger(reader, genColumn);
if (!hasMoreVlq(reader, semi)) {
const last = stack.pop();
last[2] = genLine;
last[3] = genColumn;
continue;
}
const fields = decodeInteger(reader, 0);
const hasDefinition = fields & 1;
const hasCallsite = fields & 2;
const hasScope = fields & 4;
let callsite = null;
let bindings = EMPTY;
let range;
if (hasDefinition) {
const defSourcesIndex = decodeInteger(reader, definitionSourcesIndex);
definitionScopeIndex = decodeInteger(
reader,
definitionSourcesIndex === defSourcesIndex ? definitionScopeIndex : 0
);
definitionSourcesIndex = defSourcesIndex;
range = [genLine, genColumn, 0, 0, defSourcesIndex, definitionScopeIndex];
} else {
range = [genLine, genColumn, 0, 0];
}
range.isScope = !!hasScope;
if (hasCallsite) {
const prevCsi = callsiteSourcesIndex;
const prevLine = callsiteLine;
callsiteSourcesIndex = decodeInteger(reader, callsiteSourcesIndex);
const sameSource = prevCsi === callsiteSourcesIndex;
callsiteLine = decodeInteger(reader, sameSource ? callsiteLine : 0);
callsiteColumn = decodeInteger(
reader,
sameSource && prevLine === callsiteLine ? callsiteColumn : 0
);
callsite = [callsiteSourcesIndex, callsiteLine, callsiteColumn];
}
range.callsite = callsite;
if (hasMoreVlq(reader, semi)) {
bindings = [];
do { do {
const c = reader.next(); bindingLine = genLine;
integer = charToInt[c]; bindingColumn = genColumn;
value |= (integer & 31) << shift; const expressionsCount = decodeInteger(reader, 0);
shift += 5; let expressionRanges;
} while (integer & 32); if (expressionsCount < -1) {
const shouldNegate = value & 1; expressionRanges = [[decodeInteger(reader, 0)]];
value >>>= 1; for (let i = -1; i > expressionsCount; i--) {
if (shouldNegate) { const prevBl = bindingLine;
value = -0x80000000 | -value; bindingLine = decodeInteger(reader, bindingLine);
} bindingColumn = decodeInteger(reader, bindingLine === prevBl ? bindingColumn : 0);
return relative + value; const expression = decodeInteger(reader, 0);
expressionRanges.push([expression, bindingLine, bindingColumn]);
}
} else {
expressionRanges = [[expressionsCount]];
}
bindings.push(expressionRanges);
} while (hasMoreVlq(reader, semi));
}
range.bindings = bindings;
ranges.push(range);
stack.push(range);
} }
function encodeInteger(builder, num, relative) { genLine++;
let delta = num - relative; reader.pos = semi + 1;
delta = delta < 0 ? (-delta << 1) | 1 : delta << 1; } while (reader.pos < length);
do { return ranges;
let clamped = delta & 0b011111; }
delta >>>= 5; function encodeGeneratedRanges(ranges) {
if (delta > 0) if (ranges.length === 0) return "";
clamped |= 0b100000; const writer = new StringWriter();
builder.write(intToChar[clamped]); for (let i = 0; i < ranges.length; ) {
} while (delta > 0); i = _encodeGeneratedRanges(ranges, i, writer, [0, 0, 0, 0, 0, 0, 0]);
return num; }
return writer.flush();
}
function _encodeGeneratedRanges(ranges, index, writer, state) {
const range = ranges[index];
const {
0: startLine,
1: startColumn,
2: endLine,
3: endColumn,
isScope,
callsite,
bindings
} = range;
if (state[0] < startLine) {
catchupLine(writer, state[0], startLine);
state[0] = startLine;
state[1] = 0;
} else if (index > 0) {
writer.write(comma);
}
state[1] = encodeInteger(writer, range[1], state[1]);
const fields = (range.length === 6 ? 1 : 0) | (callsite ? 2 : 0) | (isScope ? 4 : 0);
encodeInteger(writer, fields, 0);
if (range.length === 6) {
const { 4: sourcesIndex, 5: scopesIndex } = range;
if (sourcesIndex !== state[2]) {
state[3] = 0;
} }
function hasMoreVlq(reader, max) { state[2] = encodeInteger(writer, sourcesIndex, state[2]);
if (reader.pos >= max) state[3] = encodeInteger(writer, scopesIndex, state[3]);
return false; }
return reader.peek() !== comma; if (callsite) {
const { 0: sourcesIndex, 1: callLine, 2: callColumn } = range.callsite;
if (sourcesIndex !== state[4]) {
state[5] = 0;
state[6] = 0;
} else if (callLine !== state[5]) {
state[6] = 0;
} }
state[4] = encodeInteger(writer, sourcesIndex, state[4]);
state[5] = encodeInteger(writer, callLine, state[5]);
state[6] = encodeInteger(writer, callColumn, state[6]);
}
if (bindings) {
for (const binding of bindings) {
if (binding.length > 1) encodeInteger(writer, -binding.length, 0);
const expression = binding[0][0];
encodeInteger(writer, expression, 0);
let bindingStartLine = startLine;
let bindingStartColumn = startColumn;
for (let i = 1; i < binding.length; i++) {
const expRange = binding[i];
bindingStartLine = encodeInteger(writer, expRange[1], bindingStartLine);
bindingStartColumn = encodeInteger(writer, expRange[2], bindingStartColumn);
encodeInteger(writer, expRange[0], 0);
}
}
}
for (index++; index < ranges.length; ) {
const next = ranges[index];
const { 0: l, 1: c } = next;
if (l > endLine || l === endLine && c >= endColumn) {
break;
}
index = _encodeGeneratedRanges(ranges, index, writer, state);
}
if (state[0] < endLine) {
catchupLine(writer, state[0], endLine);
state[0] = endLine;
state[1] = 0;
} else {
writer.write(comma);
}
state[1] = encodeInteger(writer, endColumn, state[1]);
return index;
}
function catchupLine(writer, lastLine, line) {
do {
writer.write(semicolon);
} while (++lastLine < line);
}
const bufLength = 1024 * 16; // src/sourcemap-codec.ts
// Provide a fallback for older environments. function decode(mappings) {
const td = typeof TextDecoder !== 'undefined' const { length } = mappings;
? /* #__PURE__ */ new TextDecoder() const reader = new StringReader(mappings);
: typeof Buffer !== 'undefined' const decoded = [];
? { let genColumn = 0;
decode(buf) { let sourcesIndex = 0;
const out = Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength); let sourceLine = 0;
return out.toString(); let sourceColumn = 0;
}, let namesIndex = 0;
} do {
: { const semi = reader.indexOf(";");
decode(buf) { const line = [];
let out = ''; let sorted = true;
for (let i = 0; i < buf.length; i++) { let lastCol = 0;
out += String.fromCharCode(buf[i]); genColumn = 0;
} while (reader.pos < semi) {
return out; let seg;
}, genColumn = decodeInteger(reader, genColumn);
}; if (genColumn < lastCol) sorted = false;
class StringWriter { lastCol = genColumn;
constructor() { if (hasMoreVlq(reader, semi)) {
this.pos = 0; sourcesIndex = decodeInteger(reader, sourcesIndex);
this.out = ''; sourceLine = decodeInteger(reader, sourceLine);
this.buffer = new Uint8Array(bufLength); sourceColumn = decodeInteger(reader, sourceColumn);
} if (hasMoreVlq(reader, semi)) {
write(v) { namesIndex = decodeInteger(reader, namesIndex);
const { buffer } = this; seg = [genColumn, sourcesIndex, sourceLine, sourceColumn, namesIndex];
buffer[this.pos++] = v; } else {
if (this.pos === bufLength) { seg = [genColumn, sourcesIndex, sourceLine, sourceColumn];
this.out += td.decode(buffer);
this.pos = 0;
}
}
flush() {
const { buffer, out, pos } = this;
return pos > 0 ? out + td.decode(buffer.subarray(0, pos)) : out;
} }
} else {
seg = [genColumn];
}
line.push(seg);
reader.pos++;
} }
class StringReader { if (!sorted) sort(line);
constructor(buffer) { decoded.push(line);
this.pos = 0; reader.pos = semi + 1;
this.buffer = buffer; } while (reader.pos <= length);
} return decoded;
next() { }
return this.buffer.charCodeAt(this.pos++); function sort(line) {
} line.sort(sortComparator);
peek() { }
return this.buffer.charCodeAt(this.pos); function sortComparator(a, b) {
} return a[0] - b[0];
indexOf(char) { }
const { buffer, pos } = this; function encode(decoded) {
const idx = buffer.indexOf(char, pos); const writer = new StringWriter();
return idx === -1 ? buffer.length : idx; let sourcesIndex = 0;
} let sourceLine = 0;
let sourceColumn = 0;
let namesIndex = 0;
for (let i = 0; i < decoded.length; i++) {
const line = decoded[i];
if (i > 0) writer.write(semicolon);
if (line.length === 0) continue;
let genColumn = 0;
for (let j = 0; j < line.length; j++) {
const segment = line[j];
if (j > 0) writer.write(comma);
genColumn = encodeInteger(writer, segment[0], genColumn);
if (segment.length === 1) continue;
sourcesIndex = encodeInteger(writer, segment[1], sourcesIndex);
sourceLine = encodeInteger(writer, segment[2], sourceLine);
sourceColumn = encodeInteger(writer, segment[3], sourceColumn);
if (segment.length === 4) continue;
namesIndex = encodeInteger(writer, segment[4], namesIndex);
} }
}
const EMPTY = []; return writer.flush();
function decodeOriginalScopes(input) { }
const { length } = input;
const reader = new StringReader(input);
const scopes = [];
const stack = [];
let line = 0;
for (; reader.pos < length; reader.pos++) {
line = decodeInteger(reader, line);
const column = decodeInteger(reader, 0);
if (!hasMoreVlq(reader, length)) {
const last = stack.pop();
last[2] = line;
last[3] = column;
continue;
}
const kind = decodeInteger(reader, 0);
const fields = decodeInteger(reader, 0);
const hasName = fields & 0b0001;
const scope = (hasName ? [line, column, 0, 0, kind, decodeInteger(reader, 0)] : [line, column, 0, 0, kind]);
let vars = EMPTY;
if (hasMoreVlq(reader, length)) {
vars = [];
do {
const varsIndex = decodeInteger(reader, 0);
vars.push(varsIndex);
} while (hasMoreVlq(reader, length));
}
scope.vars = vars;
scopes.push(scope);
stack.push(scope);
}
return scopes;
}
function encodeOriginalScopes(scopes) {
const writer = new StringWriter();
for (let i = 0; i < scopes.length;) {
i = _encodeOriginalScopes(scopes, i, writer, [0]);
}
return writer.flush();
}
function _encodeOriginalScopes(scopes, index, writer, state) {
const scope = scopes[index];
const { 0: startLine, 1: startColumn, 2: endLine, 3: endColumn, 4: kind, vars } = scope;
if (index > 0)
writer.write(comma);
state[0] = encodeInteger(writer, startLine, state[0]);
encodeInteger(writer, startColumn, 0);
encodeInteger(writer, kind, 0);
const fields = scope.length === 6 ? 0b0001 : 0;
encodeInteger(writer, fields, 0);
if (scope.length === 6)
encodeInteger(writer, scope[5], 0);
for (const v of vars) {
encodeInteger(writer, v, 0);
}
for (index++; index < scopes.length;) {
const next = scopes[index];
const { 0: l, 1: c } = next;
if (l > endLine || (l === endLine && c >= endColumn)) {
break;
}
index = _encodeOriginalScopes(scopes, index, writer, state);
}
writer.write(comma);
state[0] = encodeInteger(writer, endLine, state[0]);
encodeInteger(writer, endColumn, 0);
return index;
}
function decodeGeneratedRanges(input) {
const { length } = input;
const reader = new StringReader(input);
const ranges = [];
const stack = [];
let genLine = 0;
let definitionSourcesIndex = 0;
let definitionScopeIndex = 0;
let callsiteSourcesIndex = 0;
let callsiteLine = 0;
let callsiteColumn = 0;
let bindingLine = 0;
let bindingColumn = 0;
do {
const semi = reader.indexOf(';');
let genColumn = 0;
for (; reader.pos < semi; reader.pos++) {
genColumn = decodeInteger(reader, genColumn);
if (!hasMoreVlq(reader, semi)) {
const last = stack.pop();
last[2] = genLine;
last[3] = genColumn;
continue;
}
const fields = decodeInteger(reader, 0);
const hasDefinition = fields & 0b0001;
const hasCallsite = fields & 0b0010;
const hasScope = fields & 0b0100;
let callsite = null;
let bindings = EMPTY;
let range;
if (hasDefinition) {
const defSourcesIndex = decodeInteger(reader, definitionSourcesIndex);
definitionScopeIndex = decodeInteger(reader, definitionSourcesIndex === defSourcesIndex ? definitionScopeIndex : 0);
definitionSourcesIndex = defSourcesIndex;
range = [genLine, genColumn, 0, 0, defSourcesIndex, definitionScopeIndex];
}
else {
range = [genLine, genColumn, 0, 0];
}
range.isScope = !!hasScope;
if (hasCallsite) {
const prevCsi = callsiteSourcesIndex;
const prevLine = callsiteLine;
callsiteSourcesIndex = decodeInteger(reader, callsiteSourcesIndex);
const sameSource = prevCsi === callsiteSourcesIndex;
callsiteLine = decodeInteger(reader, sameSource ? callsiteLine : 0);
callsiteColumn = decodeInteger(reader, sameSource && prevLine === callsiteLine ? callsiteColumn : 0);
callsite = [callsiteSourcesIndex, callsiteLine, callsiteColumn];
}
range.callsite = callsite;
if (hasMoreVlq(reader, semi)) {
bindings = [];
do {
bindingLine = genLine;
bindingColumn = genColumn;
const expressionsCount = decodeInteger(reader, 0);
let expressionRanges;
if (expressionsCount < -1) {
expressionRanges = [[decodeInteger(reader, 0)]];
for (let i = -1; i > expressionsCount; i--) {
const prevBl = bindingLine;
bindingLine = decodeInteger(reader, bindingLine);
bindingColumn = decodeInteger(reader, bindingLine === prevBl ? bindingColumn : 0);
const expression = decodeInteger(reader, 0);
expressionRanges.push([expression, bindingLine, bindingColumn]);
}
}
else {
expressionRanges = [[expressionsCount]];
}
bindings.push(expressionRanges);
} while (hasMoreVlq(reader, semi));
}
range.bindings = bindings;
ranges.push(range);
stack.push(range);
}
genLine++;
reader.pos = semi + 1;
} while (reader.pos < length);
return ranges;
}
function encodeGeneratedRanges(ranges) {
if (ranges.length === 0)
return '';
const writer = new StringWriter();
for (let i = 0; i < ranges.length;) {
i = _encodeGeneratedRanges(ranges, i, writer, [0, 0, 0, 0, 0, 0, 0]);
}
return writer.flush();
}
function _encodeGeneratedRanges(ranges, index, writer, state) {
const range = ranges[index];
const { 0: startLine, 1: startColumn, 2: endLine, 3: endColumn, isScope, callsite, bindings, } = range;
if (state[0] < startLine) {
catchupLine(writer, state[0], startLine);
state[0] = startLine;
state[1] = 0;
}
else if (index > 0) {
writer.write(comma);
}
state[1] = encodeInteger(writer, range[1], state[1]);
const fields = (range.length === 6 ? 0b0001 : 0) | (callsite ? 0b0010 : 0) | (isScope ? 0b0100 : 0);
encodeInteger(writer, fields, 0);
if (range.length === 6) {
const { 4: sourcesIndex, 5: scopesIndex } = range;
if (sourcesIndex !== state[2]) {
state[3] = 0;
}
state[2] = encodeInteger(writer, sourcesIndex, state[2]);
state[3] = encodeInteger(writer, scopesIndex, state[3]);
}
if (callsite) {
const { 0: sourcesIndex, 1: callLine, 2: callColumn } = range.callsite;
if (sourcesIndex !== state[4]) {
state[5] = 0;
state[6] = 0;
}
else if (callLine !== state[5]) {
state[6] = 0;
}
state[4] = encodeInteger(writer, sourcesIndex, state[4]);
state[5] = encodeInteger(writer, callLine, state[5]);
state[6] = encodeInteger(writer, callColumn, state[6]);
}
if (bindings) {
for (const binding of bindings) {
if (binding.length > 1)
encodeInteger(writer, -binding.length, 0);
const expression = binding[0][0];
encodeInteger(writer, expression, 0);
let bindingStartLine = startLine;
let bindingStartColumn = startColumn;
for (let i = 1; i < binding.length; i++) {
const expRange = binding[i];
bindingStartLine = encodeInteger(writer, expRange[1], bindingStartLine);
bindingStartColumn = encodeInteger(writer, expRange[2], bindingStartColumn);
encodeInteger(writer, expRange[0], 0);
}
}
}
for (index++; index < ranges.length;) {
const next = ranges[index];
const { 0: l, 1: c } = next;
if (l > endLine || (l === endLine && c >= endColumn)) {
break;
}
index = _encodeGeneratedRanges(ranges, index, writer, state);
}
if (state[0] < endLine) {
catchupLine(writer, state[0], endLine);
state[0] = endLine;
state[1] = 0;
}
else {
writer.write(comma);
}
state[1] = encodeInteger(writer, endColumn, state[1]);
return index;
}
function catchupLine(writer, lastLine, line) {
do {
writer.write(semicolon);
} while (++lastLine < line);
}
function decode(mappings) {
const { length } = mappings;
const reader = new StringReader(mappings);
const decoded = [];
let genColumn = 0;
let sourcesIndex = 0;
let sourceLine = 0;
let sourceColumn = 0;
let namesIndex = 0;
do {
const semi = reader.indexOf(';');
const line = [];
let sorted = true;
let lastCol = 0;
genColumn = 0;
while (reader.pos < semi) {
let seg;
genColumn = decodeInteger(reader, genColumn);
if (genColumn < lastCol)
sorted = false;
lastCol = genColumn;
if (hasMoreVlq(reader, semi)) {
sourcesIndex = decodeInteger(reader, sourcesIndex);
sourceLine = decodeInteger(reader, sourceLine);
sourceColumn = decodeInteger(reader, sourceColumn);
if (hasMoreVlq(reader, semi)) {
namesIndex = decodeInteger(reader, namesIndex);
seg = [genColumn, sourcesIndex, sourceLine, sourceColumn, namesIndex];
}
else {
seg = [genColumn, sourcesIndex, sourceLine, sourceColumn];
}
}
else {
seg = [genColumn];
}
line.push(seg);
reader.pos++;
}
if (!sorted)
sort(line);
decoded.push(line);
reader.pos = semi + 1;
} while (reader.pos <= length);
return decoded;
}
function sort(line) {
line.sort(sortComparator);
}
function sortComparator(a, b) {
return a[0] - b[0];
}
function encode(decoded) {
const writer = new StringWriter();
let sourcesIndex = 0;
let sourceLine = 0;
let sourceColumn = 0;
let namesIndex = 0;
for (let i = 0; i < decoded.length; i++) {
const line = decoded[i];
if (i > 0)
writer.write(semicolon);
if (line.length === 0)
continue;
let genColumn = 0;
for (let j = 0; j < line.length; j++) {
const segment = line[j];
if (j > 0)
writer.write(comma);
genColumn = encodeInteger(writer, segment[0], genColumn);
if (segment.length === 1)
continue;
sourcesIndex = encodeInteger(writer, segment[1], sourcesIndex);
sourceLine = encodeInteger(writer, segment[2], sourceLine);
sourceColumn = encodeInteger(writer, segment[3], sourceColumn);
if (segment.length === 4)
continue;
namesIndex = encodeInteger(writer, segment[4], namesIndex);
}
}
return writer.flush();
}
exports.decode = decode;
exports.decodeGeneratedRanges = decodeGeneratedRanges;
exports.decodeOriginalScopes = decodeOriginalScopes;
exports.encode = encode;
exports.encodeGeneratedRanges = encodeGeneratedRanges;
exports.encodeOriginalScopes = encodeOriginalScopes;
Object.defineProperty(exports, '__esModule', { value: true });
})); }));
//# sourceMappingURL=sourcemap-codec.umd.js.map //# sourceMappingURL=sourcemap-codec.umd.js.map

File diff suppressed because one or more lines are too long

View File

@ -1,49 +0,0 @@
declare type Line = number;
declare type Column = number;
declare type Kind = number;
declare type Name = number;
declare type Var = number;
declare type SourcesIndex = number;
declare type ScopesIndex = number;
declare type Mix<A, B, O> = (A & O) | (B & O);
export declare type OriginalScope = Mix<[
Line,
Column,
Line,
Column,
Kind
], [
Line,
Column,
Line,
Column,
Kind,
Name
], {
vars: Var[];
}>;
export declare type GeneratedRange = Mix<[
Line,
Column,
Line,
Column
], [
Line,
Column,
Line,
Column,
SourcesIndex,
ScopesIndex
], {
callsite: CallSite | null;
bindings: Binding[];
isScope: boolean;
}>;
export declare type CallSite = [SourcesIndex, Line, Column];
declare type Binding = BindingExpressionRange[];
export declare type BindingExpressionRange = [Name] | [Name, Line, Column];
export declare function decodeOriginalScopes(input: string): OriginalScope[];
export declare function encodeOriginalScopes(scopes: OriginalScope[]): string;
export declare function decodeGeneratedRanges(input: string): GeneratedRange[];
export declare function encodeGeneratedRanges(ranges: GeneratedRange[]): string;
export {};

View File

@ -1,8 +0,0 @@
export { decodeOriginalScopes, encodeOriginalScopes, decodeGeneratedRanges, encodeGeneratedRanges, } from './scopes';
export type { OriginalScope, GeneratedRange, CallSite, BindingExpressionRange } from './scopes';
export declare type SourceMapSegment = [number] | [number, number, number, number] | [number, number, number, number, number];
export declare type SourceMapLine = SourceMapSegment[];
export declare type SourceMapMappings = SourceMapLine[];
export declare function decode(mappings: string): SourceMapMappings;
export declare function encode(decoded: SourceMapMappings): string;
export declare function encode(decoded: Readonly<SourceMapMappings>): string;

View File

@ -1,15 +0,0 @@
export declare class StringWriter {
pos: number;
private out;
private buffer;
write(v: number): void;
flush(): string;
}
export declare class StringReader {
pos: number;
private buffer;
constructor(buffer: string);
next(): number;
peek(): number;
indexOf(char: string): number;
}

View File

@ -1,6 +0,0 @@
import type { StringReader, StringWriter } from './strings';
export declare const comma: number;
export declare const semicolon: number;
export declare function decodeInteger(reader: StringReader, relative: number): number;
export declare function encodeInteger(builder: StringWriter, num: number, relative: number): number;
export declare function hasMoreVlq(reader: StringReader, max: number): boolean;

View File

@ -1,6 +1,6 @@
{ {
"name": "@jridgewell/sourcemap-codec", "name": "@jridgewell/sourcemap-codec",
"version": "1.5.0", "version": "1.5.4",
"description": "Encode/decode sourcemap mappings", "description": "Encode/decode sourcemap mappings",
"keywords": [ "keywords": [
"sourcemap", "sourcemap",
@ -8,68 +8,60 @@
], ],
"main": "dist/sourcemap-codec.umd.js", "main": "dist/sourcemap-codec.umd.js",
"module": "dist/sourcemap-codec.mjs", "module": "dist/sourcemap-codec.mjs",
"types": "dist/types/sourcemap-codec.d.ts", "types": "types/sourcemap-codec.d.cts",
"files": [ "files": [
"dist" "dist",
"src",
"types"
], ],
"exports": { "exports": {
".": [ ".": [
{ {
"types": "./dist/types/sourcemap-codec.d.ts", "import": {
"browser": "./dist/sourcemap-codec.umd.js", "types": "./types/sourcemap-codec.d.mts",
"require": "./dist/sourcemap-codec.umd.js", "default": "./dist/sourcemap-codec.mjs"
"import": "./dist/sourcemap-codec.mjs" },
"require": {
"types": "./types/sourcemap-codec.d.cts",
"default": "./dist/sourcemap-codec.umd.js"
},
"browser": {
"types": "./types/sourcemap-codec.d.cts",
"default": "./dist/sourcemap-codec.umd.js"
}
}, },
"./dist/sourcemap-codec.umd.js" "./dist/sourcemap-codec.umd.js"
], ],
"./package.json": "./package.json" "./package.json": "./package.json"
}, },
"scripts": { "scripts": {
"benchmark": "run-s build:rollup benchmark:*", "benchmark": "run-s build:code benchmark:*",
"benchmark:install": "cd benchmark && npm install", "benchmark:install": "cd benchmark && npm install",
"benchmark:only": "node --expose-gc benchmark/index.js", "benchmark:only": "node --expose-gc benchmark/index.js",
"build": "run-s -n build:*", "build": "run-s -n build:code build:types",
"build:rollup": "rollup -c rollup.config.js", "build:code": "node ../../esbuild.mjs sourcemap-codec.ts",
"build:ts": "tsc --project tsconfig.build.json", "build:types": "run-s build:types:force build:types:emit build:types:mts",
"lint": "run-s -n lint:*", "build:types:force": "rimraf tsconfig.build.tsbuildinfo",
"lint:prettier": "npm run test:lint:prettier -- --write", "build:types:emit": "tsc --project tsconfig.build.json",
"lint:ts": "npm run test:lint:ts -- --fix", "build:types:mts": "node ../../mts-types.mjs",
"prebuild": "rm -rf dist", "clean": "run-s -n clean:code clean:types",
"prepublishOnly": "npm run preversion", "clean:code": "tsc --build --clean tsconfig.build.json",
"preversion": "run-s test build", "clean:types": "rimraf dist types",
"test": "run-s -n test:lint test:only", "test": "run-s -n test:types test:only test:format",
"test:debug": "mocha --inspect-brk", "test:format": "prettier --check '{src,test}/**/*.ts'",
"test:lint": "run-s -n test:lint:*",
"test:lint:prettier": "prettier --check '{src,test}/**/*.ts'",
"test:lint:ts": "eslint '{src,test}/**/*.ts'",
"test:only": "mocha", "test:only": "mocha",
"test:coverage": "c8 mocha", "test:types": "eslint '{src,test}/**/*.ts'",
"test:watch": "mocha --watch" "lint": "run-s -n lint:types lint:format",
"lint:format": "npm run test:format -- --write",
"lint:types": "npm run test:types -- --fix",
"prepublishOnly": "npm run-s -n build test"
}, },
"homepage": "https://github.com/jridgewell/sourcemaps/tree/main/packages/sourcemap-codec",
"repository": { "repository": {
"type": "git", "type": "git",
"url": "git+https://github.com/jridgewell/sourcemap-codec.git" "url": "git+https://github.com/jridgewell/sourcemaps.git",
"directory": "packages/sourcemap-codec"
}, },
"author": "Rich Harris", "author": "Justin Ridgewell <justin@ridgewell.name>",
"license": "MIT", "license": "MIT"
"devDependencies": {
"@rollup/plugin-typescript": "8.3.0",
"@types/mocha": "10.0.6",
"@types/node": "17.0.15",
"@typescript-eslint/eslint-plugin": "5.10.0",
"@typescript-eslint/parser": "5.10.0",
"benchmark": "2.1.4",
"c8": "7.11.2",
"eslint": "8.7.0",
"eslint-config-prettier": "8.3.0",
"mocha": "9.2.0",
"npm-run-all": "4.1.5",
"prettier": "2.5.1",
"rollup": "2.64.0",
"source-map": "0.6.1",
"source-map-js": "1.0.2",
"sourcemap-codec": "1.4.8",
"tsx": "4.7.1",
"typescript": "4.5.4"
}
} }

View File

@ -1,5 +1,5 @@
/** /**
* @vue/compiler-core v3.5.13 * @vue/compiler-core v3.5.17
* (c) 2018-present Yuxi (Evan) You and Vue contributors * (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT * @license MIT
**/ **/
@ -1063,7 +1063,7 @@ class Tokenizer {
this.buffer = input; this.buffer = input;
while (this.index < this.buffer.length) { while (this.index < this.buffer.length) {
const c = this.buffer.charCodeAt(this.index); const c = this.buffer.charCodeAt(this.index);
if (c === 10) { if (c === 10 && this.state !== 33) {
this.newlines.push(this.index); this.newlines.push(this.index);
} }
switch (this.state) { switch (this.state) {
@ -1782,7 +1782,7 @@ function isReferenced(node, parent, grandparent) {
if (parent.key === node) { if (parent.key === node) {
return !!parent.computed; return !!parent.computed;
} }
return !grandparent; return true;
// no: class { NODE = value; } // no: class { NODE = value; }
// yes: class { [NODE] = value; } // yes: class { [NODE] = value; }
// yes: class { key = NODE; } // yes: class { key = NODE; }
@ -2473,7 +2473,7 @@ const tokenizer = new Tokenizer(stack, {
"COMPILER_V_BIND_SYNC", "COMPILER_V_BIND_SYNC",
currentOptions, currentOptions,
currentProp.loc, currentProp.loc,
currentProp.rawName currentProp.arg.loc.source
)) { )) {
currentProp.name = "model"; currentProp.name = "model";
currentProp.modifiers.splice(syncIndex, 1); currentProp.modifiers.splice(syncIndex, 1);
@ -2813,7 +2813,7 @@ function isUpperCase(c) {
return c > 64 && c < 91; return c > 64 && c < 91;
} }
const windowsNewlineRE = /\r\n/g; const windowsNewlineRE = /\r\n/g;
function condenseWhitespace(nodes, tag) { function condenseWhitespace(nodes) {
const shouldCondense = currentOptions.whitespace !== "preserve"; const shouldCondense = currentOptions.whitespace !== "preserve";
let removedWhitespace = false; let removedWhitespace = false;
for (let i = 0; i < nodes.length; i++) { for (let i = 0; i < nodes.length; i++) {
@ -2999,12 +2999,12 @@ function cacheStatic(root, context) {
context, context,
// Root node is unfortunately non-hoistable due to potential parent // Root node is unfortunately non-hoistable due to potential parent
// fallthrough attributes. // fallthrough attributes.
isSingleElementRoot(root, root.children[0]) !!getSingleElementRoot(root)
); );
} }
function isSingleElementRoot(root, child) { function getSingleElementRoot(root) {
const { children } = root; const children = root.children.filter((x) => x.type !== 3);
return children.length === 1 && child.type === 1 && !isSlotOutlet(child); return children.length === 1 && children[0].type === 1 && !isSlotOutlet(children[0]) ? children[0] : null;
} }
function walk(node, parent, context, doNotHoistNode = false, inFor = false) { function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
const { children } = node; const { children } = node;
@ -3065,6 +3065,7 @@ function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
} }
} }
let cachedAsArray = false; let cachedAsArray = false;
const slotCacheKeys = [];
if (toCache.length === children.length && node.type === 1) { if (toCache.length === children.length && node.type === 1) {
if (node.tagType === 0 && node.codegenNode && node.codegenNode.type === 13 && shared.isArray(node.codegenNode.children)) { if (node.tagType === 0 && node.codegenNode && node.codegenNode.type === 13 && shared.isArray(node.codegenNode.children)) {
node.codegenNode.children = getCacheExpression( node.codegenNode.children = getCacheExpression(
@ -3074,6 +3075,7 @@ function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
} else if (node.tagType === 1 && node.codegenNode && node.codegenNode.type === 13 && node.codegenNode.children && !shared.isArray(node.codegenNode.children) && node.codegenNode.children.type === 15) { } else if (node.tagType === 1 && node.codegenNode && node.codegenNode.type === 13 && node.codegenNode.children && !shared.isArray(node.codegenNode.children) && node.codegenNode.children.type === 15) {
const slot = getSlotNode(node.codegenNode, "default"); const slot = getSlotNode(node.codegenNode, "default");
if (slot) { if (slot) {
slotCacheKeys.push(context.cached.length);
slot.returns = getCacheExpression( slot.returns = getCacheExpression(
createArrayExpression(slot.returns) createArrayExpression(slot.returns)
); );
@ -3083,6 +3085,7 @@ function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
const slotName = findDir(node, "slot", true); const slotName = findDir(node, "slot", true);
const slot = slotName && slotName.arg && getSlotNode(parent.codegenNode, slotName.arg); const slot = slotName && slotName.arg && getSlotNode(parent.codegenNode, slotName.arg);
if (slot) { if (slot) {
slotCacheKeys.push(context.cached.length);
slot.returns = getCacheExpression( slot.returns = getCacheExpression(
createArrayExpression(slot.returns) createArrayExpression(slot.returns)
); );
@ -3092,9 +3095,18 @@ function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
} }
if (!cachedAsArray) { if (!cachedAsArray) {
for (const child of toCache) { for (const child of toCache) {
slotCacheKeys.push(context.cached.length);
child.codegenNode = context.cache(child.codegenNode); child.codegenNode = context.cache(child.codegenNode);
} }
} }
if (slotCacheKeys.length && node.type === 1 && node.tagType === 1 && node.codegenNode && node.codegenNode.type === 13 && node.codegenNode.children && !shared.isArray(node.codegenNode.children) && node.codegenNode.children.type === 15) {
node.codegenNode.children.properties.push(
createObjectProperty(
`__`,
createSimpleExpression(JSON.stringify(slotCacheKeys), false)
)
);
}
function getCacheExpression(value) { function getCacheExpression(value) {
const exp = context.cache(value); const exp = context.cache(value);
if (inFor && context.hmr) { if (inFor && context.hmr) {
@ -3486,15 +3498,15 @@ function createRootCodegen(root, context) {
const { helper } = context; const { helper } = context;
const { children } = root; const { children } = root;
if (children.length === 1) { if (children.length === 1) {
const child = children[0]; const singleElementRootChild = getSingleElementRoot(root);
if (isSingleElementRoot(root, child) && child.codegenNode) { if (singleElementRootChild && singleElementRootChild.codegenNode) {
const codegenNode = child.codegenNode; const codegenNode = singleElementRootChild.codegenNode;
if (codegenNode.type === 13) { if (codegenNode.type === 13) {
convertToBlock(codegenNode, context); convertToBlock(codegenNode, context);
} }
root.codegenNode = codegenNode; root.codegenNode = codegenNode;
} else { } else {
root.codegenNode = child; root.codegenNode = children[0];
} }
} else if (children.length > 1) { } else if (children.length > 1) {
let patchFlag = 64; let patchFlag = 64;
@ -3653,7 +3665,9 @@ function createCodegenContext(ast, {
name = content; name = content;
} }
} }
addMapping(node.loc.start, name); if (node.loc.source) {
addMapping(node.loc.start, name);
}
} }
if (newlineIndex === -3 /* Unknown */) { if (newlineIndex === -3 /* Unknown */) {
advancePositionWithMutation(context, code); advancePositionWithMutation(context, code);
@ -3669,7 +3683,7 @@ function createCodegenContext(ast, {
context.column = code.length - newlineIndex; context.column = code.length - newlineIndex;
} }
} }
if (node && node.loc !== locStub) { if (node && node.loc !== locStub && node.loc.source) {
addMapping(node.loc.end); addMapping(node.loc.end);
} }
} }
@ -5276,7 +5290,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
let prev; let prev;
while (j--) { while (j--) {
prev = children[j]; prev = children[j];
if (prev.type !== 3) { if (prev.type !== 3 && isNonWhitespaceContent(prev)) {
break; break;
} }
} }
@ -5780,9 +5794,8 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
hasDynamicKeys = true; hasDynamicKeys = true;
if (exp) { if (exp) {
if (isVBind) { if (isVBind) {
pushRefVForMarker();
pushMergeArg();
{ {
pushMergeArg();
{ {
const hasOverridableKeys = mergeArgs.some((arg2) => { const hasOverridableKeys = mergeArgs.some((arg2) => {
if (arg2.type === 15) { if (arg2.type === 15) {
@ -5812,6 +5825,8 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
continue; continue;
} }
} }
pushRefVForMarker();
pushMergeArg();
mergeArgs.push(exp); mergeArgs.push(exp);
} else { } else {
pushMergeArg({ pushMergeArg({

View File

@ -1,5 +1,5 @@
/** /**
* @vue/compiler-core v3.5.13 * @vue/compiler-core v3.5.17
* (c) 2018-present Yuxi (Evan) You and Vue contributors * (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT * @license MIT
**/ **/
@ -1063,7 +1063,7 @@ class Tokenizer {
this.buffer = input; this.buffer = input;
while (this.index < this.buffer.length) { while (this.index < this.buffer.length) {
const c = this.buffer.charCodeAt(this.index); const c = this.buffer.charCodeAt(this.index);
if (c === 10) { if (c === 10 && this.state !== 33) {
this.newlines.push(this.index); this.newlines.push(this.index);
} }
switch (this.state) { switch (this.state) {
@ -1778,7 +1778,7 @@ function isReferenced(node, parent, grandparent) {
if (parent.key === node) { if (parent.key === node) {
return !!parent.computed; return !!parent.computed;
} }
return !grandparent; return true;
// no: class { NODE = value; } // no: class { NODE = value; }
// yes: class { [NODE] = value; } // yes: class { [NODE] = value; }
// yes: class { key = NODE; } // yes: class { key = NODE; }
@ -2469,7 +2469,7 @@ const tokenizer = new Tokenizer(stack, {
"COMPILER_V_BIND_SYNC", "COMPILER_V_BIND_SYNC",
currentOptions, currentOptions,
currentProp.loc, currentProp.loc,
currentProp.rawName currentProp.arg.loc.source
)) { )) {
currentProp.name = "model"; currentProp.name = "model";
currentProp.modifiers.splice(syncIndex, 1); currentProp.modifiers.splice(syncIndex, 1);
@ -2779,7 +2779,7 @@ function isUpperCase(c) {
return c > 64 && c < 91; return c > 64 && c < 91;
} }
const windowsNewlineRE = /\r\n/g; const windowsNewlineRE = /\r\n/g;
function condenseWhitespace(nodes, tag) { function condenseWhitespace(nodes) {
const shouldCondense = currentOptions.whitespace !== "preserve"; const shouldCondense = currentOptions.whitespace !== "preserve";
let removedWhitespace = false; let removedWhitespace = false;
for (let i = 0; i < nodes.length; i++) { for (let i = 0; i < nodes.length; i++) {
@ -2958,12 +2958,12 @@ function cacheStatic(root, context) {
context, context,
// Root node is unfortunately non-hoistable due to potential parent // Root node is unfortunately non-hoistable due to potential parent
// fallthrough attributes. // fallthrough attributes.
isSingleElementRoot(root, root.children[0]) !!getSingleElementRoot(root)
); );
} }
function isSingleElementRoot(root, child) { function getSingleElementRoot(root) {
const { children } = root; const children = root.children.filter((x) => x.type !== 3);
return children.length === 1 && child.type === 1 && !isSlotOutlet(child); return children.length === 1 && children[0].type === 1 && !isSlotOutlet(children[0]) ? children[0] : null;
} }
function walk(node, parent, context, doNotHoistNode = false, inFor = false) { function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
const { children } = node; const { children } = node;
@ -3024,6 +3024,7 @@ function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
} }
} }
let cachedAsArray = false; let cachedAsArray = false;
const slotCacheKeys = [];
if (toCache.length === children.length && node.type === 1) { if (toCache.length === children.length && node.type === 1) {
if (node.tagType === 0 && node.codegenNode && node.codegenNode.type === 13 && shared.isArray(node.codegenNode.children)) { if (node.tagType === 0 && node.codegenNode && node.codegenNode.type === 13 && shared.isArray(node.codegenNode.children)) {
node.codegenNode.children = getCacheExpression( node.codegenNode.children = getCacheExpression(
@ -3033,6 +3034,7 @@ function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
} else if (node.tagType === 1 && node.codegenNode && node.codegenNode.type === 13 && node.codegenNode.children && !shared.isArray(node.codegenNode.children) && node.codegenNode.children.type === 15) { } else if (node.tagType === 1 && node.codegenNode && node.codegenNode.type === 13 && node.codegenNode.children && !shared.isArray(node.codegenNode.children) && node.codegenNode.children.type === 15) {
const slot = getSlotNode(node.codegenNode, "default"); const slot = getSlotNode(node.codegenNode, "default");
if (slot) { if (slot) {
slotCacheKeys.push(context.cached.length);
slot.returns = getCacheExpression( slot.returns = getCacheExpression(
createArrayExpression(slot.returns) createArrayExpression(slot.returns)
); );
@ -3042,6 +3044,7 @@ function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
const slotName = findDir(node, "slot", true); const slotName = findDir(node, "slot", true);
const slot = slotName && slotName.arg && getSlotNode(parent.codegenNode, slotName.arg); const slot = slotName && slotName.arg && getSlotNode(parent.codegenNode, slotName.arg);
if (slot) { if (slot) {
slotCacheKeys.push(context.cached.length);
slot.returns = getCacheExpression( slot.returns = getCacheExpression(
createArrayExpression(slot.returns) createArrayExpression(slot.returns)
); );
@ -3051,9 +3054,18 @@ function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
} }
if (!cachedAsArray) { if (!cachedAsArray) {
for (const child of toCache) { for (const child of toCache) {
slotCacheKeys.push(context.cached.length);
child.codegenNode = context.cache(child.codegenNode); child.codegenNode = context.cache(child.codegenNode);
} }
} }
if (slotCacheKeys.length && node.type === 1 && node.tagType === 1 && node.codegenNode && node.codegenNode.type === 13 && node.codegenNode.children && !shared.isArray(node.codegenNode.children) && node.codegenNode.children.type === 15) {
node.codegenNode.children.properties.push(
createObjectProperty(
`__`,
createSimpleExpression(JSON.stringify(slotCacheKeys), false)
)
);
}
function getCacheExpression(value) { function getCacheExpression(value) {
const exp = context.cache(value); const exp = context.cache(value);
if (inFor && context.hmr) { if (inFor && context.hmr) {
@ -3431,15 +3443,15 @@ function createRootCodegen(root, context) {
const { helper } = context; const { helper } = context;
const { children } = root; const { children } = root;
if (children.length === 1) { if (children.length === 1) {
const child = children[0]; const singleElementRootChild = getSingleElementRoot(root);
if (isSingleElementRoot(root, child) && child.codegenNode) { if (singleElementRootChild && singleElementRootChild.codegenNode) {
const codegenNode = child.codegenNode; const codegenNode = singleElementRootChild.codegenNode;
if (codegenNode.type === 13) { if (codegenNode.type === 13) {
convertToBlock(codegenNode, context); convertToBlock(codegenNode, context);
} }
root.codegenNode = codegenNode; root.codegenNode = codegenNode;
} else { } else {
root.codegenNode = child; root.codegenNode = children[0];
} }
} else if (children.length > 1) { } else if (children.length > 1) {
let patchFlag = 64; let patchFlag = 64;
@ -3595,7 +3607,9 @@ function createCodegenContext(ast, {
name = content; name = content;
} }
} }
addMapping(node.loc.start, name); if (node.loc.source) {
addMapping(node.loc.start, name);
}
} }
if (newlineIndex === -3 /* Unknown */) { if (newlineIndex === -3 /* Unknown */) {
advancePositionWithMutation(context, code); advancePositionWithMutation(context, code);
@ -3611,7 +3625,7 @@ function createCodegenContext(ast, {
context.column = code.length - newlineIndex; context.column = code.length - newlineIndex;
} }
} }
if (node && node.loc !== locStub) { if (node && node.loc !== locStub && node.loc.source) {
addMapping(node.loc.end); addMapping(node.loc.end);
} }
} }
@ -5191,7 +5205,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
let prev; let prev;
while (j--) { while (j--) {
prev = children[j]; prev = children[j];
if (prev.type !== 3) { if (prev.type !== 3 && isNonWhitespaceContent(prev)) {
break; break;
} }
} }
@ -5686,9 +5700,8 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
hasDynamicKeys = true; hasDynamicKeys = true;
if (exp) { if (exp) {
if (isVBind) { if (isVBind) {
pushRefVForMarker();
pushMergeArg();
{ {
pushMergeArg();
if (isCompatEnabled( if (isCompatEnabled(
"COMPILER_V_BIND_OBJECT_ORDER", "COMPILER_V_BIND_OBJECT_ORDER",
context context
@ -5697,6 +5710,8 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
continue; continue;
} }
} }
pushRefVForMarker();
pushMergeArg();
mergeArgs.push(exp); mergeArgs.push(exp);
} else { } else {
pushMergeArg({ pushMergeArg({

View File

@ -1089,3 +1089,4 @@ export declare function processSlotOutlet(node: SlotOutletNode, context: Transfo
export declare function getConstantType(node: TemplateChildNode | SimpleExpressionNode | CacheExpression, context: TransformContext): ConstantTypes; export declare function getConstantType(node: TemplateChildNode | SimpleExpressionNode | CacheExpression, context: TransformContext): ConstantTypes;

View File

@ -1,9 +1,9 @@
/** /**
* @vue/compiler-core v3.5.13 * @vue/compiler-core v3.5.17
* (c) 2018-present Yuxi (Evan) You and Vue contributors * (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT * @license MIT
**/ **/
import { isString, NOOP, isObject, NO, extend, isSymbol, isArray, capitalize, camelize, EMPTY_OBJ, PatchFlagNames, slotFlagsText, isOn, isBuiltInDirective, isReservedProp, toHandlerKey } from '@vue/shared'; import { isString, NOOP, isObject, extend, NO, isSymbol, isArray, capitalize, camelize, EMPTY_OBJ, PatchFlagNames, slotFlagsText, isOn, isBuiltInDirective, isReservedProp, toHandlerKey } from '@vue/shared';
export { generateCodeFrame } from '@vue/shared'; export { generateCodeFrame } from '@vue/shared';
const FRAGMENT = Symbol(!!(process.env.NODE_ENV !== "production") ? `Fragment` : ``); const FRAGMENT = Symbol(!!(process.env.NODE_ENV !== "production") ? `Fragment` : ``);
@ -1023,7 +1023,7 @@ class Tokenizer {
this.buffer = input; this.buffer = input;
while (this.index < this.buffer.length) { while (this.index < this.buffer.length) {
const c = this.buffer.charCodeAt(this.index); const c = this.buffer.charCodeAt(this.index);
if (c === 10) { if (c === 10 && this.state !== 33) {
this.newlines.push(this.index); this.newlines.push(this.index);
} }
switch (this.state) { switch (this.state) {
@ -2153,7 +2153,7 @@ const tokenizer = new Tokenizer(stack, {
"COMPILER_V_BIND_SYNC", "COMPILER_V_BIND_SYNC",
currentOptions, currentOptions,
currentProp.loc, currentProp.loc,
currentProp.rawName currentProp.arg.loc.source
)) { )) {
currentProp.name = "model"; currentProp.name = "model";
currentProp.modifiers.splice(syncIndex, 1); currentProp.modifiers.splice(syncIndex, 1);
@ -2499,7 +2499,7 @@ function isUpperCase(c) {
return c > 64 && c < 91; return c > 64 && c < 91;
} }
const windowsNewlineRE = /\r\n/g; const windowsNewlineRE = /\r\n/g;
function condenseWhitespace(nodes, tag) { function condenseWhitespace(nodes) {
const shouldCondense = currentOptions.whitespace !== "preserve"; const shouldCondense = currentOptions.whitespace !== "preserve";
let removedWhitespace = false; let removedWhitespace = false;
for (let i = 0; i < nodes.length; i++) { for (let i = 0; i < nodes.length; i++) {
@ -2663,12 +2663,12 @@ function cacheStatic(root, context) {
context, context,
// Root node is unfortunately non-hoistable due to potential parent // Root node is unfortunately non-hoistable due to potential parent
// fallthrough attributes. // fallthrough attributes.
isSingleElementRoot(root, root.children[0]) !!getSingleElementRoot(root)
); );
} }
function isSingleElementRoot(root, child) { function getSingleElementRoot(root) {
const { children } = root; const children = root.children.filter((x) => x.type !== 3);
return children.length === 1 && child.type === 1 && !isSlotOutlet(child); return children.length === 1 && children[0].type === 1 && !isSlotOutlet(children[0]) ? children[0] : null;
} }
function walk(node, parent, context, doNotHoistNode = false, inFor = false) { function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
const { children } = node; const { children } = node;
@ -2729,6 +2729,7 @@ function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
} }
} }
let cachedAsArray = false; let cachedAsArray = false;
const slotCacheKeys = [];
if (toCache.length === children.length && node.type === 1) { if (toCache.length === children.length && node.type === 1) {
if (node.tagType === 0 && node.codegenNode && node.codegenNode.type === 13 && isArray(node.codegenNode.children)) { if (node.tagType === 0 && node.codegenNode && node.codegenNode.type === 13 && isArray(node.codegenNode.children)) {
node.codegenNode.children = getCacheExpression( node.codegenNode.children = getCacheExpression(
@ -2738,6 +2739,7 @@ function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
} else if (node.tagType === 1 && node.codegenNode && node.codegenNode.type === 13 && node.codegenNode.children && !isArray(node.codegenNode.children) && node.codegenNode.children.type === 15) { } else if (node.tagType === 1 && node.codegenNode && node.codegenNode.type === 13 && node.codegenNode.children && !isArray(node.codegenNode.children) && node.codegenNode.children.type === 15) {
const slot = getSlotNode(node.codegenNode, "default"); const slot = getSlotNode(node.codegenNode, "default");
if (slot) { if (slot) {
slotCacheKeys.push(context.cached.length);
slot.returns = getCacheExpression( slot.returns = getCacheExpression(
createArrayExpression(slot.returns) createArrayExpression(slot.returns)
); );
@ -2747,6 +2749,7 @@ function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
const slotName = findDir(node, "slot", true); const slotName = findDir(node, "slot", true);
const slot = slotName && slotName.arg && getSlotNode(parent.codegenNode, slotName.arg); const slot = slotName && slotName.arg && getSlotNode(parent.codegenNode, slotName.arg);
if (slot) { if (slot) {
slotCacheKeys.push(context.cached.length);
slot.returns = getCacheExpression( slot.returns = getCacheExpression(
createArrayExpression(slot.returns) createArrayExpression(slot.returns)
); );
@ -2756,9 +2759,18 @@ function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
} }
if (!cachedAsArray) { if (!cachedAsArray) {
for (const child of toCache) { for (const child of toCache) {
slotCacheKeys.push(context.cached.length);
child.codegenNode = context.cache(child.codegenNode); child.codegenNode = context.cache(child.codegenNode);
} }
} }
if (slotCacheKeys.length && node.type === 1 && node.tagType === 1 && node.codegenNode && node.codegenNode.type === 13 && node.codegenNode.children && !isArray(node.codegenNode.children) && node.codegenNode.children.type === 15) {
node.codegenNode.children.properties.push(
createObjectProperty(
`__`,
createSimpleExpression(JSON.stringify(slotCacheKeys), false)
)
);
}
function getCacheExpression(value) { function getCacheExpression(value) {
const exp = context.cache(value); const exp = context.cache(value);
if (inFor && context.hmr) { if (inFor && context.hmr) {
@ -3123,15 +3135,15 @@ function createRootCodegen(root, context) {
const { helper } = context; const { helper } = context;
const { children } = root; const { children } = root;
if (children.length === 1) { if (children.length === 1) {
const child = children[0]; const singleElementRootChild = getSingleElementRoot(root);
if (isSingleElementRoot(root, child) && child.codegenNode) { if (singleElementRootChild && singleElementRootChild.codegenNode) {
const codegenNode = child.codegenNode; const codegenNode = singleElementRootChild.codegenNode;
if (codegenNode.type === 13) { if (codegenNode.type === 13) {
convertToBlock(codegenNode, context); convertToBlock(codegenNode, context);
} }
root.codegenNode = codegenNode; root.codegenNode = codegenNode;
} else { } else {
root.codegenNode = child; root.codegenNode = children[0];
} }
} else if (children.length > 1) { } else if (children.length > 1) {
let patchFlag = 64; let patchFlag = 64;
@ -4516,7 +4528,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
let prev; let prev;
while (j--) { while (j--) {
prev = children[j]; prev = children[j];
if (prev.type !== 3) { if (prev.type !== 3 && isNonWhitespaceContent(prev)) {
break; break;
} }
} }
@ -4950,9 +4962,8 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
hasDynamicKeys = true; hasDynamicKeys = true;
if (exp) { if (exp) {
if (isVBind) { if (isVBind) {
pushRefVForMarker();
pushMergeArg();
{ {
pushMergeArg();
if (!!(process.env.NODE_ENV !== "production")) { if (!!(process.env.NODE_ENV !== "production")) {
const hasOverridableKeys = mergeArgs.some((arg2) => { const hasOverridableKeys = mergeArgs.some((arg2) => {
if (arg2.type === 15) { if (arg2.type === 15) {
@ -4982,6 +4993,8 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
continue; continue;
} }
} }
pushRefVForMarker();
pushMergeArg();
mergeArgs.push(exp); mergeArgs.push(exp);
} else { } else {
pushMergeArg({ pushMergeArg({
@ -5490,8 +5503,7 @@ const transformModel = (dir, node, context) => {
context.onError(createCompilerError(44, exp.loc)); context.onError(createCompilerError(44, exp.loc));
return createTransformProps(); return createTransformProps();
} }
const maybeRef = false; if (!expString.trim() || !isMemberExpression(exp) && true) {
if (!expString.trim() || !isMemberExpression(exp) && !maybeRef) {
context.onError( context.onError(
createCompilerError(42, exp.loc) createCompilerError(42, exp.loc)
); );

View File

@ -1,6 +1,6 @@
{ {
"name": "@vue/compiler-core", "name": "@vue/compiler-core",
"version": "3.5.13", "version": "3.5.17",
"description": "@vue/compiler-core", "description": "@vue/compiler-core",
"main": "index.js", "main": "index.js",
"module": "dist/compiler-core.esm-bundler.js", "module": "dist/compiler-core.esm-bundler.js",
@ -46,13 +46,13 @@
}, },
"homepage": "https://github.com/vuejs/core/tree/main/packages/compiler-core#readme", "homepage": "https://github.com/vuejs/core/tree/main/packages/compiler-core#readme",
"dependencies": { "dependencies": {
"@babel/parser": "^7.25.3", "@babel/parser": "^7.27.5",
"entities": "^4.5.0", "entities": "^4.5.0",
"estree-walker": "^2.0.2", "estree-walker": "^2.0.2",
"source-map-js": "^1.2.0", "source-map-js": "^1.2.1",
"@vue/shared": "3.5.13" "@vue/shared": "3.5.17"
}, },
"devDependencies": { "devDependencies": {
"@babel/types": "^7.25.2" "@babel/types": "^7.27.6"
} }
} }

View File

@ -1,5 +1,5 @@
/** /**
* @vue/compiler-dom v3.5.13 * @vue/compiler-dom v3.5.17
* (c) 2018-present Yuxi (Evan) You and Vue contributors * (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT * @license MIT
**/ **/
@ -694,6 +694,9 @@ const ignoreSideEffectTags = (node, context) => {
}; };
function isValidHTMLNesting(parent, child) { function isValidHTMLNesting(parent, child) {
if (parent === "template") {
return true;
}
if (parent in onlyValidChildren) { if (parent in onlyValidChildren) {
return onlyValidChildren[parent].has(child); return onlyValidChildren[parent].has(child);
} }

View File

@ -1,5 +1,5 @@
/** /**
* @vue/compiler-dom v3.5.13 * @vue/compiler-dom v3.5.17
* (c) 2018-present Yuxi (Evan) You and Vue contributors * (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT * @license MIT
**/ **/

View File

@ -1,5 +1,5 @@
/** /**
* @vue/compiler-dom v3.5.13 * @vue/compiler-dom v3.5.17
* (c) 2018-present Yuxi (Evan) You and Vue contributors * (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT * @license MIT
**/ **/
@ -65,7 +65,7 @@ const PatchFlagNames = {
[512]: `NEED_PATCH`, [512]: `NEED_PATCH`,
[1024]: `DYNAMIC_SLOTS`, [1024]: `DYNAMIC_SLOTS`,
[2048]: `DEV_ROOT_FRAGMENT`, [2048]: `DEV_ROOT_FRAGMENT`,
[-1]: `HOISTED`, [-1]: `CACHED`,
[-2]: `BAIL` [-2]: `BAIL`
}; };
@ -1157,7 +1157,7 @@ class Tokenizer {
this.buffer = input; this.buffer = input;
while (this.index < this.buffer.length) { while (this.index < this.buffer.length) {
const c = this.buffer.charCodeAt(this.index); const c = this.buffer.charCodeAt(this.index);
if (c === 10) { if (c === 10 && this.state !== 33) {
this.newlines.push(this.index); this.newlines.push(this.index);
} }
switch (this.state) { switch (this.state) {
@ -2286,7 +2286,7 @@ const tokenizer = new Tokenizer(stack, {
"COMPILER_V_BIND_SYNC", "COMPILER_V_BIND_SYNC",
currentOptions, currentOptions,
currentProp.loc, currentProp.loc,
currentProp.rawName currentProp.arg.loc.source
)) { )) {
currentProp.name = "model"; currentProp.name = "model";
currentProp.modifiers.splice(syncIndex, 1); currentProp.modifiers.splice(syncIndex, 1);
@ -2632,7 +2632,7 @@ function isUpperCase(c) {
return c > 64 && c < 91; return c > 64 && c < 91;
} }
const windowsNewlineRE = /\r\n/g; const windowsNewlineRE = /\r\n/g;
function condenseWhitespace(nodes, tag) { function condenseWhitespace(nodes) {
const shouldCondense = currentOptions.whitespace !== "preserve"; const shouldCondense = currentOptions.whitespace !== "preserve";
let removedWhitespace = false; let removedWhitespace = false;
for (let i = 0; i < nodes.length; i++) { for (let i = 0; i < nodes.length; i++) {
@ -2796,12 +2796,12 @@ function cacheStatic(root, context) {
context, context,
// Root node is unfortunately non-hoistable due to potential parent // Root node is unfortunately non-hoistable due to potential parent
// fallthrough attributes. // fallthrough attributes.
isSingleElementRoot(root, root.children[0]) !!getSingleElementRoot(root)
); );
} }
function isSingleElementRoot(root, child) { function getSingleElementRoot(root) {
const { children } = root; const children = root.children.filter((x) => x.type !== 3);
return children.length === 1 && child.type === 1 && !isSlotOutlet(child); return children.length === 1 && children[0].type === 1 && !isSlotOutlet(children[0]) ? children[0] : null;
} }
function walk(node, parent, context, doNotHoistNode = false, inFor = false) { function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
const { children } = node; const { children } = node;
@ -2862,6 +2862,7 @@ function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
} }
} }
let cachedAsArray = false; let cachedAsArray = false;
const slotCacheKeys = [];
if (toCache.length === children.length && node.type === 1) { if (toCache.length === children.length && node.type === 1) {
if (node.tagType === 0 && node.codegenNode && node.codegenNode.type === 13 && isArray(node.codegenNode.children)) { if (node.tagType === 0 && node.codegenNode && node.codegenNode.type === 13 && isArray(node.codegenNode.children)) {
node.codegenNode.children = getCacheExpression( node.codegenNode.children = getCacheExpression(
@ -2871,6 +2872,7 @@ function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
} else if (node.tagType === 1 && node.codegenNode && node.codegenNode.type === 13 && node.codegenNode.children && !isArray(node.codegenNode.children) && node.codegenNode.children.type === 15) { } else if (node.tagType === 1 && node.codegenNode && node.codegenNode.type === 13 && node.codegenNode.children && !isArray(node.codegenNode.children) && node.codegenNode.children.type === 15) {
const slot = getSlotNode(node.codegenNode, "default"); const slot = getSlotNode(node.codegenNode, "default");
if (slot) { if (slot) {
slotCacheKeys.push(context.cached.length);
slot.returns = getCacheExpression( slot.returns = getCacheExpression(
createArrayExpression(slot.returns) createArrayExpression(slot.returns)
); );
@ -2880,6 +2882,7 @@ function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
const slotName = findDir(node, "slot", true); const slotName = findDir(node, "slot", true);
const slot = slotName && slotName.arg && getSlotNode(parent.codegenNode, slotName.arg); const slot = slotName && slotName.arg && getSlotNode(parent.codegenNode, slotName.arg);
if (slot) { if (slot) {
slotCacheKeys.push(context.cached.length);
slot.returns = getCacheExpression( slot.returns = getCacheExpression(
createArrayExpression(slot.returns) createArrayExpression(slot.returns)
); );
@ -2889,9 +2892,18 @@ function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
} }
if (!cachedAsArray) { if (!cachedAsArray) {
for (const child of toCache) { for (const child of toCache) {
slotCacheKeys.push(context.cached.length);
child.codegenNode = context.cache(child.codegenNode); child.codegenNode = context.cache(child.codegenNode);
} }
} }
if (slotCacheKeys.length && node.type === 1 && node.tagType === 1 && node.codegenNode && node.codegenNode.type === 13 && node.codegenNode.children && !isArray(node.codegenNode.children) && node.codegenNode.children.type === 15) {
node.codegenNode.children.properties.push(
createObjectProperty(
`__`,
createSimpleExpression(JSON.stringify(slotCacheKeys), false)
)
);
}
function getCacheExpression(value) { function getCacheExpression(value) {
const exp = context.cache(value); const exp = context.cache(value);
if (inFor && context.hmr) { if (inFor && context.hmr) {
@ -3255,15 +3267,15 @@ function createRootCodegen(root, context) {
const { helper } = context; const { helper } = context;
const { children } = root; const { children } = root;
if (children.length === 1) { if (children.length === 1) {
const child = children[0]; const singleElementRootChild = getSingleElementRoot(root);
if (isSingleElementRoot(root, child) && child.codegenNode) { if (singleElementRootChild && singleElementRootChild.codegenNode) {
const codegenNode = child.codegenNode; const codegenNode = singleElementRootChild.codegenNode;
if (codegenNode.type === 13) { if (codegenNode.type === 13) {
convertToBlock(codegenNode, context); convertToBlock(codegenNode, context);
} }
root.codegenNode = codegenNode; root.codegenNode = codegenNode;
} else { } else {
root.codegenNode = child; root.codegenNode = children[0];
} }
} else if (children.length > 1) { } else if (children.length > 1) {
let patchFlag = 64; let patchFlag = 64;
@ -4646,7 +4658,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
let prev; let prev;
while (j--) { while (j--) {
prev = children[j]; prev = children[j];
if (prev.type !== 3) { if (prev.type !== 3 && isNonWhitespaceContent(prev)) {
break; break;
} }
} }
@ -5080,9 +5092,8 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
hasDynamicKeys = true; hasDynamicKeys = true;
if (exp) { if (exp) {
if (isVBind) { if (isVBind) {
pushRefVForMarker();
pushMergeArg();
{ {
pushMergeArg();
{ {
const hasOverridableKeys = mergeArgs.some((arg2) => { const hasOverridableKeys = mergeArgs.some((arg2) => {
if (arg2.type === 15) { if (arg2.type === 15) {
@ -5112,6 +5123,8 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
continue; continue;
} }
} }
pushRefVForMarker();
pushMergeArg();
mergeArgs.push(exp); mergeArgs.push(exp);
} else { } else {
pushMergeArg({ pushMergeArg({
@ -5620,8 +5633,7 @@ const transformModel$1 = (dir, node, context) => {
context.onError(createCompilerError(44, exp.loc)); context.onError(createCompilerError(44, exp.loc));
return createTransformProps(); return createTransformProps();
} }
const maybeRef = false; if (!expString.trim() || !isMemberExpression(exp) && true) {
if (!expString.trim() || !isMemberExpression(exp) && !maybeRef) {
context.onError( context.onError(
createCompilerError(42, exp.loc) createCompilerError(42, exp.loc)
); );
@ -6384,6 +6396,9 @@ const ignoreSideEffectTags = (node, context) => {
}; };
function isValidHTMLNesting(parent, child) { function isValidHTMLNesting(parent, child) {
if (parent === "template") {
return true;
}
if (parent in onlyValidChildren) { if (parent in onlyValidChildren) {
return onlyValidChildren[parent].has(child); return onlyValidChildren[parent].has(child);
} }

File diff suppressed because one or more lines are too long

View File

@ -1,11 +1,11 @@
/** /**
* @vue/compiler-dom v3.5.13 * @vue/compiler-dom v3.5.17
* (c) 2018-present Yuxi (Evan) You and Vue contributors * (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT * @license MIT
**/ **/
import { registerRuntimeHelpers, createSimpleExpression, createCompilerError, createObjectProperty, getConstantType, createCallExpression, TO_DISPLAY_STRING, transformModel as transformModel$1, findProp, hasDynamicKeyVBind, findDir, isStaticArgOf, transformOn as transformOn$1, isStaticExp, createCompoundExpression, checkCompatEnabled, noopDirectiveTransform, baseCompile, baseParse } from '@vue/compiler-core'; import { registerRuntimeHelpers, createSimpleExpression, createCompilerError, createObjectProperty, createCallExpression, getConstantType, TO_DISPLAY_STRING, transformModel as transformModel$1, findProp, hasDynamicKeyVBind, findDir, isStaticArgOf, transformOn as transformOn$1, isStaticExp, createCompoundExpression, checkCompatEnabled, noopDirectiveTransform, baseCompile, baseParse } from '@vue/compiler-core';
export * from '@vue/compiler-core'; export * from '@vue/compiler-core';
import { isVoidTag, isHTMLTag, isSVGTag, isMathMLTag, parseStringStyle, capitalize, makeMap, extend } from '@vue/shared'; import { isHTMLTag, isSVGTag, isMathMLTag, isVoidTag, parseStringStyle, makeMap, capitalize, extend } from '@vue/shared';
const V_MODEL_RADIO = Symbol(!!(process.env.NODE_ENV !== "production") ? `vModelRadio` : ``); const V_MODEL_RADIO = Symbol(!!(process.env.NODE_ENV !== "production") ? `vModelRadio` : ``);
const V_MODEL_CHECKBOX = Symbol( const V_MODEL_CHECKBOX = Symbol(
@ -474,6 +474,9 @@ const ignoreSideEffectTags = (node, context) => {
}; };
function isValidHTMLNesting(parent, child) { function isValidHTMLNesting(parent, child) {
if (parent === "template") {
return true;
}
if (parent in onlyValidChildren) { if (parent in onlyValidChildren) {
return onlyValidChildren[parent].has(child); return onlyValidChildren[parent].has(child);
} }

View File

@ -1,5 +1,5 @@
/** /**
* @vue/compiler-dom v3.5.13 * @vue/compiler-dom v3.5.17
* (c) 2018-present Yuxi (Evan) You and Vue contributors * (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT * @license MIT
**/ **/
@ -68,7 +68,7 @@ var VueCompilerDOM = (function (exports) {
[512]: `NEED_PATCH`, [512]: `NEED_PATCH`,
[1024]: `DYNAMIC_SLOTS`, [1024]: `DYNAMIC_SLOTS`,
[2048]: `DEV_ROOT_FRAGMENT`, [2048]: `DEV_ROOT_FRAGMENT`,
[-1]: `HOISTED`, [-1]: `CACHED`,
[-2]: `BAIL` [-2]: `BAIL`
}; };
@ -1160,7 +1160,7 @@ var VueCompilerDOM = (function (exports) {
this.buffer = input; this.buffer = input;
while (this.index < this.buffer.length) { while (this.index < this.buffer.length) {
const c = this.buffer.charCodeAt(this.index); const c = this.buffer.charCodeAt(this.index);
if (c === 10) { if (c === 10 && this.state !== 33) {
this.newlines.push(this.index); this.newlines.push(this.index);
} }
switch (this.state) { switch (this.state) {
@ -2289,7 +2289,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
"COMPILER_V_BIND_SYNC", "COMPILER_V_BIND_SYNC",
currentOptions, currentOptions,
currentProp.loc, currentProp.loc,
currentProp.rawName currentProp.arg.loc.source
)) { )) {
currentProp.name = "model"; currentProp.name = "model";
currentProp.modifiers.splice(syncIndex, 1); currentProp.modifiers.splice(syncIndex, 1);
@ -2635,7 +2635,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
return c > 64 && c < 91; return c > 64 && c < 91;
} }
const windowsNewlineRE = /\r\n/g; const windowsNewlineRE = /\r\n/g;
function condenseWhitespace(nodes, tag) { function condenseWhitespace(nodes) {
const shouldCondense = currentOptions.whitespace !== "preserve"; const shouldCondense = currentOptions.whitespace !== "preserve";
let removedWhitespace = false; let removedWhitespace = false;
for (let i = 0; i < nodes.length; i++) { for (let i = 0; i < nodes.length; i++) {
@ -2799,12 +2799,12 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
context, context,
// Root node is unfortunately non-hoistable due to potential parent // Root node is unfortunately non-hoistable due to potential parent
// fallthrough attributes. // fallthrough attributes.
isSingleElementRoot(root, root.children[0]) !!getSingleElementRoot(root)
); );
} }
function isSingleElementRoot(root, child) { function getSingleElementRoot(root) {
const { children } = root; const children = root.children.filter((x) => x.type !== 3);
return children.length === 1 && child.type === 1 && !isSlotOutlet(child); return children.length === 1 && children[0].type === 1 && !isSlotOutlet(children[0]) ? children[0] : null;
} }
function walk(node, parent, context, doNotHoistNode = false, inFor = false) { function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
const { children } = node; const { children } = node;
@ -2865,6 +2865,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
} }
} }
let cachedAsArray = false; let cachedAsArray = false;
const slotCacheKeys = [];
if (toCache.length === children.length && node.type === 1) { if (toCache.length === children.length && node.type === 1) {
if (node.tagType === 0 && node.codegenNode && node.codegenNode.type === 13 && isArray(node.codegenNode.children)) { if (node.tagType === 0 && node.codegenNode && node.codegenNode.type === 13 && isArray(node.codegenNode.children)) {
node.codegenNode.children = getCacheExpression( node.codegenNode.children = getCacheExpression(
@ -2874,6 +2875,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
} else if (node.tagType === 1 && node.codegenNode && node.codegenNode.type === 13 && node.codegenNode.children && !isArray(node.codegenNode.children) && node.codegenNode.children.type === 15) { } else if (node.tagType === 1 && node.codegenNode && node.codegenNode.type === 13 && node.codegenNode.children && !isArray(node.codegenNode.children) && node.codegenNode.children.type === 15) {
const slot = getSlotNode(node.codegenNode, "default"); const slot = getSlotNode(node.codegenNode, "default");
if (slot) { if (slot) {
slotCacheKeys.push(context.cached.length);
slot.returns = getCacheExpression( slot.returns = getCacheExpression(
createArrayExpression(slot.returns) createArrayExpression(slot.returns)
); );
@ -2883,6 +2885,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
const slotName = findDir(node, "slot", true); const slotName = findDir(node, "slot", true);
const slot = slotName && slotName.arg && getSlotNode(parent.codegenNode, slotName.arg); const slot = slotName && slotName.arg && getSlotNode(parent.codegenNode, slotName.arg);
if (slot) { if (slot) {
slotCacheKeys.push(context.cached.length);
slot.returns = getCacheExpression( slot.returns = getCacheExpression(
createArrayExpression(slot.returns) createArrayExpression(slot.returns)
); );
@ -2892,9 +2895,18 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
} }
if (!cachedAsArray) { if (!cachedAsArray) {
for (const child of toCache) { for (const child of toCache) {
slotCacheKeys.push(context.cached.length);
child.codegenNode = context.cache(child.codegenNode); child.codegenNode = context.cache(child.codegenNode);
} }
} }
if (slotCacheKeys.length && node.type === 1 && node.tagType === 1 && node.codegenNode && node.codegenNode.type === 13 && node.codegenNode.children && !isArray(node.codegenNode.children) && node.codegenNode.children.type === 15) {
node.codegenNode.children.properties.push(
createObjectProperty(
`__`,
createSimpleExpression(JSON.stringify(slotCacheKeys), false)
)
);
}
function getCacheExpression(value) { function getCacheExpression(value) {
const exp = context.cache(value); const exp = context.cache(value);
if (inFor && context.hmr) { if (inFor && context.hmr) {
@ -3258,15 +3270,15 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
const { helper } = context; const { helper } = context;
const { children } = root; const { children } = root;
if (children.length === 1) { if (children.length === 1) {
const child = children[0]; const singleElementRootChild = getSingleElementRoot(root);
if (isSingleElementRoot(root, child) && child.codegenNode) { if (singleElementRootChild && singleElementRootChild.codegenNode) {
const codegenNode = child.codegenNode; const codegenNode = singleElementRootChild.codegenNode;
if (codegenNode.type === 13) { if (codegenNode.type === 13) {
convertToBlock(codegenNode, context); convertToBlock(codegenNode, context);
} }
root.codegenNode = codegenNode; root.codegenNode = codegenNode;
} else { } else {
root.codegenNode = child; root.codegenNode = children[0];
} }
} else if (children.length > 1) { } else if (children.length > 1) {
let patchFlag = 64; let patchFlag = 64;
@ -4649,7 +4661,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
let prev; let prev;
while (j--) { while (j--) {
prev = children[j]; prev = children[j];
if (prev.type !== 3) { if (prev.type !== 3 && isNonWhitespaceContent(prev)) {
break; break;
} }
} }
@ -5083,9 +5095,8 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
hasDynamicKeys = true; hasDynamicKeys = true;
if (exp) { if (exp) {
if (isVBind) { if (isVBind) {
pushRefVForMarker();
pushMergeArg();
{ {
pushMergeArg();
{ {
const hasOverridableKeys = mergeArgs.some((arg2) => { const hasOverridableKeys = mergeArgs.some((arg2) => {
if (arg2.type === 15) { if (arg2.type === 15) {
@ -5115,6 +5126,8 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
continue; continue;
} }
} }
pushRefVForMarker();
pushMergeArg();
mergeArgs.push(exp); mergeArgs.push(exp);
} else { } else {
pushMergeArg({ pushMergeArg({
@ -5623,8 +5636,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
context.onError(createCompilerError(44, exp.loc)); context.onError(createCompilerError(44, exp.loc));
return createTransformProps(); return createTransformProps();
} }
const maybeRef = false; if (!expString.trim() || !isMemberExpression(exp) && true) {
if (!expString.trim() || !isMemberExpression(exp) && !maybeRef) {
context.onError( context.onError(
createCompilerError(42, exp.loc) createCompilerError(42, exp.loc)
); );
@ -6387,6 +6399,9 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
}; };
function isValidHTMLNesting(parent, child) { function isValidHTMLNesting(parent, child) {
if (parent === "template") {
return true;
}
if (parent in onlyValidChildren) { if (parent in onlyValidChildren) {
return onlyValidChildren[parent].has(child); return onlyValidChildren[parent].has(child);
} }

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
{ {
"name": "@vue/compiler-dom", "name": "@vue/compiler-dom",
"version": "3.5.13", "version": "3.5.17",
"description": "@vue/compiler-dom", "description": "@vue/compiler-dom",
"main": "index.js", "main": "index.js",
"module": "dist/compiler-dom.esm-bundler.js", "module": "dist/compiler-dom.esm-bundler.js",
@ -51,7 +51,7 @@
}, },
"homepage": "https://github.com/vuejs/core/tree/main/packages/compiler-dom#readme", "homepage": "https://github.com/vuejs/core/tree/main/packages/compiler-dom#readme",
"dependencies": { "dependencies": {
"@vue/shared": "3.5.13", "@vue/shared": "3.5.17",
"@vue/compiler-core": "3.5.13" "@vue/compiler-core": "3.5.17"
} }
} }

View File

@ -1,5 +1,5 @@
/** /**
* @vue/compiler-sfc v3.5.13 * @vue/compiler-sfc v3.5.17
* (c) 2018-present Yuxi (Evan) You and Vue contributors * (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT * @license MIT
**/ **/
@ -4882,29 +4882,39 @@ function requireContainer$1 () {
return this.removeAll(); return this.removeAll();
}; };
_proto.insertAfter = function insertAfter(oldNode, newNode) { _proto.insertAfter = function insertAfter(oldNode, newNode) {
var _this$nodes;
newNode.parent = this; newNode.parent = this;
var oldIndex = this.index(oldNode); var oldIndex = this.index(oldNode);
this.nodes.splice(oldIndex + 1, 0, newNode); var resetNode = [];
for (var i = 2; i < arguments.length; i++) {
resetNode.push(arguments[i]);
}
(_this$nodes = this.nodes).splice.apply(_this$nodes, [oldIndex + 1, 0, newNode].concat(resetNode));
newNode.parent = this; newNode.parent = this;
var index; var index;
for (var id in this.indexes) { for (var id in this.indexes) {
index = this.indexes[id]; index = this.indexes[id];
if (oldIndex < index) { if (oldIndex < index) {
this.indexes[id] = index + 1; this.indexes[id] = index + arguments.length - 1;
} }
} }
return this; return this;
}; };
_proto.insertBefore = function insertBefore(oldNode, newNode) { _proto.insertBefore = function insertBefore(oldNode, newNode) {
var _this$nodes2;
newNode.parent = this; newNode.parent = this;
var oldIndex = this.index(oldNode); var oldIndex = this.index(oldNode);
this.nodes.splice(oldIndex, 0, newNode); var resetNode = [];
for (var i = 2; i < arguments.length; i++) {
resetNode.push(arguments[i]);
}
(_this$nodes2 = this.nodes).splice.apply(_this$nodes2, [oldIndex, 0, newNode].concat(resetNode));
newNode.parent = this; newNode.parent = this;
var index; var index;
for (var id in this.indexes) { for (var id in this.indexes) {
index = this.indexes[id]; index = this.indexes[id];
if (index >= oldIndex) { if (index >= oldIndex) {
this.indexes[id] = index + 1; this.indexes[id] = index + arguments.length - 1;
} }
} }
return this; return this;
@ -12056,8 +12066,6 @@ var hasRequiredLodash_camelcase;
function requireLodash_camelcase () { function requireLodash_camelcase () {
if (hasRequiredLodash_camelcase) return lodash_camelcase; if (hasRequiredLodash_camelcase) return lodash_camelcase;
hasRequiredLodash_camelcase = 1; hasRequiredLodash_camelcase = 1;
/** Used as references for various `Number` constants. */
var INFINITY = 1 / 0;
/** `Object#toString` result references. */ /** `Object#toString` result references. */
var symbolTag = '[object Symbol]'; var symbolTag = '[object Symbol]';
@ -12393,7 +12401,7 @@ function requireLodash_camelcase () {
return symbolToString ? symbolToString.call(value) : ''; return symbolToString ? symbolToString.call(value) : '';
} }
var result = (value + ''); var result = (value + '');
return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; return (result == '0' && (1 / value) == -Infinity) ? '-0' : result;
} }
/** /**
@ -13161,7 +13169,7 @@ function requireWasmHash () {
// 64 is the maximum chunk size for every possible wasm hash implementation // 64 is the maximum chunk size for every possible wasm hash implementation
// 4 is the maximum number of bytes per char for string encoding (max is utf-8) // 4 is the maximum number of bytes per char for string encoding (max is utf-8)
// ~3 makes sure that it's always a block of 4 chars, so avoid partially encoded bytes for base64 // ~3 makes sure that it's always a block of 4 chars, so avoid partially encoded bytes for base64
const MAX_SHORT_STRING = Math.floor((65536 - 64) / 4) & ~3; const MAX_SHORT_STRING = Math.floor((65536 - 64) / 4) & -4;
class WasmHash { class WasmHash {
/** /**
@ -19796,7 +19804,7 @@ const ${as} = {}`);
ast.forEach((node) => { ast.forEach((node) => {
if (node.type === "ExportDefaultDeclaration") { if (node.type === "ExportDefaultDeclaration") {
if (node.declaration.type === "ClassDeclaration" && node.declaration.id) { if (node.declaration.type === "ClassDeclaration" && node.declaration.id) {
let start = node.declaration.decorators && node.declaration.decorators.length > 0 ? node.declaration.decorators[node.declaration.decorators.length - 1].end : node.start; const start = node.declaration.decorators && node.declaration.decorators.length > 0 ? node.declaration.decorators[node.declaration.decorators.length - 1].end : node.start;
s.overwrite(start, node.declaration.id.start, ` class `); s.overwrite(start, node.declaration.id.start, ` class `);
s.append(` s.append(`
const ${as} = ${node.declaration.id.name}`); const ${as} = ${node.declaration.id.name}`);
@ -19915,289 +19923,250 @@ export default ${defaultVar}`;
} }
} }
var balancedMatch; const balanced = (a, b, str) => {
var hasRequiredBalancedMatch; const ma = a instanceof RegExp ? maybeMatch(a, str) : a;
const mb = b instanceof RegExp ? maybeMatch(b, str) : b;
const r = ma !== null && mb != null && range(ma, mb, str);
return (r && {
start: r[0],
end: r[1],
pre: str.slice(0, r[0]),
body: str.slice(r[0] + ma.length, r[1]),
post: str.slice(r[1] + mb.length),
});
};
const maybeMatch = (reg, str) => {
const m = str.match(reg);
return m ? m[0] : null;
};
const range = (a, b, str) => {
let begs, beg, left, right = undefined, result;
let ai = str.indexOf(a);
let bi = str.indexOf(b, ai + 1);
let i = ai;
if (ai >= 0 && bi > 0) {
if (a === b) {
return [ai, bi];
}
begs = [];
left = str.length;
while (i >= 0 && !result) {
if (i === ai) {
begs.push(i);
ai = str.indexOf(a, i + 1);
}
else if (begs.length === 1) {
const r = begs.pop();
if (r !== undefined)
result = [r, bi];
}
else {
beg = begs.pop();
if (beg !== undefined && beg < left) {
left = beg;
right = bi;
}
bi = str.indexOf(b, i + 1);
}
i = ai < bi && ai >= 0 ? ai : bi;
}
if (begs.length && right !== undefined) {
result = [left, right];
}
}
return result;
};
function requireBalancedMatch () { const escSlash = '\0SLASH' + Math.random() + '\0';
if (hasRequiredBalancedMatch) return balancedMatch; const escOpen = '\0OPEN' + Math.random() + '\0';
hasRequiredBalancedMatch = 1; const escClose = '\0CLOSE' + Math.random() + '\0';
balancedMatch = balanced; const escComma = '\0COMMA' + Math.random() + '\0';
function balanced(a, b, str) { const escPeriod = '\0PERIOD' + Math.random() + '\0';
if (a instanceof RegExp) a = maybeMatch(a, str); const escSlashPattern = new RegExp(escSlash, 'g');
if (b instanceof RegExp) b = maybeMatch(b, str); const escOpenPattern = new RegExp(escOpen, 'g');
const escClosePattern = new RegExp(escClose, 'g');
var r = range(a, b, str); const escCommaPattern = new RegExp(escComma, 'g');
const escPeriodPattern = new RegExp(escPeriod, 'g');
return r && { const slashPattern = /\\\\/g;
start: r[0], const openPattern = /\\{/g;
end: r[1], const closePattern = /\\}/g;
pre: str.slice(0, r[0]), const commaPattern = /\\,/g;
body: str.slice(r[0] + a.length, r[1]), const periodPattern = /\\./g;
post: str.slice(r[1] + b.length) function numeric(str) {
}; return !isNaN(str) ? parseInt(str, 10) : str.charCodeAt(0);
}
function maybeMatch(reg, str) {
var m = str.match(reg);
return m ? m[0] : null;
}
balanced.range = range;
function range(a, b, str) {
var begs, beg, left, right, result;
var ai = str.indexOf(a);
var bi = str.indexOf(b, ai + 1);
var i = ai;
if (ai >= 0 && bi > 0) {
if(a===b) {
return [ai, bi];
}
begs = [];
left = str.length;
while (i >= 0 && !result) {
if (i == ai) {
begs.push(i);
ai = str.indexOf(a, i + 1);
} else if (begs.length == 1) {
result = [ begs.pop(), bi ];
} else {
beg = begs.pop();
if (beg < left) {
left = beg;
right = bi;
}
bi = str.indexOf(b, i + 1);
}
i = ai < bi && ai >= 0 ? ai : bi;
}
if (begs.length) {
result = [ left, right ];
}
}
return result;
}
return balancedMatch;
} }
function escapeBraces(str) {
var braceExpansion; return str
var hasRequiredBraceExpansion; .replace(slashPattern, escSlash)
.replace(openPattern, escOpen)
function requireBraceExpansion () { .replace(closePattern, escClose)
if (hasRequiredBraceExpansion) return braceExpansion; .replace(commaPattern, escComma)
hasRequiredBraceExpansion = 1; .replace(periodPattern, escPeriod);
var balanced = /*@__PURE__*/ requireBalancedMatch(); }
function unescapeBraces(str) {
braceExpansion = expandTop; return str
.replace(escSlashPattern, '\\')
var escSlash = '\0SLASH'+Math.random()+'\0'; .replace(escOpenPattern, '{')
var escOpen = '\0OPEN'+Math.random()+'\0'; .replace(escClosePattern, '}')
var escClose = '\0CLOSE'+Math.random()+'\0'; .replace(escCommaPattern, ',')
var escComma = '\0COMMA'+Math.random()+'\0'; .replace(escPeriodPattern, '.');
var escPeriod = '\0PERIOD'+Math.random()+'\0'; }
/**
function numeric(str) { * Basically just str.split(","), but handling cases
return parseInt(str, 10) == str * where we have nested braced sections, which should be
? parseInt(str, 10) * treated as individual members, like {a,{b,c},d}
: str.charCodeAt(0); */
} function parseCommaParts(str) {
if (!str) {
function escapeBraces(str) { return [''];
return str.split('\\\\').join(escSlash) }
.split('\\{').join(escOpen) const parts = [];
.split('\\}').join(escClose) const m = balanced('{', '}', str);
.split('\\,').join(escComma) if (!m) {
.split('\\.').join(escPeriod); return str.split(',');
} }
const { pre, body, post } = m;
function unescapeBraces(str) { const p = pre.split(',');
return str.split(escSlash).join('\\') p[p.length - 1] += '{' + body + '}';
.split(escOpen).join('{') const postParts = parseCommaParts(post);
.split(escClose).join('}') if (post.length) {
.split(escComma).join(',') p[p.length - 1] += postParts.shift();
.split(escPeriod).join('.'); p.push.apply(p, postParts);
} }
parts.push.apply(parts, p);
return parts;
// Basically just str.split(","), but handling cases }
// where we have nested braced sections, which should be function expand(str) {
// treated as individual members, like {a,{b,c},d} if (!str) {
function parseCommaParts(str) { return [];
if (!str) }
return ['']; // I don't know why Bash 4.3 does this, but it does.
// Anything starting with {} will have the first two bytes preserved
var parts = []; // but *only* at the top level, so {},a}b will not expand to anything,
var m = balanced('{', '}', str); // but a{},b}c will be expanded to [a}c,abc].
// One could argue that this is a bug in Bash, but since the goal of
if (!m) // this module is to match Bash's rules, we escape a leading {}
return str.split(','); if (str.slice(0, 2) === '{}') {
str = '\\{\\}' + str.slice(2);
var pre = m.pre; }
var body = m.body; return expand_(escapeBraces(str), true).map(unescapeBraces);
var post = m.post; }
var p = pre.split(','); function embrace(str) {
return '{' + str + '}';
p[p.length-1] += '{' + body + '}'; }
var postParts = parseCommaParts(post); function isPadded(el) {
if (post.length) { return /^-?0\d/.test(el);
p[p.length-1] += postParts.shift(); }
p.push.apply(p, postParts); function lte(i, y) {
} return i <= y;
}
parts.push.apply(parts, p); function gte(i, y) {
return i >= y;
return parts; }
} function expand_(str, isTop) {
/** @type {string[]} */
function expandTop(str) { const expansions = [];
if (!str) const m = balanced('{', '}', str);
return []; if (!m)
return [str];
// I don't know why Bash 4.3 does this, but it does. // no need to expand pre, since it is guaranteed to be free of brace-sets
// Anything starting with {} will have the first two bytes preserved const pre = m.pre;
// but *only* at the top level, so {},a}b will not expand to anything, const post = m.post.length ? expand_(m.post, false) : [''];
// but a{},b}c will be expanded to [a}c,abc]. if (/\$$/.test(m.pre)) {
// One could argue that this is a bug in Bash, but since the goal of for (let k = 0; k < post.length; k++) {
// this module is to match Bash's rules, we escape a leading {} const expansion = pre + '{' + m.body + '}' + post[k];
if (str.substr(0, 2) === '{}') { expansions.push(expansion);
str = '\\{\\}' + str.substr(2); }
} }
else {
return expand(escapeBraces(str), true).map(unescapeBraces); const isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
} const isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
const isSequence = isNumericSequence || isAlphaSequence;
function embrace(str) { const isOptions = m.body.indexOf(',') >= 0;
return '{' + str + '}'; if (!isSequence && !isOptions) {
} // {a},b}
function isPadded(el) { if (m.post.match(/,(?!,).*\}/)) {
return /^-?0\d/.test(el); str = m.pre + '{' + m.body + escClose + m.post;
} return expand_(str);
}
function lte(i, y) { return [str];
return i <= y; }
} let n;
function gte(i, y) { if (isSequence) {
return i >= y; n = m.body.split(/\.\./);
} }
else {
function expand(str, isTop) { n = parseCommaParts(m.body);
var expansions = []; if (n.length === 1 && n[0] !== undefined) {
// x{{a,b}}y ==> x{a}y x{b}y
var m = balanced('{', '}', str); n = expand_(n[0], false).map(embrace);
if (!m) return [str]; //XXX is this necessary? Can't seem to hit it in tests.
/* c8 ignore start */
// no need to expand pre, since it is guaranteed to be free of brace-sets if (n.length === 1) {
var pre = m.pre; return post.map(p => m.pre + n[0] + p);
var post = m.post.length }
? expand(m.post, false) /* c8 ignore stop */
: ['']; }
}
if (/\$$/.test(m.pre)) { // at this point, n is the parts, and we know it's not a comma set
for (var k = 0; k < post.length; k++) { // with a single entry.
var expansion = pre+ '{' + m.body + '}' + post[k]; let N;
expansions.push(expansion); if (isSequence && n[0] !== undefined && n[1] !== undefined) {
} const x = numeric(n[0]);
} else { const y = numeric(n[1]);
var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body); const width = Math.max(n[0].length, n[1].length);
var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body); let incr = n.length === 3 && n[2] !== undefined ? Math.abs(numeric(n[2])) : 1;
var isSequence = isNumericSequence || isAlphaSequence; let test = lte;
var isOptions = m.body.indexOf(',') >= 0; const reverse = y < x;
if (!isSequence && !isOptions) { if (reverse) {
// {a},b} incr *= -1;
if (m.post.match(/,.*\}/)) { test = gte;
str = m.pre + '{' + m.body + escClose + m.post; }
return expand(str); const pad = n.some(isPadded);
} N = [];
return [str]; for (let i = x; test(i, y); i += incr) {
} let c;
if (isAlphaSequence) {
var n; c = String.fromCharCode(i);
if (isSequence) { if (c === '\\') {
n = m.body.split(/\.\./); c = '';
} else { }
n = parseCommaParts(m.body); }
if (n.length === 1) { else {
// x{{a,b}}y ==> x{a}y x{b}y c = String(i);
n = expand(n[0], false).map(embrace); if (pad) {
if (n.length === 1) { const need = width - c.length;
return post.map(function(p) { if (need > 0) {
return m.pre + n[0] + p; const z = new Array(need + 1).join('0');
}); if (i < 0) {
} c = '-' + z + c.slice(1);
} }
} else {
c = z + c;
// at this point, n is the parts, and we know it's not a comma set }
// with a single entry. }
var N; }
}
if (isSequence) { N.push(c);
var x = numeric(n[0]); }
var y = numeric(n[1]); }
var width = Math.max(n[0].length, n[1].length); else {
var incr = n.length == 3 N = [];
? Math.abs(numeric(n[2])) for (let j = 0; j < n.length; j++) {
: 1; N.push.apply(N, expand_(n[j], false));
var test = lte; }
var reverse = y < x; }
if (reverse) { for (let j = 0; j < N.length; j++) {
incr *= -1; for (let k = 0; k < post.length; k++) {
test = gte; const expansion = pre + N[j] + post[k];
} if (!isTop || isSequence || expansion) {
var pad = n.some(isPadded); expansions.push(expansion);
}
N = []; }
}
for (var i = x; test(i, y); i += incr) { }
var c; return expansions;
if (isAlphaSequence) {
c = String.fromCharCode(i);
if (c === '\\')
c = '';
} else {
c = String(i);
if (pad) {
var need = width - c.length;
if (need > 0) {
var z = new Array(need + 1).join('0');
if (i < 0)
c = '-' + z + c.slice(1);
else
c = z + c;
}
}
}
N.push(c);
}
} else {
N = [];
for (var j = 0; j < n.length; j++) {
N.push.apply(N, expand(n[j], false));
}
}
for (var j = 0; j < N.length; j++) {
for (var k = 0; k < post.length; k++) {
var expansion = pre + N[j] + post[k];
if (!isTop || isSequence || expansion)
expansions.push(expansion);
}
}
}
return expansions;
}
return braceExpansion;
} }
var braceExpansionExports = /*@__PURE__*/ requireBraceExpansion();
var expand = /*@__PURE__*/getDefaultExportFromCjs(braceExpansionExports);
const MAX_PATTERN_LENGTH = 1024 * 64; const MAX_PATTERN_LENGTH = 1024 * 64;
const assertValidPattern = (pattern) => { const assertValidPattern = (pattern) => {
@ -22318,25 +22287,39 @@ function resolveArrayElementType(ctx, node, scope) {
scope scope
); );
} }
function resolveStringType(ctx, node, scope) { function resolveStringType(ctx, node, scope, typeParameters) {
switch (node.type) { switch (node.type) {
case "StringLiteral": case "StringLiteral":
return [node.value]; return [node.value];
case "TSLiteralType": case "TSLiteralType":
return resolveStringType(ctx, node.literal, scope); return resolveStringType(ctx, node.literal, scope, typeParameters);
case "TSUnionType": case "TSUnionType":
return node.types.map((t) => resolveStringType(ctx, t, scope)).flat(); return node.types.map((t) => resolveStringType(ctx, t, scope, typeParameters)).flat();
case "TemplateLiteral": { case "TemplateLiteral": {
return resolveTemplateKeys(ctx, node, scope); return resolveTemplateKeys(ctx, node, scope);
} }
case "TSTypeReference": { case "TSTypeReference": {
const resolved = resolveTypeReference(ctx, node, scope); const resolved = resolveTypeReference(ctx, node, scope);
if (resolved) { if (resolved) {
return resolveStringType(ctx, resolved, scope); return resolveStringType(ctx, resolved, scope, typeParameters);
} }
if (node.typeName.type === "Identifier") { if (node.typeName.type === "Identifier") {
const getParam = (index = 0) => resolveStringType(ctx, node.typeParameters.params[index], scope); const name = node.typeName.name;
switch (node.typeName.name) { if (typeParameters && typeParameters[name]) {
return resolveStringType(
ctx,
typeParameters[name],
scope,
typeParameters
);
}
const getParam = (index = 0) => resolveStringType(
ctx,
node.typeParameters.params[index],
scope,
typeParameters
);
switch (name) {
case "Extract": case "Extract":
return getParam(1); return getParam(1);
case "Exclude": { case "Exclude": {
@ -22423,7 +22406,8 @@ function resolveBuiltin(ctx, node, name, scope, typeParameters) {
const picked = resolveStringType( const picked = resolveStringType(
ctx, ctx,
node.typeParameters.params[1], node.typeParameters.params[1],
scope scope,
typeParameters
); );
const res2 = { props: {}, calls: t.calls }; const res2 = { props: {}, calls: t.calls };
for (const key of picked) { for (const key of picked) {
@ -22435,7 +22419,8 @@ function resolveBuiltin(ctx, node, name, scope, typeParameters) {
const omitted = resolveStringType( const omitted = resolveStringType(
ctx, ctx,
node.typeParameters.params[1], node.typeParameters.params[1],
scope scope,
typeParameters
); );
const res = { props: {}, calls: t.calls }; const res = { props: {}, calls: t.calls };
for (const key in t.props) { for (const key in t.props) {
@ -22560,13 +22545,13 @@ function resolveFS(ctx) {
} }
return ctx.fs = { return ctx.fs = {
fileExists(file) { fileExists(file) {
if (file.endsWith(".vue.ts")) { if (file.endsWith(".vue.ts") && !file.endsWith(".d.vue.ts")) {
file = file.replace(/\.ts$/, ""); file = file.replace(/\.ts$/, "");
} }
return fs.fileExists(file); return fs.fileExists(file);
}, },
readFile(file) { readFile(file) {
if (file.endsWith(".vue.ts")) { if (file.endsWith(".vue.ts") && !file.endsWith(".d.vue.ts")) {
file = file.replace(/\.ts$/, ""); file = file.replace(/\.ts$/, "");
} }
return fs.readFile(file); return fs.readFile(file);
@ -22694,7 +22679,7 @@ function resolveWithTS(containingFile, source, ts2, fs) {
); );
if (res.resolvedModule) { if (res.resolvedModule) {
let filename = res.resolvedModule.resolvedFileName; let filename = res.resolvedModule.resolvedFileName;
if (filename.endsWith(".vue.ts")) { if (filename.endsWith(".vue.ts") && !filename.endsWith(".d.vue.ts")) {
filename = filename.replace(/\.ts$/, ""); filename = filename.replace(/\.ts$/, "");
} }
return fs.realpath ? fs.realpath(filename) : filename; return fs.realpath ? fs.realpath(filename) : filename;
@ -22738,13 +22723,13 @@ function fileToScope(ctx, filename, asGlobal = false) {
} }
const fs = resolveFS(ctx); const fs = resolveFS(ctx);
const source = fs.readFile(filename) || ""; const source = fs.readFile(filename) || "";
const body = parseFile(filename, source, ctx.options.babelParserPlugins); const body = parseFile(filename, source, fs, ctx.options.babelParserPlugins);
const scope = new TypeScope(filename, source, 0, recordImports(body)); const scope = new TypeScope(filename, source, 0, recordImports(body));
recordTypes(ctx, body, scope, asGlobal); recordTypes(ctx, body, scope, asGlobal);
fileToScopeCache.set(filename, scope); fileToScopeCache.set(filename, scope);
return scope; return scope;
} }
function parseFile(filename, content, parserPlugins) { function parseFile(filename, content, fs, parserPlugins) {
const ext = path$1.extname(filename); const ext = path$1.extname(filename);
if (ext === ".ts" || ext === ".mts" || ext === ".tsx" || ext === ".mtsx") { if (ext === ".ts" || ext === ".mts" || ext === ".tsx" || ext === ".mtsx") {
return parser$2.parse(content, { return parser$2.parse(content, {
@ -22755,7 +22740,17 @@ function parseFile(filename, content, parserPlugins) {
), ),
sourceType: "module" sourceType: "module"
}).program.body; }).program.body;
} else if (ext === ".vue") { }
const isUnknownTypeSource = !/\.[cm]?[tj]sx?$/.test(filename);
const arbitraryTypeSource = `${filename.slice(0, -ext.length)}.d${ext}.ts`;
const hasArbitraryTypeDeclaration = isUnknownTypeSource && fs.fileExists(arbitraryTypeSource);
if (hasArbitraryTypeDeclaration) {
return parser$2.parse(fs.readFile(arbitraryTypeSource), {
plugins: resolveParserPlugins("ts", parserPlugins, true),
sourceType: "module"
}).program.body;
}
if (ext === ".vue") {
const { const {
descriptor: { script, scriptSetup } descriptor: { script, scriptSetup }
} = parse$1(content); } = parse$1(content);
@ -23076,6 +23071,9 @@ function inferRuntimeType(ctx, node, scope = node._ownerScope || ctxToScope(ctx)
case "TSTypeReference": { case "TSTypeReference": {
const resolved = resolveTypeReference(ctx, node, scope); const resolved = resolveTypeReference(ctx, node, scope);
if (resolved) { if (resolved) {
if (resolved.type === "TSTypeAliasDeclaration" && resolved.typeAnnotation.type === "TSFunctionType") {
return ["Function"];
}
return inferRuntimeType(ctx, resolved, resolved._ownerScope, isKeyOf); return inferRuntimeType(ctx, resolved, resolved._ownerScope, isKeyOf);
} }
if (node.typeName.type === "Identifier") { if (node.typeName.type === "Identifier") {
@ -23926,7 +23924,7 @@ function transformDestructuredProps(ctx, vueImportAliases) {
}, },
leave(node, parent) { leave(node, parent) {
parent && parentStack.pop(); parent && parentStack.pop();
if (node.type === "BlockStatement" && !CompilerDOM.isFunctionType(parent) || CompilerDOM.isFunctionType(node)) { if (node.type === "BlockStatement" && !CompilerDOM.isFunctionType(parent) || CompilerDOM.isFunctionType(node) || node.type === "CatchClause") {
popScope(); popScope();
} }
} }
@ -24600,6 +24598,7 @@ let __temp${any}, __restore${any}
if (destructureElements.length) { if (destructureElements.length) {
args += `, { ${destructureElements.join(", ")} }`; args += `, { ${destructureElements.join(", ")} }`;
} }
let templateMap;
let returned; let returned;
if (!options.inlineTemplate || !sfc.template && ctx.hasDefaultExportRender) { if (!options.inlineTemplate || !sfc.template && ctx.hasDefaultExportRender) {
const allBindings = { const allBindings = {
@ -24628,7 +24627,7 @@ let __temp${any}, __restore${any}
if (options.templateOptions && options.templateOptions.ssr) { if (options.templateOptions && options.templateOptions.ssr) {
hasInlinedSsrRenderFn = true; hasInlinedSsrRenderFn = true;
} }
const { code, ast, preamble, tips, errors } = compileTemplate({ const { code, ast, preamble, tips, errors, map: map2 } = compileTemplate({
filename, filename,
ast: sfc.template.ast, ast: sfc.template.ast,
source: sfc.template.content, source: sfc.template.content,
@ -24645,6 +24644,7 @@ let __temp${any}, __restore${any}
bindingMetadata: ctx.bindingMetadata bindingMetadata: ctx.bindingMetadata
} }
}); });
templateMap = map2;
if (tips.length) { if (tips.length) {
tips.forEach(warnOnce); tips.forEach(warnOnce);
} }
@ -24761,16 +24761,23 @@ ${exposeCall}`
` `
); );
} }
const content = ctx.s.toString();
let map = options.sourceMap !== false ? ctx.s.generateMap({
source: filename,
hires: true,
includeContent: true
}) : void 0;
if (templateMap && map) {
const offset = content.indexOf(returned);
const templateLineOffset = content.slice(0, offset).split(/\r?\n/).length - 1;
map = mergeSourceMaps(map, templateMap, templateLineOffset);
}
return { return {
...scriptSetup, ...scriptSetup,
bindings: ctx.bindingMetadata, bindings: ctx.bindingMetadata,
imports: ctx.userImports, imports: ctx.userImports,
content: ctx.s.toString(), content,
map: options.sourceMap !== false ? ctx.s.generateMap({ map,
source: filename,
hires: true,
includeContent: true
}) : void 0,
scriptAst: scriptAst == null ? void 0 : scriptAst.body, scriptAst: scriptAst == null ? void 0 : scriptAst.body,
scriptSetupAst: scriptSetupAst == null ? void 0 : scriptSetupAst.body, scriptSetupAst: scriptSetupAst == null ? void 0 : scriptSetupAst.body,
deps: ctx.deps ? [...ctx.deps] : void 0 deps: ctx.deps ? [...ctx.deps] : void 0
@ -24808,7 +24815,7 @@ function walkDeclaration(from, node, bindings, userImportAliases, hoistStatic, i
} else if (isConst) { } else if (isConst) {
if (isCallOf( if (isCallOf(
init, init,
(m) => m === userImportAliases["ref"] || m === userImportAliases["computed"] || m === userImportAliases["shallowRef"] || m === userImportAliases["customRef"] || m === userImportAliases["toRef"] || m === DEFINE_MODEL (m) => m === userImportAliases["ref"] || m === userImportAliases["computed"] || m === userImportAliases["shallowRef"] || m === userImportAliases["customRef"] || m === userImportAliases["toRef"] || m === userImportAliases["useTemplateRef"] || m === DEFINE_MODEL
)) { )) {
bindingType = "setup-ref"; bindingType = "setup-ref";
} else { } else {
@ -24933,8 +24940,41 @@ function isStaticNode(node) {
} }
return false; return false;
} }
function mergeSourceMaps(scriptMap, templateMap, templateLineOffset) {
const generator = new sourceMapJs.SourceMapGenerator();
const addMapping = (map, lineOffset = 0) => {
const consumer = new sourceMapJs.SourceMapConsumer(map);
consumer.sources.forEach((sourceFile) => {
generator._sources.add(sourceFile);
const sourceContent = consumer.sourceContentFor(sourceFile);
if (sourceContent != null) {
generator.setSourceContent(sourceFile, sourceContent);
}
});
consumer.eachMapping((m) => {
if (m.originalLine == null) return;
generator.addMapping({
generated: {
line: m.generatedLine + lineOffset,
column: m.generatedColumn
},
original: {
line: m.originalLine,
column: m.originalColumn
},
source: m.source,
name: m.name
});
});
};
addMapping(scriptMap);
addMapping(templateMap, templateLineOffset);
generator._sourceRoot = scriptMap.sourceRoot;
generator._file = scriptMap.file;
return generator.toJSON();
}
const version = "3.5.13"; const version = "3.5.17";
const parseCache = parseCache$1; const parseCache = parseCache$1;
const errorMessages = { const errorMessages = {
...CompilerDOM.errorMessages, ...CompilerDOM.errorMessages,

View File

@ -1,6 +1,6 @@
import * as _babel_types from '@babel/types'; import * as _babel_types from '@babel/types';
import { Statement, Expression, TSType, Node, Program, CallExpression, ObjectPattern, TSModuleDeclaration, TSPropertySignature, TSMethodSignature, TSCallSignatureDeclaration, TSFunctionType } 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, RawSourceMap, SourceLocation, BindingMetadata as BindingMetadata$1 } from '@vue/compiler-core'; import { RootNode, CompilerOptions, CodegenResult, ParserOptions, RawSourceMap, CompilerError, SourceLocation, BindingMetadata as BindingMetadata$1 } from '@vue/compiler-core';
export { BindingMetadata, CompilerError, CompilerOptions, extractIdentifiers, generateCodeFrame, isInDestructureAssignment, isStaticProperty, walkIdentifiers } from '@vue/compiler-core'; export { BindingMetadata, CompilerError, CompilerOptions, extractIdentifiers, generateCodeFrame, isInDestructureAssignment, isStaticProperty, walkIdentifiers } from '@vue/compiler-core';
import { ParserPlugin } from '@babel/parser'; import { ParserPlugin } from '@babel/parser';
export { parse as babelParse } from '@babel/parser'; export { parse as babelParse } from '@babel/parser';
@ -482,3 +482,4 @@ export declare const walk: any;
*/ */
export declare const shouldTransformRef: () => boolean; export declare const shouldTransformRef: () => boolean;

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{ {
"name": "@vue/compiler-sfc", "name": "@vue/compiler-sfc",
"version": "3.5.13", "version": "3.5.17",
"description": "@vue/compiler-sfc", "description": "@vue/compiler-sfc",
"main": "dist/compiler-sfc.cjs.js", "main": "dist/compiler-sfc.cjs.js",
"module": "dist/compiler-sfc.esm-browser.js", "module": "dist/compiler-sfc.esm-browser.js",
@ -42,26 +42,26 @@
}, },
"homepage": "https://github.com/vuejs/core/tree/main/packages/compiler-sfc#readme", "homepage": "https://github.com/vuejs/core/tree/main/packages/compiler-sfc#readme",
"dependencies": { "dependencies": {
"@babel/parser": "^7.25.3", "@babel/parser": "^7.27.5",
"estree-walker": "^2.0.2", "estree-walker": "^2.0.2",
"magic-string": "^0.30.11", "magic-string": "^0.30.17",
"postcss": "^8.4.48", "postcss": "^8.5.6",
"source-map-js": "^1.2.0", "source-map-js": "^1.2.1",
"@vue/compiler-core": "3.5.13", "@vue/compiler-dom": "3.5.17",
"@vue/shared": "3.5.13", "@vue/compiler-core": "3.5.17",
"@vue/compiler-dom": "3.5.13", "@vue/compiler-ssr": "3.5.17",
"@vue/compiler-ssr": "3.5.13" "@vue/shared": "3.5.17"
}, },
"devDependencies": { "devDependencies": {
"@babel/types": "^7.25.2", "@babel/types": "^7.27.6",
"@vue/consolidate": "^1.0.0", "@vue/consolidate": "^1.0.0",
"hash-sum": "^2.0.0", "hash-sum": "^2.0.0",
"lru-cache": "10.1.0", "lru-cache": "10.1.0",
"merge-source-map": "^1.1.0", "merge-source-map": "^1.1.0",
"minimatch": "~9.0.5", "minimatch": "~10.0.3",
"postcss-modules": "^6.0.0", "postcss-modules": "^6.0.1",
"postcss-selector-parser": "^7.0.0", "postcss-selector-parser": "^7.1.0",
"pug": "^3.0.3", "pug": "^3.0.3",
"sass": "^1.80.6" "sass": "^1.89.2"
} }
} }

View File

@ -1,5 +1,5 @@
/** /**
* @vue/compiler-ssr v3.5.13 * @vue/compiler-ssr v3.5.17
* (c) 2018-present Yuxi (Evan) You and Vue contributors * (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT * @license MIT
**/ **/
@ -1086,6 +1086,17 @@ const ssrTransformModel = (dir, node, context) => {
); );
} }
} }
const processSelectChildren = (children) => {
children.forEach((child) => {
if (child.type === 1) {
processOption(child);
} else if (child.type === 11) {
processSelectChildren(child.children);
} else if (child.type === 9) {
child.branches.forEach((b) => processSelectChildren(b.children));
}
});
};
function processOption(plainNode) { function processOption(plainNode) {
if (plainNode.tag === "option") { if (plainNode.tag === "option") {
if (plainNode.props.findIndex((p) => p.name === "selected") === -1) { if (plainNode.props.findIndex((p) => p.name === "selected") === -1) {
@ -1112,9 +1123,7 @@ const ssrTransformModel = (dir, node, context) => {
); );
} }
} else if (plainNode.tag === "optgroup") { } else if (plainNode.tag === "optgroup") {
plainNode.children.forEach( processSelectChildren(plainNode.children);
(option) => processOption(option)
);
} }
} }
if (node.tagType === 0) { if (node.tagType === 0) {
@ -1199,18 +1208,7 @@ const ssrTransformModel = (dir, node, context) => {
checkDuplicatedValue(); checkDuplicatedValue();
node.children = [compilerDom.createInterpolation(model, model.loc)]; node.children = [compilerDom.createInterpolation(model, model.loc)];
} else if (node.tag === "select") { } else if (node.tag === "select") {
const processChildren = (children) => { processSelectChildren(node.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 { } else {
context.onError( context.onError(
compilerDom.createDOMCompilerError( compilerDom.createDOMCompilerError(

View File

@ -1,6 +1,6 @@
{ {
"name": "@vue/compiler-ssr", "name": "@vue/compiler-ssr",
"version": "3.5.13", "version": "3.5.17",
"description": "@vue/compiler-ssr", "description": "@vue/compiler-ssr",
"main": "dist/compiler-ssr.cjs.js", "main": "dist/compiler-ssr.cjs.js",
"types": "dist/compiler-ssr.d.ts", "types": "dist/compiler-ssr.d.ts",
@ -28,7 +28,7 @@
}, },
"homepage": "https://github.com/vuejs/core/tree/main/packages/compiler-ssr#readme", "homepage": "https://github.com/vuejs/core/tree/main/packages/compiler-ssr#readme",
"dependencies": { "dependencies": {
"@vue/shared": "3.5.13", "@vue/shared": "3.5.17",
"@vue/compiler-dom": "3.5.13" "@vue/compiler-dom": "3.5.17"
} }
} }

View File

@ -1,5 +1,5 @@
/** /**
* @vue/reactivity v3.5.13 * @vue/reactivity v3.5.17
* (c) 2018-present Yuxi (Evan) You and Vue contributors * (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT * @license MIT
**/ **/
@ -21,6 +21,10 @@ class EffectScope {
* @internal * @internal
*/ */
this._active = true; this._active = true;
/**
* @internal track `on` calls, allow `on` call multiple times
*/
this._on = 0;
/** /**
* @internal * @internal
*/ */
@ -91,14 +95,20 @@ class EffectScope {
* @internal * @internal
*/ */
on() { on() {
activeEffectScope = this; if (++this._on === 1) {
this.prevScope = activeEffectScope;
activeEffectScope = this;
}
} }
/** /**
* This should only be called on non-detached scopes * This should only be called on non-detached scopes
* @internal * @internal
*/ */
off() { off() {
activeEffectScope = this.parent; if (this._on > 0 && --this._on === 0) {
activeEffectScope = this.prevScope;
this.prevScope = void 0;
}
} }
stop(fromParent) { stop(fromParent) {
if (this._active) { if (this._active) {
@ -160,7 +170,9 @@ const EffectFlags = {
"ALLOW_RECURSE": 32, "ALLOW_RECURSE": 32,
"32": "ALLOW_RECURSE", "32": "ALLOW_RECURSE",
"PAUSED": 64, "PAUSED": 64,
"64": "PAUSED" "64": "PAUSED",
"EVALUATED": 128,
"128": "EVALUATED"
}; };
const pausedQueueEffects = /* @__PURE__ */ new WeakSet(); const pausedQueueEffects = /* @__PURE__ */ new WeakSet();
class ReactiveEffect { class ReactiveEffect {
@ -196,7 +208,7 @@ class ReactiveEffect {
} }
resume() { resume() {
if (this.flags & 64) { if (this.flags & 64) {
this.flags &= ~64; this.flags &= -65;
if (pausedQueueEffects.has(this)) { if (pausedQueueEffects.has(this)) {
pausedQueueEffects.delete(this); pausedQueueEffects.delete(this);
this.trigger(); this.trigger();
@ -236,7 +248,7 @@ class ReactiveEffect {
cleanupDeps(this); cleanupDeps(this);
activeSub = prevEffect; activeSub = prevEffect;
shouldTrack = prevShouldTrack; shouldTrack = prevShouldTrack;
this.flags &= ~2; this.flags &= -3;
} }
} }
stop() { stop() {
@ -247,7 +259,7 @@ class ReactiveEffect {
this.deps = this.depsTail = void 0; this.deps = this.depsTail = void 0;
cleanupEffect(this); cleanupEffect(this);
this.onStop && this.onStop(); this.onStop && this.onStop();
this.flags &= ~1; this.flags &= -2;
} }
} }
trigger() { trigger() {
@ -297,7 +309,7 @@ function endBatch() {
while (e) { while (e) {
const next = e.next; const next = e.next;
e.next = void 0; e.next = void 0;
e.flags &= ~8; e.flags &= -9;
e = next; e = next;
} }
} }
@ -308,7 +320,7 @@ function endBatch() {
while (e) { while (e) {
const next = e.next; const next = e.next;
e.next = void 0; e.next = void 0;
e.flags &= ~8; e.flags &= -9;
if (e.flags & 1) { if (e.flags & 1) {
try { try {
; ;
@ -364,17 +376,16 @@ function refreshComputed(computed) {
if (computed.flags & 4 && !(computed.flags & 16)) { if (computed.flags & 4 && !(computed.flags & 16)) {
return; return;
} }
computed.flags &= ~16; computed.flags &= -17;
if (computed.globalVersion === globalVersion) { if (computed.globalVersion === globalVersion) {
return; return;
} }
computed.globalVersion = globalVersion; computed.globalVersion = globalVersion;
const dep = computed.dep; if (!computed.isSSR && computed.flags & 128 && (!computed.deps && !computed._dirty || !isDirty(computed))) {
computed.flags |= 2;
if (dep.version > 0 && !computed.isSSR && computed.deps && !isDirty(computed)) {
computed.flags &= ~2;
return; return;
} }
computed.flags |= 2;
const dep = computed.dep;
const prevSub = activeSub; const prevSub = activeSub;
const prevShouldTrack = shouldTrack; const prevShouldTrack = shouldTrack;
activeSub = computed; activeSub = computed;
@ -383,6 +394,7 @@ function refreshComputed(computed) {
prepareDeps(computed); prepareDeps(computed);
const value = computed.fn(computed._value); const value = computed.fn(computed._value);
if (dep.version === 0 || shared.hasChanged(value, computed._value)) { if (dep.version === 0 || shared.hasChanged(value, computed._value)) {
computed.flags |= 128;
computed._value = value; computed._value = value;
dep.version++; dep.version++;
} }
@ -393,7 +405,7 @@ function refreshComputed(computed) {
activeSub = prevSub; activeSub = prevSub;
shouldTrack = prevShouldTrack; shouldTrack = prevShouldTrack;
cleanupDeps(computed); cleanupDeps(computed);
computed.flags &= ~2; computed.flags &= -3;
} }
} }
function removeSub(link, soft = false) { function removeSub(link, soft = false) {
@ -412,7 +424,7 @@ function removeSub(link, soft = false) {
if (dep.subs === link) { if (dep.subs === link) {
dep.subs = prevSub; dep.subs = prevSub;
if (!prevSub && dep.computed) { if (!prevSub && dep.computed) {
dep.computed.flags &= ~4; dep.computed.flags &= -5;
for (let l = dep.computed.deps; l; l = l.nextDep) { for (let l = dep.computed.deps; l; l = l.nextDep) {
removeSub(l, true); removeSub(l, true);
} }
@ -501,6 +513,7 @@ class Link {
} }
} }
class Dep { class Dep {
// TODO isolatedDeclarations "__v_skip"
constructor(computed) { constructor(computed) {
this.computed = computed; this.computed = computed;
this.version = 0; this.version = 0;
@ -521,6 +534,10 @@ class Dep {
* Subscriber counter * Subscriber counter
*/ */
this.sc = 0; this.sc = 0;
/**
* @internal
*/
this.__v_skip = true;
{ {
this.subsHead = void 0; this.subsHead = void 0;
} }
@ -1358,14 +1375,14 @@ function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandl
if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) { if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) {
return target; return target;
} }
const existingProxy = proxyMap.get(target);
if (existingProxy) {
return existingProxy;
}
const targetType = getTargetType(target); const targetType = getTargetType(target);
if (targetType === 0 /* INVALID */) { if (targetType === 0 /* INVALID */) {
return target; return target;
} }
const existingProxy = proxyMap.get(target);
if (existingProxy) {
return existingProxy;
}
const proxy = new Proxy( const proxy = new Proxy(
target, target,
targetType === 2 /* COLLECTION */ ? collectionHandlers : baseHandlers targetType === 2 /* COLLECTION */ ? collectionHandlers : baseHandlers
@ -1804,11 +1821,11 @@ function watch(source, cb, options = shared.EMPTY_OBJ) {
oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue, oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
boundCleanup boundCleanup
]; ];
oldValue = newValue;
call ? call(cb, 3, args) : ( call ? call(cb, 3, args) : (
// @ts-expect-error // @ts-expect-error
cb(...args) cb(...args)
); );
oldValue = newValue;
} finally { } finally {
activeWatcher = currentWatcher; activeWatcher = currentWatcher;
} }

View File

@ -1,5 +1,5 @@
/** /**
* @vue/reactivity v3.5.13 * @vue/reactivity v3.5.17
* (c) 2018-present Yuxi (Evan) You and Vue contributors * (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT * @license MIT
**/ **/
@ -17,6 +17,10 @@ class EffectScope {
* @internal * @internal
*/ */
this._active = true; this._active = true;
/**
* @internal track `on` calls, allow `on` call multiple times
*/
this._on = 0;
/** /**
* @internal * @internal
*/ */
@ -85,14 +89,20 @@ class EffectScope {
* @internal * @internal
*/ */
on() { on() {
activeEffectScope = this; if (++this._on === 1) {
this.prevScope = activeEffectScope;
activeEffectScope = this;
}
} }
/** /**
* This should only be called on non-detached scopes * This should only be called on non-detached scopes
* @internal * @internal
*/ */
off() { off() {
activeEffectScope = this.parent; if (this._on > 0 && --this._on === 0) {
activeEffectScope = this.prevScope;
this.prevScope = void 0;
}
} }
stop(fromParent) { stop(fromParent) {
if (this._active) { if (this._active) {
@ -150,7 +160,9 @@ const EffectFlags = {
"ALLOW_RECURSE": 32, "ALLOW_RECURSE": 32,
"32": "ALLOW_RECURSE", "32": "ALLOW_RECURSE",
"PAUSED": 64, "PAUSED": 64,
"64": "PAUSED" "64": "PAUSED",
"EVALUATED": 128,
"128": "EVALUATED"
}; };
const pausedQueueEffects = /* @__PURE__ */ new WeakSet(); const pausedQueueEffects = /* @__PURE__ */ new WeakSet();
class ReactiveEffect { class ReactiveEffect {
@ -186,7 +198,7 @@ class ReactiveEffect {
} }
resume() { resume() {
if (this.flags & 64) { if (this.flags & 64) {
this.flags &= ~64; this.flags &= -65;
if (pausedQueueEffects.has(this)) { if (pausedQueueEffects.has(this)) {
pausedQueueEffects.delete(this); pausedQueueEffects.delete(this);
this.trigger(); this.trigger();
@ -221,7 +233,7 @@ class ReactiveEffect {
cleanupDeps(this); cleanupDeps(this);
activeSub = prevEffect; activeSub = prevEffect;
shouldTrack = prevShouldTrack; shouldTrack = prevShouldTrack;
this.flags &= ~2; this.flags &= -3;
} }
} }
stop() { stop() {
@ -232,7 +244,7 @@ class ReactiveEffect {
this.deps = this.depsTail = void 0; this.deps = this.depsTail = void 0;
cleanupEffect(this); cleanupEffect(this);
this.onStop && this.onStop(); this.onStop && this.onStop();
this.flags &= ~1; this.flags &= -2;
} }
} }
trigger() { trigger() {
@ -282,7 +294,7 @@ function endBatch() {
while (e) { while (e) {
const next = e.next; const next = e.next;
e.next = void 0; e.next = void 0;
e.flags &= ~8; e.flags &= -9;
e = next; e = next;
} }
} }
@ -293,7 +305,7 @@ function endBatch() {
while (e) { while (e) {
const next = e.next; const next = e.next;
e.next = void 0; e.next = void 0;
e.flags &= ~8; e.flags &= -9;
if (e.flags & 1) { if (e.flags & 1) {
try { try {
; ;
@ -349,17 +361,16 @@ function refreshComputed(computed) {
if (computed.flags & 4 && !(computed.flags & 16)) { if (computed.flags & 4 && !(computed.flags & 16)) {
return; return;
} }
computed.flags &= ~16; computed.flags &= -17;
if (computed.globalVersion === globalVersion) { if (computed.globalVersion === globalVersion) {
return; return;
} }
computed.globalVersion = globalVersion; computed.globalVersion = globalVersion;
const dep = computed.dep; if (!computed.isSSR && computed.flags & 128 && (!computed.deps && !computed._dirty || !isDirty(computed))) {
computed.flags |= 2;
if (dep.version > 0 && !computed.isSSR && computed.deps && !isDirty(computed)) {
computed.flags &= ~2;
return; return;
} }
computed.flags |= 2;
const dep = computed.dep;
const prevSub = activeSub; const prevSub = activeSub;
const prevShouldTrack = shouldTrack; const prevShouldTrack = shouldTrack;
activeSub = computed; activeSub = computed;
@ -368,6 +379,7 @@ function refreshComputed(computed) {
prepareDeps(computed); prepareDeps(computed);
const value = computed.fn(computed._value); const value = computed.fn(computed._value);
if (dep.version === 0 || shared.hasChanged(value, computed._value)) { if (dep.version === 0 || shared.hasChanged(value, computed._value)) {
computed.flags |= 128;
computed._value = value; computed._value = value;
dep.version++; dep.version++;
} }
@ -378,7 +390,7 @@ function refreshComputed(computed) {
activeSub = prevSub; activeSub = prevSub;
shouldTrack = prevShouldTrack; shouldTrack = prevShouldTrack;
cleanupDeps(computed); cleanupDeps(computed);
computed.flags &= ~2; computed.flags &= -3;
} }
} }
function removeSub(link, soft = false) { function removeSub(link, soft = false) {
@ -394,7 +406,7 @@ function removeSub(link, soft = false) {
if (dep.subs === link) { if (dep.subs === link) {
dep.subs = prevSub; dep.subs = prevSub;
if (!prevSub && dep.computed) { if (!prevSub && dep.computed) {
dep.computed.flags &= ~4; dep.computed.flags &= -5;
for (let l = dep.computed.deps; l; l = l.nextDep) { for (let l = dep.computed.deps; l; l = l.nextDep) {
removeSub(l, true); removeSub(l, true);
} }
@ -479,6 +491,7 @@ class Link {
} }
} }
class Dep { class Dep {
// TODO isolatedDeclarations "__v_skip"
constructor(computed) { constructor(computed) {
this.computed = computed; this.computed = computed;
this.version = 0; this.version = 0;
@ -499,6 +512,10 @@ class Dep {
* Subscriber counter * Subscriber counter
*/ */
this.sc = 0; this.sc = 0;
/**
* @internal
*/
this.__v_skip = true;
} }
track(debugInfo) { track(debugInfo) {
if (!activeSub || !shouldTrack || activeSub === this.computed) { if (!activeSub || !shouldTrack || activeSub === this.computed) {
@ -1254,14 +1271,14 @@ function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandl
if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) { if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) {
return target; return target;
} }
const existingProxy = proxyMap.get(target);
if (existingProxy) {
return existingProxy;
}
const targetType = getTargetType(target); const targetType = getTargetType(target);
if (targetType === 0 /* INVALID */) { if (targetType === 0 /* INVALID */) {
return target; return target;
} }
const existingProxy = proxyMap.get(target);
if (existingProxy) {
return existingProxy;
}
const proxy = new Proxy( const proxy = new Proxy(
target, target,
targetType === 2 /* COLLECTION */ ? collectionHandlers : baseHandlers targetType === 2 /* COLLECTION */ ? collectionHandlers : baseHandlers
@ -1658,11 +1675,11 @@ function watch(source, cb, options = shared.EMPTY_OBJ) {
oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue, oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
boundCleanup boundCleanup
]; ];
oldValue = newValue;
call ? call(cb, 3, args) : ( call ? call(cb, 3, args) : (
// @ts-expect-error // @ts-expect-error
cb(...args) cb(...args)
); );
oldValue = newValue;
} finally { } finally {
activeWatcher = currentWatcher; activeWatcher = currentWatcher;
} }

View File

@ -47,9 +47,9 @@ export type ShallowReactive<T> = T & {
[ShallowReactiveMarker]?: true; [ShallowReactiveMarker]?: true;
}; };
/** /**
* Shallow version of {@link reactive()}. * Shallow version of {@link reactive}.
* *
* Unlike {@link reactive()}, there is no deep conversion: only root-level * Unlike {@link reactive}, there is no deep conversion: only root-level
* properties are reactive for a shallow reactive object. Property values are * properties are reactive for a shallow reactive object. Property values are
* stored and exposed as-is - this also means properties with ref values will * stored and exposed as-is - this also means properties with ref values will
* not be automatically unwrapped. * not be automatically unwrapped.
@ -87,7 +87,7 @@ export type DeepReadonly<T> = T extends Builtin ? T : T extends Map<infer K, inf
* the original. * the original.
* *
* A readonly proxy is deep: any nested property accessed will be readonly as * A readonly proxy is deep: any nested property accessed will be readonly as
* well. It also has the same ref-unwrapping behavior as {@link reactive()}, * well. It also has the same ref-unwrapping behavior as {@link reactive},
* except the unwrapped values will also be made readonly. * except the unwrapped values will also be made readonly.
* *
* @example * @example
@ -113,9 +113,9 @@ export type DeepReadonly<T> = T extends Builtin ? T : T extends Map<infer K, inf
*/ */
export declare function readonly<T extends object>(target: T): DeepReadonly<UnwrapNestedRefs<T>>; export declare function readonly<T extends object>(target: T): DeepReadonly<UnwrapNestedRefs<T>>;
/** /**
* Shallow version of {@link readonly()}. * Shallow version of {@link readonly}.
* *
* Unlike {@link readonly()}, there is no deep conversion: only root-level * Unlike {@link readonly}, there is no deep conversion: only root-level
* properties are made readonly. Property values are stored and exposed as-is - * properties are made readonly. Property values are stored and exposed as-is -
* this also means properties with ref values will not be automatically * this also means properties with ref values will not be automatically
* unwrapped. * unwrapped.
@ -144,8 +144,8 @@ export declare function readonly<T extends object>(target: T): DeepReadonly<Unwr
*/ */
export declare function shallowReadonly<T extends object>(target: T): Readonly<T>; export declare function shallowReadonly<T extends object>(target: T): Readonly<T>;
/** /**
* Checks if an object is a proxy created by {@link reactive()} or * Checks if an object is a proxy created by {@link reactive} or
* {@link shallowReactive()} (or {@link ref()} in some cases). * {@link shallowReactive} (or {@link ref} in some cases).
* *
* @example * @example
* ```js * ```js
@ -167,7 +167,7 @@ export declare function isReactive(value: unknown): boolean;
* readonly object can change, but they can't be assigned directly via the * readonly object can change, but they can't be assigned directly via the
* passed object. * passed object.
* *
* The proxies created by {@link readonly()} and {@link shallowReadonly()} are * The proxies created by {@link readonly} and {@link shallowReadonly} are
* both considered readonly, as is a computed ref without a set function. * both considered readonly, as is a computed ref without a set function.
* *
* @param value - The value to check. * @param value - The value to check.
@ -177,7 +177,7 @@ export declare function isReadonly(value: unknown): boolean;
export declare function isShallow(value: unknown): boolean; export declare function isShallow(value: unknown): boolean;
/** /**
* Checks if an object is a proxy created by {@link reactive}, * Checks if an object is a proxy created by {@link reactive},
* {@link readonly}, {@link shallowReactive} or {@link shallowReadonly()}. * {@link readonly}, {@link shallowReactive} or {@link shallowReadonly}.
* *
* @param value - The value to check. * @param value - The value to check.
* @see {@link https://vuejs.org/api/reactivity-utilities.html#isproxy} * @see {@link https://vuejs.org/api/reactivity-utilities.html#isproxy}
@ -187,8 +187,8 @@ export declare function isProxy(value: any): boolean;
* Returns the raw, original object of a Vue-created proxy. * Returns the raw, original object of a Vue-created proxy.
* *
* `toRaw()` can return the original object from proxies created by * `toRaw()` can return the original object from proxies created by
* {@link reactive()}, {@link readonly()}, {@link shallowReactive()} or * {@link reactive}, {@link readonly}, {@link shallowReactive} or
* {@link shallowReadonly()}. * {@link shallowReadonly}.
* *
* This is an escape hatch that can be used to temporarily read without * This is an escape hatch that can be used to temporarily read without
* incurring proxy access / tracking overhead or write without triggering * incurring proxy access / tracking overhead or write without triggering
@ -225,7 +225,7 @@ export type Raw<T> = T & {
* ``` * ```
* *
* **Warning:** `markRaw()` together with the shallow APIs such as * **Warning:** `markRaw()` together with the shallow APIs such as
* {@link shallowReactive()} allow you to selectively opt-out of the default * {@link shallowReactive} allow you to selectively opt-out of the default
* deep reactive/readonly conversion and embed raw, non-proxied objects in your * deep reactive/readonly conversion and embed raw, non-proxied objects in your
* state graph. * state graph.
* *
@ -281,7 +281,8 @@ export declare enum EffectFlags {
NOTIFIED = 8, NOTIFIED = 8,
DIRTY = 16, DIRTY = 16,
ALLOW_RECURSE = 32, ALLOW_RECURSE = 32,
PAUSED = 64 PAUSED = 64,
EVALUATED = 128
} }
/** /**
* Subscriber is a type that tracks (or subscribes to) a list of deps. * Subscriber is a type that tracks (or subscribes to) a list of deps.
@ -447,7 +448,7 @@ export type ShallowRef<T = any, S = T> = Ref<T, S> & {
[ShallowRefMarker]?: true; [ShallowRefMarker]?: true;
}; };
/** /**
* Shallow version of {@link ref()}. * Shallow version of {@link ref}.
* *
* @example * @example
* ```js * ```js
@ -512,7 +513,7 @@ export type MaybeRefOrGetter<T = any> = MaybeRef<T> | ComputedRef<T> | (() => T)
export declare function unref<T>(ref: MaybeRef<T> | ComputedRef<T>): T; export declare function unref<T>(ref: MaybeRef<T> | ComputedRef<T>): T;
/** /**
* Normalizes values / refs / getters to values. * Normalizes values / refs / getters to values.
* This is similar to {@link unref()}, except that it also normalizes getters. * This is similar to {@link unref}, except that it also normalizes getters.
* If the argument is a getter, it will be invoked and its return value will * If the argument is a getter, it will be invoked and its return value will
* be returned. * be returned.
* *
@ -554,7 +555,7 @@ export type ToRefs<T = any> = {
/** /**
* Converts a reactive object to a plain object where each property of the * Converts a reactive object to a plain object where each property of the
* resulting object is a ref pointing to the corresponding property of the * resulting object is a ref pointing to the corresponding property of the
* original object. Each individual ref is created using {@link toRef()}. * original object. Each individual ref is created using {@link toRef}.
* *
* @param object - Reactive object to be made into an object of linked refs. * @param object - Reactive object to be made into an object of linked refs.
* @see {@link https://vuejs.org/api/reactivity-utilities.html#torefs} * @see {@link https://vuejs.org/api/reactivity-utilities.html#torefs}
@ -672,6 +673,7 @@ export declare class EffectScope {
*/ */
resume(): void; resume(): void;
run<T>(fn: () => T): T | undefined; run<T>(fn: () => T): T | undefined;
prevScope: EffectScope | undefined;
stop(fromParent?: boolean): void; stop(fromParent?: boolean): void;
} }
/** /**
@ -752,3 +754,4 @@ export declare function onWatcherCleanup(cleanupFn: () => void, failSilently?: b
export declare function watch(source: WatchSource | WatchSource[] | WatchEffect | object, cb?: WatchCallback | null, options?: WatchOptions): WatchHandle; 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; export declare function traverse(value: unknown, depth?: number, seen?: Set<unknown>): unknown;

View File

@ -1,5 +1,5 @@
/** /**
* @vue/reactivity v3.5.13 * @vue/reactivity v3.5.17
* (c) 2018-present Yuxi (Evan) You and Vue contributors * (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT * @license MIT
**/ **/
@ -69,6 +69,10 @@ class EffectScope {
* @internal * @internal
*/ */
this._active = true; this._active = true;
/**
* @internal track `on` calls, allow `on` call multiple times
*/
this._on = 0;
/** /**
* @internal * @internal
*/ */
@ -139,14 +143,20 @@ class EffectScope {
* @internal * @internal
*/ */
on() { on() {
activeEffectScope = this; if (++this._on === 1) {
this.prevScope = activeEffectScope;
activeEffectScope = this;
}
} }
/** /**
* This should only be called on non-detached scopes * This should only be called on non-detached scopes
* @internal * @internal
*/ */
off() { off() {
activeEffectScope = this.parent; if (this._on > 0 && --this._on === 0) {
activeEffectScope = this.prevScope;
this.prevScope = void 0;
}
} }
stop(fromParent) { stop(fromParent) {
if (this._active) { if (this._active) {
@ -208,7 +218,9 @@ const EffectFlags = {
"ALLOW_RECURSE": 32, "ALLOW_RECURSE": 32,
"32": "ALLOW_RECURSE", "32": "ALLOW_RECURSE",
"PAUSED": 64, "PAUSED": 64,
"64": "PAUSED" "64": "PAUSED",
"EVALUATED": 128,
"128": "EVALUATED"
}; };
const pausedQueueEffects = /* @__PURE__ */ new WeakSet(); const pausedQueueEffects = /* @__PURE__ */ new WeakSet();
class ReactiveEffect { class ReactiveEffect {
@ -244,7 +256,7 @@ class ReactiveEffect {
} }
resume() { resume() {
if (this.flags & 64) { if (this.flags & 64) {
this.flags &= ~64; this.flags &= -65;
if (pausedQueueEffects.has(this)) { if (pausedQueueEffects.has(this)) {
pausedQueueEffects.delete(this); pausedQueueEffects.delete(this);
this.trigger(); this.trigger();
@ -284,7 +296,7 @@ class ReactiveEffect {
cleanupDeps(this); cleanupDeps(this);
activeSub = prevEffect; activeSub = prevEffect;
shouldTrack = prevShouldTrack; shouldTrack = prevShouldTrack;
this.flags &= ~2; this.flags &= -3;
} }
} }
stop() { stop() {
@ -295,7 +307,7 @@ class ReactiveEffect {
this.deps = this.depsTail = void 0; this.deps = this.depsTail = void 0;
cleanupEffect(this); cleanupEffect(this);
this.onStop && this.onStop(); this.onStop && this.onStop();
this.flags &= ~1; this.flags &= -2;
} }
} }
trigger() { trigger() {
@ -345,7 +357,7 @@ function endBatch() {
while (e) { while (e) {
const next = e.next; const next = e.next;
e.next = void 0; e.next = void 0;
e.flags &= ~8; e.flags &= -9;
e = next; e = next;
} }
} }
@ -356,7 +368,7 @@ function endBatch() {
while (e) { while (e) {
const next = e.next; const next = e.next;
e.next = void 0; e.next = void 0;
e.flags &= ~8; e.flags &= -9;
if (e.flags & 1) { if (e.flags & 1) {
try { try {
; ;
@ -412,17 +424,16 @@ function refreshComputed(computed) {
if (computed.flags & 4 && !(computed.flags & 16)) { if (computed.flags & 4 && !(computed.flags & 16)) {
return; return;
} }
computed.flags &= ~16; computed.flags &= -17;
if (computed.globalVersion === globalVersion) { if (computed.globalVersion === globalVersion) {
return; return;
} }
computed.globalVersion = globalVersion; computed.globalVersion = globalVersion;
const dep = computed.dep; if (!computed.isSSR && computed.flags & 128 && (!computed.deps && !computed._dirty || !isDirty(computed))) {
computed.flags |= 2;
if (dep.version > 0 && !computed.isSSR && computed.deps && !isDirty(computed)) {
computed.flags &= ~2;
return; return;
} }
computed.flags |= 2;
const dep = computed.dep;
const prevSub = activeSub; const prevSub = activeSub;
const prevShouldTrack = shouldTrack; const prevShouldTrack = shouldTrack;
activeSub = computed; activeSub = computed;
@ -431,6 +442,7 @@ function refreshComputed(computed) {
prepareDeps(computed); prepareDeps(computed);
const value = computed.fn(computed._value); const value = computed.fn(computed._value);
if (dep.version === 0 || hasChanged(value, computed._value)) { if (dep.version === 0 || hasChanged(value, computed._value)) {
computed.flags |= 128;
computed._value = value; computed._value = value;
dep.version++; dep.version++;
} }
@ -441,7 +453,7 @@ function refreshComputed(computed) {
activeSub = prevSub; activeSub = prevSub;
shouldTrack = prevShouldTrack; shouldTrack = prevShouldTrack;
cleanupDeps(computed); cleanupDeps(computed);
computed.flags &= ~2; computed.flags &= -3;
} }
} }
function removeSub(link, soft = false) { function removeSub(link, soft = false) {
@ -460,7 +472,7 @@ function removeSub(link, soft = false) {
if (dep.subs === link) { if (dep.subs === link) {
dep.subs = prevSub; dep.subs = prevSub;
if (!prevSub && dep.computed) { if (!prevSub && dep.computed) {
dep.computed.flags &= ~4; dep.computed.flags &= -5;
for (let l = dep.computed.deps; l; l = l.nextDep) { for (let l = dep.computed.deps; l; l = l.nextDep) {
removeSub(l, true); removeSub(l, true);
} }
@ -549,6 +561,7 @@ class Link {
} }
} }
class Dep { class Dep {
// TODO isolatedDeclarations "__v_skip"
constructor(computed) { constructor(computed) {
this.computed = computed; this.computed = computed;
this.version = 0; this.version = 0;
@ -569,6 +582,10 @@ class Dep {
* Subscriber counter * Subscriber counter
*/ */
this.sc = 0; this.sc = 0;
/**
* @internal
*/
this.__v_skip = true;
{ {
this.subsHead = void 0; this.subsHead = void 0;
} }
@ -1406,14 +1423,14 @@ function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandl
if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) { if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) {
return target; return target;
} }
const existingProxy = proxyMap.get(target);
if (existingProxy) {
return existingProxy;
}
const targetType = getTargetType(target); const targetType = getTargetType(target);
if (targetType === 0 /* INVALID */) { if (targetType === 0 /* INVALID */) {
return target; return target;
} }
const existingProxy = proxyMap.get(target);
if (existingProxy) {
return existingProxy;
}
const proxy = new Proxy( const proxy = new Proxy(
target, target,
targetType === 2 /* COLLECTION */ ? collectionHandlers : baseHandlers targetType === 2 /* COLLECTION */ ? collectionHandlers : baseHandlers
@ -1852,11 +1869,11 @@ function watch(source, cb, options = EMPTY_OBJ) {
oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue, oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
boundCleanup boundCleanup
]; ];
oldValue = newValue;
call ? call(cb, 3, args) : ( call ? call(cb, 3, args) : (
// @ts-expect-error // @ts-expect-error
cb(...args) cb(...args)
); );
oldValue = newValue;
} finally { } finally {
activeWatcher = currentWatcher; activeWatcher = currentWatcher;
} }

File diff suppressed because one or more lines are too long

View File

@ -1,9 +1,9 @@
/** /**
* @vue/reactivity v3.5.13 * @vue/reactivity v3.5.17
* (c) 2018-present Yuxi (Evan) You and Vue contributors * (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT * @license MIT
**/ **/
import { hasChanged, extend, isArray, isIntegerKey, isSymbol, isMap, hasOwn, isObject, makeMap, toRawType, capitalize, def, isFunction, EMPTY_OBJ, isSet, isPlainObject, NOOP, remove } from '@vue/shared'; import { extend, hasChanged, isArray, isIntegerKey, isSymbol, isMap, hasOwn, makeMap, isObject, capitalize, toRawType, def, isFunction, EMPTY_OBJ, isSet, isPlainObject, remove, NOOP } from '@vue/shared';
function warn(msg, ...args) { function warn(msg, ...args) {
console.warn(`[Vue warn] ${msg}`, ...args); console.warn(`[Vue warn] ${msg}`, ...args);
@ -17,6 +17,10 @@ class EffectScope {
* @internal * @internal
*/ */
this._active = true; this._active = true;
/**
* @internal track `on` calls, allow `on` call multiple times
*/
this._on = 0;
/** /**
* @internal * @internal
*/ */
@ -87,14 +91,20 @@ class EffectScope {
* @internal * @internal
*/ */
on() { on() {
activeEffectScope = this; if (++this._on === 1) {
this.prevScope = activeEffectScope;
activeEffectScope = this;
}
} }
/** /**
* This should only be called on non-detached scopes * This should only be called on non-detached scopes
* @internal * @internal
*/ */
off() { off() {
activeEffectScope = this.parent; if (this._on > 0 && --this._on === 0) {
activeEffectScope = this.prevScope;
this.prevScope = void 0;
}
} }
stop(fromParent) { stop(fromParent) {
if (this._active) { if (this._active) {
@ -156,7 +166,9 @@ const EffectFlags = {
"ALLOW_RECURSE": 32, "ALLOW_RECURSE": 32,
"32": "ALLOW_RECURSE", "32": "ALLOW_RECURSE",
"PAUSED": 64, "PAUSED": 64,
"64": "PAUSED" "64": "PAUSED",
"EVALUATED": 128,
"128": "EVALUATED"
}; };
const pausedQueueEffects = /* @__PURE__ */ new WeakSet(); const pausedQueueEffects = /* @__PURE__ */ new WeakSet();
class ReactiveEffect { class ReactiveEffect {
@ -192,7 +204,7 @@ class ReactiveEffect {
} }
resume() { resume() {
if (this.flags & 64) { if (this.flags & 64) {
this.flags &= ~64; this.flags &= -65;
if (pausedQueueEffects.has(this)) { if (pausedQueueEffects.has(this)) {
pausedQueueEffects.delete(this); pausedQueueEffects.delete(this);
this.trigger(); this.trigger();
@ -232,7 +244,7 @@ class ReactiveEffect {
cleanupDeps(this); cleanupDeps(this);
activeSub = prevEffect; activeSub = prevEffect;
shouldTrack = prevShouldTrack; shouldTrack = prevShouldTrack;
this.flags &= ~2; this.flags &= -3;
} }
} }
stop() { stop() {
@ -243,7 +255,7 @@ class ReactiveEffect {
this.deps = this.depsTail = void 0; this.deps = this.depsTail = void 0;
cleanupEffect(this); cleanupEffect(this);
this.onStop && this.onStop(); this.onStop && this.onStop();
this.flags &= ~1; this.flags &= -2;
} }
} }
trigger() { trigger() {
@ -293,7 +305,7 @@ function endBatch() {
while (e) { while (e) {
const next = e.next; const next = e.next;
e.next = void 0; e.next = void 0;
e.flags &= ~8; e.flags &= -9;
e = next; e = next;
} }
} }
@ -304,7 +316,7 @@ function endBatch() {
while (e) { while (e) {
const next = e.next; const next = e.next;
e.next = void 0; e.next = void 0;
e.flags &= ~8; e.flags &= -9;
if (e.flags & 1) { if (e.flags & 1) {
try { try {
; ;
@ -360,17 +372,16 @@ function refreshComputed(computed) {
if (computed.flags & 4 && !(computed.flags & 16)) { if (computed.flags & 4 && !(computed.flags & 16)) {
return; return;
} }
computed.flags &= ~16; computed.flags &= -17;
if (computed.globalVersion === globalVersion) { if (computed.globalVersion === globalVersion) {
return; return;
} }
computed.globalVersion = globalVersion; computed.globalVersion = globalVersion;
const dep = computed.dep; if (!computed.isSSR && computed.flags & 128 && (!computed.deps && !computed._dirty || !isDirty(computed))) {
computed.flags |= 2;
if (dep.version > 0 && !computed.isSSR && computed.deps && !isDirty(computed)) {
computed.flags &= ~2;
return; return;
} }
computed.flags |= 2;
const dep = computed.dep;
const prevSub = activeSub; const prevSub = activeSub;
const prevShouldTrack = shouldTrack; const prevShouldTrack = shouldTrack;
activeSub = computed; activeSub = computed;
@ -379,6 +390,7 @@ function refreshComputed(computed) {
prepareDeps(computed); prepareDeps(computed);
const value = computed.fn(computed._value); const value = computed.fn(computed._value);
if (dep.version === 0 || hasChanged(value, computed._value)) { if (dep.version === 0 || hasChanged(value, computed._value)) {
computed.flags |= 128;
computed._value = value; computed._value = value;
dep.version++; dep.version++;
} }
@ -389,7 +401,7 @@ function refreshComputed(computed) {
activeSub = prevSub; activeSub = prevSub;
shouldTrack = prevShouldTrack; shouldTrack = prevShouldTrack;
cleanupDeps(computed); cleanupDeps(computed);
computed.flags &= ~2; computed.flags &= -3;
} }
} }
function removeSub(link, soft = false) { function removeSub(link, soft = false) {
@ -408,7 +420,7 @@ function removeSub(link, soft = false) {
if (dep.subs === link) { if (dep.subs === link) {
dep.subs = prevSub; dep.subs = prevSub;
if (!prevSub && dep.computed) { if (!prevSub && dep.computed) {
dep.computed.flags &= ~4; dep.computed.flags &= -5;
for (let l = dep.computed.deps; l; l = l.nextDep) { for (let l = dep.computed.deps; l; l = l.nextDep) {
removeSub(l, true); removeSub(l, true);
} }
@ -497,6 +509,7 @@ class Link {
} }
} }
class Dep { class Dep {
// TODO isolatedDeclarations "__v_skip"
constructor(computed) { constructor(computed) {
this.computed = computed; this.computed = computed;
this.version = 0; this.version = 0;
@ -517,6 +530,10 @@ class Dep {
* Subscriber counter * Subscriber counter
*/ */
this.sc = 0; this.sc = 0;
/**
* @internal
*/
this.__v_skip = true;
if (!!(process.env.NODE_ENV !== "production")) { if (!!(process.env.NODE_ENV !== "production")) {
this.subsHead = void 0; this.subsHead = void 0;
} }
@ -1358,14 +1375,14 @@ function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandl
if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) { if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) {
return target; return target;
} }
const existingProxy = proxyMap.get(target);
if (existingProxy) {
return existingProxy;
}
const targetType = getTargetType(target); const targetType = getTargetType(target);
if (targetType === 0 /* INVALID */) { if (targetType === 0 /* INVALID */) {
return target; return target;
} }
const existingProxy = proxyMap.get(target);
if (existingProxy) {
return existingProxy;
}
const proxy = new Proxy( const proxy = new Proxy(
target, target,
targetType === 2 /* COLLECTION */ ? collectionHandlers : baseHandlers targetType === 2 /* COLLECTION */ ? collectionHandlers : baseHandlers
@ -1810,11 +1827,11 @@ function watch(source, cb, options = EMPTY_OBJ) {
oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue, oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
boundCleanup boundCleanup
]; ];
oldValue = newValue;
call ? call(cb, 3, args) : ( call ? call(cb, 3, args) : (
// @ts-expect-error // @ts-expect-error
cb(...args) cb(...args)
); );
oldValue = newValue;
} finally { } finally {
activeWatcher = currentWatcher; activeWatcher = currentWatcher;
} }

View File

@ -1,5 +1,5 @@
/** /**
* @vue/reactivity v3.5.13 * @vue/reactivity v3.5.17
* (c) 2018-present Yuxi (Evan) You and Vue contributors * (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT * @license MIT
**/ **/
@ -72,6 +72,10 @@ var VueReactivity = (function (exports) {
* @internal * @internal
*/ */
this._active = true; this._active = true;
/**
* @internal track `on` calls, allow `on` call multiple times
*/
this._on = 0;
/** /**
* @internal * @internal
*/ */
@ -142,14 +146,20 @@ var VueReactivity = (function (exports) {
* @internal * @internal
*/ */
on() { on() {
activeEffectScope = this; if (++this._on === 1) {
this.prevScope = activeEffectScope;
activeEffectScope = this;
}
} }
/** /**
* This should only be called on non-detached scopes * This should only be called on non-detached scopes
* @internal * @internal
*/ */
off() { off() {
activeEffectScope = this.parent; if (this._on > 0 && --this._on === 0) {
activeEffectScope = this.prevScope;
this.prevScope = void 0;
}
} }
stop(fromParent) { stop(fromParent) {
if (this._active) { if (this._active) {
@ -211,7 +221,9 @@ var VueReactivity = (function (exports) {
"ALLOW_RECURSE": 32, "ALLOW_RECURSE": 32,
"32": "ALLOW_RECURSE", "32": "ALLOW_RECURSE",
"PAUSED": 64, "PAUSED": 64,
"64": "PAUSED" "64": "PAUSED",
"EVALUATED": 128,
"128": "EVALUATED"
}; };
const pausedQueueEffects = /* @__PURE__ */ new WeakSet(); const pausedQueueEffects = /* @__PURE__ */ new WeakSet();
class ReactiveEffect { class ReactiveEffect {
@ -247,7 +259,7 @@ var VueReactivity = (function (exports) {
} }
resume() { resume() {
if (this.flags & 64) { if (this.flags & 64) {
this.flags &= ~64; this.flags &= -65;
if (pausedQueueEffects.has(this)) { if (pausedQueueEffects.has(this)) {
pausedQueueEffects.delete(this); pausedQueueEffects.delete(this);
this.trigger(); this.trigger();
@ -287,7 +299,7 @@ var VueReactivity = (function (exports) {
cleanupDeps(this); cleanupDeps(this);
activeSub = prevEffect; activeSub = prevEffect;
shouldTrack = prevShouldTrack; shouldTrack = prevShouldTrack;
this.flags &= ~2; this.flags &= -3;
} }
} }
stop() { stop() {
@ -298,7 +310,7 @@ var VueReactivity = (function (exports) {
this.deps = this.depsTail = void 0; this.deps = this.depsTail = void 0;
cleanupEffect(this); cleanupEffect(this);
this.onStop && this.onStop(); this.onStop && this.onStop();
this.flags &= ~1; this.flags &= -2;
} }
} }
trigger() { trigger() {
@ -348,7 +360,7 @@ var VueReactivity = (function (exports) {
while (e) { while (e) {
const next = e.next; const next = e.next;
e.next = void 0; e.next = void 0;
e.flags &= ~8; e.flags &= -9;
e = next; e = next;
} }
} }
@ -359,7 +371,7 @@ var VueReactivity = (function (exports) {
while (e) { while (e) {
const next = e.next; const next = e.next;
e.next = void 0; e.next = void 0;
e.flags &= ~8; e.flags &= -9;
if (e.flags & 1) { if (e.flags & 1) {
try { try {
; ;
@ -415,17 +427,16 @@ var VueReactivity = (function (exports) {
if (computed.flags & 4 && !(computed.flags & 16)) { if (computed.flags & 4 && !(computed.flags & 16)) {
return; return;
} }
computed.flags &= ~16; computed.flags &= -17;
if (computed.globalVersion === globalVersion) { if (computed.globalVersion === globalVersion) {
return; return;
} }
computed.globalVersion = globalVersion; computed.globalVersion = globalVersion;
const dep = computed.dep; if (!computed.isSSR && computed.flags & 128 && (!computed.deps && !computed._dirty || !isDirty(computed))) {
computed.flags |= 2;
if (dep.version > 0 && !computed.isSSR && computed.deps && !isDirty(computed)) {
computed.flags &= ~2;
return; return;
} }
computed.flags |= 2;
const dep = computed.dep;
const prevSub = activeSub; const prevSub = activeSub;
const prevShouldTrack = shouldTrack; const prevShouldTrack = shouldTrack;
activeSub = computed; activeSub = computed;
@ -434,6 +445,7 @@ var VueReactivity = (function (exports) {
prepareDeps(computed); prepareDeps(computed);
const value = computed.fn(computed._value); const value = computed.fn(computed._value);
if (dep.version === 0 || hasChanged(value, computed._value)) { if (dep.version === 0 || hasChanged(value, computed._value)) {
computed.flags |= 128;
computed._value = value; computed._value = value;
dep.version++; dep.version++;
} }
@ -444,7 +456,7 @@ var VueReactivity = (function (exports) {
activeSub = prevSub; activeSub = prevSub;
shouldTrack = prevShouldTrack; shouldTrack = prevShouldTrack;
cleanupDeps(computed); cleanupDeps(computed);
computed.flags &= ~2; computed.flags &= -3;
} }
} }
function removeSub(link, soft = false) { function removeSub(link, soft = false) {
@ -463,7 +475,7 @@ var VueReactivity = (function (exports) {
if (dep.subs === link) { if (dep.subs === link) {
dep.subs = prevSub; dep.subs = prevSub;
if (!prevSub && dep.computed) { if (!prevSub && dep.computed) {
dep.computed.flags &= ~4; dep.computed.flags &= -5;
for (let l = dep.computed.deps; l; l = l.nextDep) { for (let l = dep.computed.deps; l; l = l.nextDep) {
removeSub(l, true); removeSub(l, true);
} }
@ -552,6 +564,7 @@ var VueReactivity = (function (exports) {
} }
} }
class Dep { class Dep {
// TODO isolatedDeclarations "__v_skip"
constructor(computed) { constructor(computed) {
this.computed = computed; this.computed = computed;
this.version = 0; this.version = 0;
@ -572,6 +585,10 @@ var VueReactivity = (function (exports) {
* Subscriber counter * Subscriber counter
*/ */
this.sc = 0; this.sc = 0;
/**
* @internal
*/
this.__v_skip = true;
{ {
this.subsHead = void 0; this.subsHead = void 0;
} }
@ -1409,14 +1426,14 @@ var VueReactivity = (function (exports) {
if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) { if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) {
return target; return target;
} }
const existingProxy = proxyMap.get(target);
if (existingProxy) {
return existingProxy;
}
const targetType = getTargetType(target); const targetType = getTargetType(target);
if (targetType === 0 /* INVALID */) { if (targetType === 0 /* INVALID */) {
return target; return target;
} }
const existingProxy = proxyMap.get(target);
if (existingProxy) {
return existingProxy;
}
const proxy = new Proxy( const proxy = new Proxy(
target, target,
targetType === 2 /* COLLECTION */ ? collectionHandlers : baseHandlers targetType === 2 /* COLLECTION */ ? collectionHandlers : baseHandlers
@ -1855,11 +1872,11 @@ var VueReactivity = (function (exports) {
oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue, oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
boundCleanup boundCleanup
]; ];
oldValue = newValue;
call ? call(cb, 3, args) : ( call ? call(cb, 3, args) : (
// @ts-expect-error // @ts-expect-error
cb(...args) cb(...args)
); );
oldValue = newValue;
} finally { } finally {
activeWatcher = currentWatcher; activeWatcher = currentWatcher;
} }

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
{ {
"name": "@vue/reactivity", "name": "@vue/reactivity",
"version": "3.5.13", "version": "3.5.17",
"description": "@vue/reactivity", "description": "@vue/reactivity",
"main": "index.js", "main": "index.js",
"module": "dist/reactivity.esm-bundler.js", "module": "dist/reactivity.esm-bundler.js",
@ -50,6 +50,6 @@
}, },
"homepage": "https://github.com/vuejs/core/tree/main/packages/reactivity#readme", "homepage": "https://github.com/vuejs/core/tree/main/packages/reactivity#readme",
"dependencies": { "dependencies": {
"@vue/shared": "3.5.13" "@vue/shared": "3.5.17"
} }
} }

View File

@ -1,5 +1,5 @@
/** /**
* @vue/runtime-core v3.5.13 * @vue/runtime-core v3.5.17
* (c) 2018-present Yuxi (Evan) You and Vue contributors * (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT * @license MIT
**/ **/
@ -348,11 +348,11 @@ function flushPreFlushCbs(instance, seen, i = flushIndex + 1) {
queue.splice(i, 1); queue.splice(i, 1);
i--; i--;
if (cb.flags & 4) { if (cb.flags & 4) {
cb.flags &= ~1; cb.flags &= -2;
} }
cb(); cb();
if (!(cb.flags & 4)) { if (!(cb.flags & 4)) {
cb.flags &= ~1; cb.flags &= -2;
} }
} }
} }
@ -377,10 +377,10 @@ function flushPostFlushCbs(seen) {
continue; continue;
} }
if (cb.flags & 4) { if (cb.flags & 4) {
cb.flags &= ~1; cb.flags &= -2;
} }
if (!(cb.flags & 8)) cb(); if (!(cb.flags & 8)) cb();
cb.flags &= ~1; cb.flags &= -2;
} }
activePostFlushCbs = null; activePostFlushCbs = null;
postFlushIndex = 0; postFlushIndex = 0;
@ -416,7 +416,7 @@ function flushJobs(seen) {
for (; flushIndex < queue.length; flushIndex++) { for (; flushIndex < queue.length; flushIndex++) {
const job = queue[flushIndex]; const job = queue[flushIndex];
if (job) { if (job) {
job.flags &= ~1; job.flags &= -2;
} }
} }
flushIndex = -1; flushIndex = -1;
@ -856,15 +856,16 @@ const TeleportImpl = {
updateCssVars(n2, true); updateCssVars(n2, true);
} }
if (isTeleportDeferred(n2.props)) { if (isTeleportDeferred(n2.props)) {
n2.el.__isMounted = false;
queuePostRenderEffect(() => { queuePostRenderEffect(() => {
mountToTarget(); mountToTarget();
n2.el.__isMounted = true; delete n2.el.__isMounted;
}, parentSuspense); }, parentSuspense);
} else { } else {
mountToTarget(); mountToTarget();
} }
} else { } else {
if (isTeleportDeferred(n2.props) && !n1.el.__isMounted) { if (isTeleportDeferred(n2.props) && n1.el.__isMounted === false) {
queuePostRenderEffect(() => { queuePostRenderEffect(() => {
TeleportImpl.process( TeleportImpl.process(
n1, n1,
@ -878,7 +879,6 @@ const TeleportImpl = {
optimized, optimized,
internals internals
); );
delete n1.el.__isMounted;
}, parentSuspense); }, parentSuspense);
return; return;
} }
@ -905,7 +905,7 @@ const TeleportImpl = {
namespace, namespace,
slotScopeIds slotScopeIds
); );
traverseStaticChildren(n1, n2, true); traverseStaticChildren(n1, n2, false);
} else if (!optimized) { } else if (!optimized) {
patchChildren( patchChildren(
n1, n1,
@ -1866,6 +1866,8 @@ function createHydrationFunctions(rendererInternals) {
) && parentComponent && parentComponent.vnode.props && parentComponent.vnode.props.appear; ) && parentComponent && parentComponent.vnode.props && parentComponent.vnode.props.appear;
const content = el.content.firstChild; const content = el.content.firstChild;
if (needCallTransitionHooks) { if (needCallTransitionHooks) {
const cls = content.getAttribute("class");
if (cls) content.$cls = cls;
transition.beforeEnter(content); transition.beforeEnter(content);
} }
replaceNode(content, el, parentComponent); replaceNode(content, el, parentComponent);
@ -2118,7 +2120,12 @@ function propHasMismatch(el, key, clientValue, vnode, instance) {
let actual; let actual;
let expected; let expected;
if (key === "class") { if (key === "class") {
actual = el.getAttribute("class"); if (el.$cls) {
actual = el.$cls;
delete el.$cls;
} else {
actual = el.getAttribute("class");
}
expected = shared.normalizeClass(clientValue); expected = shared.normalizeClass(clientValue);
if (!isSetEqual(toClassSet(actual || ""), toClassSet(expected))) { if (!isSetEqual(toClassSet(actual || ""), toClassSet(expected))) {
mismatchType = 2 /* CLASS */; mismatchType = 2 /* CLASS */;
@ -2256,7 +2263,7 @@ function isMismatchAllowed(el, allowedType) {
if (allowedType === 0 /* TEXT */ && list.includes("children")) { if (allowedType === 0 /* TEXT */ && list.includes("children")) {
return true; return true;
} }
return allowedAttr.split(",").includes(MismatchTypeString[allowedType]); return list.includes(MismatchTypeString[allowedType]);
} }
} }
@ -2413,14 +2420,25 @@ function defineAsyncComponent(source) {
name: "AsyncComponentWrapper", name: "AsyncComponentWrapper",
__asyncLoader: load, __asyncLoader: load,
__asyncHydrate(el, instance, hydrate) { __asyncHydrate(el, instance, hydrate) {
let patched = false;
const doHydrate = hydrateStrategy ? () => { const doHydrate = hydrateStrategy ? () => {
const performHydrate = () => {
if (patched) {
warn$1(
`Skipping lazy hydration for component '${getComponentName(resolvedComp)}': it was updated before lazy hydration performed.`
);
return;
}
hydrate();
};
const teardown = hydrateStrategy( const teardown = hydrateStrategy(
hydrate, performHydrate,
(cb) => forEachElement(el, cb) (cb) => forEachElement(el, cb)
); );
if (teardown) { if (teardown) {
(instance.bum || (instance.bum = [])).push(teardown); (instance.bum || (instance.bum = [])).push(teardown);
} }
(instance.u || (instance.u = [])).push(() => patched = true);
} : hydrate; } : hydrate;
if (resolvedComp) { if (resolvedComp) {
doHydrate(); doHydrate();
@ -2677,7 +2695,7 @@ const KeepAliveImpl = {
); );
const { include, exclude, max } = props; const { include, exclude, max } = props;
if (include && (!name || !matches(include, name)) || exclude && name && matches(exclude, name)) { if (include && (!name || !matches(include, name)) || exclude && name && matches(exclude, name)) {
vnode.shapeFlag &= ~256; vnode.shapeFlag &= -257;
current = vnode; current = vnode;
return rawVNode; return rawVNode;
} }
@ -2764,8 +2782,8 @@ function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) {
}, target); }, target);
} }
function resetShapeFlag(vnode) { function resetShapeFlag(vnode) {
vnode.shapeFlag &= ~256; vnode.shapeFlag &= -257;
vnode.shapeFlag &= ~512; vnode.shapeFlag &= -513;
} }
function getInnerChild(vnode) { function getInnerChild(vnode) {
return vnode.shapeFlag & 128 ? vnode.ssContent : vnode; return vnode.shapeFlag & 128 ? vnode.ssContent : vnode;
@ -2880,14 +2898,16 @@ function renderList(source, renderItem, cache, index) {
if (sourceIsArray || shared.isString(source)) { if (sourceIsArray || shared.isString(source)) {
const sourceIsReactiveArray = sourceIsArray && reactivity.isReactive(source); const sourceIsReactiveArray = sourceIsArray && reactivity.isReactive(source);
let needsWrap = false; let needsWrap = false;
let isReadonlySource = false;
if (sourceIsReactiveArray) { if (sourceIsReactiveArray) {
needsWrap = !reactivity.isShallow(source); needsWrap = !reactivity.isShallow(source);
isReadonlySource = reactivity.isReadonly(source);
source = reactivity.shallowReadArray(source); source = reactivity.shallowReadArray(source);
} }
ret = new Array(source.length); ret = new Array(source.length);
for (let i = 0, l = source.length; i < l; i++) { for (let i = 0, l = source.length; i < l; i++) {
ret[i] = renderItem( ret[i] = renderItem(
needsWrap ? reactivity.toReactive(source[i]) : source[i], needsWrap ? isReadonlySource ? reactivity.toReadonly(reactivity.toReactive(source[i])) : reactivity.toReactive(source[i]) : source[i],
i, i,
void 0, void 0,
cached && cached[i] cached && cached[i]
@ -3909,11 +3929,9 @@ function createAppAPI(render, hydrate) {
} }
{ {
context.reload = () => { context.reload = () => {
render( const cloned = cloneVNode(vnode);
cloneVNode(vnode), cloned.el = null;
rootContainer, render(cloned, rootContainer, namespace);
namespace
);
}; };
} }
if (isHydrate && hydrate) { if (isHydrate && hydrate) {
@ -3963,9 +3981,15 @@ If you want to remount the same app, move your app creation logic into a factory
}, },
provide(key, value) { provide(key, value) {
if (key in context.provides) { if (key in context.provides) {
warn$1( if (shared.hasOwn(context.provides, key)) {
`App already provides property with key "${String(key)}". It will be overwritten with the new value.` warn$1(
); `App already provides property with key "${String(key)}". It will be overwritten with the new value.`
);
} else {
warn$1(
`App already provides property with key "${String(key)}" inherited from its parent element. It will be overwritten with the new value.`
);
}
} }
context.provides[key] = value; context.provides[key] = value;
return app; return app;
@ -4002,7 +4026,7 @@ function provide(key, value) {
function inject(key, defaultValue, treatDefaultAsFactory = false) { function inject(key, defaultValue, treatDefaultAsFactory = false) {
const instance = currentInstance || currentRenderingInstance; const instance = currentInstance || currentRenderingInstance;
if (instance || currentApp) { if (instance || currentApp) {
const provides = currentApp ? currentApp._context.provides : instance ? instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : void 0; let provides = currentApp ? currentApp._context.provides : instance ? instance.parent == null || instance.ce ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : void 0;
if (provides && key in provides) { if (provides && key in provides) {
return provides[key]; return provides[key];
} else if (arguments.length > 1) { } else if (arguments.length > 1) {
@ -4436,7 +4460,7 @@ const normalizeSlot = (key, rawSlot, ctx) => {
return rawSlot; return rawSlot;
} }
const normalized = withCtx((...args) => { const normalized = withCtx((...args) => {
if (currentInstance && (!ctx || ctx.root === currentInstance.root)) { if (currentInstance && !(ctx === null && currentRenderingInstance) && !(ctx && ctx.root !== currentInstance.root)) {
warn$1( warn$1(
`Slot "${key}" invoked outside of the render function: this will not track dependencies used in the slot. Invoke the slot function inside the render function instead.` `Slot "${key}" invoked outside of the render function: this will not track dependencies used in the slot. Invoke the slot function inside the render function instead.`
); );
@ -4475,7 +4499,7 @@ const normalizeVNodeSlots = (instance, children) => {
}; };
const assignSlots = (slots, children, optimized) => { const assignSlots = (slots, children, optimized) => {
for (const key in children) { for (const key in children) {
if (optimized || key !== "_") { if (optimized || !isInternalKey(key)) {
slots[key] = children[key]; slots[key] = children[key];
} }
} }
@ -4483,6 +4507,8 @@ const assignSlots = (slots, children, optimized) => {
const initSlots = (instance, children, optimized) => { const initSlots = (instance, children, optimized) => {
const slots = instance.slots = createInternalObject(); const slots = instance.slots = createInternalObject();
if (instance.vnode.shapeFlag & 32) { if (instance.vnode.shapeFlag & 32) {
const cacheIndexes = children.__;
if (cacheIndexes) shared.def(slots, "__", cacheIndexes, true);
const type = children._; const type = children._;
if (type) { if (type) {
assignSlots(slots, children, optimized); assignSlots(slots, children, optimized);
@ -4694,6 +4720,8 @@ function baseCreateRenderer(options, createHydrationFns) {
} }
if (ref != null && parentComponent) { if (ref != null && parentComponent) {
setRef(ref, n1 && n1.ref, parentSuspense, n2 || n1, !n2); setRef(ref, n1 && n1.ref, parentSuspense, n2 || n1, !n2);
} else if (ref == null && n1 && n1.ref != null) {
setRef(n1.ref, null, parentSuspense, n1, true);
} }
}; };
const processText = (n1, n2, container, anchor) => { const processText = (n1, n2, container, anchor) => {
@ -4999,7 +5027,7 @@ function baseCreateRenderer(options, createHydrationFns) {
(oldVNode.type === Fragment || // - In the case of different nodes, there is going to be a replacement (oldVNode.type === Fragment || // - In the case of different nodes, there is going to be a replacement
// which also requires the correct parent container // which also requires the correct parent container
!isSameVNodeType(oldVNode, newVNode) || // - In the case of a component, it could contain anything. !isSameVNodeType(oldVNode, newVNode) || // - In the case of a component, it could contain anything.
oldVNode.shapeFlag & (6 | 64)) ? hostParentNode(oldVNode.el) : ( oldVNode.shapeFlag & (6 | 64 | 128)) ? hostParentNode(oldVNode.el) : (
// In other cases, the parent container is not actually used so we // In other cases, the parent container is not actually used so we
// just pass the block element here to avoid a DOM parentNode call. // just pass the block element here to avoid a DOM parentNode call.
fallbackContainer fallbackContainer
@ -5161,8 +5189,8 @@ function baseCreateRenderer(options, createHydrationFns) {
endMeasure(instance, `init`); endMeasure(instance, `init`);
} }
} }
if (isHmrUpdating) initialVNode.el = null;
if (instance.asyncDep) { if (instance.asyncDep) {
if (isHmrUpdating) initialVNode.el = null;
parentSuspense && parentSuspense.registerDep(instance, setupRenderEffect, optimized); parentSuspense && parentSuspense.registerDep(instance, setupRenderEffect, optimized);
if (!initialVNode.el) { if (!initialVNode.el) {
const placeholder = instance.subTree = createVNode(Comment); const placeholder = instance.subTree = createVNode(Comment);
@ -5253,7 +5281,8 @@ function baseCreateRenderer(options, createHydrationFns) {
hydrateSubTree(); hydrateSubTree();
} }
} else { } else {
if (root.ce) { if (root.ce && // @ts-expect-error _def is private
root.ce._def.shadowRoot !== false) {
root.ce._injectChildStyle(type); root.ce._injectChildStyle(type);
} }
{ {
@ -5724,7 +5753,13 @@ function baseCreateRenderer(options, createHydrationFns) {
queuePostRenderEffect(() => transition.enter(el), parentSuspense); queuePostRenderEffect(() => transition.enter(el), parentSuspense);
} else { } else {
const { leave, delayLeave, afterLeave } = transition; const { leave, delayLeave, afterLeave } = transition;
const remove2 = () => hostInsert(el, container, anchor); const remove2 = () => {
if (vnode.ctx.isUnmounted) {
hostRemove(el);
} else {
hostInsert(el, container, anchor);
}
};
const performLeave = () => { const performLeave = () => {
leave(el, () => { leave(el, () => {
remove2(); remove2();
@ -5757,7 +5792,9 @@ function baseCreateRenderer(options, createHydrationFns) {
optimized = false; optimized = false;
} }
if (ref != null) { if (ref != null) {
reactivity.pauseTracking();
setRef(ref, null, parentSuspense, vnode, true); setRef(ref, null, parentSuspense, vnode, true);
reactivity.resetTracking();
} }
if (cacheIndex != null) { if (cacheIndex != null) {
parentComponent.renderCache[cacheIndex] = void 0; parentComponent.renderCache[cacheIndex] = void 0;
@ -5869,12 +5906,27 @@ function baseCreateRenderer(options, createHydrationFns) {
if (instance.type.__hmrId) { if (instance.type.__hmrId) {
unregisterHMR(instance); unregisterHMR(instance);
} }
const { bum, scope, job, subTree, um, m, a } = instance; const {
bum,
scope,
job,
subTree,
um,
m,
a,
parent,
slots: { __: slotCacheKeys }
} = instance;
invalidateMount(m); invalidateMount(m);
invalidateMount(a); invalidateMount(a);
if (bum) { if (bum) {
shared.invokeArrayFns(bum); shared.invokeArrayFns(bum);
} }
if (parent && shared.isArray(slotCacheKeys)) {
slotCacheKeys.forEach((v) => {
parent.renderCache[v] = void 0;
});
}
scope.stop(); scope.stop();
if (job) { if (job) {
job.flags |= 8; job.flags |= 8;
@ -5970,8 +6022,8 @@ function toggleRecurse({ effect, job }, allowed) {
effect.flags |= 32; effect.flags |= 32;
job.flags |= 4; job.flags |= 4;
} else { } else {
effect.flags &= ~32; effect.flags &= -33;
job.flags &= ~4; job.flags &= -5;
} }
} }
function needTransition(parentSuspense, transition) { function needTransition(parentSuspense, transition) {
@ -5998,6 +6050,9 @@ function traverseStaticChildren(n1, n2, shallow = false) {
if (c2.type === Comment && !c2.el) { if (c2.type === Comment && !c2.el) {
c2.el = c1.el; c2.el = c1.el;
} }
{
c2.el && (c2.el.__vnode = c2);
}
} }
} }
} }
@ -7343,8 +7398,8 @@ function isSameVNodeType(n1, n2) {
if (n2.shapeFlag & 6 && n1.component) { if (n2.shapeFlag & 6 && n1.component) {
const dirtyInstances = hmrDirtyComponents.get(n2.type); const dirtyInstances = hmrDirtyComponents.get(n2.type);
if (dirtyInstances && dirtyInstances.has(n1.component)) { if (dirtyInstances && dirtyInstances.has(n1.component)) {
n1.shapeFlag &= ~256; n1.shapeFlag &= -257;
n2.shapeFlag &= ~512; n2.shapeFlag &= -513;
return false; return false;
} }
} }
@ -7805,7 +7860,7 @@ function setupComponent(instance, isSSR = false, optimized = false) {
const { props, children } = instance.vnode; const { props, children } = instance.vnode;
const isStateful = isStatefulComponent(instance); const isStateful = isStatefulComponent(instance);
initProps(instance, props, isStateful, isSSR); initProps(instance, props, isStateful, isSSR);
initSlots(instance, children, optimized); initSlots(instance, children, optimized || isSSR);
const setupResult = isStateful ? setupStatefulComponent(instance, isSSR) : void 0; const setupResult = isStateful ? setupStatefulComponent(instance, isSSR) : void 0;
isSSR && setInSSRSetupState(false); isSSR && setInSSRSetupState(false);
return setupResult; return setupResult;
@ -8136,13 +8191,15 @@ function initCustomFormatter() {
if (obj.__isVue) { if (obj.__isVue) {
return ["div", vueStyle, `VueInstance`]; return ["div", vueStyle, `VueInstance`];
} else if (reactivity.isRef(obj)) { } else if (reactivity.isRef(obj)) {
reactivity.pauseTracking();
const value = obj.value;
reactivity.resetTracking();
return [ return [
"div", "div",
{}, {},
["span", vueStyle, genRefFlag(obj)], ["span", vueStyle, genRefFlag(obj)],
"<", "<",
// avoid debugger accessing value affecting behavior formatValue(value),
formatValue("_value" in obj ? obj._value : obj),
`>` `>`
]; ];
} else if (reactivity.isReactive(obj)) { } else if (reactivity.isReactive(obj)) {
@ -8323,7 +8380,7 @@ function isMemoSame(cached, memo) {
return true; return true;
} }
const version = "3.5.13"; const version = "3.5.17";
const warn = warn$1 ; const warn = warn$1 ;
const ErrorTypeStrings = ErrorTypeStrings$1 ; const ErrorTypeStrings = ErrorTypeStrings$1 ;
const devtools = devtools$1 ; const devtools = devtools$1 ;

View File

@ -1,5 +1,5 @@
/** /**
* @vue/runtime-core v3.5.13 * @vue/runtime-core v3.5.17
* (c) 2018-present Yuxi (Evan) You and Vue contributors * (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT * @license MIT
**/ **/
@ -213,11 +213,11 @@ function flushPreFlushCbs(instance, seen, i = flushIndex + 1) {
queue.splice(i, 1); queue.splice(i, 1);
i--; i--;
if (cb.flags & 4) { if (cb.flags & 4) {
cb.flags &= ~1; cb.flags &= -2;
} }
cb(); cb();
if (!(cb.flags & 4)) { if (!(cb.flags & 4)) {
cb.flags &= ~1; cb.flags &= -2;
} }
} }
} }
@ -236,10 +236,10 @@ function flushPostFlushCbs(seen) {
for (postFlushIndex = 0; postFlushIndex < activePostFlushCbs.length; postFlushIndex++) { for (postFlushIndex = 0; postFlushIndex < activePostFlushCbs.length; postFlushIndex++) {
const cb = activePostFlushCbs[postFlushIndex]; const cb = activePostFlushCbs[postFlushIndex];
if (cb.flags & 4) { if (cb.flags & 4) {
cb.flags &= ~1; cb.flags &= -2;
} }
if (!(cb.flags & 8)) cb(); if (!(cb.flags & 8)) cb();
cb.flags &= ~1; cb.flags &= -2;
} }
activePostFlushCbs = null; activePostFlushCbs = null;
postFlushIndex = 0; postFlushIndex = 0;
@ -269,7 +269,7 @@ function flushJobs(seen) {
for (; flushIndex < queue.length; flushIndex++) { for (; flushIndex < queue.length; flushIndex++) {
const job = queue[flushIndex]; const job = queue[flushIndex];
if (job) { if (job) {
job.flags &= ~1; job.flags &= -2;
} }
} }
flushIndex = -1; flushIndex = -1;
@ -449,15 +449,16 @@ const TeleportImpl = {
updateCssVars(n2, true); updateCssVars(n2, true);
} }
if (isTeleportDeferred(n2.props)) { if (isTeleportDeferred(n2.props)) {
n2.el.__isMounted = false;
queuePostRenderEffect(() => { queuePostRenderEffect(() => {
mountToTarget(); mountToTarget();
n2.el.__isMounted = true; delete n2.el.__isMounted;
}, parentSuspense); }, parentSuspense);
} else { } else {
mountToTarget(); mountToTarget();
} }
} else { } else {
if (isTeleportDeferred(n2.props) && !n1.el.__isMounted) { if (isTeleportDeferred(n2.props) && n1.el.__isMounted === false) {
queuePostRenderEffect(() => { queuePostRenderEffect(() => {
TeleportImpl.process( TeleportImpl.process(
n1, n1,
@ -471,7 +472,6 @@ const TeleportImpl = {
optimized, optimized,
internals internals
); );
delete n1.el.__isMounted;
}, parentSuspense); }, parentSuspense);
return; return;
} }
@ -998,6 +998,9 @@ function getInnerChild$1(vnode) {
} }
return vnode; return vnode;
} }
if (vnode.component) {
return vnode.component.subTree;
}
const { shapeFlag, children } = vnode; const { shapeFlag, children } = vnode;
if (children) { if (children) {
if (shapeFlag & 16) { if (shapeFlag & 16) {
@ -1387,6 +1390,8 @@ function createHydrationFunctions(rendererInternals) {
) && parentComponent && parentComponent.vnode.props && parentComponent.vnode.props.appear; ) && parentComponent && parentComponent.vnode.props && parentComponent.vnode.props.appear;
const content = el.content.firstChild; const content = el.content.firstChild;
if (needCallTransitionHooks) { if (needCallTransitionHooks) {
const cls = content.getAttribute("class");
if (cls) content.$cls = cls;
transition.beforeEnter(content); transition.beforeEnter(content);
} }
replaceNode(content, el, parentComponent); replaceNode(content, el, parentComponent);
@ -1627,7 +1632,7 @@ function isMismatchAllowed(el, allowedType) {
if (allowedType === 0 /* TEXT */ && list.includes("children")) { if (allowedType === 0 /* TEXT */ && list.includes("children")) {
return true; return true;
} }
return allowedAttr.split(",").includes(MismatchTypeString[allowedType]); return list.includes(MismatchTypeString[allowedType]);
} }
} }
@ -1777,13 +1782,17 @@ function defineAsyncComponent(source) {
__asyncLoader: load, __asyncLoader: load,
__asyncHydrate(el, instance, hydrate) { __asyncHydrate(el, instance, hydrate) {
const doHydrate = hydrateStrategy ? () => { const doHydrate = hydrateStrategy ? () => {
const performHydrate = () => {
hydrate();
};
const teardown = hydrateStrategy( const teardown = hydrateStrategy(
hydrate, performHydrate,
(cb) => forEachElement(el, cb) (cb) => forEachElement(el, cb)
); );
if (teardown) { if (teardown) {
(instance.bum || (instance.bum = [])).push(teardown); (instance.bum || (instance.bum = [])).push(teardown);
} }
(instance.u || (instance.u = [])).push(() => true);
} : hydrate; } : hydrate;
if (resolvedComp) { if (resolvedComp) {
doHydrate(); doHydrate();
@ -2028,7 +2037,7 @@ const KeepAliveImpl = {
); );
const { include, exclude, max } = props; const { include, exclude, max } = props;
if (include && (!name || !matches(include, name)) || exclude && name && matches(exclude, name)) { if (include && (!name || !matches(include, name)) || exclude && name && matches(exclude, name)) {
vnode.shapeFlag &= ~256; vnode.shapeFlag &= -257;
current = vnode; current = vnode;
return rawVNode; return rawVNode;
} }
@ -2115,8 +2124,8 @@ function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) {
}, target); }, target);
} }
function resetShapeFlag(vnode) { function resetShapeFlag(vnode) {
vnode.shapeFlag &= ~256; vnode.shapeFlag &= -257;
vnode.shapeFlag &= ~512; vnode.shapeFlag &= -513;
} }
function getInnerChild(vnode) { function getInnerChild(vnode) {
return vnode.shapeFlag & 128 ? vnode.ssContent : vnode; return vnode.shapeFlag & 128 ? vnode.ssContent : vnode;
@ -2217,14 +2226,16 @@ function renderList(source, renderItem, cache, index) {
if (sourceIsArray || shared.isString(source)) { if (sourceIsArray || shared.isString(source)) {
const sourceIsReactiveArray = sourceIsArray && reactivity.isReactive(source); const sourceIsReactiveArray = sourceIsArray && reactivity.isReactive(source);
let needsWrap = false; let needsWrap = false;
let isReadonlySource = false;
if (sourceIsReactiveArray) { if (sourceIsReactiveArray) {
needsWrap = !reactivity.isShallow(source); needsWrap = !reactivity.isShallow(source);
isReadonlySource = reactivity.isReadonly(source);
source = reactivity.shallowReadArray(source); source = reactivity.shallowReadArray(source);
} }
ret = new Array(source.length); ret = new Array(source.length);
for (let i = 0, l = source.length; i < l; i++) { for (let i = 0, l = source.length; i < l; i++) {
ret[i] = renderItem( ret[i] = renderItem(
needsWrap ? reactivity.toReactive(source[i]) : source[i], needsWrap ? isReadonlySource ? reactivity.toReadonly(reactivity.toReactive(source[i])) : reactivity.toReactive(source[i]) : source[i],
i, i,
void 0, void 0,
cached && cached[i] cached && cached[i]
@ -3037,7 +3048,7 @@ function provide(key, value) {
function inject(key, defaultValue, treatDefaultAsFactory = false) { function inject(key, defaultValue, treatDefaultAsFactory = false) {
const instance = currentInstance || currentRenderingInstance; const instance = currentInstance || currentRenderingInstance;
if (instance || currentApp) { if (instance || currentApp) {
const provides = currentApp ? currentApp._context.provides : instance ? instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : void 0; let provides = currentApp ? currentApp._context.provides : instance ? instance.parent == null || instance.ce ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : void 0;
if (provides && key in provides) { if (provides && key in provides) {
return provides[key]; return provides[key];
} else if (arguments.length > 1) { } else if (arguments.length > 1) {
@ -3357,7 +3368,7 @@ const normalizeVNodeSlots = (instance, children) => {
}; };
const assignSlots = (slots, children, optimized) => { const assignSlots = (slots, children, optimized) => {
for (const key in children) { for (const key in children) {
if (optimized || key !== "_") { if (optimized || !isInternalKey(key)) {
slots[key] = children[key]; slots[key] = children[key];
} }
} }
@ -3365,6 +3376,8 @@ const assignSlots = (slots, children, optimized) => {
const initSlots = (instance, children, optimized) => { const initSlots = (instance, children, optimized) => {
const slots = instance.slots = createInternalObject(); const slots = instance.slots = createInternalObject();
if (instance.vnode.shapeFlag & 32) { if (instance.vnode.shapeFlag & 32) {
const cacheIndexes = children.__;
if (cacheIndexes) shared.def(slots, "__", cacheIndexes, true);
const type = children._; const type = children._;
if (type) { if (type) {
assignSlots(slots, children, optimized); assignSlots(slots, children, optimized);
@ -3526,6 +3539,8 @@ function baseCreateRenderer(options, createHydrationFns) {
} }
if (ref != null && parentComponent) { if (ref != null && parentComponent) {
setRef(ref, n1 && n1.ref, parentSuspense, n2 || n1, !n2); setRef(ref, n1 && n1.ref, parentSuspense, n2 || n1, !n2);
} else if (ref == null && n1 && n1.ref != null) {
setRef(n1.ref, null, parentSuspense, n1, true);
} }
}; };
const processText = (n1, n2, container, anchor) => { const processText = (n1, n2, container, anchor) => {
@ -3798,7 +3813,7 @@ function baseCreateRenderer(options, createHydrationFns) {
(oldVNode.type === Fragment || // - In the case of different nodes, there is going to be a replacement (oldVNode.type === Fragment || // - In the case of different nodes, there is going to be a replacement
// which also requires the correct parent container // which also requires the correct parent container
!isSameVNodeType(oldVNode, newVNode) || // - In the case of a component, it could contain anything. !isSameVNodeType(oldVNode, newVNode) || // - In the case of a component, it could contain anything.
oldVNode.shapeFlag & (6 | 64)) ? hostParentNode(oldVNode.el) : ( oldVNode.shapeFlag & (6 | 64 | 128)) ? hostParentNode(oldVNode.el) : (
// In other cases, the parent container is not actually used so we // In other cases, the parent container is not actually used so we
// just pass the block element here to avoid a DOM parentNode call. // just pass the block element here to avoid a DOM parentNode call.
fallbackContainer fallbackContainer
@ -4019,7 +4034,8 @@ function baseCreateRenderer(options, createHydrationFns) {
hydrateSubTree(); hydrateSubTree();
} }
} else { } else {
if (root.ce) { if (root.ce && // @ts-expect-error _def is private
root.ce._def.shadowRoot !== false) {
root.ce._injectChildStyle(type); root.ce._injectChildStyle(type);
} }
const subTree = instance.subTree = renderComponentRoot(instance); const subTree = instance.subTree = renderComponentRoot(instance);
@ -4443,7 +4459,13 @@ function baseCreateRenderer(options, createHydrationFns) {
queuePostRenderEffect(() => transition.enter(el), parentSuspense); queuePostRenderEffect(() => transition.enter(el), parentSuspense);
} else { } else {
const { leave, delayLeave, afterLeave } = transition; const { leave, delayLeave, afterLeave } = transition;
const remove2 = () => hostInsert(el, container, anchor); const remove2 = () => {
if (vnode.ctx.isUnmounted) {
hostRemove(el);
} else {
hostInsert(el, container, anchor);
}
};
const performLeave = () => { const performLeave = () => {
leave(el, () => { leave(el, () => {
remove2(); remove2();
@ -4476,7 +4498,9 @@ function baseCreateRenderer(options, createHydrationFns) {
optimized = false; optimized = false;
} }
if (ref != null) { if (ref != null) {
reactivity.pauseTracking();
setRef(ref, null, parentSuspense, vnode, true); setRef(ref, null, parentSuspense, vnode, true);
reactivity.resetTracking();
} }
if (cacheIndex != null) { if (cacheIndex != null) {
parentComponent.renderCache[cacheIndex] = void 0; parentComponent.renderCache[cacheIndex] = void 0;
@ -4577,12 +4601,27 @@ function baseCreateRenderer(options, createHydrationFns) {
hostRemove(end); hostRemove(end);
}; };
const unmountComponent = (instance, parentSuspense, doRemove) => { const unmountComponent = (instance, parentSuspense, doRemove) => {
const { bum, scope, job, subTree, um, m, a } = instance; const {
bum,
scope,
job,
subTree,
um,
m,
a,
parent,
slots: { __: slotCacheKeys }
} = instance;
invalidateMount(m); invalidateMount(m);
invalidateMount(a); invalidateMount(a);
if (bum) { if (bum) {
shared.invokeArrayFns(bum); shared.invokeArrayFns(bum);
} }
if (parent && shared.isArray(slotCacheKeys)) {
slotCacheKeys.forEach((v) => {
parent.renderCache[v] = void 0;
});
}
scope.stop(); scope.stop();
if (job) { if (job) {
job.flags |= 8; job.flags |= 8;
@ -4675,8 +4714,8 @@ function toggleRecurse({ effect, job }, allowed) {
effect.flags |= 32; effect.flags |= 32;
job.flags |= 4; job.flags |= 4;
} else { } else {
effect.flags &= ~32; effect.flags &= -33;
job.flags &= ~4; job.flags &= -5;
} }
} }
function needTransition(parentSuspense, transition) { function needTransition(parentSuspense, transition) {
@ -4700,6 +4739,9 @@ function traverseStaticChildren(n1, n2, shallow = false) {
if (c2.type === Text) { if (c2.type === Text) {
c2.el = c1.el; c2.el = c1.el;
} }
if (c2.type === Comment && !c2.el) {
c2.el = c1.el;
}
} }
} }
} }
@ -6275,7 +6317,7 @@ function setupComponent(instance, isSSR = false, optimized = false) {
const { props, children } = instance.vnode; const { props, children } = instance.vnode;
const isStateful = isStatefulComponent(instance); const isStateful = isStatefulComponent(instance);
initProps(instance, props, isStateful, isSSR); initProps(instance, props, isStateful, isSSR);
initSlots(instance, children, optimized); initSlots(instance, children, optimized || isSSR);
const setupResult = isStateful ? setupStatefulComponent(instance, isSSR) : void 0; const setupResult = isStateful ? setupStatefulComponent(instance, isSSR) : void 0;
isSSR && setInSSRSetupState(false); isSSR && setInSSRSetupState(false);
return setupResult; return setupResult;
@ -6484,7 +6526,7 @@ function isMemoSame(cached, memo) {
return true; return true;
} }
const version = "3.5.13"; const version = "3.5.17";
const warn$1 = shared.NOOP; const warn$1 = shared.NOOP;
const ErrorTypeStrings = ErrorTypeStrings$1 ; const ErrorTypeStrings = ErrorTypeStrings$1 ;
const devtools = void 0; const devtools = void 0;

View File

@ -1,4 +1,4 @@
import { computed as computed$1, Ref, OnCleanup, WatchStopHandle, ShallowUnwrapRef, UnwrapNestedRefs, DebuggerEvent, ComputedGetter, WritableComputedOptions, WatchCallback, ReactiveEffect, DebuggerOptions, WatchEffect, WatchHandle, WatchSource, ReactiveMarker, ShallowRef, WatchErrorCodes, reactive } from '@vue/reactivity'; import { computed as computed$1, Ref, OnCleanup, WatchStopHandle, ShallowUnwrapRef, UnwrapNestedRefs, DebuggerEvent, ComputedGetter, WritableComputedOptions, WatchCallback, ReactiveEffect, DebuggerOptions, WatchSource, WatchHandle, ReactiveMarker, WatchEffect, ShallowRef, WatchErrorCodes, reactive } from '@vue/reactivity';
export { ComputedGetter, ComputedRef, ComputedSetter, CustomRefFactory, DebuggerEvent, DebuggerEventExtraInfo, DebuggerOptions, DeepReadonly, EffectScheduler, EffectScope, MaybeRef, MaybeRefOrGetter, Raw, Reactive, ReactiveEffect, ReactiveEffectOptions, ReactiveEffectRunner, ReactiveFlags, Ref, ShallowReactive, ShallowRef, ShallowUnwrapRef, ToRef, ToRefs, TrackOpTypes, TriggerOpTypes, UnwrapNestedRefs, UnwrapRef, WatchCallback, WatchEffect, WatchHandle, WatchSource, WatchStopHandle, WritableComputedOptions, WritableComputedRef, customRef, effect, effectScope, getCurrentScope, getCurrentWatcher, isProxy, isReactive, isReadonly, isRef, isShallow, markRaw, onScopeDispose, onWatcherCleanup, proxyRefs, reactive, readonly, ref, shallowReactive, shallowReadonly, shallowRef, stop, toRaw, toRef, toRefs, toValue, triggerRef, unref } from '@vue/reactivity'; export { ComputedGetter, ComputedRef, ComputedSetter, CustomRefFactory, DebuggerEvent, DebuggerEventExtraInfo, DebuggerOptions, DeepReadonly, EffectScheduler, EffectScope, MaybeRef, MaybeRefOrGetter, Raw, Reactive, ReactiveEffect, ReactiveEffectOptions, ReactiveEffectRunner, ReactiveFlags, Ref, ShallowReactive, ShallowRef, ShallowUnwrapRef, ToRef, ToRefs, TrackOpTypes, TriggerOpTypes, UnwrapNestedRefs, UnwrapRef, WatchCallback, WatchEffect, WatchHandle, WatchSource, WatchStopHandle, WritableComputedOptions, WritableComputedRef, customRef, effect, effectScope, getCurrentScope, getCurrentWatcher, isProxy, isReactive, isReadonly, isRef, isShallow, markRaw, onScopeDispose, onWatcherCleanup, proxyRefs, reactive, readonly, ref, shallowReactive, shallowReadonly, shallowRef, stop, toRaw, toRef, toRefs, toValue, triggerRef, unref } from '@vue/reactivity';
import { IfAny, Prettify, LooseRequired, UnionToIntersection, OverloadParameters, IsKeyValues } from '@vue/shared'; import { IfAny, Prettify, LooseRequired, UnionToIntersection, OverloadParameters, IsKeyValues } from '@vue/shared';
export { camelize, capitalize, normalizeClass, normalizeProps, normalizeStyle, toDisplayString, toHandlerKey } from '@vue/shared'; export { camelize, capitalize, normalizeClass, normalizeProps, normalizeStyle, toDisplayString, toHandlerKey } from '@vue/shared';
@ -129,7 +129,9 @@ type InferPropType<T, NullAsAny = true> = [T] extends [null] ? NullAsAny extends
* To extract accepted props from the parent, use {@link ExtractPublicPropTypes}. * To extract accepted props from the parent, use {@link ExtractPublicPropTypes}.
*/ */
export type ExtractPropTypes<O> = { export type ExtractPropTypes<O> = {
[K in keyof Pick<O, RequiredKeys<O>>]: InferPropType<O[K]>; [K in keyof Pick<O, RequiredKeys<O>>]: O[K] extends {
default: any;
} ? Exclude<InferPropType<O[K]>, undefined> : InferPropType<O[K]>;
} & { } & {
[K in keyof Pick<O, OptionalKeys<O>>]?: InferPropType<O[K]>; [K in keyof Pick<O, OptionalKeys<O>>]?: InferPropType<O[K]>;
}; };
@ -417,7 +419,7 @@ export interface ObjectDirective<HostElement = any, Value = any, Modifiers exten
} }
export type FunctionDirective<HostElement = any, V = any, Modifiers extends string = string, Arg extends string = string> = DirectiveHook<HostElement, any, V, Modifiers, Arg>; export type FunctionDirective<HostElement = any, V = any, Modifiers extends string = string, Arg extends string = string> = DirectiveHook<HostElement, any, V, Modifiers, Arg>;
export type Directive<HostElement = any, Value = any, Modifiers extends string = string, Arg extends string = string> = ObjectDirective<HostElement, Value, Modifiers, Arg> | FunctionDirective<HostElement, Value, Modifiers, Arg>; export type Directive<HostElement = any, Value = any, Modifiers extends string = string, Arg extends string = string> = ObjectDirective<HostElement, Value, Modifiers, Arg> | FunctionDirective<HostElement, Value, Modifiers, Arg>;
type DirectiveModifiers<K extends string = string> = Record<K, boolean>; type DirectiveModifiers<K extends string = string> = Partial<Record<K, boolean>>;
export type DirectiveArguments = Array<[Directive | undefined] | [Directive | undefined, any] | [Directive | undefined, any, string] | [Directive | undefined, any, string | undefined, DirectiveModifiers]>; export type DirectiveArguments = Array<[Directive | undefined] | [Directive | undefined, any] | [Directive | undefined, any, string] | [Directive | undefined, any, string | undefined, DirectiveModifiers]>;
/** /**
* Adds directives to a VNode. * Adds directives to a VNode.
@ -872,20 +874,20 @@ interface LegacyOptions<Props, D, C extends ComputedOptions, M extends MethodOpt
filters?: Record<string, Function>; filters?: Record<string, Function>;
mixins?: Mixin[]; mixins?: Mixin[];
extends?: Extends; extends?: Extends;
beforeCreate?(): void; beforeCreate?(): any;
created?(): void; created?(): any;
beforeMount?(): void; beforeMount?(): any;
mounted?(): void; mounted?(): any;
beforeUpdate?(): void; beforeUpdate?(): any;
updated?(): void; updated?(): any;
activated?(): void; activated?(): any;
deactivated?(): void; deactivated?(): any;
/** @deprecated use `beforeUnmount` instead */ /** @deprecated use `beforeUnmount` instead */
beforeDestroy?(): void; beforeDestroy?(): any;
beforeUnmount?(): void; beforeUnmount?(): any;
/** @deprecated use `unmounted` instead */ /** @deprecated use `unmounted` instead */
destroyed?(): void; destroyed?(): any;
unmounted?(): void; unmounted?(): any;
renderTracked?: DebuggerHook; renderTracked?: DebuggerHook;
renderTriggered?: DebuggerHook; renderTriggered?: DebuggerHook;
errorCaptured?: ErrorCapturedHook; errorCaptured?: ErrorCapturedHook;
@ -1017,8 +1019,8 @@ InjectOptions, InjectKeys, Slots, LocalComponents, Directives, Exposed, Provide>
export interface App<HostElement = any> { export interface App<HostElement = any> {
version: string; version: string;
config: AppConfig; config: AppConfig;
use<Options extends unknown[]>(plugin: Plugin<Options>, ...options: Options): this; use<Options extends unknown[]>(plugin: Plugin<Options>, ...options: NoInfer<Options>): this;
use<Options>(plugin: Plugin<Options>, options: Options): this; use<Options>(plugin: Plugin<Options>, options: NoInfer<Options>): this;
mixin(mixin: ComponentOptions): this; mixin(mixin: ComponentOptions): this;
component(name: string): Component | undefined; component(name: string): Component | undefined;
component<T extends Component | DefineComponent>(name: string, component: T): this; component<T extends Component | DefineComponent>(name: string, component: T): this;
@ -1105,7 +1107,7 @@ export type ObjectPlugin<Options = any[]> = {
install: PluginInstallFunction<Options>; install: PluginInstallFunction<Options>;
}; };
export type FunctionPlugin<Options = any[]> = PluginInstallFunction<Options> & Partial<ObjectPlugin<Options>>; export type FunctionPlugin<Options = any[]> = PluginInstallFunction<Options> & Partial<ObjectPlugin<Options>>;
export type Plugin<Options = any[]> = FunctionPlugin<Options> | ObjectPlugin<Options>; export type Plugin<Options = any[], P extends unknown[] = Options extends unknown[] ? Options : [Options]> = FunctionPlugin<P> | ObjectPlugin<P>;
export type CreateAppFunction<HostElement> = (rootComponent: Component, rootProps?: Data | null) => App<HostElement>; export type CreateAppFunction<HostElement> = (rootComponent: Component, rootProps?: Data | null) => App<HostElement>;
type TeleportVNode = VNode<RendererNode, RendererElement, TeleportProps>; type TeleportVNode = VNode<RendererNode, RendererElement, TeleportProps>;
@ -1317,7 +1319,9 @@ type Data = Record<string, unknown>;
*/ */
export type ComponentInstance<T> = T extends { export type ComponentInstance<T> = T extends {
new (): ComponentPublicInstance; new (): ComponentPublicInstance;
} ? InstanceType<T> : T extends FunctionalComponent<infer Props, infer Emits> ? ComponentPublicInstance<Props, {}, {}, {}, {}, ShortEmitsToObject<Emits>> : T extends Component<infer Props, infer RawBindings, infer D, infer C, infer M> ? ComponentPublicInstance<unknown extends Props ? {} : Props, unknown extends RawBindings ? {} : RawBindings, unknown extends D ? {} : D, C, M> : never; } ? InstanceType<T> : T extends FunctionalComponent<infer Props, infer Emits> ? ComponentPublicInstance<Props, {}, {}, {}, {}, ShortEmitsToObject<Emits>> : T extends Component<infer PropsOrInstance, infer RawBindings, infer D, infer C, infer M> ? PropsOrInstance extends {
$props: unknown;
} ? PropsOrInstance : ComponentPublicInstance<unknown extends PropsOrInstance ? {} : PropsOrInstance, unknown extends RawBindings ? {} : RawBindings, unknown extends D ? {} : D, C, M> : never;
/** /**
* For extending allowed non-declared props on components in TSX * For extending allowed non-declared props on components in TSX
*/ */
@ -1406,7 +1410,7 @@ export type ConcreteComponent<Props = {}, RawBindings = any, D = any, C extends
* A type used in public APIs where a component type is expected. * A type used in public APIs where a component type is expected.
* The constructor type is an artificial type returned by defineComponent(). * The constructor type is an artificial type returned by defineComponent().
*/ */
export type Component<Props = any, RawBindings = any, D = any, C extends ComputedOptions = ComputedOptions, M extends MethodOptions = MethodOptions, E extends EmitsOptions | Record<string, any[]> = {}, S extends Record<string, any> = any> = ConcreteComponent<Props, RawBindings, D, C, M, E, S> | ComponentPublicInstanceConstructor<Props>; export type Component<PropsOrInstance = any, RawBindings = any, D = any, C extends ComputedOptions = ComputedOptions, M extends MethodOptions = MethodOptions, E extends EmitsOptions | Record<string, any[]> = {}, S extends Record<string, any> = any> = ConcreteComponent<PropsOrInstance, RawBindings, D, C, M, E, S> | ComponentPublicInstanceConstructor<PropsOrInstance>;
export type SetupContext<E = EmitsOptions, S extends SlotsType = {}> = E extends any ? { export type SetupContext<E = EmitsOptions, S extends SlotsType = {}> = E extends any ? {
attrs: Data; attrs: Data;
@ -1525,7 +1529,8 @@ export declare function defineAsyncComponent<T extends Component = {
export declare function useModel<M extends PropertyKey, T extends Record<string, any>, K extends keyof T, G = T[K], S = T[K]>(props: T, name: K, options?: DefineModelOptions<T[K], G, S>): ModelRef<T[K], M, G, S>; export declare function useModel<M extends PropertyKey, T extends Record<string, any>, K extends keyof T, G = T[K], S = T[K]>(props: T, name: K, options?: DefineModelOptions<T[K], G, S>): ModelRef<T[K], M, G, S>;
export declare function useTemplateRef<T = unknown, Keys extends string = string>(key: Keys): Readonly<ShallowRef<T | null>>; export type TemplateRef<T = unknown> = Readonly<ShallowRef<T | null>>;
export declare function useTemplateRef<T = unknown, Keys extends string = string>(key: Keys): TemplateRef<T>;
export declare function useId(): string; export declare function useId(): string;
@ -1798,7 +1803,8 @@ declare module '@vue/reactivity' {
export declare const DeprecationTypes: typeof DeprecationTypes$1; export declare const DeprecationTypes: typeof DeprecationTypes$1;
export { type WatchEffectOptions as WatchOptionsBase, createBaseVNode as createElementVNode, }; export { createBaseVNode as createElementVNode, };
export type { WatchEffectOptions as WatchOptionsBase };
// Note: this file is auto concatenated to the end of the bundled d.ts during // Note: this file is auto concatenated to the end of the bundled d.ts during
// build. // build.

View File

@ -1,11 +1,11 @@
/** /**
* @vue/runtime-core v3.5.13 * @vue/runtime-core v3.5.17
* (c) 2018-present Yuxi (Evan) You and Vue contributors * (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT * @license MIT
**/ **/
import { pauseTracking, resetTracking, isRef, toRaw, traverse, shallowRef, readonly, isReactive, ref, isShallow, shallowReadArray, toReactive, shallowReadonly, track, reactive, shallowReactive, trigger, ReactiveEffect, watch as watch$1, customRef, isProxy, proxyRefs, markRaw, EffectScope, computed as computed$1, isReadonly } from '@vue/reactivity'; import { pauseTracking, resetTracking, isRef, toRaw, traverse, shallowRef, readonly, isReactive, ref, isShallow, isReadonly, shallowReadArray, toReadonly, toReactive, shallowReadonly, track, reactive, shallowReactive, trigger, ReactiveEffect, watch as watch$1, customRef, isProxy, proxyRefs, markRaw, EffectScope, computed as computed$1 } from '@vue/reactivity';
export { EffectScope, ReactiveEffect, TrackOpTypes, TriggerOpTypes, customRef, effect, effectScope, getCurrentScope, getCurrentWatcher, isProxy, isReactive, isReadonly, isRef, isShallow, markRaw, onScopeDispose, onWatcherCleanup, proxyRefs, reactive, readonly, ref, shallowReactive, shallowReadonly, shallowRef, stop, toRaw, toRef, toRefs, toValue, triggerRef, unref } from '@vue/reactivity'; export { EffectScope, ReactiveEffect, TrackOpTypes, TriggerOpTypes, customRef, effect, effectScope, getCurrentScope, getCurrentWatcher, isProxy, isReactive, isReadonly, isRef, isShallow, markRaw, onScopeDispose, onWatcherCleanup, proxyRefs, reactive, readonly, ref, shallowReactive, shallowReadonly, shallowRef, stop, toRaw, toRef, toRefs, toValue, triggerRef, unref } from '@vue/reactivity';
import { isString, isFunction, isPromise, isArray, EMPTY_OBJ, NOOP, getGlobalThis, extend, isBuiltInDirective, hasOwn, remove, def, isOn, isReservedProp, normalizeClass, stringifyStyle, normalizeStyle, isKnownSvgAttr, isBooleanAttr, isKnownHtmlAttr, includeBooleanAttr, isRenderableAttrValue, getEscapedCssVarName, isObject, isRegExp, invokeArrayFns, toHandlerKey, capitalize, camelize, isSymbol, isGloballyAllowed, NO, hyphenate, EMPTY_ARR, toRawType, makeMap, hasChanged, looseToNumber, isModelListener, toNumber } from '@vue/shared'; import { isString, isFunction, EMPTY_OBJ, isPromise, isArray, NOOP, getGlobalThis, extend, isBuiltInDirective, hasOwn, remove, def, isOn, isReservedProp, normalizeClass, stringifyStyle, normalizeStyle, isKnownSvgAttr, isBooleanAttr, isKnownHtmlAttr, includeBooleanAttr, isRenderableAttrValue, getEscapedCssVarName, isObject, isRegExp, invokeArrayFns, toHandlerKey, camelize, capitalize, isSymbol, isGloballyAllowed, NO, EMPTY_ARR, hyphenate, makeMap, toRawType, hasChanged, looseToNumber, isModelListener, toNumber } from '@vue/shared';
export { camelize, capitalize, normalizeClass, normalizeProps, normalizeStyle, toDisplayString, toHandlerKey } from '@vue/shared'; export { camelize, capitalize, normalizeClass, normalizeProps, normalizeStyle, toDisplayString, toHandlerKey } from '@vue/shared';
const stack = []; const stack = [];
@ -351,11 +351,11 @@ function flushPreFlushCbs(instance, seen, i = flushIndex + 1) {
queue.splice(i, 1); queue.splice(i, 1);
i--; i--;
if (cb.flags & 4) { if (cb.flags & 4) {
cb.flags &= ~1; cb.flags &= -2;
} }
cb(); cb();
if (!(cb.flags & 4)) { if (!(cb.flags & 4)) {
cb.flags &= ~1; cb.flags &= -2;
} }
} }
} }
@ -380,10 +380,10 @@ function flushPostFlushCbs(seen) {
continue; continue;
} }
if (cb.flags & 4) { if (cb.flags & 4) {
cb.flags &= ~1; cb.flags &= -2;
} }
if (!(cb.flags & 8)) cb(); if (!(cb.flags & 8)) cb();
cb.flags &= ~1; cb.flags &= -2;
} }
activePostFlushCbs = null; activePostFlushCbs = null;
postFlushIndex = 0; postFlushIndex = 0;
@ -419,7 +419,7 @@ function flushJobs(seen) {
for (; flushIndex < queue.length; flushIndex++) { for (; flushIndex < queue.length; flushIndex++) {
const job = queue[flushIndex]; const job = queue[flushIndex];
if (job) { if (job) {
job.flags &= ~1; job.flags &= -2;
} }
} }
flushIndex = -1; flushIndex = -1;
@ -859,15 +859,16 @@ const TeleportImpl = {
updateCssVars(n2, true); updateCssVars(n2, true);
} }
if (isTeleportDeferred(n2.props)) { if (isTeleportDeferred(n2.props)) {
n2.el.__isMounted = false;
queuePostRenderEffect(() => { queuePostRenderEffect(() => {
mountToTarget(); mountToTarget();
n2.el.__isMounted = true; delete n2.el.__isMounted;
}, parentSuspense); }, parentSuspense);
} else { } else {
mountToTarget(); mountToTarget();
} }
} else { } else {
if (isTeleportDeferred(n2.props) && !n1.el.__isMounted) { if (isTeleportDeferred(n2.props) && n1.el.__isMounted === false) {
queuePostRenderEffect(() => { queuePostRenderEffect(() => {
TeleportImpl.process( TeleportImpl.process(
n1, n1,
@ -881,7 +882,6 @@ const TeleportImpl = {
optimized, optimized,
internals internals
); );
delete n1.el.__isMounted;
}, parentSuspense); }, parentSuspense);
return; return;
} }
@ -908,7 +908,7 @@ const TeleportImpl = {
namespace, namespace,
slotScopeIds slotScopeIds
); );
traverseStaticChildren(n1, n2, true); traverseStaticChildren(n1, n2, !!!(process.env.NODE_ENV !== "production"));
} else if (!optimized) { } else if (!optimized) {
patchChildren( patchChildren(
n1, n1,
@ -1425,7 +1425,7 @@ function getInnerChild$1(vnode) {
} }
return vnode; return vnode;
} }
if (!!(process.env.NODE_ENV !== "production") && vnode.component) { if (vnode.component) {
return vnode.component.subTree; return vnode.component.subTree;
} }
const { shapeFlag, children } = vnode; const { shapeFlag, children } = vnode;
@ -1870,6 +1870,8 @@ function createHydrationFunctions(rendererInternals) {
) && parentComponent && parentComponent.vnode.props && parentComponent.vnode.props.appear; ) && parentComponent && parentComponent.vnode.props && parentComponent.vnode.props.appear;
const content = el.content.firstChild; const content = el.content.firstChild;
if (needCallTransitionHooks) { if (needCallTransitionHooks) {
const cls = content.getAttribute("class");
if (cls) content.$cls = cls;
transition.beforeEnter(content); transition.beforeEnter(content);
} }
replaceNode(content, el, parentComponent); replaceNode(content, el, parentComponent);
@ -2133,7 +2135,12 @@ function propHasMismatch(el, key, clientValue, vnode, instance) {
let actual; let actual;
let expected; let expected;
if (key === "class") { if (key === "class") {
actual = el.getAttribute("class"); if (el.$cls) {
actual = el.$cls;
delete el.$cls;
} else {
actual = el.getAttribute("class");
}
expected = normalizeClass(clientValue); expected = normalizeClass(clientValue);
if (!isSetEqual(toClassSet(actual || ""), toClassSet(expected))) { if (!isSetEqual(toClassSet(actual || ""), toClassSet(expected))) {
mismatchType = 2 /* CLASS */; mismatchType = 2 /* CLASS */;
@ -2271,7 +2278,7 @@ function isMismatchAllowed(el, allowedType) {
if (allowedType === 0 /* TEXT */ && list.includes("children")) { if (allowedType === 0 /* TEXT */ && list.includes("children")) {
return true; return true;
} }
return allowedAttr.split(",").includes(MismatchTypeString[allowedType]); return list.includes(MismatchTypeString[allowedType]);
} }
} }
@ -2428,14 +2435,25 @@ function defineAsyncComponent(source) {
name: "AsyncComponentWrapper", name: "AsyncComponentWrapper",
__asyncLoader: load, __asyncLoader: load,
__asyncHydrate(el, instance, hydrate) { __asyncHydrate(el, instance, hydrate) {
let patched = false;
const doHydrate = hydrateStrategy ? () => { const doHydrate = hydrateStrategy ? () => {
const performHydrate = () => {
if (!!(process.env.NODE_ENV !== "production") && patched) {
warn$1(
`Skipping lazy hydration for component '${getComponentName(resolvedComp)}': it was updated before lazy hydration performed.`
);
return;
}
hydrate();
};
const teardown = hydrateStrategy( const teardown = hydrateStrategy(
hydrate, performHydrate,
(cb) => forEachElement(el, cb) (cb) => forEachElement(el, cb)
); );
if (teardown) { if (teardown) {
(instance.bum || (instance.bum = [])).push(teardown); (instance.bum || (instance.bum = [])).push(teardown);
} }
(instance.u || (instance.u = [])).push(() => patched = true);
} : hydrate; } : hydrate;
if (resolvedComp) { if (resolvedComp) {
doHydrate(); doHydrate();
@ -2605,6 +2623,9 @@ const KeepAliveImpl = {
if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) { if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) {
devtoolsComponentAdded(instance2); devtoolsComponentAdded(instance2);
} }
if (!!(process.env.NODE_ENV !== "production") && true) {
instance2.__keepAliveStorageContainer = storageContainer;
}
}; };
function unmount(vnode) { function unmount(vnode) {
resetShapeFlag(vnode); resetShapeFlag(vnode);
@ -2692,7 +2713,7 @@ const KeepAliveImpl = {
); );
const { include, exclude, max } = props; const { include, exclude, max } = props;
if (include && (!name || !matches(include, name)) || exclude && name && matches(exclude, name)) { if (include && (!name || !matches(include, name)) || exclude && name && matches(exclude, name)) {
vnode.shapeFlag &= ~256; vnode.shapeFlag &= -257;
current = vnode; current = vnode;
return rawVNode; return rawVNode;
} }
@ -2779,8 +2800,8 @@ function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) {
}, target); }, target);
} }
function resetShapeFlag(vnode) { function resetShapeFlag(vnode) {
vnode.shapeFlag &= ~256; vnode.shapeFlag &= -257;
vnode.shapeFlag &= ~512; vnode.shapeFlag &= -513;
} }
function getInnerChild(vnode) { function getInnerChild(vnode) {
return vnode.shapeFlag & 128 ? vnode.ssContent : vnode; return vnode.shapeFlag & 128 ? vnode.ssContent : vnode;
@ -2895,14 +2916,16 @@ function renderList(source, renderItem, cache, index) {
if (sourceIsArray || isString(source)) { if (sourceIsArray || isString(source)) {
const sourceIsReactiveArray = sourceIsArray && isReactive(source); const sourceIsReactiveArray = sourceIsArray && isReactive(source);
let needsWrap = false; let needsWrap = false;
let isReadonlySource = false;
if (sourceIsReactiveArray) { if (sourceIsReactiveArray) {
needsWrap = !isShallow(source); needsWrap = !isShallow(source);
isReadonlySource = isReadonly(source);
source = shallowReadArray(source); source = shallowReadArray(source);
} }
ret = new Array(source.length); ret = new Array(source.length);
for (let i = 0, l = source.length; i < l; i++) { for (let i = 0, l = source.length; i < l; i++) {
ret[i] = renderItem( ret[i] = renderItem(
needsWrap ? toReactive(source[i]) : source[i], needsWrap ? isReadonlySource ? toReadonly(toReactive(source[i])) : toReactive(source[i]) : source[i],
i, i,
void 0, void 0,
cached && cached[i] cached && cached[i]
@ -3928,11 +3951,9 @@ function createAppAPI(render, hydrate) {
} }
if (!!(process.env.NODE_ENV !== "production")) { if (!!(process.env.NODE_ENV !== "production")) {
context.reload = () => { context.reload = () => {
render( const cloned = cloneVNode(vnode);
cloneVNode(vnode), cloned.el = null;
rootContainer, render(cloned, rootContainer, namespace);
namespace
);
}; };
} }
if (isHydrate && hydrate) { if (isHydrate && hydrate) {
@ -3982,9 +4003,15 @@ If you want to remount the same app, move your app creation logic into a factory
}, },
provide(key, value) { provide(key, value) {
if (!!(process.env.NODE_ENV !== "production") && key in context.provides) { if (!!(process.env.NODE_ENV !== "production") && key in context.provides) {
warn$1( if (hasOwn(context.provides, key)) {
`App already provides property with key "${String(key)}". It will be overwritten with the new value.` warn$1(
); `App already provides property with key "${String(key)}". It will be overwritten with the new value.`
);
} else {
warn$1(
`App already provides property with key "${String(key)}" inherited from its parent element. It will be overwritten with the new value.`
);
}
} }
context.provides[key] = value; context.provides[key] = value;
return app; return app;
@ -4021,7 +4048,7 @@ function provide(key, value) {
function inject(key, defaultValue, treatDefaultAsFactory = false) { function inject(key, defaultValue, treatDefaultAsFactory = false) {
const instance = currentInstance || currentRenderingInstance; const instance = currentInstance || currentRenderingInstance;
if (instance || currentApp) { if (instance || currentApp) {
const provides = currentApp ? currentApp._context.provides : instance ? instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : void 0; let provides = currentApp ? currentApp._context.provides : instance ? instance.parent == null || instance.ce ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : void 0;
if (provides && key in provides) { if (provides && key in provides) {
return provides[key]; return provides[key];
} else if (arguments.length > 1) { } else if (arguments.length > 1) {
@ -4455,7 +4482,7 @@ const normalizeSlot = (key, rawSlot, ctx) => {
return rawSlot; return rawSlot;
} }
const normalized = withCtx((...args) => { const normalized = withCtx((...args) => {
if (!!(process.env.NODE_ENV !== "production") && currentInstance && (!ctx || ctx.root === currentInstance.root)) { if (!!(process.env.NODE_ENV !== "production") && currentInstance && !(ctx === null && currentRenderingInstance) && !(ctx && ctx.root !== currentInstance.root)) {
warn$1( warn$1(
`Slot "${key}" invoked outside of the render function: this will not track dependencies used in the slot. Invoke the slot function inside the render function instead.` `Slot "${key}" invoked outside of the render function: this will not track dependencies used in the slot. Invoke the slot function inside the render function instead.`
); );
@ -4494,7 +4521,7 @@ const normalizeVNodeSlots = (instance, children) => {
}; };
const assignSlots = (slots, children, optimized) => { const assignSlots = (slots, children, optimized) => {
for (const key in children) { for (const key in children) {
if (optimized || key !== "_") { if (optimized || !isInternalKey(key)) {
slots[key] = children[key]; slots[key] = children[key];
} }
} }
@ -4502,6 +4529,8 @@ const assignSlots = (slots, children, optimized) => {
const initSlots = (instance, children, optimized) => { const initSlots = (instance, children, optimized) => {
const slots = instance.slots = createInternalObject(); const slots = instance.slots = createInternalObject();
if (instance.vnode.shapeFlag & 32) { if (instance.vnode.shapeFlag & 32) {
const cacheIndexes = children.__;
if (cacheIndexes) def(slots, "__", cacheIndexes, true);
const type = children._; const type = children._;
if (type) { if (type) {
assignSlots(slots, children, optimized); assignSlots(slots, children, optimized);
@ -4740,6 +4769,8 @@ function baseCreateRenderer(options, createHydrationFns) {
} }
if (ref != null && parentComponent) { if (ref != null && parentComponent) {
setRef(ref, n1 && n1.ref, parentSuspense, n2 || n1, !n2); setRef(ref, n1 && n1.ref, parentSuspense, n2 || n1, !n2);
} else if (ref == null && n1 && n1.ref != null) {
setRef(n1.ref, null, parentSuspense, n1, true);
} }
}; };
const processText = (n1, n2, container, anchor) => { const processText = (n1, n2, container, anchor) => {
@ -5045,7 +5076,7 @@ function baseCreateRenderer(options, createHydrationFns) {
(oldVNode.type === Fragment || // - In the case of different nodes, there is going to be a replacement (oldVNode.type === Fragment || // - In the case of different nodes, there is going to be a replacement
// which also requires the correct parent container // which also requires the correct parent container
!isSameVNodeType(oldVNode, newVNode) || // - In the case of a component, it could contain anything. !isSameVNodeType(oldVNode, newVNode) || // - In the case of a component, it could contain anything.
oldVNode.shapeFlag & (6 | 64)) ? hostParentNode(oldVNode.el) : ( oldVNode.shapeFlag & (6 | 64 | 128)) ? hostParentNode(oldVNode.el) : (
// In other cases, the parent container is not actually used so we // In other cases, the parent container is not actually used so we
// just pass the block element here to avoid a DOM parentNode call. // just pass the block element here to avoid a DOM parentNode call.
fallbackContainer fallbackContainer
@ -5218,8 +5249,8 @@ function baseCreateRenderer(options, createHydrationFns) {
endMeasure(instance, `init`); endMeasure(instance, `init`);
} }
} }
if (!!(process.env.NODE_ENV !== "production") && isHmrUpdating) initialVNode.el = null;
if (instance.asyncDep) { if (instance.asyncDep) {
if (!!(process.env.NODE_ENV !== "production") && isHmrUpdating) initialVNode.el = null;
parentSuspense && parentSuspense.registerDep(instance, setupRenderEffect, optimized); parentSuspense && parentSuspense.registerDep(instance, setupRenderEffect, optimized);
if (!initialVNode.el) { if (!initialVNode.el) {
const placeholder = instance.subTree = createVNode(Comment); const placeholder = instance.subTree = createVNode(Comment);
@ -5310,7 +5341,8 @@ function baseCreateRenderer(options, createHydrationFns) {
hydrateSubTree(); hydrateSubTree();
} }
} else { } else {
if (root.ce) { if (root.ce && // @ts-expect-error _def is private
root.ce._def.shadowRoot !== false) {
root.ce._injectChildStyle(type); root.ce._injectChildStyle(type);
} }
if (!!(process.env.NODE_ENV !== "production")) { if (!!(process.env.NODE_ENV !== "production")) {
@ -5781,7 +5813,13 @@ function baseCreateRenderer(options, createHydrationFns) {
queuePostRenderEffect(() => transition.enter(el), parentSuspense); queuePostRenderEffect(() => transition.enter(el), parentSuspense);
} else { } else {
const { leave, delayLeave, afterLeave } = transition; const { leave, delayLeave, afterLeave } = transition;
const remove2 = () => hostInsert(el, container, anchor); const remove2 = () => {
if (vnode.ctx.isUnmounted) {
hostRemove(el);
} else {
hostInsert(el, container, anchor);
}
};
const performLeave = () => { const performLeave = () => {
leave(el, () => { leave(el, () => {
remove2(); remove2();
@ -5814,7 +5852,9 @@ function baseCreateRenderer(options, createHydrationFns) {
optimized = false; optimized = false;
} }
if (ref != null) { if (ref != null) {
pauseTracking();
setRef(ref, null, parentSuspense, vnode, true); setRef(ref, null, parentSuspense, vnode, true);
resetTracking();
} }
if (cacheIndex != null) { if (cacheIndex != null) {
parentComponent.renderCache[cacheIndex] = void 0; parentComponent.renderCache[cacheIndex] = void 0;
@ -5926,12 +5966,27 @@ function baseCreateRenderer(options, createHydrationFns) {
if (!!(process.env.NODE_ENV !== "production") && instance.type.__hmrId) { if (!!(process.env.NODE_ENV !== "production") && instance.type.__hmrId) {
unregisterHMR(instance); unregisterHMR(instance);
} }
const { bum, scope, job, subTree, um, m, a } = instance; const {
bum,
scope,
job,
subTree,
um,
m,
a,
parent,
slots: { __: slotCacheKeys }
} = instance;
invalidateMount(m); invalidateMount(m);
invalidateMount(a); invalidateMount(a);
if (bum) { if (bum) {
invokeArrayFns(bum); invokeArrayFns(bum);
} }
if (parent && isArray(slotCacheKeys)) {
slotCacheKeys.forEach((v) => {
parent.renderCache[v] = void 0;
});
}
scope.stop(); scope.stop();
if (job) { if (job) {
job.flags |= 8; job.flags |= 8;
@ -6027,8 +6082,8 @@ function toggleRecurse({ effect, job }, allowed) {
effect.flags |= 32; effect.flags |= 32;
job.flags |= 4; job.flags |= 4;
} else { } else {
effect.flags &= ~32; effect.flags &= -33;
job.flags &= ~4; job.flags &= -5;
} }
} }
function needTransition(parentSuspense, transition) { function needTransition(parentSuspense, transition) {
@ -6052,9 +6107,12 @@ function traverseStaticChildren(n1, n2, shallow = false) {
if (c2.type === Text) { if (c2.type === Text) {
c2.el = c1.el; c2.el = c1.el;
} }
if (!!(process.env.NODE_ENV !== "production") && c2.type === Comment && !c2.el) { if (c2.type === Comment && !c2.el) {
c2.el = c1.el; c2.el = c1.el;
} }
if (!!(process.env.NODE_ENV !== "production")) {
c2.el && (c2.el.__vnode = c2);
}
} }
} }
} }
@ -7400,8 +7458,8 @@ function isSameVNodeType(n1, n2) {
if (!!(process.env.NODE_ENV !== "production") && n2.shapeFlag & 6 && n1.component) { if (!!(process.env.NODE_ENV !== "production") && n2.shapeFlag & 6 && n1.component) {
const dirtyInstances = hmrDirtyComponents.get(n2.type); const dirtyInstances = hmrDirtyComponents.get(n2.type);
if (dirtyInstances && dirtyInstances.has(n1.component)) { if (dirtyInstances && dirtyInstances.has(n1.component)) {
n1.shapeFlag &= ~256; n1.shapeFlag &= -257;
n2.shapeFlag &= ~512; n2.shapeFlag &= -513;
return false; return false;
} }
} }
@ -7864,7 +7922,7 @@ function setupComponent(instance, isSSR = false, optimized = false) {
const { props, children } = instance.vnode; const { props, children } = instance.vnode;
const isStateful = isStatefulComponent(instance); const isStateful = isStatefulComponent(instance);
initProps(instance, props, isStateful, isSSR); initProps(instance, props, isStateful, isSSR);
initSlots(instance, children, optimized); initSlots(instance, children, optimized || isSSR);
const setupResult = isStateful ? setupStatefulComponent(instance, isSSR) : void 0; const setupResult = isStateful ? setupStatefulComponent(instance, isSSR) : void 0;
isSSR && setInSSRSetupState(false); isSSR && setInSSRSetupState(false);
return setupResult; return setupResult;
@ -8207,13 +8265,15 @@ function initCustomFormatter() {
if (obj.__isVue) { if (obj.__isVue) {
return ["div", vueStyle, `VueInstance`]; return ["div", vueStyle, `VueInstance`];
} else if (isRef(obj)) { } else if (isRef(obj)) {
pauseTracking();
const value = obj.value;
resetTracking();
return [ return [
"div", "div",
{}, {},
["span", vueStyle, genRefFlag(obj)], ["span", vueStyle, genRefFlag(obj)],
"<", "<",
// avoid debugger accessing value affecting behavior formatValue(value),
formatValue("_value" in obj ? obj._value : obj),
`>` `>`
]; ];
} else if (isReactive(obj)) { } else if (isReactive(obj)) {
@ -8394,7 +8454,7 @@ function isMemoSame(cached, memo) {
return true; return true;
} }
const version = "3.5.13"; const version = "3.5.17";
const warn = !!(process.env.NODE_ENV !== "production") ? warn$1 : NOOP; const warn = !!(process.env.NODE_ENV !== "production") ? warn$1 : NOOP;
const ErrorTypeStrings = ErrorTypeStrings$1 ; const ErrorTypeStrings = ErrorTypeStrings$1 ;
const devtools = !!(process.env.NODE_ENV !== "production") || true ? devtools$1 : void 0; const devtools = !!(process.env.NODE_ENV !== "production") || true ? devtools$1 : void 0;

View File

@ -1,6 +1,6 @@
{ {
"name": "@vue/runtime-core", "name": "@vue/runtime-core",
"version": "3.5.13", "version": "3.5.17",
"description": "@vue/runtime-core", "description": "@vue/runtime-core",
"main": "index.js", "main": "index.js",
"module": "dist/runtime-core.esm-bundler.js", "module": "dist/runtime-core.esm-bundler.js",
@ -46,7 +46,7 @@
}, },
"homepage": "https://github.com/vuejs/core/tree/main/packages/runtime-core#readme", "homepage": "https://github.com/vuejs/core/tree/main/packages/runtime-core#readme",
"dependencies": { "dependencies": {
"@vue/shared": "3.5.13", "@vue/shared": "3.5.17",
"@vue/reactivity": "3.5.13" "@vue/reactivity": "3.5.17"
} }
} }

View File

@ -1,5 +1,5 @@
/** /**
* @vue/runtime-dom v3.5.13 * @vue/runtime-dom v3.5.17
* (c) 2018-present Yuxi (Evan) You and Vue contributors * (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT * @license MIT
**/ **/
@ -739,7 +739,7 @@ function shouldSetAsProp(el, key, value, isSVG) {
} }
return false; return false;
} }
if (key === "spellcheck" || key === "draggable" || key === "translate") { if (key === "spellcheck" || key === "draggable" || key === "translate" || key === "autocorrect") {
return false; return false;
} }
if (key === "form") { if (key === "form") {
@ -822,13 +822,10 @@ class VueElement extends BaseClass {
this._root = this; this._root = this;
} }
} }
if (!this._def.__asyncLoader) {
this._resolveProps(this._def);
}
} }
connectedCallback() { connectedCallback() {
if (!this.isConnected) return; if (!this.isConnected) return;
if (!this.shadowRoot) { if (!this.shadowRoot && !this._resolved) {
this._parseSlots(); this._parseSlots();
} }
this._connected = true; this._connected = true;
@ -841,8 +838,7 @@ class VueElement extends BaseClass {
} }
if (!this._instance) { if (!this._instance) {
if (this._resolved) { if (this._resolved) {
this._setParent(); this._mount(this._def);
this._update();
} else { } else {
if (parent && parent._pendingResolve) { if (parent && parent._pendingResolve) {
this._pendingResolve = parent._pendingResolve.then(() => { this._pendingResolve = parent._pendingResolve.then(() => {
@ -858,7 +854,15 @@ class VueElement extends BaseClass {
_setParent(parent = this._parent) { _setParent(parent = this._parent) {
if (parent) { if (parent) {
this._instance.parent = parent._instance; this._instance.parent = parent._instance;
this._instance.provides = parent._instance.provides; this._inheritParentContext(parent);
}
}
_inheritParentContext(parent = this._parent) {
if (parent && this._app) {
Object.setPrototypeOf(
this._app._context.provides,
parent._instance.provides
);
} }
} }
disconnectedCallback() { disconnectedCallback() {
@ -908,9 +912,7 @@ class VueElement extends BaseClass {
} }
} }
this._numberProps = numberProps; this._numberProps = numberProps;
if (isAsync) { this._resolveProps(def);
this._resolveProps(def);
}
if (this.shadowRoot) { if (this.shadowRoot) {
this._applyStyles(styles); this._applyStyles(styles);
} else if (styles) { } else if (styles) {
@ -922,9 +924,10 @@ class VueElement extends BaseClass {
}; };
const asyncDef = this._def.__asyncLoader; const asyncDef = this._def.__asyncLoader;
if (asyncDef) { if (asyncDef) {
this._pendingResolve = asyncDef().then( this._pendingResolve = asyncDef().then((def) => {
(def) => resolve(this._def = def, true) def.configureApp = this._def.configureApp;
); resolve(this._def = def, true);
});
} else { } else {
resolve(this._def); resolve(this._def);
} }
@ -934,6 +937,7 @@ class VueElement extends BaseClass {
def.name = "VueElement"; def.name = "VueElement";
} }
this._app = this._createApp(def); this._app = this._createApp(def);
this._inheritParentContext();
if (def.configureApp) { if (def.configureApp) {
def.configureApp(this._app); def.configureApp(this._app);
} }
@ -1018,7 +1022,9 @@ class VueElement extends BaseClass {
} }
} }
_update() { _update() {
render(this._createVNode(), this._root); const vnode = this._createVNode();
if (this._app) vnode.appContext = this._app._context;
render(vnode, this._root);
} }
_createVNode() { _createVNode() {
const baseProps = {}; const baseProps = {};
@ -1228,6 +1234,7 @@ const TransitionGroupImpl = /* @__PURE__ */ decorate({
instance.vnode.el, instance.vnode.el,
moveClass moveClass
)) { )) {
prevChildren = [];
return; return;
} }
prevChildren.forEach(callPendingCbs); prevChildren.forEach(callPendingCbs);
@ -1251,6 +1258,7 @@ const TransitionGroupImpl = /* @__PURE__ */ decorate({
}; };
el.addEventListener("transitionend", cb); el.addEventListener("transitionend", cb);
}); });
prevChildren = [];
}); });
return () => { return () => {
const rawProps = runtimeCore.toRaw(props); const rawProps = runtimeCore.toRaw(props);

View File

@ -1,5 +1,5 @@
/** /**
* @vue/runtime-dom v3.5.13 * @vue/runtime-dom v3.5.17
* (c) 2018-present Yuxi (Evan) You and Vue contributors * (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT * @license MIT
**/ **/
@ -708,7 +708,7 @@ function shouldSetAsProp(el, key, value, isSVG) {
} }
return false; return false;
} }
if (key === "spellcheck" || key === "draggable" || key === "translate") { if (key === "spellcheck" || key === "draggable" || key === "translate" || key === "autocorrect") {
return false; return false;
} }
if (key === "form") { if (key === "form") {
@ -786,13 +786,10 @@ class VueElement extends BaseClass {
this._root = this; this._root = this;
} }
} }
if (!this._def.__asyncLoader) {
this._resolveProps(this._def);
}
} }
connectedCallback() { connectedCallback() {
if (!this.isConnected) return; if (!this.isConnected) return;
if (!this.shadowRoot) { if (!this.shadowRoot && !this._resolved) {
this._parseSlots(); this._parseSlots();
} }
this._connected = true; this._connected = true;
@ -805,8 +802,7 @@ class VueElement extends BaseClass {
} }
if (!this._instance) { if (!this._instance) {
if (this._resolved) { if (this._resolved) {
this._setParent(); this._mount(this._def);
this._update();
} else { } else {
if (parent && parent._pendingResolve) { if (parent && parent._pendingResolve) {
this._pendingResolve = parent._pendingResolve.then(() => { this._pendingResolve = parent._pendingResolve.then(() => {
@ -822,7 +818,15 @@ class VueElement extends BaseClass {
_setParent(parent = this._parent) { _setParent(parent = this._parent) {
if (parent) { if (parent) {
this._instance.parent = parent._instance; this._instance.parent = parent._instance;
this._instance.provides = parent._instance.provides; this._inheritParentContext(parent);
}
}
_inheritParentContext(parent = this._parent) {
if (parent && this._app) {
Object.setPrototypeOf(
this._app._context.provides,
parent._instance.provides
);
} }
} }
disconnectedCallback() { disconnectedCallback() {
@ -872,9 +876,7 @@ class VueElement extends BaseClass {
} }
} }
this._numberProps = numberProps; this._numberProps = numberProps;
if (isAsync) { this._resolveProps(def);
this._resolveProps(def);
}
if (this.shadowRoot) { if (this.shadowRoot) {
this._applyStyles(styles); this._applyStyles(styles);
} }
@ -882,15 +884,17 @@ class VueElement extends BaseClass {
}; };
const asyncDef = this._def.__asyncLoader; const asyncDef = this._def.__asyncLoader;
if (asyncDef) { if (asyncDef) {
this._pendingResolve = asyncDef().then( this._pendingResolve = asyncDef().then((def) => {
(def) => resolve(this._def = def, true) def.configureApp = this._def.configureApp;
); resolve(this._def = def, true);
});
} else { } else {
resolve(this._def); resolve(this._def);
} }
} }
_mount(def) { _mount(def) {
this._app = this._createApp(def); this._app = this._createApp(def);
this._inheritParentContext();
if (def.configureApp) { if (def.configureApp) {
def.configureApp(this._app); def.configureApp(this._app);
} }
@ -973,7 +977,9 @@ class VueElement extends BaseClass {
} }
} }
_update() { _update() {
render(this._createVNode(), this._root); const vnode = this._createVNode();
if (this._app) vnode.appContext = this._app._context;
render(vnode, this._root);
} }
_createVNode() { _createVNode() {
const baseProps = {}; const baseProps = {};
@ -1135,6 +1141,7 @@ const TransitionGroupImpl = /* @__PURE__ */ decorate({
instance.vnode.el, instance.vnode.el,
moveClass moveClass
)) { )) {
prevChildren = [];
return; return;
} }
prevChildren.forEach(callPendingCbs); prevChildren.forEach(callPendingCbs);
@ -1158,6 +1165,7 @@ const TransitionGroupImpl = /* @__PURE__ */ decorate({
}; };
el.addEventListener("transitionend", cb); el.addEventListener("transitionend", cb);
}); });
prevChildren = [];
}); });
return () => { return () => {
const rawProps = runtimeCore.toRaw(props); const rawProps = runtimeCore.toRaw(props);

View File

@ -1,4 +1,4 @@
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'; import { BaseTransitionProps, FunctionalComponent, ObjectDirective, Directive, SetupContext, RenderFunction, ComponentOptions, App, ComponentCustomElementInterface, ConcreteComponent, CreateAppFunction, ComponentObjectPropsOptions, EmitsOptions, ComputedOptions, MethodOptions, ComponentOptionsMixin, ComponentInjectOptions, SlotsType, Component, ComponentProvideOptions, ExtractPropTypes, EmitsToProps, ComponentOptionsBase, CreateComponentPublicInstanceWithMixins, ComponentPublicInstance, DefineComponent, VNodeRef, RootRenderFunction, RootHydrateFunction } from '@vue/runtime-core';
export * from '@vue/runtime-core'; export * from '@vue/runtime-core';
import * as CSS from 'csstype'; import * as CSS from 'csstype';
@ -147,6 +147,7 @@ export declare class VueElement extends BaseClass implements ComponentCustomElem
_def: InnerComponentDef, _props?: Record<string, any>, _createApp?: CreateAppFunction<Element>); _def: InnerComponentDef, _props?: Record<string, any>, _createApp?: CreateAppFunction<Element>);
connectedCallback(): void; connectedCallback(): void;
private _setParent; private _setParent;
private _inheritParentContext;
disconnectedCallback(): void; disconnectedCallback(): void;
/** /**
* resolve inner component definition (handle possible async component) * resolve inner component definition (handle possible async component)
@ -1384,8 +1385,8 @@ declare module '@vue/runtime-core' {
vOn: VOnDirective; vOn: VOnDirective;
vBind: VModelDirective; vBind: VModelDirective;
vIf: Directive<any, boolean>; vIf: Directive<any, boolean>;
VOnce: Directive; vOnce: Directive;
VSlot: Directive; vSlot: Directive;
} }
} }
export declare const render: RootRenderFunction<Element | ShadowRoot>; export declare const render: RootRenderFunction<Element | ShadowRoot>;
@ -1393,3 +1394,4 @@ export declare const hydrate: RootHydrateFunction;
export declare const createApp: CreateAppFunction<Element>; export declare const createApp: CreateAppFunction<Element>;
export declare const createSSRApp: CreateAppFunction<Element>; export declare const createSSRApp: CreateAppFunction<Element>;

View File

@ -1,5 +1,5 @@
/** /**
* @vue/runtime-dom v3.5.13 * @vue/runtime-dom v3.5.17
* (c) 2018-present Yuxi (Evan) You and Vue contributors * (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT * @license MIT
**/ **/
@ -323,6 +323,10 @@ class EffectScope {
* @internal * @internal
*/ */
this._active = true; this._active = true;
/**
* @internal track `on` calls, allow `on` call multiple times
*/
this._on = 0;
/** /**
* @internal * @internal
*/ */
@ -393,14 +397,20 @@ class EffectScope {
* @internal * @internal
*/ */
on() { on() {
activeEffectScope = this; if (++this._on === 1) {
this.prevScope = activeEffectScope;
activeEffectScope = this;
}
} }
/** /**
* This should only be called on non-detached scopes * This should only be called on non-detached scopes
* @internal * @internal
*/ */
off() { off() {
activeEffectScope = this.parent; if (this._on > 0 && --this._on === 0) {
activeEffectScope = this.prevScope;
this.prevScope = void 0;
}
} }
stop(fromParent) { stop(fromParent) {
if (this._active) { if (this._active) {
@ -482,7 +492,7 @@ class ReactiveEffect {
} }
resume() { resume() {
if (this.flags & 64) { if (this.flags & 64) {
this.flags &= ~64; this.flags &= -65;
if (pausedQueueEffects.has(this)) { if (pausedQueueEffects.has(this)) {
pausedQueueEffects.delete(this); pausedQueueEffects.delete(this);
this.trigger(); this.trigger();
@ -522,7 +532,7 @@ class ReactiveEffect {
cleanupDeps(this); cleanupDeps(this);
activeSub = prevEffect; activeSub = prevEffect;
shouldTrack = prevShouldTrack; shouldTrack = prevShouldTrack;
this.flags &= ~2; this.flags &= -3;
} }
} }
stop() { stop() {
@ -533,7 +543,7 @@ class ReactiveEffect {
this.deps = this.depsTail = void 0; this.deps = this.depsTail = void 0;
cleanupEffect(this); cleanupEffect(this);
this.onStop && this.onStop(); this.onStop && this.onStop();
this.flags &= ~1; this.flags &= -2;
} }
} }
trigger() { trigger() {
@ -583,7 +593,7 @@ function endBatch() {
while (e) { while (e) {
const next = e.next; const next = e.next;
e.next = void 0; e.next = void 0;
e.flags &= ~8; e.flags &= -9;
e = next; e = next;
} }
} }
@ -594,7 +604,7 @@ function endBatch() {
while (e) { while (e) {
const next = e.next; const next = e.next;
e.next = void 0; e.next = void 0;
e.flags &= ~8; e.flags &= -9;
if (e.flags & 1) { if (e.flags & 1) {
try { try {
; ;
@ -650,17 +660,16 @@ function refreshComputed(computed) {
if (computed.flags & 4 && !(computed.flags & 16)) { if (computed.flags & 4 && !(computed.flags & 16)) {
return; return;
} }
computed.flags &= ~16; computed.flags &= -17;
if (computed.globalVersion === globalVersion) { if (computed.globalVersion === globalVersion) {
return; return;
} }
computed.globalVersion = globalVersion; computed.globalVersion = globalVersion;
const dep = computed.dep; if (!computed.isSSR && computed.flags & 128 && (!computed.deps && !computed._dirty || !isDirty(computed))) {
computed.flags |= 2;
if (dep.version > 0 && !computed.isSSR && computed.deps && !isDirty(computed)) {
computed.flags &= ~2;
return; return;
} }
computed.flags |= 2;
const dep = computed.dep;
const prevSub = activeSub; const prevSub = activeSub;
const prevShouldTrack = shouldTrack; const prevShouldTrack = shouldTrack;
activeSub = computed; activeSub = computed;
@ -669,6 +678,7 @@ function refreshComputed(computed) {
prepareDeps(computed); prepareDeps(computed);
const value = computed.fn(computed._value); const value = computed.fn(computed._value);
if (dep.version === 0 || hasChanged(value, computed._value)) { if (dep.version === 0 || hasChanged(value, computed._value)) {
computed.flags |= 128;
computed._value = value; computed._value = value;
dep.version++; dep.version++;
} }
@ -679,7 +689,7 @@ function refreshComputed(computed) {
activeSub = prevSub; activeSub = prevSub;
shouldTrack = prevShouldTrack; shouldTrack = prevShouldTrack;
cleanupDeps(computed); cleanupDeps(computed);
computed.flags &= ~2; computed.flags &= -3;
} }
} }
function removeSub(link, soft = false) { function removeSub(link, soft = false) {
@ -698,7 +708,7 @@ function removeSub(link, soft = false) {
if (dep.subs === link) { if (dep.subs === link) {
dep.subs = prevSub; dep.subs = prevSub;
if (!prevSub && dep.computed) { if (!prevSub && dep.computed) {
dep.computed.flags &= ~4; dep.computed.flags &= -5;
for (let l = dep.computed.deps; l; l = l.nextDep) { for (let l = dep.computed.deps; l; l = l.nextDep) {
removeSub(l, true); removeSub(l, true);
} }
@ -774,6 +784,7 @@ class Link {
} }
} }
class Dep { class Dep {
// TODO isolatedDeclarations "__v_skip"
constructor(computed) { constructor(computed) {
this.computed = computed; this.computed = computed;
this.version = 0; this.version = 0;
@ -794,6 +805,10 @@ class Dep {
* Subscriber counter * Subscriber counter
*/ */
this.sc = 0; this.sc = 0;
/**
* @internal
*/
this.__v_skip = true;
{ {
this.subsHead = void 0; this.subsHead = void 0;
} }
@ -1631,14 +1646,14 @@ function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandl
if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) { if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) {
return target; return target;
} }
const existingProxy = proxyMap.get(target);
if (existingProxy) {
return existingProxy;
}
const targetType = getTargetType(target); const targetType = getTargetType(target);
if (targetType === 0 /* INVALID */) { if (targetType === 0 /* INVALID */) {
return target; return target;
} }
const existingProxy = proxyMap.get(target);
if (existingProxy) {
return existingProxy;
}
const proxy = new Proxy( const proxy = new Proxy(
target, target,
targetType === 2 /* COLLECTION */ ? collectionHandlers : baseHandlers targetType === 2 /* COLLECTION */ ? collectionHandlers : baseHandlers
@ -2061,11 +2076,11 @@ function watch$1(source, cb, options = EMPTY_OBJ) {
oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue, oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
boundCleanup boundCleanup
]; ];
oldValue = newValue;
call ? call(cb, 3, args) : ( call ? call(cb, 3, args) : (
// @ts-expect-error // @ts-expect-error
cb(...args) cb(...args)
); );
oldValue = newValue;
} finally { } finally {
activeWatcher = currentWatcher; activeWatcher = currentWatcher;
} }
@ -2482,11 +2497,11 @@ function flushPreFlushCbs(instance, seen, i = flushIndex + 1) {
queue.splice(i, 1); queue.splice(i, 1);
i--; i--;
if (cb.flags & 4) { if (cb.flags & 4) {
cb.flags &= ~1; cb.flags &= -2;
} }
cb(); cb();
if (!(cb.flags & 4)) { if (!(cb.flags & 4)) {
cb.flags &= ~1; cb.flags &= -2;
} }
} }
} }
@ -2511,10 +2526,10 @@ function flushPostFlushCbs(seen) {
continue; continue;
} }
if (cb.flags & 4) { if (cb.flags & 4) {
cb.flags &= ~1; cb.flags &= -2;
} }
if (!(cb.flags & 8)) cb(); if (!(cb.flags & 8)) cb();
cb.flags &= ~1; cb.flags &= -2;
} }
activePostFlushCbs = null; activePostFlushCbs = null;
postFlushIndex = 0; postFlushIndex = 0;
@ -2550,7 +2565,7 @@ function flushJobs(seen) {
for (; flushIndex < queue.length; flushIndex++) { for (; flushIndex < queue.length; flushIndex++) {
const job = queue[flushIndex]; const job = queue[flushIndex];
if (job) { if (job) {
job.flags &= ~1; job.flags &= -2;
} }
} }
flushIndex = -1; flushIndex = -1;
@ -2990,15 +3005,16 @@ const TeleportImpl = {
updateCssVars(n2, true); updateCssVars(n2, true);
} }
if (isTeleportDeferred(n2.props)) { if (isTeleportDeferred(n2.props)) {
n2.el.__isMounted = false;
queuePostRenderEffect(() => { queuePostRenderEffect(() => {
mountToTarget(); mountToTarget();
n2.el.__isMounted = true; delete n2.el.__isMounted;
}, parentSuspense); }, parentSuspense);
} else { } else {
mountToTarget(); mountToTarget();
} }
} else { } else {
if (isTeleportDeferred(n2.props) && !n1.el.__isMounted) { if (isTeleportDeferred(n2.props) && n1.el.__isMounted === false) {
queuePostRenderEffect(() => { queuePostRenderEffect(() => {
TeleportImpl.process( TeleportImpl.process(
n1, n1,
@ -3012,7 +3028,6 @@ const TeleportImpl = {
optimized, optimized,
internals internals
); );
delete n1.el.__isMounted;
}, parentSuspense); }, parentSuspense);
return; return;
} }
@ -3039,7 +3054,7 @@ const TeleportImpl = {
namespace, namespace,
slotScopeIds slotScopeIds
); );
traverseStaticChildren(n1, n2, true); traverseStaticChildren(n1, n2, false);
} else if (!optimized) { } else if (!optimized) {
patchChildren( patchChildren(
n1, n1,
@ -4000,6 +4015,8 @@ function createHydrationFunctions(rendererInternals) {
) && parentComponent && parentComponent.vnode.props && parentComponent.vnode.props.appear; ) && parentComponent && parentComponent.vnode.props && parentComponent.vnode.props.appear;
const content = el.content.firstChild; const content = el.content.firstChild;
if (needCallTransitionHooks) { if (needCallTransitionHooks) {
const cls = content.getAttribute("class");
if (cls) content.$cls = cls;
transition.beforeEnter(content); transition.beforeEnter(content);
} }
replaceNode(content, el, parentComponent); replaceNode(content, el, parentComponent);
@ -4252,7 +4269,12 @@ function propHasMismatch(el, key, clientValue, vnode, instance) {
let actual; let actual;
let expected; let expected;
if (key === "class") { if (key === "class") {
actual = el.getAttribute("class"); if (el.$cls) {
actual = el.$cls;
delete el.$cls;
} else {
actual = el.getAttribute("class");
}
expected = normalizeClass(clientValue); expected = normalizeClass(clientValue);
if (!isSetEqual(toClassSet(actual || ""), toClassSet(expected))) { if (!isSetEqual(toClassSet(actual || ""), toClassSet(expected))) {
mismatchType = 2 /* CLASS */; mismatchType = 2 /* CLASS */;
@ -4390,7 +4412,7 @@ function isMismatchAllowed(el, allowedType) {
if (allowedType === 0 /* TEXT */ && list.includes("children")) { if (allowedType === 0 /* TEXT */ && list.includes("children")) {
return true; return true;
} }
return allowedAttr.split(",").includes(MismatchTypeString[allowedType]); return list.includes(MismatchTypeString[allowedType]);
} }
} }
@ -4547,14 +4569,25 @@ function defineAsyncComponent(source) {
name: "AsyncComponentWrapper", name: "AsyncComponentWrapper",
__asyncLoader: load, __asyncLoader: load,
__asyncHydrate(el, instance, hydrate) { __asyncHydrate(el, instance, hydrate) {
let patched = false;
const doHydrate = hydrateStrategy ? () => { const doHydrate = hydrateStrategy ? () => {
const performHydrate = () => {
if (patched) {
warn$1(
`Skipping lazy hydration for component '${getComponentName(resolvedComp)}': it was updated before lazy hydration performed.`
);
return;
}
hydrate();
};
const teardown = hydrateStrategy( const teardown = hydrateStrategy(
hydrate, performHydrate,
(cb) => forEachElement(el, cb) (cb) => forEachElement(el, cb)
); );
if (teardown) { if (teardown) {
(instance.bum || (instance.bum = [])).push(teardown); (instance.bum || (instance.bum = [])).push(teardown);
} }
(instance.u || (instance.u = [])).push(() => patched = true);
} : hydrate; } : hydrate;
if (resolvedComp) { if (resolvedComp) {
doHydrate(); doHydrate();
@ -4724,6 +4757,9 @@ const KeepAliveImpl = {
{ {
devtoolsComponentAdded(instance2); devtoolsComponentAdded(instance2);
} }
{
instance2.__keepAliveStorageContainer = storageContainer;
}
}; };
function unmount(vnode) { function unmount(vnode) {
resetShapeFlag(vnode); resetShapeFlag(vnode);
@ -4811,7 +4847,7 @@ const KeepAliveImpl = {
); );
const { include, exclude, max } = props; const { include, exclude, max } = props;
if (include && (!name || !matches(include, name)) || exclude && name && matches(exclude, name)) { if (include && (!name || !matches(include, name)) || exclude && name && matches(exclude, name)) {
vnode.shapeFlag &= ~256; vnode.shapeFlag &= -257;
current = vnode; current = vnode;
return rawVNode; return rawVNode;
} }
@ -4898,8 +4934,8 @@ function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) {
}, target); }, target);
} }
function resetShapeFlag(vnode) { function resetShapeFlag(vnode) {
vnode.shapeFlag &= ~256; vnode.shapeFlag &= -257;
vnode.shapeFlag &= ~512; vnode.shapeFlag &= -513;
} }
function getInnerChild(vnode) { function getInnerChild(vnode) {
return vnode.shapeFlag & 128 ? vnode.ssContent : vnode; return vnode.shapeFlag & 128 ? vnode.ssContent : vnode;
@ -5014,14 +5050,16 @@ function renderList(source, renderItem, cache, index) {
if (sourceIsArray || isString(source)) { if (sourceIsArray || isString(source)) {
const sourceIsReactiveArray = sourceIsArray && isReactive(source); const sourceIsReactiveArray = sourceIsArray && isReactive(source);
let needsWrap = false; let needsWrap = false;
let isReadonlySource = false;
if (sourceIsReactiveArray) { if (sourceIsReactiveArray) {
needsWrap = !isShallow(source); needsWrap = !isShallow(source);
isReadonlySource = isReadonly(source);
source = shallowReadArray(source); source = shallowReadArray(source);
} }
ret = new Array(source.length); ret = new Array(source.length);
for (let i = 0, l = source.length; i < l; i++) { for (let i = 0, l = source.length; i < l; i++) {
ret[i] = renderItem( ret[i] = renderItem(
needsWrap ? toReactive(source[i]) : source[i], needsWrap ? isReadonlySource ? toReadonly(toReactive(source[i])) : toReactive(source[i]) : source[i],
i, i,
void 0, void 0,
cached && cached[i] cached && cached[i]
@ -6043,11 +6081,9 @@ function createAppAPI(render, hydrate) {
} }
{ {
context.reload = () => { context.reload = () => {
render( const cloned = cloneVNode(vnode);
cloneVNode(vnode), cloned.el = null;
rootContainer, render(cloned, rootContainer, namespace);
namespace
);
}; };
} }
if (isHydrate && hydrate) { if (isHydrate && hydrate) {
@ -6097,9 +6133,15 @@ If you want to remount the same app, move your app creation logic into a factory
}, },
provide(key, value) { provide(key, value) {
if (key in context.provides) { if (key in context.provides) {
warn$1( if (hasOwn(context.provides, key)) {
`App already provides property with key "${String(key)}". It will be overwritten with the new value.` warn$1(
); `App already provides property with key "${String(key)}". It will be overwritten with the new value.`
);
} else {
warn$1(
`App already provides property with key "${String(key)}" inherited from its parent element. It will be overwritten with the new value.`
);
}
} }
context.provides[key] = value; context.provides[key] = value;
return app; return app;
@ -6136,7 +6178,7 @@ function provide(key, value) {
function inject(key, defaultValue, treatDefaultAsFactory = false) { function inject(key, defaultValue, treatDefaultAsFactory = false) {
const instance = currentInstance || currentRenderingInstance; const instance = currentInstance || currentRenderingInstance;
if (instance || currentApp) { if (instance || currentApp) {
const provides = currentApp ? currentApp._context.provides : instance ? instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : void 0; let provides = currentApp ? currentApp._context.provides : instance ? instance.parent == null || instance.ce ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : void 0;
if (provides && key in provides) { if (provides && key in provides) {
return provides[key]; return provides[key];
} else if (arguments.length > 1) { } else if (arguments.length > 1) {
@ -6570,7 +6612,7 @@ const normalizeSlot = (key, rawSlot, ctx) => {
return rawSlot; return rawSlot;
} }
const normalized = withCtx((...args) => { const normalized = withCtx((...args) => {
if (currentInstance && (!ctx || ctx.root === currentInstance.root)) { if (currentInstance && !(ctx === null && currentRenderingInstance) && !(ctx && ctx.root !== currentInstance.root)) {
warn$1( warn$1(
`Slot "${key}" invoked outside of the render function: this will not track dependencies used in the slot. Invoke the slot function inside the render function instead.` `Slot "${key}" invoked outside of the render function: this will not track dependencies used in the slot. Invoke the slot function inside the render function instead.`
); );
@ -6609,7 +6651,7 @@ const normalizeVNodeSlots = (instance, children) => {
}; };
const assignSlots = (slots, children, optimized) => { const assignSlots = (slots, children, optimized) => {
for (const key in children) { for (const key in children) {
if (optimized || key !== "_") { if (optimized || !isInternalKey(key)) {
slots[key] = children[key]; slots[key] = children[key];
} }
} }
@ -6617,6 +6659,8 @@ const assignSlots = (slots, children, optimized) => {
const initSlots = (instance, children, optimized) => { const initSlots = (instance, children, optimized) => {
const slots = instance.slots = createInternalObject(); const slots = instance.slots = createInternalObject();
if (instance.vnode.shapeFlag & 32) { if (instance.vnode.shapeFlag & 32) {
const cacheIndexes = children.__;
if (cacheIndexes) def(slots, "__", cacheIndexes, true);
const type = children._; const type = children._;
if (type) { if (type) {
assignSlots(slots, children, optimized); assignSlots(slots, children, optimized);
@ -6828,6 +6872,8 @@ function baseCreateRenderer(options, createHydrationFns) {
} }
if (ref != null && parentComponent) { if (ref != null && parentComponent) {
setRef(ref, n1 && n1.ref, parentSuspense, n2 || n1, !n2); setRef(ref, n1 && n1.ref, parentSuspense, n2 || n1, !n2);
} else if (ref == null && n1 && n1.ref != null) {
setRef(n1.ref, null, parentSuspense, n1, true);
} }
}; };
const processText = (n1, n2, container, anchor) => { const processText = (n1, n2, container, anchor) => {
@ -7133,7 +7179,7 @@ function baseCreateRenderer(options, createHydrationFns) {
(oldVNode.type === Fragment || // - In the case of different nodes, there is going to be a replacement (oldVNode.type === Fragment || // - In the case of different nodes, there is going to be a replacement
// which also requires the correct parent container // which also requires the correct parent container
!isSameVNodeType(oldVNode, newVNode) || // - In the case of a component, it could contain anything. !isSameVNodeType(oldVNode, newVNode) || // - In the case of a component, it could contain anything.
oldVNode.shapeFlag & (6 | 64)) ? hostParentNode(oldVNode.el) : ( oldVNode.shapeFlag & (6 | 64 | 128)) ? hostParentNode(oldVNode.el) : (
// In other cases, the parent container is not actually used so we // In other cases, the parent container is not actually used so we
// just pass the block element here to avoid a DOM parentNode call. // just pass the block element here to avoid a DOM parentNode call.
fallbackContainer fallbackContainer
@ -7295,8 +7341,8 @@ function baseCreateRenderer(options, createHydrationFns) {
endMeasure(instance, `init`); endMeasure(instance, `init`);
} }
} }
if (isHmrUpdating) initialVNode.el = null;
if (instance.asyncDep) { if (instance.asyncDep) {
if (isHmrUpdating) initialVNode.el = null;
parentSuspense && parentSuspense.registerDep(instance, setupRenderEffect, optimized); parentSuspense && parentSuspense.registerDep(instance, setupRenderEffect, optimized);
if (!initialVNode.el) { if (!initialVNode.el) {
const placeholder = instance.subTree = createVNode(Comment); const placeholder = instance.subTree = createVNode(Comment);
@ -7387,7 +7433,8 @@ function baseCreateRenderer(options, createHydrationFns) {
hydrateSubTree(); hydrateSubTree();
} }
} else { } else {
if (root.ce) { if (root.ce && // @ts-expect-error _def is private
root.ce._def.shadowRoot !== false) {
root.ce._injectChildStyle(type); root.ce._injectChildStyle(type);
} }
{ {
@ -7858,7 +7905,13 @@ function baseCreateRenderer(options, createHydrationFns) {
queuePostRenderEffect(() => transition.enter(el), parentSuspense); queuePostRenderEffect(() => transition.enter(el), parentSuspense);
} else { } else {
const { leave, delayLeave, afterLeave } = transition; const { leave, delayLeave, afterLeave } = transition;
const remove2 = () => hostInsert(el, container, anchor); const remove2 = () => {
if (vnode.ctx.isUnmounted) {
hostRemove(el);
} else {
hostInsert(el, container, anchor);
}
};
const performLeave = () => { const performLeave = () => {
leave(el, () => { leave(el, () => {
remove2(); remove2();
@ -7891,7 +7944,9 @@ function baseCreateRenderer(options, createHydrationFns) {
optimized = false; optimized = false;
} }
if (ref != null) { if (ref != null) {
pauseTracking();
setRef(ref, null, parentSuspense, vnode, true); setRef(ref, null, parentSuspense, vnode, true);
resetTracking();
} }
if (cacheIndex != null) { if (cacheIndex != null) {
parentComponent.renderCache[cacheIndex] = void 0; parentComponent.renderCache[cacheIndex] = void 0;
@ -8003,12 +8058,27 @@ function baseCreateRenderer(options, createHydrationFns) {
if (instance.type.__hmrId) { if (instance.type.__hmrId) {
unregisterHMR(instance); unregisterHMR(instance);
} }
const { bum, scope, job, subTree, um, m, a } = instance; const {
bum,
scope,
job,
subTree,
um,
m,
a,
parent,
slots: { __: slotCacheKeys }
} = instance;
invalidateMount(m); invalidateMount(m);
invalidateMount(a); invalidateMount(a);
if (bum) { if (bum) {
invokeArrayFns(bum); invokeArrayFns(bum);
} }
if (parent && isArray(slotCacheKeys)) {
slotCacheKeys.forEach((v) => {
parent.renderCache[v] = void 0;
});
}
scope.stop(); scope.stop();
if (job) { if (job) {
job.flags |= 8; job.flags |= 8;
@ -8104,8 +8174,8 @@ function toggleRecurse({ effect, job }, allowed) {
effect.flags |= 32; effect.flags |= 32;
job.flags |= 4; job.flags |= 4;
} else { } else {
effect.flags &= ~32; effect.flags &= -33;
job.flags &= ~4; job.flags &= -5;
} }
} }
function needTransition(parentSuspense, transition) { function needTransition(parentSuspense, transition) {
@ -8132,6 +8202,9 @@ function traverseStaticChildren(n1, n2, shallow = false) {
if (c2.type === Comment && !c2.el) { if (c2.type === Comment && !c2.el) {
c2.el = c1.el; c2.el = c1.el;
} }
{
c2.el && (c2.el.__vnode = c2);
}
} }
} }
} }
@ -9477,8 +9550,8 @@ function isSameVNodeType(n1, n2) {
if (n2.shapeFlag & 6 && n1.component) { if (n2.shapeFlag & 6 && n1.component) {
const dirtyInstances = hmrDirtyComponents.get(n2.type); const dirtyInstances = hmrDirtyComponents.get(n2.type);
if (dirtyInstances && dirtyInstances.has(n1.component)) { if (dirtyInstances && dirtyInstances.has(n1.component)) {
n1.shapeFlag &= ~256; n1.shapeFlag &= -257;
n2.shapeFlag &= ~512; n2.shapeFlag &= -513;
return false; return false;
} }
} }
@ -9939,7 +10012,7 @@ function setupComponent(instance, isSSR = false, optimized = false) {
const { props, children } = instance.vnode; const { props, children } = instance.vnode;
const isStateful = isStatefulComponent(instance); const isStateful = isStatefulComponent(instance);
initProps(instance, props, isStateful, isSSR); initProps(instance, props, isStateful, isSSR);
initSlots(instance, children, optimized); initSlots(instance, children, optimized || isSSR);
const setupResult = isStateful ? setupStatefulComponent(instance, isSSR) : void 0; const setupResult = isStateful ? setupStatefulComponent(instance, isSSR) : void 0;
isSSR && setInSSRSetupState(false); isSSR && setInSSRSetupState(false);
return setupResult; return setupResult;
@ -10270,13 +10343,15 @@ function initCustomFormatter() {
if (obj.__isVue) { if (obj.__isVue) {
return ["div", vueStyle, `VueInstance`]; return ["div", vueStyle, `VueInstance`];
} else if (isRef(obj)) { } else if (isRef(obj)) {
pauseTracking();
const value = obj.value;
resetTracking();
return [ return [
"div", "div",
{}, {},
["span", vueStyle, genRefFlag(obj)], ["span", vueStyle, genRefFlag(obj)],
"<", "<",
// avoid debugger accessing value affecting behavior formatValue(value),
formatValue("_value" in obj ? obj._value : obj),
`>` `>`
]; ];
} else if (isReactive(obj)) { } else if (isReactive(obj)) {
@ -10457,7 +10532,7 @@ function isMemoSame(cached, memo) {
return true; return true;
} }
const version = "3.5.13"; const version = "3.5.17";
const warn = warn$1 ; const warn = warn$1 ;
const ErrorTypeStrings = ErrorTypeStrings$1 ; const ErrorTypeStrings = ErrorTypeStrings$1 ;
const devtools = devtools$1 ; const devtools = devtools$1 ;
@ -11275,7 +11350,7 @@ function shouldSetAsProp(el, key, value, isSVG) {
} }
return false; return false;
} }
if (key === "spellcheck" || key === "draggable" || key === "translate") { if (key === "spellcheck" || key === "draggable" || key === "translate" || key === "autocorrect") {
return false; return false;
} }
if (key === "form") { if (key === "form") {
@ -11358,13 +11433,10 @@ class VueElement extends BaseClass {
this._root = this; this._root = this;
} }
} }
if (!this._def.__asyncLoader) {
this._resolveProps(this._def);
}
} }
connectedCallback() { connectedCallback() {
if (!this.isConnected) return; if (!this.isConnected) return;
if (!this.shadowRoot) { if (!this.shadowRoot && !this._resolved) {
this._parseSlots(); this._parseSlots();
} }
this._connected = true; this._connected = true;
@ -11377,8 +11449,7 @@ class VueElement extends BaseClass {
} }
if (!this._instance) { if (!this._instance) {
if (this._resolved) { if (this._resolved) {
this._setParent(); this._mount(this._def);
this._update();
} else { } else {
if (parent && parent._pendingResolve) { if (parent && parent._pendingResolve) {
this._pendingResolve = parent._pendingResolve.then(() => { this._pendingResolve = parent._pendingResolve.then(() => {
@ -11394,7 +11465,15 @@ class VueElement extends BaseClass {
_setParent(parent = this._parent) { _setParent(parent = this._parent) {
if (parent) { if (parent) {
this._instance.parent = parent._instance; this._instance.parent = parent._instance;
this._instance.provides = parent._instance.provides; this._inheritParentContext(parent);
}
}
_inheritParentContext(parent = this._parent) {
if (parent && this._app) {
Object.setPrototypeOf(
this._app._context.provides,
parent._instance.provides
);
} }
} }
disconnectedCallback() { disconnectedCallback() {
@ -11444,9 +11523,7 @@ class VueElement extends BaseClass {
} }
} }
this._numberProps = numberProps; this._numberProps = numberProps;
if (isAsync) { this._resolveProps(def);
this._resolveProps(def);
}
if (this.shadowRoot) { if (this.shadowRoot) {
this._applyStyles(styles); this._applyStyles(styles);
} else if (styles) { } else if (styles) {
@ -11458,9 +11535,10 @@ class VueElement extends BaseClass {
}; };
const asyncDef = this._def.__asyncLoader; const asyncDef = this._def.__asyncLoader;
if (asyncDef) { if (asyncDef) {
this._pendingResolve = asyncDef().then( this._pendingResolve = asyncDef().then((def) => {
(def) => resolve(this._def = def, true) def.configureApp = this._def.configureApp;
); resolve(this._def = def, true);
});
} else { } else {
resolve(this._def); resolve(this._def);
} }
@ -11470,6 +11548,7 @@ class VueElement extends BaseClass {
def.name = "VueElement"; def.name = "VueElement";
} }
this._app = this._createApp(def); this._app = this._createApp(def);
this._inheritParentContext();
if (def.configureApp) { if (def.configureApp) {
def.configureApp(this._app); def.configureApp(this._app);
} }
@ -11554,7 +11633,9 @@ class VueElement extends BaseClass {
} }
} }
_update() { _update() {
render(this._createVNode(), this._root); const vnode = this._createVNode();
if (this._app) vnode.appContext = this._app._context;
render(vnode, this._root);
} }
_createVNode() { _createVNode() {
const baseProps = {}; const baseProps = {};
@ -11764,6 +11845,7 @@ const TransitionGroupImpl = /* @__PURE__ */ decorate({
instance.vnode.el, instance.vnode.el,
moveClass moveClass
)) { )) {
prevChildren = [];
return; return;
} }
prevChildren.forEach(callPendingCbs); prevChildren.forEach(callPendingCbs);
@ -11787,6 +11869,7 @@ const TransitionGroupImpl = /* @__PURE__ */ decorate({
}; };
el.addEventListener("transitionend", cb); el.addEventListener("transitionend", cb);
}); });
prevChildren = [];
}); });
return () => { return () => {
const rawProps = toRaw(props); const rawProps = toRaw(props);

File diff suppressed because one or more lines are too long

View File

@ -1,11 +1,11 @@
/** /**
* @vue/runtime-dom v3.5.13 * @vue/runtime-dom v3.5.17
* (c) 2018-present Yuxi (Evan) You and Vue contributors * (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT * @license MIT
**/ **/
import { warn, h, BaseTransition, assertNumber, BaseTransitionPropsValidators, getCurrentInstance, onBeforeUpdate, queuePostFlushCb, onMounted, watch, onUnmounted, Fragment, Static, camelize, callWithAsyncErrorHandling, defineComponent, nextTick, unref, createVNode, useTransitionState, onUpdated, toRaw, getTransitionRawChildren, setTransitionHooks, resolveTransitionHooks, Text, isRuntimeOnly, createRenderer, createHydrationRenderer } from '@vue/runtime-core'; import { warn, BaseTransitionPropsValidators, h, BaseTransition, assertNumber, getCurrentInstance, onBeforeUpdate, queuePostFlushCb, onMounted, watch, onUnmounted, Fragment, Static, camelize, callWithAsyncErrorHandling, defineComponent, nextTick, unref, createVNode, useTransitionState, onUpdated, toRaw, getTransitionRawChildren, setTransitionHooks, resolveTransitionHooks, Text, createRenderer, createHydrationRenderer, isRuntimeOnly } from '@vue/runtime-core';
export * from '@vue/runtime-core'; export * from '@vue/runtime-core';
import { extend, isObject, toNumber, isArray, NOOP, isString, hyphenate, capitalize, includeBooleanAttr, isSymbol, isSpecialBooleanAttr, isFunction, isOn, isModelListener, camelize as camelize$1, isPlainObject, hasOwn, EMPTY_OBJ, looseToNumber, looseIndexOf, isSet, looseEqual, invokeArrayFns, isHTMLTag, isSVGTag, isMathMLTag } from '@vue/shared'; import { extend, isObject, toNumber, isArray, NOOP, isString, hyphenate, capitalize, isSpecialBooleanAttr, includeBooleanAttr, isSymbol, isFunction, isOn, isModelListener, camelize as camelize$1, isPlainObject, hasOwn, EMPTY_OBJ, looseToNumber, looseIndexOf, isSet, looseEqual, invokeArrayFns, isHTMLTag, isSVGTag, isMathMLTag } from '@vue/shared';
let policy = void 0; let policy = void 0;
const tt = typeof window !== "undefined" && window.trustedTypes; const tt = typeof window !== "undefined" && window.trustedTypes;
@ -803,7 +803,7 @@ function shouldSetAsProp(el, key, value, isSVG) {
} }
return false; return false;
} }
if (key === "spellcheck" || key === "draggable" || key === "translate") { if (key === "spellcheck" || key === "draggable" || key === "translate" || key === "autocorrect") {
return false; return false;
} }
if (key === "form") { if (key === "form") {
@ -886,13 +886,10 @@ class VueElement extends BaseClass {
this._root = this; this._root = this;
} }
} }
if (!this._def.__asyncLoader) {
this._resolveProps(this._def);
}
} }
connectedCallback() { connectedCallback() {
if (!this.isConnected) return; if (!this.isConnected) return;
if (!this.shadowRoot) { if (!this.shadowRoot && !this._resolved) {
this._parseSlots(); this._parseSlots();
} }
this._connected = true; this._connected = true;
@ -905,8 +902,7 @@ class VueElement extends BaseClass {
} }
if (!this._instance) { if (!this._instance) {
if (this._resolved) { if (this._resolved) {
this._setParent(); this._mount(this._def);
this._update();
} else { } else {
if (parent && parent._pendingResolve) { if (parent && parent._pendingResolve) {
this._pendingResolve = parent._pendingResolve.then(() => { this._pendingResolve = parent._pendingResolve.then(() => {
@ -922,7 +918,15 @@ class VueElement extends BaseClass {
_setParent(parent = this._parent) { _setParent(parent = this._parent) {
if (parent) { if (parent) {
this._instance.parent = parent._instance; this._instance.parent = parent._instance;
this._instance.provides = parent._instance.provides; this._inheritParentContext(parent);
}
}
_inheritParentContext(parent = this._parent) {
if (parent && this._app) {
Object.setPrototypeOf(
this._app._context.provides,
parent._instance.provides
);
} }
} }
disconnectedCallback() { disconnectedCallback() {
@ -972,9 +976,7 @@ class VueElement extends BaseClass {
} }
} }
this._numberProps = numberProps; this._numberProps = numberProps;
if (isAsync) { this._resolveProps(def);
this._resolveProps(def);
}
if (this.shadowRoot) { if (this.shadowRoot) {
this._applyStyles(styles); this._applyStyles(styles);
} else if (!!(process.env.NODE_ENV !== "production") && styles) { } else if (!!(process.env.NODE_ENV !== "production") && styles) {
@ -986,9 +988,10 @@ class VueElement extends BaseClass {
}; };
const asyncDef = this._def.__asyncLoader; const asyncDef = this._def.__asyncLoader;
if (asyncDef) { if (asyncDef) {
this._pendingResolve = asyncDef().then( this._pendingResolve = asyncDef().then((def) => {
(def) => resolve(this._def = def, true) def.configureApp = this._def.configureApp;
); resolve(this._def = def, true);
});
} else { } else {
resolve(this._def); resolve(this._def);
} }
@ -998,6 +1001,7 @@ class VueElement extends BaseClass {
def.name = "VueElement"; def.name = "VueElement";
} }
this._app = this._createApp(def); this._app = this._createApp(def);
this._inheritParentContext();
if (def.configureApp) { if (def.configureApp) {
def.configureApp(this._app); def.configureApp(this._app);
} }
@ -1082,7 +1086,9 @@ class VueElement extends BaseClass {
} }
} }
_update() { _update() {
render(this._createVNode(), this._root); const vnode = this._createVNode();
if (this._app) vnode.appContext = this._app._context;
render(vnode, this._root);
} }
_createVNode() { _createVNode() {
const baseProps = {}; const baseProps = {};
@ -1292,6 +1298,7 @@ const TransitionGroupImpl = /* @__PURE__ */ decorate({
instance.vnode.el, instance.vnode.el,
moveClass moveClass
)) { )) {
prevChildren = [];
return; return;
} }
prevChildren.forEach(callPendingCbs); prevChildren.forEach(callPendingCbs);
@ -1315,6 +1322,7 @@ const TransitionGroupImpl = /* @__PURE__ */ decorate({
}; };
el.addEventListener("transitionend", cb); el.addEventListener("transitionend", cb);
}); });
prevChildren = [];
}); });
return () => { return () => {
const rawProps = toRaw(props); const rawProps = toRaw(props);

View File

@ -1,5 +1,5 @@
/** /**
* @vue/runtime-dom v3.5.13 * @vue/runtime-dom v3.5.17
* (c) 2018-present Yuxi (Evan) You and Vue contributors * (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT * @license MIT
**/ **/
@ -326,6 +326,10 @@ var VueRuntimeDOM = (function (exports) {
* @internal * @internal
*/ */
this._active = true; this._active = true;
/**
* @internal track `on` calls, allow `on` call multiple times
*/
this._on = 0;
/** /**
* @internal * @internal
*/ */
@ -396,14 +400,20 @@ var VueRuntimeDOM = (function (exports) {
* @internal * @internal
*/ */
on() { on() {
activeEffectScope = this; if (++this._on === 1) {
this.prevScope = activeEffectScope;
activeEffectScope = this;
}
} }
/** /**
* This should only be called on non-detached scopes * This should only be called on non-detached scopes
* @internal * @internal
*/ */
off() { off() {
activeEffectScope = this.parent; if (this._on > 0 && --this._on === 0) {
activeEffectScope = this.prevScope;
this.prevScope = void 0;
}
} }
stop(fromParent) { stop(fromParent) {
if (this._active) { if (this._active) {
@ -485,7 +495,7 @@ var VueRuntimeDOM = (function (exports) {
} }
resume() { resume() {
if (this.flags & 64) { if (this.flags & 64) {
this.flags &= ~64; this.flags &= -65;
if (pausedQueueEffects.has(this)) { if (pausedQueueEffects.has(this)) {
pausedQueueEffects.delete(this); pausedQueueEffects.delete(this);
this.trigger(); this.trigger();
@ -525,7 +535,7 @@ var VueRuntimeDOM = (function (exports) {
cleanupDeps(this); cleanupDeps(this);
activeSub = prevEffect; activeSub = prevEffect;
shouldTrack = prevShouldTrack; shouldTrack = prevShouldTrack;
this.flags &= ~2; this.flags &= -3;
} }
} }
stop() { stop() {
@ -536,7 +546,7 @@ var VueRuntimeDOM = (function (exports) {
this.deps = this.depsTail = void 0; this.deps = this.depsTail = void 0;
cleanupEffect(this); cleanupEffect(this);
this.onStop && this.onStop(); this.onStop && this.onStop();
this.flags &= ~1; this.flags &= -2;
} }
} }
trigger() { trigger() {
@ -586,7 +596,7 @@ var VueRuntimeDOM = (function (exports) {
while (e) { while (e) {
const next = e.next; const next = e.next;
e.next = void 0; e.next = void 0;
e.flags &= ~8; e.flags &= -9;
e = next; e = next;
} }
} }
@ -597,7 +607,7 @@ var VueRuntimeDOM = (function (exports) {
while (e) { while (e) {
const next = e.next; const next = e.next;
e.next = void 0; e.next = void 0;
e.flags &= ~8; e.flags &= -9;
if (e.flags & 1) { if (e.flags & 1) {
try { try {
; ;
@ -653,17 +663,16 @@ var VueRuntimeDOM = (function (exports) {
if (computed.flags & 4 && !(computed.flags & 16)) { if (computed.flags & 4 && !(computed.flags & 16)) {
return; return;
} }
computed.flags &= ~16; computed.flags &= -17;
if (computed.globalVersion === globalVersion) { if (computed.globalVersion === globalVersion) {
return; return;
} }
computed.globalVersion = globalVersion; computed.globalVersion = globalVersion;
const dep = computed.dep; if (!computed.isSSR && computed.flags & 128 && (!computed.deps && !computed._dirty || !isDirty(computed))) {
computed.flags |= 2;
if (dep.version > 0 && !computed.isSSR && computed.deps && !isDirty(computed)) {
computed.flags &= ~2;
return; return;
} }
computed.flags |= 2;
const dep = computed.dep;
const prevSub = activeSub; const prevSub = activeSub;
const prevShouldTrack = shouldTrack; const prevShouldTrack = shouldTrack;
activeSub = computed; activeSub = computed;
@ -672,6 +681,7 @@ var VueRuntimeDOM = (function (exports) {
prepareDeps(computed); prepareDeps(computed);
const value = computed.fn(computed._value); const value = computed.fn(computed._value);
if (dep.version === 0 || hasChanged(value, computed._value)) { if (dep.version === 0 || hasChanged(value, computed._value)) {
computed.flags |= 128;
computed._value = value; computed._value = value;
dep.version++; dep.version++;
} }
@ -682,7 +692,7 @@ var VueRuntimeDOM = (function (exports) {
activeSub = prevSub; activeSub = prevSub;
shouldTrack = prevShouldTrack; shouldTrack = prevShouldTrack;
cleanupDeps(computed); cleanupDeps(computed);
computed.flags &= ~2; computed.flags &= -3;
} }
} }
function removeSub(link, soft = false) { function removeSub(link, soft = false) {
@ -701,7 +711,7 @@ var VueRuntimeDOM = (function (exports) {
if (dep.subs === link) { if (dep.subs === link) {
dep.subs = prevSub; dep.subs = prevSub;
if (!prevSub && dep.computed) { if (!prevSub && dep.computed) {
dep.computed.flags &= ~4; dep.computed.flags &= -5;
for (let l = dep.computed.deps; l; l = l.nextDep) { for (let l = dep.computed.deps; l; l = l.nextDep) {
removeSub(l, true); removeSub(l, true);
} }
@ -777,6 +787,7 @@ var VueRuntimeDOM = (function (exports) {
} }
} }
class Dep { class Dep {
// TODO isolatedDeclarations "__v_skip"
constructor(computed) { constructor(computed) {
this.computed = computed; this.computed = computed;
this.version = 0; this.version = 0;
@ -797,6 +808,10 @@ var VueRuntimeDOM = (function (exports) {
* Subscriber counter * Subscriber counter
*/ */
this.sc = 0; this.sc = 0;
/**
* @internal
*/
this.__v_skip = true;
{ {
this.subsHead = void 0; this.subsHead = void 0;
} }
@ -1634,14 +1649,14 @@ var VueRuntimeDOM = (function (exports) {
if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) { if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) {
return target; return target;
} }
const existingProxy = proxyMap.get(target);
if (existingProxy) {
return existingProxy;
}
const targetType = getTargetType(target); const targetType = getTargetType(target);
if (targetType === 0 /* INVALID */) { if (targetType === 0 /* INVALID */) {
return target; return target;
} }
const existingProxy = proxyMap.get(target);
if (existingProxy) {
return existingProxy;
}
const proxy = new Proxy( const proxy = new Proxy(
target, target,
targetType === 2 /* COLLECTION */ ? collectionHandlers : baseHandlers targetType === 2 /* COLLECTION */ ? collectionHandlers : baseHandlers
@ -2064,11 +2079,11 @@ var VueRuntimeDOM = (function (exports) {
oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue, oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
boundCleanup boundCleanup
]; ];
oldValue = newValue;
call ? call(cb, 3, args) : ( call ? call(cb, 3, args) : (
// @ts-expect-error // @ts-expect-error
cb(...args) cb(...args)
); );
oldValue = newValue;
} finally { } finally {
activeWatcher = currentWatcher; activeWatcher = currentWatcher;
} }
@ -2485,11 +2500,11 @@ var VueRuntimeDOM = (function (exports) {
queue.splice(i, 1); queue.splice(i, 1);
i--; i--;
if (cb.flags & 4) { if (cb.flags & 4) {
cb.flags &= ~1; cb.flags &= -2;
} }
cb(); cb();
if (!(cb.flags & 4)) { if (!(cb.flags & 4)) {
cb.flags &= ~1; cb.flags &= -2;
} }
} }
} }
@ -2514,10 +2529,10 @@ var VueRuntimeDOM = (function (exports) {
continue; continue;
} }
if (cb.flags & 4) { if (cb.flags & 4) {
cb.flags &= ~1; cb.flags &= -2;
} }
if (!(cb.flags & 8)) cb(); if (!(cb.flags & 8)) cb();
cb.flags &= ~1; cb.flags &= -2;
} }
activePostFlushCbs = null; activePostFlushCbs = null;
postFlushIndex = 0; postFlushIndex = 0;
@ -2553,7 +2568,7 @@ var VueRuntimeDOM = (function (exports) {
for (; flushIndex < queue.length; flushIndex++) { for (; flushIndex < queue.length; flushIndex++) {
const job = queue[flushIndex]; const job = queue[flushIndex];
if (job) { if (job) {
job.flags &= ~1; job.flags &= -2;
} }
} }
flushIndex = -1; flushIndex = -1;
@ -2993,15 +3008,16 @@ var VueRuntimeDOM = (function (exports) {
updateCssVars(n2, true); updateCssVars(n2, true);
} }
if (isTeleportDeferred(n2.props)) { if (isTeleportDeferred(n2.props)) {
n2.el.__isMounted = false;
queuePostRenderEffect(() => { queuePostRenderEffect(() => {
mountToTarget(); mountToTarget();
n2.el.__isMounted = true; delete n2.el.__isMounted;
}, parentSuspense); }, parentSuspense);
} else { } else {
mountToTarget(); mountToTarget();
} }
} else { } else {
if (isTeleportDeferred(n2.props) && !n1.el.__isMounted) { if (isTeleportDeferred(n2.props) && n1.el.__isMounted === false) {
queuePostRenderEffect(() => { queuePostRenderEffect(() => {
TeleportImpl.process( TeleportImpl.process(
n1, n1,
@ -3015,7 +3031,6 @@ var VueRuntimeDOM = (function (exports) {
optimized, optimized,
internals internals
); );
delete n1.el.__isMounted;
}, parentSuspense); }, parentSuspense);
return; return;
} }
@ -3042,7 +3057,7 @@ var VueRuntimeDOM = (function (exports) {
namespace, namespace,
slotScopeIds slotScopeIds
); );
traverseStaticChildren(n1, n2, true); traverseStaticChildren(n1, n2, false);
} else if (!optimized) { } else if (!optimized) {
patchChildren( patchChildren(
n1, n1,
@ -4003,6 +4018,8 @@ var VueRuntimeDOM = (function (exports) {
) && parentComponent && parentComponent.vnode.props && parentComponent.vnode.props.appear; ) && parentComponent && parentComponent.vnode.props && parentComponent.vnode.props.appear;
const content = el.content.firstChild; const content = el.content.firstChild;
if (needCallTransitionHooks) { if (needCallTransitionHooks) {
const cls = content.getAttribute("class");
if (cls) content.$cls = cls;
transition.beforeEnter(content); transition.beforeEnter(content);
} }
replaceNode(content, el, parentComponent); replaceNode(content, el, parentComponent);
@ -4255,7 +4272,12 @@ Server rendered element contains fewer child nodes than client vdom.`
let actual; let actual;
let expected; let expected;
if (key === "class") { if (key === "class") {
actual = el.getAttribute("class"); if (el.$cls) {
actual = el.$cls;
delete el.$cls;
} else {
actual = el.getAttribute("class");
}
expected = normalizeClass(clientValue); expected = normalizeClass(clientValue);
if (!isSetEqual(toClassSet(actual || ""), toClassSet(expected))) { if (!isSetEqual(toClassSet(actual || ""), toClassSet(expected))) {
mismatchType = 2 /* CLASS */; mismatchType = 2 /* CLASS */;
@ -4393,7 +4415,7 @@ Server rendered element contains fewer child nodes than client vdom.`
if (allowedType === 0 /* TEXT */ && list.includes("children")) { if (allowedType === 0 /* TEXT */ && list.includes("children")) {
return true; return true;
} }
return allowedAttr.split(",").includes(MismatchTypeString[allowedType]); return list.includes(MismatchTypeString[allowedType]);
} }
} }
@ -4550,14 +4572,25 @@ Server rendered element contains fewer child nodes than client vdom.`
name: "AsyncComponentWrapper", name: "AsyncComponentWrapper",
__asyncLoader: load, __asyncLoader: load,
__asyncHydrate(el, instance, hydrate) { __asyncHydrate(el, instance, hydrate) {
let patched = false;
const doHydrate = hydrateStrategy ? () => { const doHydrate = hydrateStrategy ? () => {
const performHydrate = () => {
if (patched) {
warn$1(
`Skipping lazy hydration for component '${getComponentName(resolvedComp)}': it was updated before lazy hydration performed.`
);
return;
}
hydrate();
};
const teardown = hydrateStrategy( const teardown = hydrateStrategy(
hydrate, performHydrate,
(cb) => forEachElement(el, cb) (cb) => forEachElement(el, cb)
); );
if (teardown) { if (teardown) {
(instance.bum || (instance.bum = [])).push(teardown); (instance.bum || (instance.bum = [])).push(teardown);
} }
(instance.u || (instance.u = [])).push(() => patched = true);
} : hydrate; } : hydrate;
if (resolvedComp) { if (resolvedComp) {
doHydrate(); doHydrate();
@ -4721,6 +4754,9 @@ Server rendered element contains fewer child nodes than client vdom.`
{ {
devtoolsComponentAdded(instance2); devtoolsComponentAdded(instance2);
} }
{
instance2.__keepAliveStorageContainer = storageContainer;
}
}; };
function unmount(vnode) { function unmount(vnode) {
resetShapeFlag(vnode); resetShapeFlag(vnode);
@ -4808,7 +4844,7 @@ Server rendered element contains fewer child nodes than client vdom.`
); );
const { include, exclude, max } = props; const { include, exclude, max } = props;
if (include && (!name || !matches(include, name)) || exclude && name && matches(exclude, name)) { if (include && (!name || !matches(include, name)) || exclude && name && matches(exclude, name)) {
vnode.shapeFlag &= ~256; vnode.shapeFlag &= -257;
current = vnode; current = vnode;
return rawVNode; return rawVNode;
} }
@ -4895,8 +4931,8 @@ Server rendered element contains fewer child nodes than client vdom.`
}, target); }, target);
} }
function resetShapeFlag(vnode) { function resetShapeFlag(vnode) {
vnode.shapeFlag &= ~256; vnode.shapeFlag &= -257;
vnode.shapeFlag &= ~512; vnode.shapeFlag &= -513;
} }
function getInnerChild(vnode) { function getInnerChild(vnode) {
return vnode.shapeFlag & 128 ? vnode.ssContent : vnode; return vnode.shapeFlag & 128 ? vnode.ssContent : vnode;
@ -5011,14 +5047,16 @@ If this is a native custom element, make sure to exclude it from component resol
if (sourceIsArray || isString(source)) { if (sourceIsArray || isString(source)) {
const sourceIsReactiveArray = sourceIsArray && isReactive(source); const sourceIsReactiveArray = sourceIsArray && isReactive(source);
let needsWrap = false; let needsWrap = false;
let isReadonlySource = false;
if (sourceIsReactiveArray) { if (sourceIsReactiveArray) {
needsWrap = !isShallow(source); needsWrap = !isShallow(source);
isReadonlySource = isReadonly(source);
source = shallowReadArray(source); source = shallowReadArray(source);
} }
ret = new Array(source.length); ret = new Array(source.length);
for (let i = 0, l = source.length; i < l; i++) { for (let i = 0, l = source.length; i < l; i++) {
ret[i] = renderItem( ret[i] = renderItem(
needsWrap ? toReactive(source[i]) : source[i], needsWrap ? isReadonlySource ? toReadonly(toReactive(source[i])) : toReactive(source[i]) : source[i],
i, i,
void 0, void 0,
cached && cached[i] cached && cached[i]
@ -6037,11 +6075,9 @@ If this is a native custom element, make sure to exclude it from component resol
} }
{ {
context.reload = () => { context.reload = () => {
render( const cloned = cloneVNode(vnode);
cloneVNode(vnode), cloned.el = null;
rootContainer, render(cloned, rootContainer, namespace);
namespace
);
}; };
} }
if (isHydrate && hydrate) { if (isHydrate && hydrate) {
@ -6091,9 +6127,15 @@ If you want to remount the same app, move your app creation logic into a factory
}, },
provide(key, value) { provide(key, value) {
if (key in context.provides) { if (key in context.provides) {
warn$1( if (hasOwn(context.provides, key)) {
`App already provides property with key "${String(key)}". It will be overwritten with the new value.` warn$1(
); `App already provides property with key "${String(key)}". It will be overwritten with the new value.`
);
} else {
warn$1(
`App already provides property with key "${String(key)}" inherited from its parent element. It will be overwritten with the new value.`
);
}
} }
context.provides[key] = value; context.provides[key] = value;
return app; return app;
@ -6130,7 +6172,7 @@ If you want to remount the same app, move your app creation logic into a factory
function inject(key, defaultValue, treatDefaultAsFactory = false) { function inject(key, defaultValue, treatDefaultAsFactory = false) {
const instance = currentInstance || currentRenderingInstance; const instance = currentInstance || currentRenderingInstance;
if (instance || currentApp) { if (instance || currentApp) {
const provides = currentApp ? currentApp._context.provides : instance ? instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : void 0; let provides = currentApp ? currentApp._context.provides : instance ? instance.parent == null || instance.ce ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : void 0;
if (provides && key in provides) { if (provides && key in provides) {
return provides[key]; return provides[key];
} else if (arguments.length > 1) { } else if (arguments.length > 1) {
@ -6564,7 +6606,7 @@ If you want to remount the same app, move your app creation logic into a factory
return rawSlot; return rawSlot;
} }
const normalized = withCtx((...args) => { const normalized = withCtx((...args) => {
if (currentInstance && (!ctx || ctx.root === currentInstance.root)) { if (currentInstance && !(ctx === null && currentRenderingInstance) && !(ctx && ctx.root !== currentInstance.root)) {
warn$1( warn$1(
`Slot "${key}" invoked outside of the render function: this will not track dependencies used in the slot. Invoke the slot function inside the render function instead.` `Slot "${key}" invoked outside of the render function: this will not track dependencies used in the slot. Invoke the slot function inside the render function instead.`
); );
@ -6603,7 +6645,7 @@ If you want to remount the same app, move your app creation logic into a factory
}; };
const assignSlots = (slots, children, optimized) => { const assignSlots = (slots, children, optimized) => {
for (const key in children) { for (const key in children) {
if (optimized || key !== "_") { if (optimized || !isInternalKey(key)) {
slots[key] = children[key]; slots[key] = children[key];
} }
} }
@ -6611,6 +6653,8 @@ If you want to remount the same app, move your app creation logic into a factory
const initSlots = (instance, children, optimized) => { const initSlots = (instance, children, optimized) => {
const slots = instance.slots = createInternalObject(); const slots = instance.slots = createInternalObject();
if (instance.vnode.shapeFlag & 32) { if (instance.vnode.shapeFlag & 32) {
const cacheIndexes = children.__;
if (cacheIndexes) def(slots, "__", cacheIndexes, true);
const type = children._; const type = children._;
if (type) { if (type) {
assignSlots(slots, children, optimized); assignSlots(slots, children, optimized);
@ -6822,6 +6866,8 @@ If you want to remount the same app, move your app creation logic into a factory
} }
if (ref != null && parentComponent) { if (ref != null && parentComponent) {
setRef(ref, n1 && n1.ref, parentSuspense, n2 || n1, !n2); setRef(ref, n1 && n1.ref, parentSuspense, n2 || n1, !n2);
} else if (ref == null && n1 && n1.ref != null) {
setRef(n1.ref, null, parentSuspense, n1, true);
} }
}; };
const processText = (n1, n2, container, anchor) => { const processText = (n1, n2, container, anchor) => {
@ -7127,7 +7173,7 @@ If you want to remount the same app, move your app creation logic into a factory
(oldVNode.type === Fragment || // - In the case of different nodes, there is going to be a replacement (oldVNode.type === Fragment || // - In the case of different nodes, there is going to be a replacement
// which also requires the correct parent container // which also requires the correct parent container
!isSameVNodeType(oldVNode, newVNode) || // - In the case of a component, it could contain anything. !isSameVNodeType(oldVNode, newVNode) || // - In the case of a component, it could contain anything.
oldVNode.shapeFlag & (6 | 64)) ? hostParentNode(oldVNode.el) : ( oldVNode.shapeFlag & (6 | 64 | 128)) ? hostParentNode(oldVNode.el) : (
// In other cases, the parent container is not actually used so we // In other cases, the parent container is not actually used so we
// just pass the block element here to avoid a DOM parentNode call. // just pass the block element here to avoid a DOM parentNode call.
fallbackContainer fallbackContainer
@ -7289,8 +7335,8 @@ If you want to remount the same app, move your app creation logic into a factory
endMeasure(instance, `init`); endMeasure(instance, `init`);
} }
} }
if (isHmrUpdating) initialVNode.el = null;
if (instance.asyncDep) { if (instance.asyncDep) {
if (isHmrUpdating) initialVNode.el = null;
parentSuspense && parentSuspense.registerDep(instance, setupRenderEffect, optimized); parentSuspense && parentSuspense.registerDep(instance, setupRenderEffect, optimized);
if (!initialVNode.el) { if (!initialVNode.el) {
const placeholder = instance.subTree = createVNode(Comment); const placeholder = instance.subTree = createVNode(Comment);
@ -7381,7 +7427,8 @@ If you want to remount the same app, move your app creation logic into a factory
hydrateSubTree(); hydrateSubTree();
} }
} else { } else {
if (root.ce) { if (root.ce && // @ts-expect-error _def is private
root.ce._def.shadowRoot !== false) {
root.ce._injectChildStyle(type); root.ce._injectChildStyle(type);
} }
{ {
@ -7852,7 +7899,13 @@ If you want to remount the same app, move your app creation logic into a factory
queuePostRenderEffect(() => transition.enter(el), parentSuspense); queuePostRenderEffect(() => transition.enter(el), parentSuspense);
} else { } else {
const { leave, delayLeave, afterLeave } = transition; const { leave, delayLeave, afterLeave } = transition;
const remove2 = () => hostInsert(el, container, anchor); const remove2 = () => {
if (vnode.ctx.isUnmounted) {
hostRemove(el);
} else {
hostInsert(el, container, anchor);
}
};
const performLeave = () => { const performLeave = () => {
leave(el, () => { leave(el, () => {
remove2(); remove2();
@ -7885,7 +7938,9 @@ If you want to remount the same app, move your app creation logic into a factory
optimized = false; optimized = false;
} }
if (ref != null) { if (ref != null) {
pauseTracking();
setRef(ref, null, parentSuspense, vnode, true); setRef(ref, null, parentSuspense, vnode, true);
resetTracking();
} }
if (cacheIndex != null) { if (cacheIndex != null) {
parentComponent.renderCache[cacheIndex] = void 0; parentComponent.renderCache[cacheIndex] = void 0;
@ -7997,12 +8052,27 @@ If you want to remount the same app, move your app creation logic into a factory
if (instance.type.__hmrId) { if (instance.type.__hmrId) {
unregisterHMR(instance); unregisterHMR(instance);
} }
const { bum, scope, job, subTree, um, m, a } = instance; const {
bum,
scope,
job,
subTree,
um,
m,
a,
parent,
slots: { __: slotCacheKeys }
} = instance;
invalidateMount(m); invalidateMount(m);
invalidateMount(a); invalidateMount(a);
if (bum) { if (bum) {
invokeArrayFns(bum); invokeArrayFns(bum);
} }
if (parent && isArray(slotCacheKeys)) {
slotCacheKeys.forEach((v) => {
parent.renderCache[v] = void 0;
});
}
scope.stop(); scope.stop();
if (job) { if (job) {
job.flags |= 8; job.flags |= 8;
@ -8098,8 +8168,8 @@ If you want to remount the same app, move your app creation logic into a factory
effect.flags |= 32; effect.flags |= 32;
job.flags |= 4; job.flags |= 4;
} else { } else {
effect.flags &= ~32; effect.flags &= -33;
job.flags &= ~4; job.flags &= -5;
} }
} }
function needTransition(parentSuspense, transition) { function needTransition(parentSuspense, transition) {
@ -8126,6 +8196,9 @@ If you want to remount the same app, move your app creation logic into a factory
if (c2.type === Comment && !c2.el) { if (c2.type === Comment && !c2.el) {
c2.el = c1.el; c2.el = c1.el;
} }
{
c2.el && (c2.el.__vnode = c2);
}
} }
} }
} }
@ -9443,8 +9516,8 @@ If you want to remount the same app, move your app creation logic into a factory
if (n2.shapeFlag & 6 && n1.component) { if (n2.shapeFlag & 6 && n1.component) {
const dirtyInstances = hmrDirtyComponents.get(n2.type); const dirtyInstances = hmrDirtyComponents.get(n2.type);
if (dirtyInstances && dirtyInstances.has(n1.component)) { if (dirtyInstances && dirtyInstances.has(n1.component)) {
n1.shapeFlag &= ~256; n1.shapeFlag &= -257;
n2.shapeFlag &= ~512; n2.shapeFlag &= -513;
return false; return false;
} }
} }
@ -9893,7 +9966,7 @@ Component that was made reactive: `,
const { props, children } = instance.vnode; const { props, children } = instance.vnode;
const isStateful = isStatefulComponent(instance); const isStateful = isStatefulComponent(instance);
initProps(instance, props, isStateful, isSSR); initProps(instance, props, isStateful, isSSR);
initSlots(instance, children, optimized); initSlots(instance, children, optimized || isSSR);
const setupResult = isStateful ? setupStatefulComponent(instance, isSSR) : void 0; const setupResult = isStateful ? setupStatefulComponent(instance, isSSR) : void 0;
isSSR && setInSSRSetupState(false); isSSR && setInSSRSetupState(false);
return setupResult; return setupResult;
@ -10222,13 +10295,15 @@ Component that was made reactive: `,
if (obj.__isVue) { if (obj.__isVue) {
return ["div", vueStyle, `VueInstance`]; return ["div", vueStyle, `VueInstance`];
} else if (isRef(obj)) { } else if (isRef(obj)) {
pauseTracking();
const value = obj.value;
resetTracking();
return [ return [
"div", "div",
{}, {},
["span", vueStyle, genRefFlag(obj)], ["span", vueStyle, genRefFlag(obj)],
"<", "<",
// avoid debugger accessing value affecting behavior formatValue(value),
formatValue("_value" in obj ? obj._value : obj),
`>` `>`
]; ];
} else if (isReactive(obj)) { } else if (isReactive(obj)) {
@ -10409,7 +10484,7 @@ Component that was made reactive: `,
return true; return true;
} }
const version = "3.5.13"; const version = "3.5.17";
const warn = warn$1 ; const warn = warn$1 ;
const ErrorTypeStrings = ErrorTypeStrings$1 ; const ErrorTypeStrings = ErrorTypeStrings$1 ;
const devtools = devtools$1 ; const devtools = devtools$1 ;
@ -11208,7 +11283,7 @@ Expected function or array of functions, received type ${typeof value}.`
} }
return false; return false;
} }
if (key === "spellcheck" || key === "draggable" || key === "translate") { if (key === "spellcheck" || key === "draggable" || key === "translate" || key === "autocorrect") {
return false; return false;
} }
if (key === "form") { if (key === "form") {
@ -11291,13 +11366,10 @@ Expected function or array of functions, received type ${typeof value}.`
this._root = this; this._root = this;
} }
} }
if (!this._def.__asyncLoader) {
this._resolveProps(this._def);
}
} }
connectedCallback() { connectedCallback() {
if (!this.isConnected) return; if (!this.isConnected) return;
if (!this.shadowRoot) { if (!this.shadowRoot && !this._resolved) {
this._parseSlots(); this._parseSlots();
} }
this._connected = true; this._connected = true;
@ -11310,8 +11382,7 @@ Expected function or array of functions, received type ${typeof value}.`
} }
if (!this._instance) { if (!this._instance) {
if (this._resolved) { if (this._resolved) {
this._setParent(); this._mount(this._def);
this._update();
} else { } else {
if (parent && parent._pendingResolve) { if (parent && parent._pendingResolve) {
this._pendingResolve = parent._pendingResolve.then(() => { this._pendingResolve = parent._pendingResolve.then(() => {
@ -11327,7 +11398,15 @@ Expected function or array of functions, received type ${typeof value}.`
_setParent(parent = this._parent) { _setParent(parent = this._parent) {
if (parent) { if (parent) {
this._instance.parent = parent._instance; this._instance.parent = parent._instance;
this._instance.provides = parent._instance.provides; this._inheritParentContext(parent);
}
}
_inheritParentContext(parent = this._parent) {
if (parent && this._app) {
Object.setPrototypeOf(
this._app._context.provides,
parent._instance.provides
);
} }
} }
disconnectedCallback() { disconnectedCallback() {
@ -11377,9 +11456,7 @@ Expected function or array of functions, received type ${typeof value}.`
} }
} }
this._numberProps = numberProps; this._numberProps = numberProps;
if (isAsync) { this._resolveProps(def);
this._resolveProps(def);
}
if (this.shadowRoot) { if (this.shadowRoot) {
this._applyStyles(styles); this._applyStyles(styles);
} else if (styles) { } else if (styles) {
@ -11391,9 +11468,10 @@ Expected function or array of functions, received type ${typeof value}.`
}; };
const asyncDef = this._def.__asyncLoader; const asyncDef = this._def.__asyncLoader;
if (asyncDef) { if (asyncDef) {
this._pendingResolve = asyncDef().then( this._pendingResolve = asyncDef().then((def) => {
(def) => resolve(this._def = def, true) def.configureApp = this._def.configureApp;
); resolve(this._def = def, true);
});
} else { } else {
resolve(this._def); resolve(this._def);
} }
@ -11403,6 +11481,7 @@ Expected function or array of functions, received type ${typeof value}.`
def.name = "VueElement"; def.name = "VueElement";
} }
this._app = this._createApp(def); this._app = this._createApp(def);
this._inheritParentContext();
if (def.configureApp) { if (def.configureApp) {
def.configureApp(this._app); def.configureApp(this._app);
} }
@ -11487,7 +11566,9 @@ Expected function or array of functions, received type ${typeof value}.`
} }
} }
_update() { _update() {
render(this._createVNode(), this._root); const vnode = this._createVNode();
if (this._app) vnode.appContext = this._app._context;
render(vnode, this._root);
} }
_createVNode() { _createVNode() {
const baseProps = {}; const baseProps = {};
@ -11685,6 +11766,7 @@ Expected function or array of functions, received type ${typeof value}.`
instance.vnode.el, instance.vnode.el,
moveClass moveClass
)) { )) {
prevChildren = [];
return; return;
} }
prevChildren.forEach(callPendingCbs); prevChildren.forEach(callPendingCbs);
@ -11708,6 +11790,7 @@ Expected function or array of functions, received type ${typeof value}.`
}; };
el.addEventListener("transitionend", cb); el.addEventListener("transitionend", cb);
}); });
prevChildren = [];
}); });
return () => { return () => {
const rawProps = toRaw(props); const rawProps = toRaw(props);

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
{ {
"name": "@vue/runtime-dom", "name": "@vue/runtime-dom",
"version": "3.5.13", "version": "3.5.17",
"description": "@vue/runtime-dom", "description": "@vue/runtime-dom",
"main": "index.js", "main": "index.js",
"module": "dist/runtime-dom.esm-bundler.js", "module": "dist/runtime-dom.esm-bundler.js",
@ -50,9 +50,9 @@
"homepage": "https://github.com/vuejs/core/tree/main/packages/runtime-dom#readme", "homepage": "https://github.com/vuejs/core/tree/main/packages/runtime-dom#readme",
"dependencies": { "dependencies": {
"csstype": "^3.1.3", "csstype": "^3.1.3",
"@vue/shared": "3.5.13", "@vue/reactivity": "3.5.17",
"@vue/runtime-core": "3.5.13", "@vue/shared": "3.5.17",
"@vue/reactivity": "3.5.13" "@vue/runtime-core": "3.5.17"
}, },
"devDependencies": { "devDependencies": {
"@types/trusted-types": "^2.0.7" "@types/trusted-types": "^2.0.7"

View File

@ -1,5 +1,5 @@
/** /**
* @vue/server-renderer v3.5.13 * @vue/server-renderer v3.5.17
* (c) 2018-present Yuxi (Evan) You and Vue contributors * (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT * @license MIT
**/ **/

View File

@ -1,5 +1,5 @@
/** /**
* @vue/server-renderer v3.5.13 * @vue/server-renderer v3.5.17
* (c) 2018-present Yuxi (Evan) You and Vue contributors * (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT * @license MIT
**/ **/

View File

@ -1,5 +1,5 @@
/** /**
* @vue/server-renderer v3.5.13 * @vue/server-renderer v3.5.17
* (c) 2018-present Yuxi (Evan) You and Vue contributors * (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT * @license MIT
**/ **/
@ -354,6 +354,10 @@ class EffectScope {
* @internal * @internal
*/ */
this._active = true; this._active = true;
/**
* @internal track `on` calls, allow `on` call multiple times
*/
this._on = 0;
/** /**
* @internal * @internal
*/ */
@ -424,14 +428,20 @@ class EffectScope {
* @internal * @internal
*/ */
on() { on() {
activeEffectScope = this; if (++this._on === 1) {
this.prevScope = activeEffectScope;
activeEffectScope = this;
}
} }
/** /**
* This should only be called on non-detached scopes * This should only be called on non-detached scopes
* @internal * @internal
*/ */
off() { off() {
activeEffectScope = this.parent; if (this._on > 0 && --this._on === 0) {
activeEffectScope = this.prevScope;
this.prevScope = void 0;
}
} }
stop(fromParent) { stop(fromParent) {
if (this._active) { if (this._active) {
@ -501,7 +511,7 @@ class ReactiveEffect {
} }
resume() { resume() {
if (this.flags & 64) { if (this.flags & 64) {
this.flags &= ~64; this.flags &= -65;
if (pausedQueueEffects.has(this)) { if (pausedQueueEffects.has(this)) {
pausedQueueEffects.delete(this); pausedQueueEffects.delete(this);
this.trigger(); this.trigger();
@ -541,7 +551,7 @@ class ReactiveEffect {
cleanupDeps(this); cleanupDeps(this);
activeSub = prevEffect; activeSub = prevEffect;
shouldTrack = prevShouldTrack; shouldTrack = prevShouldTrack;
this.flags &= ~2; this.flags &= -3;
} }
} }
stop() { stop() {
@ -552,7 +562,7 @@ class ReactiveEffect {
this.deps = this.depsTail = void 0; this.deps = this.depsTail = void 0;
cleanupEffect(this); cleanupEffect(this);
this.onStop && this.onStop(); this.onStop && this.onStop();
this.flags &= ~1; this.flags &= -2;
} }
} }
trigger() { trigger() {
@ -602,7 +612,7 @@ function endBatch() {
while (e) { while (e) {
const next = e.next; const next = e.next;
e.next = void 0; e.next = void 0;
e.flags &= ~8; e.flags &= -9;
e = next; e = next;
} }
} }
@ -613,7 +623,7 @@ function endBatch() {
while (e) { while (e) {
const next = e.next; const next = e.next;
e.next = void 0; e.next = void 0;
e.flags &= ~8; e.flags &= -9;
if (e.flags & 1) { if (e.flags & 1) {
try { try {
; ;
@ -669,17 +679,16 @@ function refreshComputed(computed) {
if (computed.flags & 4 && !(computed.flags & 16)) { if (computed.flags & 4 && !(computed.flags & 16)) {
return; return;
} }
computed.flags &= ~16; computed.flags &= -17;
if (computed.globalVersion === globalVersion) { if (computed.globalVersion === globalVersion) {
return; return;
} }
computed.globalVersion = globalVersion; computed.globalVersion = globalVersion;
const dep = computed.dep; if (!computed.isSSR && computed.flags & 128 && (!computed.deps && !computed._dirty || !isDirty(computed))) {
computed.flags |= 2;
if (dep.version > 0 && !computed.isSSR && computed.deps && !isDirty(computed)) {
computed.flags &= ~2;
return; return;
} }
computed.flags |= 2;
const dep = computed.dep;
const prevSub = activeSub; const prevSub = activeSub;
const prevShouldTrack = shouldTrack; const prevShouldTrack = shouldTrack;
activeSub = computed; activeSub = computed;
@ -688,6 +697,7 @@ function refreshComputed(computed) {
prepareDeps(computed); prepareDeps(computed);
const value = computed.fn(computed._value); const value = computed.fn(computed._value);
if (dep.version === 0 || hasChanged(value, computed._value)) { if (dep.version === 0 || hasChanged(value, computed._value)) {
computed.flags |= 128;
computed._value = value; computed._value = value;
dep.version++; dep.version++;
} }
@ -698,7 +708,7 @@ function refreshComputed(computed) {
activeSub = prevSub; activeSub = prevSub;
shouldTrack = prevShouldTrack; shouldTrack = prevShouldTrack;
cleanupDeps(computed); cleanupDeps(computed);
computed.flags &= ~2; computed.flags &= -3;
} }
} }
function removeSub(link, soft = false) { function removeSub(link, soft = false) {
@ -717,7 +727,7 @@ function removeSub(link, soft = false) {
if (dep.subs === link) { if (dep.subs === link) {
dep.subs = prevSub; dep.subs = prevSub;
if (!prevSub && dep.computed) { if (!prevSub && dep.computed) {
dep.computed.flags &= ~4; dep.computed.flags &= -5;
for (let l = dep.computed.deps; l; l = l.nextDep) { for (let l = dep.computed.deps; l; l = l.nextDep) {
removeSub(l, true); removeSub(l, true);
} }
@ -772,6 +782,7 @@ class Link {
} }
} }
class Dep { class Dep {
// TODO isolatedDeclarations "__v_skip"
constructor(computed) { constructor(computed) {
this.computed = computed; this.computed = computed;
this.version = 0; this.version = 0;
@ -792,6 +803,10 @@ class Dep {
* Subscriber counter * Subscriber counter
*/ */
this.sc = 0; this.sc = 0;
/**
* @internal
*/
this.__v_skip = true;
{ {
this.subsHead = void 0; this.subsHead = void 0;
} }
@ -1625,14 +1640,14 @@ function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandl
if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) { if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) {
return target; return target;
} }
const existingProxy = proxyMap.get(target);
if (existingProxy) {
return existingProxy;
}
const targetType = getTargetType(target); const targetType = getTargetType(target);
if (targetType === 0 /* INVALID */) { if (targetType === 0 /* INVALID */) {
return target; return target;
} }
const existingProxy = proxyMap.get(target);
if (existingProxy) {
return existingProxy;
}
const proxy = new Proxy( const proxy = new Proxy(
target, target,
targetType === 2 /* COLLECTION */ ? collectionHandlers : baseHandlers targetType === 2 /* COLLECTION */ ? collectionHandlers : baseHandlers
@ -1897,11 +1912,11 @@ function watch$1(source, cb, options = EMPTY_OBJ) {
oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue, oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
boundCleanup boundCleanup
]; ];
oldValue = newValue;
call ? call(cb, 3, args) : ( call ? call(cb, 3, args) : (
// @ts-expect-error // @ts-expect-error
cb(...args) cb(...args)
); );
oldValue = newValue;
} finally { } finally {
activeWatcher = currentWatcher; activeWatcher = currentWatcher;
} }
@ -2279,11 +2294,11 @@ function flushPreFlushCbs(instance, seen, i = flushIndex + 1) {
queue.splice(i, 1); queue.splice(i, 1);
i--; i--;
if (cb.flags & 4) { if (cb.flags & 4) {
cb.flags &= ~1; cb.flags &= -2;
} }
cb(); cb();
if (!(cb.flags & 4)) { if (!(cb.flags & 4)) {
cb.flags &= ~1; cb.flags &= -2;
} }
} }
} }
@ -2308,10 +2323,10 @@ function flushPostFlushCbs(seen) {
continue; continue;
} }
if (cb.flags & 4) { if (cb.flags & 4) {
cb.flags &= ~1; cb.flags &= -2;
} }
if (!(cb.flags & 8)) cb(); if (!(cb.flags & 8)) cb();
cb.flags &= ~1; cb.flags &= -2;
} }
activePostFlushCbs = null; activePostFlushCbs = null;
postFlushIndex = 0; postFlushIndex = 0;
@ -2347,7 +2362,7 @@ function flushJobs(seen) {
for (; flushIndex < queue.length; flushIndex++) { for (; flushIndex < queue.length; flushIndex++) {
const job = queue[flushIndex]; const job = queue[flushIndex];
if (job) { if (job) {
job.flags &= ~1; job.flags &= -2;
} }
} }
flushIndex = -1; flushIndex = -1;
@ -3658,16 +3673,12 @@ function createAppAPI(render, hydrate) {
} }
{ {
context.reload = () => { context.reload = () => {
render( const cloned = cloneVNode(vnode);
cloneVNode(vnode), cloned.el = null;
rootContainer, render(cloned, rootContainer, namespace);
namespace
);
}; };
} }
if (isHydrate && hydrate) { {
hydrate(vnode, rootContainer);
} else {
render(vnode, rootContainer, namespace); render(vnode, rootContainer, namespace);
} }
isMounted = true; isMounted = true;
@ -3712,9 +3723,15 @@ If you want to remount the same app, move your app creation logic into a factory
}, },
provide(key, value) { provide(key, value) {
if (key in context.provides) { if (key in context.provides) {
warn$1( if (hasOwn(context.provides, key)) {
`App already provides property with key "${String(key)}". It will be overwritten with the new value.` warn$1(
); `App already provides property with key "${String(key)}". It will be overwritten with the new value.`
);
} else {
warn$1(
`App already provides property with key "${String(key)}" inherited from its parent element. It will be overwritten with the new value.`
);
}
} }
context.provides[key] = value; context.provides[key] = value;
return app; return app;
@ -3751,7 +3768,7 @@ function provide(key, value) {
function inject(key, defaultValue, treatDefaultAsFactory = false) { function inject(key, defaultValue, treatDefaultAsFactory = false) {
const instance = currentInstance || currentRenderingInstance; const instance = currentInstance || currentRenderingInstance;
if (instance || currentApp) { if (instance || currentApp) {
const provides = currentApp ? currentApp._context.provides : instance ? instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : void 0; let provides = currentApp ? currentApp._context.provides : instance ? instance.parent == null || instance.ce ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : void 0;
if (provides && key in provides) { if (provides && key in provides) {
return provides[key]; return provides[key];
} else if (arguments.length > 1) { } else if (arguments.length > 1) {
@ -4182,7 +4199,7 @@ const normalizeSlot = (key, rawSlot, ctx) => {
return rawSlot; return rawSlot;
} }
const normalized = withCtx((...args) => { const normalized = withCtx((...args) => {
if (currentInstance && (!ctx || ctx.root === currentInstance.root)) { if (currentInstance && !(ctx === null && currentRenderingInstance) && !(ctx && ctx.root !== currentInstance.root)) {
warn$1( warn$1(
`Slot "${key}" invoked outside of the render function: this will not track dependencies used in the slot. Invoke the slot function inside the render function instead.` `Slot "${key}" invoked outside of the render function: this will not track dependencies used in the slot. Invoke the slot function inside the render function instead.`
); );
@ -4221,7 +4238,7 @@ const normalizeVNodeSlots = (instance, children) => {
}; };
const assignSlots = (slots, children, optimized) => { const assignSlots = (slots, children, optimized) => {
for (const key in children) { for (const key in children) {
if (optimized || key !== "_") { if (optimized || !isInternalKey(key)) {
slots[key] = children[key]; slots[key] = children[key];
} }
} }
@ -4229,6 +4246,8 @@ const assignSlots = (slots, children, optimized) => {
const initSlots = (instance, children, optimized) => { const initSlots = (instance, children, optimized) => {
const slots = instance.slots = createInternalObject(); const slots = instance.slots = createInternalObject();
if (instance.vnode.shapeFlag & 32) { if (instance.vnode.shapeFlag & 32) {
const cacheIndexes = children.__;
if (cacheIndexes) def(slots, "__", cacheIndexes, true);
const type = children._; const type = children._;
if (type) { if (type) {
assignSlots(slots, children, optimized); assignSlots(slots, children, optimized);
@ -4437,6 +4456,8 @@ function baseCreateRenderer(options, createHydrationFns) {
} }
if (ref != null && parentComponent) { if (ref != null && parentComponent) {
setRef(ref, n1 && n1.ref, parentSuspense, n2 || n1, !n2); setRef(ref, n1 && n1.ref, parentSuspense, n2 || n1, !n2);
} else if (ref == null && n1 && n1.ref != null) {
setRef(n1.ref, null, parentSuspense, n1, true);
} }
}; };
const processText = (n1, n2, container, anchor) => { const processText = (n1, n2, container, anchor) => {
@ -4742,7 +4763,7 @@ function baseCreateRenderer(options, createHydrationFns) {
(oldVNode.type === Fragment || // - In the case of different nodes, there is going to be a replacement (oldVNode.type === Fragment || // - In the case of different nodes, there is going to be a replacement
// which also requires the correct parent container // which also requires the correct parent container
!isSameVNodeType(oldVNode, newVNode) || // - In the case of a component, it could contain anything. !isSameVNodeType(oldVNode, newVNode) || // - In the case of a component, it could contain anything.
oldVNode.shapeFlag & (6 | 64)) ? hostParentNode(oldVNode.el) : ( oldVNode.shapeFlag & (6 | 64 | 128)) ? hostParentNode(oldVNode.el) : (
// In other cases, the parent container is not actually used so we // In other cases, the parent container is not actually used so we
// just pass the block element here to avoid a DOM parentNode call. // just pass the block element here to avoid a DOM parentNode call.
fallbackContainer fallbackContainer
@ -4904,8 +4925,8 @@ function baseCreateRenderer(options, createHydrationFns) {
endMeasure(instance, `init`); endMeasure(instance, `init`);
} }
} }
if (isHmrUpdating) initialVNode.el = null;
if (instance.asyncDep) { if (instance.asyncDep) {
if (isHmrUpdating) initialVNode.el = null;
parentSuspense && parentSuspense.registerDep(instance, setupRenderEffect, optimized); parentSuspense && parentSuspense.registerDep(instance, setupRenderEffect, optimized);
if (!initialVNode.el) { if (!initialVNode.el) {
const placeholder = instance.subTree = createVNode(Comment); const placeholder = instance.subTree = createVNode(Comment);
@ -4963,40 +4984,9 @@ function baseCreateRenderer(options, createHydrationFns) {
invokeVNodeHook(vnodeHook, parent, initialVNode); invokeVNodeHook(vnodeHook, parent, initialVNode);
} }
toggleRecurse(instance, true); toggleRecurse(instance, true);
if (el && hydrateNode) { {
const hydrateSubTree = () => { if (root.ce && // @ts-expect-error _def is private
{ root.ce._def.shadowRoot !== false) {
startMeasure(instance, `render`);
}
instance.subTree = renderComponentRoot$1(instance);
{
endMeasure(instance, `render`);
}
{
startMeasure(instance, `hydrate`);
}
hydrateNode(
el,
instance.subTree,
instance,
parentSuspense,
null
);
{
endMeasure(instance, `hydrate`);
}
};
if (isAsyncWrapperVNode && type.__asyncHydrate) {
type.__asyncHydrate(
el,
instance,
hydrateSubTree
);
} else {
hydrateSubTree();
}
} else {
if (root.ce) {
root.ce._injectChildStyle(type); root.ce._injectChildStyle(type);
} }
{ {
@ -5467,7 +5457,13 @@ function baseCreateRenderer(options, createHydrationFns) {
queuePostRenderEffect(() => transition.enter(el), parentSuspense); queuePostRenderEffect(() => transition.enter(el), parentSuspense);
} else { } else {
const { leave, delayLeave, afterLeave } = transition; const { leave, delayLeave, afterLeave } = transition;
const remove2 = () => hostInsert(el, container, anchor); const remove2 = () => {
if (vnode.ctx.isUnmounted) {
hostRemove(el);
} else {
hostInsert(el, container, anchor);
}
};
const performLeave = () => { const performLeave = () => {
leave(el, () => { leave(el, () => {
remove2(); remove2();
@ -5500,7 +5496,9 @@ function baseCreateRenderer(options, createHydrationFns) {
optimized = false; optimized = false;
} }
if (ref != null) { if (ref != null) {
pauseTracking();
setRef(ref, null, parentSuspense, vnode, true); setRef(ref, null, parentSuspense, vnode, true);
resetTracking();
} }
if (cacheIndex != null) { if (cacheIndex != null) {
parentComponent.renderCache[cacheIndex] = void 0; parentComponent.renderCache[cacheIndex] = void 0;
@ -5612,12 +5610,27 @@ function baseCreateRenderer(options, createHydrationFns) {
if (instance.type.__hmrId) { if (instance.type.__hmrId) {
unregisterHMR(instance); unregisterHMR(instance);
} }
const { bum, scope, job, subTree, um, m, a } = instance; const {
bum,
scope,
job,
subTree,
um,
m,
a,
parent,
slots: { __: slotCacheKeys }
} = instance;
invalidateMount(m); invalidateMount(m);
invalidateMount(a); invalidateMount(a);
if (bum) { if (bum) {
invokeArrayFns(bum); invokeArrayFns(bum);
} }
if (parent && isArray(slotCacheKeys)) {
slotCacheKeys.forEach((v) => {
parent.renderCache[v] = void 0;
});
}
scope.stop(); scope.stop();
if (job) { if (job) {
job.flags |= 8; job.flags |= 8;
@ -5693,11 +5706,10 @@ function baseCreateRenderer(options, createHydrationFns) {
o: options o: options
}; };
let hydrate; let hydrate;
let hydrateNode;
return { return {
render, render,
hydrate, hydrate,
createApp: createAppAPI(render, hydrate) createApp: createAppAPI(render)
}; };
} }
function resolveChildrenNamespace({ type, props }, currentNamespace) { function resolveChildrenNamespace({ type, props }, currentNamespace) {
@ -5708,8 +5720,8 @@ function toggleRecurse({ effect, job }, allowed) {
effect.flags |= 32; effect.flags |= 32;
job.flags |= 4; job.flags |= 4;
} else { } else {
effect.flags &= ~32; effect.flags &= -33;
job.flags &= ~4; job.flags &= -5;
} }
} }
function needTransition(parentSuspense, transition) { function needTransition(parentSuspense, transition) {
@ -5736,6 +5748,9 @@ function traverseStaticChildren(n1, n2, shallow = false) {
if (c2.type === Comment && !c2.el) { if (c2.type === Comment && !c2.el) {
c2.el = c1.el; c2.el = c1.el;
} }
{
c2.el && (c2.el.__vnode = c2);
}
} }
} }
} }
@ -6379,8 +6394,8 @@ function isSameVNodeType(n1, n2) {
if (n2.shapeFlag & 6 && n1.component) { if (n2.shapeFlag & 6 && n1.component) {
const dirtyInstances = hmrDirtyComponents.get(n2.type); const dirtyInstances = hmrDirtyComponents.get(n2.type);
if (dirtyInstances && dirtyInstances.has(n1.component)) { if (dirtyInstances && dirtyInstances.has(n1.component)) {
n1.shapeFlag &= ~256; n1.shapeFlag &= -257;
n2.shapeFlag &= ~512; n2.shapeFlag &= -513;
return false; return false;
} }
} }
@ -6829,7 +6844,7 @@ function setupComponent$1(instance, isSSR = false, optimized = false) {
const { props, children } = instance.vnode; const { props, children } = instance.vnode;
const isStateful = isStatefulComponent(instance); const isStateful = isStatefulComponent(instance);
initProps(instance, props, isStateful, isSSR); initProps(instance, props, isStateful, isSSR);
initSlots(instance, children, optimized); initSlots(instance, children, optimized || isSSR);
const setupResult = isStateful ? setupStatefulComponent(instance, isSSR) : void 0; const setupResult = isStateful ? setupStatefulComponent(instance, isSSR) : void 0;
isSSR && setInSSRSetupState(false); isSSR && setInSSRSetupState(false);
return setupResult; return setupResult;
@ -6935,35 +6950,10 @@ function handleSetupResult(instance, setupResult, isSSR) {
} }
finishComponentSetup(instance, isSSR); finishComponentSetup(instance, isSSR);
} }
let compile; const isRuntimeOnly = () => true;
const isRuntimeOnly = () => !compile;
function finishComponentSetup(instance, isSSR, skipOptions) { function finishComponentSetup(instance, isSSR, skipOptions) {
const Component = instance.type; const Component = instance.type;
if (!instance.render) { if (!instance.render) {
if (!isSSR && compile && !Component.render) {
const template = Component.template || resolveMergedOptions(instance).template;
if (template) {
{
startMeasure(instance, `compile`);
}
const { isCustomElement, compilerOptions } = instance.appContext.config;
const { delimiters, compilerOptions: componentCompilerOptions } = Component;
const finalCompilerOptions = extend(
extend(
{
isCustomElement,
delimiters
},
compilerOptions
),
componentCompilerOptions
);
Component.render = compile(template, finalCompilerOptions);
{
endMeasure(instance, `compile`);
}
}
}
instance.render = Component.render || NOOP; instance.render = Component.render || NOOP;
} }
{ {
@ -7110,7 +7100,7 @@ const computed = (getterOrOptions, debugOptions) => {
return c; return c;
}; };
const version = "3.5.13"; const version = "3.5.17";
const warn = warn$1 ; const warn = warn$1 ;
const _ssrUtils = { const _ssrUtils = {
createComponentInstance: createComponentInstance$1, createComponentInstance: createComponentInstance$1,
@ -7526,7 +7516,7 @@ function shouldSetAsProp(el, key, value, isSVG) {
} }
return false; return false;
} }
if (key === "spellcheck" || key === "draggable" || key === "translate") { if (key === "spellcheck" || key === "draggable" || key === "translate" || key === "autocorrect") {
return false; return false;
} }
if (key === "form") { if (key === "form") {
@ -7550,147 +7540,12 @@ function shouldSetAsProp(el, key, value, isSVG) {
return key in el; return key in el;
} }
const getModelAssigner = (vnode) => {
const fn = vnode.props["onUpdate:modelValue"] || false;
return isArray(fn) ? (value) => invokeArrayFns(fn, value) : fn;
};
function onCompositionStart(e) {
e.target.composing = true;
}
function onCompositionEnd(e) {
const target = e.target;
if (target.composing) {
target.composing = false;
target.dispatchEvent(new Event("input"));
}
}
const assignKey = Symbol("_assign");
const vModelText = { const vModelText = {
created(el, { modifiers: { lazy, trim, number } }, vnode) { };
el[assignKey] = getModelAssigner(vnode);
const castToNumber = number || vnode.props && vnode.props.type === "number";
addEventListener(el, lazy ? "change" : "input", (e) => {
if (e.target.composing) return;
let domValue = el.value;
if (trim) {
domValue = domValue.trim();
}
if (castToNumber) {
domValue = looseToNumber(domValue);
}
el[assignKey](domValue);
});
if (trim) {
addEventListener(el, "change", () => {
el.value = el.value.trim();
});
}
if (!lazy) {
addEventListener(el, "compositionstart", onCompositionStart);
addEventListener(el, "compositionend", onCompositionEnd);
addEventListener(el, "change", onCompositionEnd);
}
},
// set value on mounted so it's after min/max for type="range"
mounted(el, { value }) {
el.value = value == null ? "" : value;
},
beforeUpdate(el, { value, oldValue, modifiers: { lazy, trim, number } }, vnode) {
el[assignKey] = getModelAssigner(vnode);
if (el.composing) return;
const elValue = (number || el.type === "number") && !/^0\d/.test(el.value) ? looseToNumber(el.value) : el.value;
const newValue = value == null ? "" : value;
if (elValue === newValue) {
return;
}
if (document.activeElement === el && el.type !== "range") {
if (lazy && value === oldValue) {
return;
}
if (trim && el.value.trim() === newValue) {
return;
}
}
el.value = newValue;
}
};
const vModelCheckbox = { const vModelCheckbox = {
// #4096 array checkboxes need to be deep traversed };
deep: true,
created(el, _, vnode) {
el[assignKey] = getModelAssigner(vnode);
addEventListener(el, "change", () => {
const modelValue = el._modelValue;
const elementValue = getValue(el);
const checked = el.checked;
const assign = el[assignKey];
if (isArray(modelValue)) {
const index = looseIndexOf(modelValue, elementValue);
const found = index !== -1;
if (checked && !found) {
assign(modelValue.concat(elementValue));
} else if (!checked && found) {
const filtered = [...modelValue];
filtered.splice(index, 1);
assign(filtered);
}
} else if (isSet(modelValue)) {
const cloned = new Set(modelValue);
if (checked) {
cloned.add(elementValue);
} else {
cloned.delete(elementValue);
}
assign(cloned);
} else {
assign(getCheckboxValue(el, checked));
}
});
},
// set initial checked on mount to wait for true-value/false-value
mounted: setChecked,
beforeUpdate(el, binding, vnode) {
el[assignKey] = getModelAssigner(vnode);
setChecked(el, binding, vnode);
}
};
function setChecked(el, { value, oldValue }, vnode) {
el._modelValue = value;
let checked;
if (isArray(value)) {
checked = looseIndexOf(value, vnode.props.value) > -1;
} else if (isSet(value)) {
checked = value.has(vnode.props.value);
} else {
if (value === oldValue) return;
checked = looseEqual(value, getCheckboxValue(el, true));
}
if (el.checked !== checked) {
el.checked = checked;
}
}
const vModelRadio = { const vModelRadio = {
created(el, { value }, vnode) { };
el.checked = looseEqual(value, vnode.props.value);
el[assignKey] = getModelAssigner(vnode);
addEventListener(el, "change", () => {
el[assignKey](getValue(el));
});
},
beforeUpdate(el, { value, oldValue }, vnode) {
el[assignKey] = getModelAssigner(vnode);
if (value !== oldValue) {
el.checked = looseEqual(value, vnode.props.value);
}
}
};
function getValue(el) {
return "_value" in el ? el._value : el.value;
}
function getCheckboxValue(el, checked) {
const key = checked ? "_trueValue" : "_falseValue";
return key in el ? el[key] : checked;
}
function initVModelForSSR() { function initVModelForSSR() {
vModelText.getSSRProps = ({ value }) => ({ value }); vModelText.getSSRProps = ({ value }) => ({ value });
vModelRadio.getSSRProps = ({ value }, vnode) => { vModelRadio.getSSRProps = ({ value }, vnode) => {

File diff suppressed because one or more lines are too long

View File

@ -1,10 +1,10 @@
/** /**
* @vue/server-renderer v3.5.13 * @vue/server-renderer v3.5.17
* (c) 2018-present Yuxi (Evan) You and Vue contributors * (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT * @license MIT
**/ **/
import { createVNode, ssrUtils, ssrContextKey, warn as warn$2, Fragment, Static, Comment, Text, mergeProps, createApp, initDirectivesForSSR } from 'vue'; 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'; import { makeMap, isOn, isRenderableAttrValue, isSVGTag, propsToAttrMap, isBooleanAttr, includeBooleanAttr, isSSRSafeAttrName, escapeHtml, normalizeClass, isString, normalizeStyle, stringifyStyle, isArray, toDisplayString, isFunction, EMPTY_OBJ, getGlobalThis, NOOP, isObject, looseEqual, looseIndexOf, escapeHtmlComment, isPromise, isVoidTag } from '@vue/shared';
export { includeBooleanAttr as ssrIncludeBooleanAttr } from '@vue/shared'; export { includeBooleanAttr as ssrIncludeBooleanAttr } from '@vue/shared';
const shouldIgnoreProp = /* @__PURE__ */ makeMap( const shouldIgnoreProp = /* @__PURE__ */ makeMap(
@ -177,144 +177,6 @@ function ssrInterpolate(value) {
return escapeHtml(toDisplayString(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() {
trackStack.push(shouldTrack);
shouldTrack = false;
}
function resetTracking() {
const last = trackStack.pop();
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) { function isProxy(value) {
return value ? !!value["__v_raw"] : false; return value ? !!value["__v_raw"] : false;
} }
@ -338,7 +200,6 @@ let isWarning = false;
function warn$1(msg, ...args) { function warn$1(msg, ...args) {
if (isWarning) return; if (isWarning) return;
isWarning = true; isWarning = true;
pauseTracking();
const instance = stack.length ? stack[stack.length - 1].component : null; const instance = stack.length ? stack[stack.length - 1].component : null;
const appWarnHandler = instance && instance.appContext.config.warnHandler; const appWarnHandler = instance && instance.appContext.config.warnHandler;
const trace = getComponentTrace(); const trace = getComponentTrace();
@ -369,7 +230,6 @@ function warn$1(msg, ...args) {
} }
console.warn(...warnArgs); console.warn(...warnArgs);
} }
resetTracking();
isWarning = false; isWarning = false;
} }
function getComponentTrace() { function getComponentTrace() {
@ -499,13 +359,11 @@ function handleError(err, instance, type, throwInDev = true) {
cur = cur.parent; cur = cur.parent;
} }
if (errorHandler) { if (errorHandler) {
pauseTracking();
callWithErrorHandling(errorHandler, null, 10, [ callWithErrorHandling(errorHandler, null, 10, [
err, err,
exposedInstance, exposedInstance,
errorInfo errorInfo
]); ]);
resetTracking();
return; return;
} }
} }
@ -587,24 +445,8 @@ function setDevtoolsHook(hook, target) {
); );
} }
!!(process.env.NODE_ENV !== "production") ? { !!(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 classifyRE = /(?:^|[-_])(\w)/g;
const classify = (str) => str.replace(classifyRE, (c) => c.toUpperCase()).replace(/[-_]/g, ""); const classify = (str) => str.replace(classifyRE, (c) => c.toUpperCase()).replace(/[-_]/g, "");
function getComponentName(Component, includeInferred = true) { function getComponentName(Component, includeInferred = true) {

Some files were not shown because too many files have changed in this diff Show More