init
This commit is contained in:
21
node_modules/@vue/compiler-core/LICENSE
generated
vendored
Normal file
21
node_modules/@vue/compiler-core/LICENSE
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2018-present, Yuxi (Evan) You
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
1
node_modules/@vue/compiler-core/README.md
generated
vendored
Normal file
1
node_modules/@vue/compiler-core/README.md
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
# @vue/compiler-core
|
6602
node_modules/@vue/compiler-core/dist/compiler-core.cjs.js
generated
vendored
Normal file
6602
node_modules/@vue/compiler-core/dist/compiler-core.cjs.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
6478
node_modules/@vue/compiler-core/dist/compiler-core.cjs.prod.js
generated
vendored
Normal file
6478
node_modules/@vue/compiler-core/dist/compiler-core.cjs.prod.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1033
node_modules/@vue/compiler-core/dist/compiler-core.d.ts
generated
vendored
Normal file
1033
node_modules/@vue/compiler-core/dist/compiler-core.d.ts
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
5661
node_modules/@vue/compiler-core/dist/compiler-core.esm-bundler.js
generated
vendored
Normal file
5661
node_modules/@vue/compiler-core/dist/compiler-core.esm-bundler.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
7
node_modules/@vue/compiler-core/index.js
generated
vendored
Normal file
7
node_modules/@vue/compiler-core/index.js
generated
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
'use strict'
|
||||
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
module.exports = require('./dist/compiler-core.cjs.prod.js')
|
||||
} else {
|
||||
module.exports = require('./dist/compiler-core.cjs.js')
|
||||
}
|
58
node_modules/@vue/compiler-core/package.json
generated
vendored
Normal file
58
node_modules/@vue/compiler-core/package.json
generated
vendored
Normal file
@ -0,0 +1,58 @@
|
||||
{
|
||||
"name": "@vue/compiler-core",
|
||||
"version": "3.4.15",
|
||||
"description": "@vue/compiler-core",
|
||||
"main": "index.js",
|
||||
"module": "dist/compiler-core.esm-bundler.js",
|
||||
"types": "dist/compiler-core.d.ts",
|
||||
"files": [
|
||||
"index.js",
|
||||
"dist"
|
||||
],
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./dist/compiler-core.d.ts",
|
||||
"node": {
|
||||
"production": "./dist/compiler-core.cjs.prod.js",
|
||||
"development": "./dist/compiler-core.cjs.js",
|
||||
"default": "./index.js"
|
||||
},
|
||||
"module": "./dist/compiler-core.esm-bundler.js",
|
||||
"import": "./dist/compiler-core.esm-bundler.js",
|
||||
"require": "./index.js"
|
||||
},
|
||||
"./*": "./*"
|
||||
},
|
||||
"buildOptions": {
|
||||
"name": "VueCompilerCore",
|
||||
"compat": true,
|
||||
"formats": [
|
||||
"esm-bundler",
|
||||
"cjs"
|
||||
]
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/vuejs/core.git",
|
||||
"directory": "packages/compiler-core"
|
||||
},
|
||||
"keywords": [
|
||||
"vue"
|
||||
],
|
||||
"author": "Evan You",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/vuejs/core/issues"
|
||||
},
|
||||
"homepage": "https://github.com/vuejs/core/tree/main/packages/compiler-core#readme",
|
||||
"dependencies": {
|
||||
"@babel/parser": "^7.23.6",
|
||||
"entities": "^4.5.0",
|
||||
"estree-walker": "^2.0.2",
|
||||
"source-map-js": "^1.0.2",
|
||||
"@vue/shared": "3.4.15"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/types": "^7.23.6"
|
||||
}
|
||||
}
|
21
node_modules/@vue/compiler-dom/LICENSE
generated
vendored
Normal file
21
node_modules/@vue/compiler-dom/LICENSE
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2018-present, Yuxi (Evan) You
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
1
node_modules/@vue/compiler-dom/README.md
generated
vendored
Normal file
1
node_modules/@vue/compiler-dom/README.md
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
# @vue/compiler-dom
|
727
node_modules/@vue/compiler-dom/dist/compiler-dom.cjs.js
generated
vendored
Normal file
727
node_modules/@vue/compiler-dom/dist/compiler-dom.cjs.js
generated
vendored
Normal file
@ -0,0 +1,727 @@
|
||||
/**
|
||||
* @vue/compiler-dom v3.4.15
|
||||
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
||||
* @license MIT
|
||||
**/
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
var compilerCore = require('@vue/compiler-core');
|
||||
var shared = require('@vue/shared');
|
||||
|
||||
const V_MODEL_RADIO = Symbol(`vModelRadio` );
|
||||
const V_MODEL_CHECKBOX = Symbol(`vModelCheckbox` );
|
||||
const V_MODEL_TEXT = Symbol(`vModelText` );
|
||||
const V_MODEL_SELECT = Symbol(`vModelSelect` );
|
||||
const V_MODEL_DYNAMIC = Symbol(`vModelDynamic` );
|
||||
const V_ON_WITH_MODIFIERS = Symbol(`vOnModifiersGuard` );
|
||||
const V_ON_WITH_KEYS = Symbol(`vOnKeysGuard` );
|
||||
const V_SHOW = Symbol(`vShow` );
|
||||
const TRANSITION = Symbol(`Transition` );
|
||||
const TRANSITION_GROUP = Symbol(`TransitionGroup` );
|
||||
compilerCore.registerRuntimeHelpers({
|
||||
[V_MODEL_RADIO]: `vModelRadio`,
|
||||
[V_MODEL_CHECKBOX]: `vModelCheckbox`,
|
||||
[V_MODEL_TEXT]: `vModelText`,
|
||||
[V_MODEL_SELECT]: `vModelSelect`,
|
||||
[V_MODEL_DYNAMIC]: `vModelDynamic`,
|
||||
[V_ON_WITH_MODIFIERS]: `withModifiers`,
|
||||
[V_ON_WITH_KEYS]: `withKeys`,
|
||||
[V_SHOW]: `vShow`,
|
||||
[TRANSITION]: `Transition`,
|
||||
[TRANSITION_GROUP]: `TransitionGroup`
|
||||
});
|
||||
|
||||
const parserOptions = {
|
||||
parseMode: "html",
|
||||
isVoidTag: shared.isVoidTag,
|
||||
isNativeTag: (tag) => shared.isHTMLTag(tag) || shared.isSVGTag(tag) || shared.isMathMLTag(tag),
|
||||
isPreTag: (tag) => tag === "pre",
|
||||
decodeEntities: void 0,
|
||||
isBuiltInComponent: (tag) => {
|
||||
if (tag === "Transition" || tag === "transition") {
|
||||
return TRANSITION;
|
||||
} else if (tag === "TransitionGroup" || tag === "transition-group") {
|
||||
return TRANSITION_GROUP;
|
||||
}
|
||||
},
|
||||
// https://html.spec.whatwg.org/multipage/parsing.html#tree-construction-dispatcher
|
||||
getNamespace(tag, parent, rootNamespace) {
|
||||
let ns = parent ? parent.ns : rootNamespace;
|
||||
if (parent && ns === 2) {
|
||||
if (parent.tag === "annotation-xml") {
|
||||
if (tag === "svg") {
|
||||
return 1;
|
||||
}
|
||||
if (parent.props.some(
|
||||
(a) => a.type === 6 && a.name === "encoding" && a.value != null && (a.value.content === "text/html" || a.value.content === "application/xhtml+xml")
|
||||
)) {
|
||||
ns = 0;
|
||||
}
|
||||
} else if (/^m(?:[ions]|text)$/.test(parent.tag) && tag !== "mglyph" && tag !== "malignmark") {
|
||||
ns = 0;
|
||||
}
|
||||
} else if (parent && ns === 1) {
|
||||
if (parent.tag === "foreignObject" || parent.tag === "desc" || parent.tag === "title") {
|
||||
ns = 0;
|
||||
}
|
||||
}
|
||||
if (ns === 0) {
|
||||
if (tag === "svg") {
|
||||
return 1;
|
||||
}
|
||||
if (tag === "math") {
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
return ns;
|
||||
}
|
||||
};
|
||||
|
||||
const transformStyle = (node) => {
|
||||
if (node.type === 1) {
|
||||
node.props.forEach((p, i) => {
|
||||
if (p.type === 6 && p.name === "style" && p.value) {
|
||||
node.props[i] = {
|
||||
type: 7,
|
||||
name: `bind`,
|
||||
arg: compilerCore.createSimpleExpression(`style`, true, p.loc),
|
||||
exp: parseInlineCSS(p.value.content, p.loc),
|
||||
modifiers: [],
|
||||
loc: p.loc
|
||||
};
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
const parseInlineCSS = (cssText, loc) => {
|
||||
const normalized = shared.parseStringStyle(cssText);
|
||||
return compilerCore.createSimpleExpression(
|
||||
JSON.stringify(normalized),
|
||||
false,
|
||||
loc,
|
||||
3
|
||||
);
|
||||
};
|
||||
|
||||
function createDOMCompilerError(code, loc) {
|
||||
return compilerCore.createCompilerError(
|
||||
code,
|
||||
loc,
|
||||
DOMErrorMessages
|
||||
);
|
||||
}
|
||||
const DOMErrorCodes = {
|
||||
"X_V_HTML_NO_EXPRESSION": 53,
|
||||
"53": "X_V_HTML_NO_EXPRESSION",
|
||||
"X_V_HTML_WITH_CHILDREN": 54,
|
||||
"54": "X_V_HTML_WITH_CHILDREN",
|
||||
"X_V_TEXT_NO_EXPRESSION": 55,
|
||||
"55": "X_V_TEXT_NO_EXPRESSION",
|
||||
"X_V_TEXT_WITH_CHILDREN": 56,
|
||||
"56": "X_V_TEXT_WITH_CHILDREN",
|
||||
"X_V_MODEL_ON_INVALID_ELEMENT": 57,
|
||||
"57": "X_V_MODEL_ON_INVALID_ELEMENT",
|
||||
"X_V_MODEL_ARG_ON_ELEMENT": 58,
|
||||
"58": "X_V_MODEL_ARG_ON_ELEMENT",
|
||||
"X_V_MODEL_ON_FILE_INPUT_ELEMENT": 59,
|
||||
"59": "X_V_MODEL_ON_FILE_INPUT_ELEMENT",
|
||||
"X_V_MODEL_UNNECESSARY_VALUE": 60,
|
||||
"60": "X_V_MODEL_UNNECESSARY_VALUE",
|
||||
"X_V_SHOW_NO_EXPRESSION": 61,
|
||||
"61": "X_V_SHOW_NO_EXPRESSION",
|
||||
"X_TRANSITION_INVALID_CHILDREN": 62,
|
||||
"62": "X_TRANSITION_INVALID_CHILDREN",
|
||||
"X_IGNORED_SIDE_EFFECT_TAG": 63,
|
||||
"63": "X_IGNORED_SIDE_EFFECT_TAG",
|
||||
"__EXTEND_POINT__": 64,
|
||||
"64": "__EXTEND_POINT__"
|
||||
};
|
||||
const DOMErrorMessages = {
|
||||
[53]: `v-html is missing expression.`,
|
||||
[54]: `v-html will override element children.`,
|
||||
[55]: `v-text is missing expression.`,
|
||||
[56]: `v-text will override element children.`,
|
||||
[57]: `v-model can only be used on <input>, <textarea> and <select> elements.`,
|
||||
[58]: `v-model argument is not supported on plain elements.`,
|
||||
[59]: `v-model cannot be used on file inputs since they are read-only. Use a v-on:change listener instead.`,
|
||||
[60]: `Unnecessary value binding used alongside v-model. It will interfere with v-model's behavior.`,
|
||||
[61]: `v-show is missing expression.`,
|
||||
[62]: `<Transition> expects exactly one child element or component.`,
|
||||
[63]: `Tags with side effect (<script> and <style>) are ignored in client component templates.`
|
||||
};
|
||||
|
||||
const transformVHtml = (dir, node, context) => {
|
||||
const { exp, loc } = dir;
|
||||
if (!exp) {
|
||||
context.onError(
|
||||
createDOMCompilerError(53, loc)
|
||||
);
|
||||
}
|
||||
if (node.children.length) {
|
||||
context.onError(
|
||||
createDOMCompilerError(54, loc)
|
||||
);
|
||||
node.children.length = 0;
|
||||
}
|
||||
return {
|
||||
props: [
|
||||
compilerCore.createObjectProperty(
|
||||
compilerCore.createSimpleExpression(`innerHTML`, true, loc),
|
||||
exp || compilerCore.createSimpleExpression("", true)
|
||||
)
|
||||
]
|
||||
};
|
||||
};
|
||||
|
||||
const transformVText = (dir, node, context) => {
|
||||
const { exp, loc } = dir;
|
||||
if (!exp) {
|
||||
context.onError(
|
||||
createDOMCompilerError(55, loc)
|
||||
);
|
||||
}
|
||||
if (node.children.length) {
|
||||
context.onError(
|
||||
createDOMCompilerError(56, loc)
|
||||
);
|
||||
node.children.length = 0;
|
||||
}
|
||||
return {
|
||||
props: [
|
||||
compilerCore.createObjectProperty(
|
||||
compilerCore.createSimpleExpression(`textContent`, true),
|
||||
exp ? compilerCore.getConstantType(exp, context) > 0 ? exp : compilerCore.createCallExpression(
|
||||
context.helperString(compilerCore.TO_DISPLAY_STRING),
|
||||
[exp],
|
||||
loc
|
||||
) : compilerCore.createSimpleExpression("", true)
|
||||
)
|
||||
]
|
||||
};
|
||||
};
|
||||
|
||||
const transformModel = (dir, node, context) => {
|
||||
const baseResult = compilerCore.transformModel(dir, node, context);
|
||||
if (!baseResult.props.length || node.tagType === 1) {
|
||||
return baseResult;
|
||||
}
|
||||
if (dir.arg) {
|
||||
context.onError(
|
||||
createDOMCompilerError(
|
||||
58,
|
||||
dir.arg.loc
|
||||
)
|
||||
);
|
||||
}
|
||||
function checkDuplicatedValue() {
|
||||
const value = compilerCore.findDir(node, "bind");
|
||||
if (value && compilerCore.isStaticArgOf(value.arg, "value")) {
|
||||
context.onError(
|
||||
createDOMCompilerError(
|
||||
60,
|
||||
value.loc
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
const { tag } = node;
|
||||
const isCustomElement = context.isCustomElement(tag);
|
||||
if (tag === "input" || tag === "textarea" || tag === "select" || isCustomElement) {
|
||||
let directiveToUse = V_MODEL_TEXT;
|
||||
let isInvalidType = false;
|
||||
if (tag === "input" || isCustomElement) {
|
||||
const type = compilerCore.findProp(node, `type`);
|
||||
if (type) {
|
||||
if (type.type === 7) {
|
||||
directiveToUse = V_MODEL_DYNAMIC;
|
||||
} else if (type.value) {
|
||||
switch (type.value.content) {
|
||||
case "radio":
|
||||
directiveToUse = V_MODEL_RADIO;
|
||||
break;
|
||||
case "checkbox":
|
||||
directiveToUse = V_MODEL_CHECKBOX;
|
||||
break;
|
||||
case "file":
|
||||
isInvalidType = true;
|
||||
context.onError(
|
||||
createDOMCompilerError(
|
||||
59,
|
||||
dir.loc
|
||||
)
|
||||
);
|
||||
break;
|
||||
default:
|
||||
checkDuplicatedValue();
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if (compilerCore.hasDynamicKeyVBind(node)) {
|
||||
directiveToUse = V_MODEL_DYNAMIC;
|
||||
} else {
|
||||
checkDuplicatedValue();
|
||||
}
|
||||
} else if (tag === "select") {
|
||||
directiveToUse = V_MODEL_SELECT;
|
||||
} else {
|
||||
checkDuplicatedValue();
|
||||
}
|
||||
if (!isInvalidType) {
|
||||
baseResult.needRuntime = context.helper(directiveToUse);
|
||||
}
|
||||
} else {
|
||||
context.onError(
|
||||
createDOMCompilerError(
|
||||
57,
|
||||
dir.loc
|
||||
)
|
||||
);
|
||||
}
|
||||
baseResult.props = baseResult.props.filter(
|
||||
(p) => !(p.key.type === 4 && p.key.content === "modelValue")
|
||||
);
|
||||
return baseResult;
|
||||
};
|
||||
|
||||
const isEventOptionModifier = /* @__PURE__ */ shared.makeMap(`passive,once,capture`);
|
||||
const isNonKeyModifier = /* @__PURE__ */ shared.makeMap(
|
||||
// event propagation management
|
||||
`stop,prevent,self,ctrl,shift,alt,meta,exact,middle`
|
||||
);
|
||||
const maybeKeyModifier = /* @__PURE__ */ shared.makeMap("left,right");
|
||||
const isKeyboardEvent = /* @__PURE__ */ shared.makeMap(
|
||||
`onkeyup,onkeydown,onkeypress`,
|
||||
true
|
||||
);
|
||||
const resolveModifiers = (key, modifiers, context, loc) => {
|
||||
const keyModifiers = [];
|
||||
const nonKeyModifiers = [];
|
||||
const eventOptionModifiers = [];
|
||||
for (let i = 0; i < modifiers.length; i++) {
|
||||
const modifier = modifiers[i];
|
||||
if (modifier === "native" && compilerCore.checkCompatEnabled(
|
||||
"COMPILER_V_ON_NATIVE",
|
||||
context,
|
||||
loc
|
||||
)) {
|
||||
eventOptionModifiers.push(modifier);
|
||||
} else if (isEventOptionModifier(modifier)) {
|
||||
eventOptionModifiers.push(modifier);
|
||||
} else {
|
||||
if (maybeKeyModifier(modifier)) {
|
||||
if (compilerCore.isStaticExp(key)) {
|
||||
if (isKeyboardEvent(key.content)) {
|
||||
keyModifiers.push(modifier);
|
||||
} else {
|
||||
nonKeyModifiers.push(modifier);
|
||||
}
|
||||
} else {
|
||||
keyModifiers.push(modifier);
|
||||
nonKeyModifiers.push(modifier);
|
||||
}
|
||||
} else {
|
||||
if (isNonKeyModifier(modifier)) {
|
||||
nonKeyModifiers.push(modifier);
|
||||
} else {
|
||||
keyModifiers.push(modifier);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return {
|
||||
keyModifiers,
|
||||
nonKeyModifiers,
|
||||
eventOptionModifiers
|
||||
};
|
||||
};
|
||||
const transformClick = (key, event) => {
|
||||
const isStaticClick = compilerCore.isStaticExp(key) && key.content.toLowerCase() === "onclick";
|
||||
return isStaticClick ? compilerCore.createSimpleExpression(event, true) : key.type !== 4 ? compilerCore.createCompoundExpression([
|
||||
`(`,
|
||||
key,
|
||||
`) === "onClick" ? "${event}" : (`,
|
||||
key,
|
||||
`)`
|
||||
]) : key;
|
||||
};
|
||||
const transformOn = (dir, node, context) => {
|
||||
return compilerCore.transformOn(dir, node, context, (baseResult) => {
|
||||
const { modifiers } = dir;
|
||||
if (!modifiers.length)
|
||||
return baseResult;
|
||||
let { key, value: handlerExp } = baseResult.props[0];
|
||||
const { keyModifiers, nonKeyModifiers, eventOptionModifiers } = resolveModifiers(key, modifiers, context, dir.loc);
|
||||
if (nonKeyModifiers.includes("right")) {
|
||||
key = transformClick(key, `onContextmenu`);
|
||||
}
|
||||
if (nonKeyModifiers.includes("middle")) {
|
||||
key = transformClick(key, `onMouseup`);
|
||||
}
|
||||
if (nonKeyModifiers.length) {
|
||||
handlerExp = compilerCore.createCallExpression(context.helper(V_ON_WITH_MODIFIERS), [
|
||||
handlerExp,
|
||||
JSON.stringify(nonKeyModifiers)
|
||||
]);
|
||||
}
|
||||
if (keyModifiers.length && // if event name is dynamic, always wrap with keys guard
|
||||
(!compilerCore.isStaticExp(key) || isKeyboardEvent(key.content))) {
|
||||
handlerExp = compilerCore.createCallExpression(context.helper(V_ON_WITH_KEYS), [
|
||||
handlerExp,
|
||||
JSON.stringify(keyModifiers)
|
||||
]);
|
||||
}
|
||||
if (eventOptionModifiers.length) {
|
||||
const modifierPostfix = eventOptionModifiers.map(shared.capitalize).join("");
|
||||
key = compilerCore.isStaticExp(key) ? compilerCore.createSimpleExpression(`${key.content}${modifierPostfix}`, true) : compilerCore.createCompoundExpression([`(`, key, `) + "${modifierPostfix}"`]);
|
||||
}
|
||||
return {
|
||||
props: [compilerCore.createObjectProperty(key, handlerExp)]
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
const transformShow = (dir, node, context) => {
|
||||
const { exp, loc } = dir;
|
||||
if (!exp) {
|
||||
context.onError(
|
||||
createDOMCompilerError(61, loc)
|
||||
);
|
||||
}
|
||||
return {
|
||||
props: [],
|
||||
needRuntime: context.helper(V_SHOW)
|
||||
};
|
||||
};
|
||||
|
||||
const transformTransition = (node, context) => {
|
||||
if (node.type === 1 && node.tagType === 1) {
|
||||
const component = context.isBuiltInComponent(node.tag);
|
||||
if (component === TRANSITION) {
|
||||
return () => {
|
||||
if (!node.children.length) {
|
||||
return;
|
||||
}
|
||||
if (hasMultipleChildren(node)) {
|
||||
context.onError(
|
||||
createDOMCompilerError(
|
||||
62,
|
||||
{
|
||||
start: node.children[0].loc.start,
|
||||
end: node.children[node.children.length - 1].loc.end,
|
||||
source: ""
|
||||
}
|
||||
)
|
||||
);
|
||||
}
|
||||
const child = node.children[0];
|
||||
if (child.type === 1) {
|
||||
for (const p of child.props) {
|
||||
if (p.type === 7 && p.name === "show") {
|
||||
node.props.push({
|
||||
type: 6,
|
||||
name: "persisted",
|
||||
nameLoc: node.loc,
|
||||
value: void 0,
|
||||
loc: node.loc
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
};
|
||||
function hasMultipleChildren(node) {
|
||||
const children = node.children = node.children.filter(
|
||||
(c) => c.type !== 3 && !(c.type === 2 && !c.content.trim())
|
||||
);
|
||||
const child = children[0];
|
||||
return children.length !== 1 || child.type === 11 || child.type === 9 && child.branches.some(hasMultipleChildren);
|
||||
}
|
||||
|
||||
const expReplaceRE = /__VUE_EXP_START__(.*?)__VUE_EXP_END__/g;
|
||||
const stringifyStatic = (children, context, parent) => {
|
||||
if (context.scopes.vSlot > 0) {
|
||||
return;
|
||||
}
|
||||
let nc = 0;
|
||||
let ec = 0;
|
||||
const currentChunk = [];
|
||||
const stringifyCurrentChunk = (currentIndex) => {
|
||||
if (nc >= 20 || ec >= 5) {
|
||||
const staticCall = compilerCore.createCallExpression(context.helper(compilerCore.CREATE_STATIC), [
|
||||
JSON.stringify(
|
||||
currentChunk.map((node) => stringifyNode(node, context)).join("")
|
||||
).replace(expReplaceRE, `" + $1 + "`),
|
||||
// the 2nd argument indicates the number of DOM nodes this static vnode
|
||||
// will insert / hydrate
|
||||
String(currentChunk.length)
|
||||
]);
|
||||
replaceHoist(currentChunk[0], staticCall, context);
|
||||
if (currentChunk.length > 1) {
|
||||
for (let i2 = 1; i2 < currentChunk.length; i2++) {
|
||||
replaceHoist(currentChunk[i2], null, context);
|
||||
}
|
||||
const deleteCount = currentChunk.length - 1;
|
||||
children.splice(currentIndex - currentChunk.length + 1, deleteCount);
|
||||
return deleteCount;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
};
|
||||
let i = 0;
|
||||
for (; i < children.length; i++) {
|
||||
const child = children[i];
|
||||
const hoisted = getHoistedNode(child);
|
||||
if (hoisted) {
|
||||
const node = child;
|
||||
const result = analyzeNode(node);
|
||||
if (result) {
|
||||
nc += result[0];
|
||||
ec += result[1];
|
||||
currentChunk.push(node);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
i -= stringifyCurrentChunk(i);
|
||||
nc = 0;
|
||||
ec = 0;
|
||||
currentChunk.length = 0;
|
||||
}
|
||||
stringifyCurrentChunk(i);
|
||||
};
|
||||
const getHoistedNode = (node) => (node.type === 1 && node.tagType === 0 || node.type == 12) && node.codegenNode && node.codegenNode.type === 4 && node.codegenNode.hoisted;
|
||||
const dataAriaRE = /^(data|aria)-/;
|
||||
const isStringifiableAttr = (name, ns) => {
|
||||
return (ns === 0 ? shared.isKnownHtmlAttr(name) : ns === 1 ? shared.isKnownSvgAttr(name) : false) || dataAriaRE.test(name);
|
||||
};
|
||||
const replaceHoist = (node, replacement, context) => {
|
||||
const hoistToReplace = node.codegenNode.hoisted;
|
||||
context.hoists[context.hoists.indexOf(hoistToReplace)] = replacement;
|
||||
};
|
||||
const isNonStringifiable = /* @__PURE__ */ shared.makeMap(
|
||||
`caption,thead,tr,th,tbody,td,tfoot,colgroup,col`
|
||||
);
|
||||
function analyzeNode(node) {
|
||||
if (node.type === 1 && isNonStringifiable(node.tag)) {
|
||||
return false;
|
||||
}
|
||||
if (node.type === 12) {
|
||||
return [1, 0];
|
||||
}
|
||||
let nc = 1;
|
||||
let ec = node.props.length > 0 ? 1 : 0;
|
||||
let bailed = false;
|
||||
const bail = () => {
|
||||
bailed = true;
|
||||
return false;
|
||||
};
|
||||
function walk(node2) {
|
||||
for (let i = 0; i < node2.props.length; i++) {
|
||||
const p = node2.props[i];
|
||||
if (p.type === 6 && !isStringifiableAttr(p.name, node2.ns)) {
|
||||
return bail();
|
||||
}
|
||||
if (p.type === 7 && p.name === "bind") {
|
||||
if (p.arg && (p.arg.type === 8 || p.arg.isStatic && !isStringifiableAttr(p.arg.content, node2.ns))) {
|
||||
return bail();
|
||||
}
|
||||
if (p.exp && (p.exp.type === 8 || p.exp.constType < 3)) {
|
||||
return bail();
|
||||
}
|
||||
}
|
||||
}
|
||||
for (let i = 0; i < node2.children.length; i++) {
|
||||
nc++;
|
||||
const child = node2.children[i];
|
||||
if (child.type === 1) {
|
||||
if (child.props.length > 0) {
|
||||
ec++;
|
||||
}
|
||||
walk(child);
|
||||
if (bailed) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return walk(node) ? [nc, ec] : false;
|
||||
}
|
||||
function stringifyNode(node, context) {
|
||||
if (shared.isString(node)) {
|
||||
return node;
|
||||
}
|
||||
if (shared.isSymbol(node)) {
|
||||
return ``;
|
||||
}
|
||||
switch (node.type) {
|
||||
case 1:
|
||||
return stringifyElement(node, context);
|
||||
case 2:
|
||||
return shared.escapeHtml(node.content);
|
||||
case 3:
|
||||
return `<!--${shared.escapeHtml(node.content)}-->`;
|
||||
case 5:
|
||||
return shared.escapeHtml(shared.toDisplayString(evaluateConstant(node.content)));
|
||||
case 8:
|
||||
return shared.escapeHtml(evaluateConstant(node));
|
||||
case 12:
|
||||
return stringifyNode(node.content, context);
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
}
|
||||
function stringifyElement(node, context) {
|
||||
let res = `<${node.tag}`;
|
||||
let innerHTML = "";
|
||||
for (let i = 0; i < node.props.length; i++) {
|
||||
const p = node.props[i];
|
||||
if (p.type === 6) {
|
||||
res += ` ${p.name}`;
|
||||
if (p.value) {
|
||||
res += `="${shared.escapeHtml(p.value.content)}"`;
|
||||
}
|
||||
} else if (p.type === 7) {
|
||||
if (p.name === "bind") {
|
||||
const exp = p.exp;
|
||||
if (exp.content[0] === "_") {
|
||||
res += ` ${p.arg.content}="__VUE_EXP_START__${exp.content}__VUE_EXP_END__"`;
|
||||
continue;
|
||||
}
|
||||
if (shared.isBooleanAttr(p.arg.content) && exp.content === "false") {
|
||||
continue;
|
||||
}
|
||||
let evaluated = evaluateConstant(exp);
|
||||
if (evaluated != null) {
|
||||
const arg = p.arg && p.arg.content;
|
||||
if (arg === "class") {
|
||||
evaluated = shared.normalizeClass(evaluated);
|
||||
} else if (arg === "style") {
|
||||
evaluated = shared.stringifyStyle(shared.normalizeStyle(evaluated));
|
||||
}
|
||||
res += ` ${p.arg.content}="${shared.escapeHtml(
|
||||
evaluated
|
||||
)}"`;
|
||||
}
|
||||
} else if (p.name === "html") {
|
||||
innerHTML = evaluateConstant(p.exp);
|
||||
} else if (p.name === "text") {
|
||||
innerHTML = shared.escapeHtml(
|
||||
shared.toDisplayString(evaluateConstant(p.exp))
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (context.scopeId) {
|
||||
res += ` ${context.scopeId}`;
|
||||
}
|
||||
res += `>`;
|
||||
if (innerHTML) {
|
||||
res += innerHTML;
|
||||
} else {
|
||||
for (let i = 0; i < node.children.length; i++) {
|
||||
res += stringifyNode(node.children[i], context);
|
||||
}
|
||||
}
|
||||
if (!shared.isVoidTag(node.tag)) {
|
||||
res += `</${node.tag}>`;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
function evaluateConstant(exp) {
|
||||
if (exp.type === 4) {
|
||||
return new Function(`return (${exp.content})`)();
|
||||
} else {
|
||||
let res = ``;
|
||||
exp.children.forEach((c) => {
|
||||
if (shared.isString(c) || shared.isSymbol(c)) {
|
||||
return;
|
||||
}
|
||||
if (c.type === 2) {
|
||||
res += c.content;
|
||||
} else if (c.type === 5) {
|
||||
res += shared.toDisplayString(evaluateConstant(c.content));
|
||||
} else {
|
||||
res += evaluateConstant(c);
|
||||
}
|
||||
});
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
const ignoreSideEffectTags = (node, context) => {
|
||||
if (node.type === 1 && node.tagType === 0 && (node.tag === "script" || node.tag === "style")) {
|
||||
context.onError(
|
||||
createDOMCompilerError(
|
||||
63,
|
||||
node.loc
|
||||
)
|
||||
);
|
||||
context.removeNode();
|
||||
}
|
||||
};
|
||||
|
||||
const DOMNodeTransforms = [
|
||||
transformStyle,
|
||||
...[transformTransition]
|
||||
];
|
||||
const DOMDirectiveTransforms = {
|
||||
cloak: compilerCore.noopDirectiveTransform,
|
||||
html: transformVHtml,
|
||||
text: transformVText,
|
||||
model: transformModel,
|
||||
// override compiler-core
|
||||
on: transformOn,
|
||||
// override compiler-core
|
||||
show: transformShow
|
||||
};
|
||||
function compile(src, options = {}) {
|
||||
return compilerCore.baseCompile(
|
||||
src,
|
||||
shared.extend({}, parserOptions, options, {
|
||||
nodeTransforms: [
|
||||
// ignore <script> and <tag>
|
||||
// this is not put inside DOMNodeTransforms because that list is used
|
||||
// by compiler-ssr to generate vnode fallback branches
|
||||
ignoreSideEffectTags,
|
||||
...DOMNodeTransforms,
|
||||
...options.nodeTransforms || []
|
||||
],
|
||||
directiveTransforms: shared.extend(
|
||||
{},
|
||||
DOMDirectiveTransforms,
|
||||
options.directiveTransforms || {}
|
||||
),
|
||||
transformHoist: stringifyStatic
|
||||
})
|
||||
);
|
||||
}
|
||||
function parse(template, options = {}) {
|
||||
return compilerCore.baseParse(template, shared.extend({}, parserOptions, options));
|
||||
}
|
||||
|
||||
exports.DOMDirectiveTransforms = DOMDirectiveTransforms;
|
||||
exports.DOMErrorCodes = DOMErrorCodes;
|
||||
exports.DOMErrorMessages = DOMErrorMessages;
|
||||
exports.DOMNodeTransforms = DOMNodeTransforms;
|
||||
exports.TRANSITION = TRANSITION;
|
||||
exports.TRANSITION_GROUP = TRANSITION_GROUP;
|
||||
exports.V_MODEL_CHECKBOX = V_MODEL_CHECKBOX;
|
||||
exports.V_MODEL_DYNAMIC = V_MODEL_DYNAMIC;
|
||||
exports.V_MODEL_RADIO = V_MODEL_RADIO;
|
||||
exports.V_MODEL_SELECT = V_MODEL_SELECT;
|
||||
exports.V_MODEL_TEXT = V_MODEL_TEXT;
|
||||
exports.V_ON_WITH_KEYS = V_ON_WITH_KEYS;
|
||||
exports.V_ON_WITH_MODIFIERS = V_ON_WITH_MODIFIERS;
|
||||
exports.V_SHOW = V_SHOW;
|
||||
exports.compile = compile;
|
||||
exports.createDOMCompilerError = createDOMCompilerError;
|
||||
exports.parse = parse;
|
||||
exports.parserOptions = parserOptions;
|
||||
exports.transformStyle = transformStyle;
|
||||
Object.keys(compilerCore).forEach(function (k) {
|
||||
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) exports[k] = compilerCore[k];
|
||||
});
|
657
node_modules/@vue/compiler-dom/dist/compiler-dom.cjs.prod.js
generated
vendored
Normal file
657
node_modules/@vue/compiler-dom/dist/compiler-dom.cjs.prod.js
generated
vendored
Normal file
@ -0,0 +1,657 @@
|
||||
/**
|
||||
* @vue/compiler-dom v3.4.15
|
||||
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
||||
* @license MIT
|
||||
**/
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
var compilerCore = require('@vue/compiler-core');
|
||||
var shared = require('@vue/shared');
|
||||
|
||||
const V_MODEL_RADIO = Symbol(``);
|
||||
const V_MODEL_CHECKBOX = Symbol(``);
|
||||
const V_MODEL_TEXT = Symbol(``);
|
||||
const V_MODEL_SELECT = Symbol(``);
|
||||
const V_MODEL_DYNAMIC = Symbol(``);
|
||||
const V_ON_WITH_MODIFIERS = Symbol(``);
|
||||
const V_ON_WITH_KEYS = Symbol(``);
|
||||
const V_SHOW = Symbol(``);
|
||||
const TRANSITION = Symbol(``);
|
||||
const TRANSITION_GROUP = Symbol(``);
|
||||
compilerCore.registerRuntimeHelpers({
|
||||
[V_MODEL_RADIO]: `vModelRadio`,
|
||||
[V_MODEL_CHECKBOX]: `vModelCheckbox`,
|
||||
[V_MODEL_TEXT]: `vModelText`,
|
||||
[V_MODEL_SELECT]: `vModelSelect`,
|
||||
[V_MODEL_DYNAMIC]: `vModelDynamic`,
|
||||
[V_ON_WITH_MODIFIERS]: `withModifiers`,
|
||||
[V_ON_WITH_KEYS]: `withKeys`,
|
||||
[V_SHOW]: `vShow`,
|
||||
[TRANSITION]: `Transition`,
|
||||
[TRANSITION_GROUP]: `TransitionGroup`
|
||||
});
|
||||
|
||||
const parserOptions = {
|
||||
parseMode: "html",
|
||||
isVoidTag: shared.isVoidTag,
|
||||
isNativeTag: (tag) => shared.isHTMLTag(tag) || shared.isSVGTag(tag) || shared.isMathMLTag(tag),
|
||||
isPreTag: (tag) => tag === "pre",
|
||||
decodeEntities: void 0,
|
||||
isBuiltInComponent: (tag) => {
|
||||
if (tag === "Transition" || tag === "transition") {
|
||||
return TRANSITION;
|
||||
} else if (tag === "TransitionGroup" || tag === "transition-group") {
|
||||
return TRANSITION_GROUP;
|
||||
}
|
||||
},
|
||||
// https://html.spec.whatwg.org/multipage/parsing.html#tree-construction-dispatcher
|
||||
getNamespace(tag, parent, rootNamespace) {
|
||||
let ns = parent ? parent.ns : rootNamespace;
|
||||
if (parent && ns === 2) {
|
||||
if (parent.tag === "annotation-xml") {
|
||||
if (tag === "svg") {
|
||||
return 1;
|
||||
}
|
||||
if (parent.props.some(
|
||||
(a) => a.type === 6 && a.name === "encoding" && a.value != null && (a.value.content === "text/html" || a.value.content === "application/xhtml+xml")
|
||||
)) {
|
||||
ns = 0;
|
||||
}
|
||||
} else if (/^m(?:[ions]|text)$/.test(parent.tag) && tag !== "mglyph" && tag !== "malignmark") {
|
||||
ns = 0;
|
||||
}
|
||||
} else if (parent && ns === 1) {
|
||||
if (parent.tag === "foreignObject" || parent.tag === "desc" || parent.tag === "title") {
|
||||
ns = 0;
|
||||
}
|
||||
}
|
||||
if (ns === 0) {
|
||||
if (tag === "svg") {
|
||||
return 1;
|
||||
}
|
||||
if (tag === "math") {
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
return ns;
|
||||
}
|
||||
};
|
||||
|
||||
const transformStyle = (node) => {
|
||||
if (node.type === 1) {
|
||||
node.props.forEach((p, i) => {
|
||||
if (p.type === 6 && p.name === "style" && p.value) {
|
||||
node.props[i] = {
|
||||
type: 7,
|
||||
name: `bind`,
|
||||
arg: compilerCore.createSimpleExpression(`style`, true, p.loc),
|
||||
exp: parseInlineCSS(p.value.content, p.loc),
|
||||
modifiers: [],
|
||||
loc: p.loc
|
||||
};
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
const parseInlineCSS = (cssText, loc) => {
|
||||
const normalized = shared.parseStringStyle(cssText);
|
||||
return compilerCore.createSimpleExpression(
|
||||
JSON.stringify(normalized),
|
||||
false,
|
||||
loc,
|
||||
3
|
||||
);
|
||||
};
|
||||
|
||||
function createDOMCompilerError(code, loc) {
|
||||
return compilerCore.createCompilerError(
|
||||
code,
|
||||
loc,
|
||||
DOMErrorMessages
|
||||
);
|
||||
}
|
||||
const DOMErrorCodes = {
|
||||
"X_V_HTML_NO_EXPRESSION": 53,
|
||||
"53": "X_V_HTML_NO_EXPRESSION",
|
||||
"X_V_HTML_WITH_CHILDREN": 54,
|
||||
"54": "X_V_HTML_WITH_CHILDREN",
|
||||
"X_V_TEXT_NO_EXPRESSION": 55,
|
||||
"55": "X_V_TEXT_NO_EXPRESSION",
|
||||
"X_V_TEXT_WITH_CHILDREN": 56,
|
||||
"56": "X_V_TEXT_WITH_CHILDREN",
|
||||
"X_V_MODEL_ON_INVALID_ELEMENT": 57,
|
||||
"57": "X_V_MODEL_ON_INVALID_ELEMENT",
|
||||
"X_V_MODEL_ARG_ON_ELEMENT": 58,
|
||||
"58": "X_V_MODEL_ARG_ON_ELEMENT",
|
||||
"X_V_MODEL_ON_FILE_INPUT_ELEMENT": 59,
|
||||
"59": "X_V_MODEL_ON_FILE_INPUT_ELEMENT",
|
||||
"X_V_MODEL_UNNECESSARY_VALUE": 60,
|
||||
"60": "X_V_MODEL_UNNECESSARY_VALUE",
|
||||
"X_V_SHOW_NO_EXPRESSION": 61,
|
||||
"61": "X_V_SHOW_NO_EXPRESSION",
|
||||
"X_TRANSITION_INVALID_CHILDREN": 62,
|
||||
"62": "X_TRANSITION_INVALID_CHILDREN",
|
||||
"X_IGNORED_SIDE_EFFECT_TAG": 63,
|
||||
"63": "X_IGNORED_SIDE_EFFECT_TAG",
|
||||
"__EXTEND_POINT__": 64,
|
||||
"64": "__EXTEND_POINT__"
|
||||
};
|
||||
const DOMErrorMessages = {
|
||||
[53]: `v-html is missing expression.`,
|
||||
[54]: `v-html will override element children.`,
|
||||
[55]: `v-text is missing expression.`,
|
||||
[56]: `v-text will override element children.`,
|
||||
[57]: `v-model can only be used on <input>, <textarea> and <select> elements.`,
|
||||
[58]: `v-model argument is not supported on plain elements.`,
|
||||
[59]: `v-model cannot be used on file inputs since they are read-only. Use a v-on:change listener instead.`,
|
||||
[60]: `Unnecessary value binding used alongside v-model. It will interfere with v-model's behavior.`,
|
||||
[61]: `v-show is missing expression.`,
|
||||
[62]: `<Transition> expects exactly one child element or component.`,
|
||||
[63]: `Tags with side effect (<script> and <style>) are ignored in client component templates.`
|
||||
};
|
||||
|
||||
const transformVHtml = (dir, node, context) => {
|
||||
const { exp, loc } = dir;
|
||||
if (!exp) {
|
||||
context.onError(
|
||||
createDOMCompilerError(53, loc)
|
||||
);
|
||||
}
|
||||
if (node.children.length) {
|
||||
context.onError(
|
||||
createDOMCompilerError(54, loc)
|
||||
);
|
||||
node.children.length = 0;
|
||||
}
|
||||
return {
|
||||
props: [
|
||||
compilerCore.createObjectProperty(
|
||||
compilerCore.createSimpleExpression(`innerHTML`, true, loc),
|
||||
exp || compilerCore.createSimpleExpression("", true)
|
||||
)
|
||||
]
|
||||
};
|
||||
};
|
||||
|
||||
const transformVText = (dir, node, context) => {
|
||||
const { exp, loc } = dir;
|
||||
if (!exp) {
|
||||
context.onError(
|
||||
createDOMCompilerError(55, loc)
|
||||
);
|
||||
}
|
||||
if (node.children.length) {
|
||||
context.onError(
|
||||
createDOMCompilerError(56, loc)
|
||||
);
|
||||
node.children.length = 0;
|
||||
}
|
||||
return {
|
||||
props: [
|
||||
compilerCore.createObjectProperty(
|
||||
compilerCore.createSimpleExpression(`textContent`, true),
|
||||
exp ? compilerCore.getConstantType(exp, context) > 0 ? exp : compilerCore.createCallExpression(
|
||||
context.helperString(compilerCore.TO_DISPLAY_STRING),
|
||||
[exp],
|
||||
loc
|
||||
) : compilerCore.createSimpleExpression("", true)
|
||||
)
|
||||
]
|
||||
};
|
||||
};
|
||||
|
||||
const transformModel = (dir, node, context) => {
|
||||
const baseResult = compilerCore.transformModel(dir, node, context);
|
||||
if (!baseResult.props.length || node.tagType === 1) {
|
||||
return baseResult;
|
||||
}
|
||||
if (dir.arg) {
|
||||
context.onError(
|
||||
createDOMCompilerError(
|
||||
58,
|
||||
dir.arg.loc
|
||||
)
|
||||
);
|
||||
}
|
||||
const { tag } = node;
|
||||
const isCustomElement = context.isCustomElement(tag);
|
||||
if (tag === "input" || tag === "textarea" || tag === "select" || isCustomElement) {
|
||||
let directiveToUse = V_MODEL_TEXT;
|
||||
let isInvalidType = false;
|
||||
if (tag === "input" || isCustomElement) {
|
||||
const type = compilerCore.findProp(node, `type`);
|
||||
if (type) {
|
||||
if (type.type === 7) {
|
||||
directiveToUse = V_MODEL_DYNAMIC;
|
||||
} else if (type.value) {
|
||||
switch (type.value.content) {
|
||||
case "radio":
|
||||
directiveToUse = V_MODEL_RADIO;
|
||||
break;
|
||||
case "checkbox":
|
||||
directiveToUse = V_MODEL_CHECKBOX;
|
||||
break;
|
||||
case "file":
|
||||
isInvalidType = true;
|
||||
context.onError(
|
||||
createDOMCompilerError(
|
||||
59,
|
||||
dir.loc
|
||||
)
|
||||
);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if (compilerCore.hasDynamicKeyVBind(node)) {
|
||||
directiveToUse = V_MODEL_DYNAMIC;
|
||||
} else ;
|
||||
} else if (tag === "select") {
|
||||
directiveToUse = V_MODEL_SELECT;
|
||||
} else ;
|
||||
if (!isInvalidType) {
|
||||
baseResult.needRuntime = context.helper(directiveToUse);
|
||||
}
|
||||
} else {
|
||||
context.onError(
|
||||
createDOMCompilerError(
|
||||
57,
|
||||
dir.loc
|
||||
)
|
||||
);
|
||||
}
|
||||
baseResult.props = baseResult.props.filter(
|
||||
(p) => !(p.key.type === 4 && p.key.content === "modelValue")
|
||||
);
|
||||
return baseResult;
|
||||
};
|
||||
|
||||
const isEventOptionModifier = /* @__PURE__ */ shared.makeMap(`passive,once,capture`);
|
||||
const isNonKeyModifier = /* @__PURE__ */ shared.makeMap(
|
||||
// event propagation management
|
||||
`stop,prevent,self,ctrl,shift,alt,meta,exact,middle`
|
||||
);
|
||||
const maybeKeyModifier = /* @__PURE__ */ shared.makeMap("left,right");
|
||||
const isKeyboardEvent = /* @__PURE__ */ shared.makeMap(
|
||||
`onkeyup,onkeydown,onkeypress`,
|
||||
true
|
||||
);
|
||||
const resolveModifiers = (key, modifiers, context, loc) => {
|
||||
const keyModifiers = [];
|
||||
const nonKeyModifiers = [];
|
||||
const eventOptionModifiers = [];
|
||||
for (let i = 0; i < modifiers.length; i++) {
|
||||
const modifier = modifiers[i];
|
||||
if (modifier === "native" && compilerCore.checkCompatEnabled(
|
||||
"COMPILER_V_ON_NATIVE",
|
||||
context,
|
||||
loc
|
||||
)) {
|
||||
eventOptionModifiers.push(modifier);
|
||||
} else if (isEventOptionModifier(modifier)) {
|
||||
eventOptionModifiers.push(modifier);
|
||||
} else {
|
||||
if (maybeKeyModifier(modifier)) {
|
||||
if (compilerCore.isStaticExp(key)) {
|
||||
if (isKeyboardEvent(key.content)) {
|
||||
keyModifiers.push(modifier);
|
||||
} else {
|
||||
nonKeyModifiers.push(modifier);
|
||||
}
|
||||
} else {
|
||||
keyModifiers.push(modifier);
|
||||
nonKeyModifiers.push(modifier);
|
||||
}
|
||||
} else {
|
||||
if (isNonKeyModifier(modifier)) {
|
||||
nonKeyModifiers.push(modifier);
|
||||
} else {
|
||||
keyModifiers.push(modifier);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return {
|
||||
keyModifiers,
|
||||
nonKeyModifiers,
|
||||
eventOptionModifiers
|
||||
};
|
||||
};
|
||||
const transformClick = (key, event) => {
|
||||
const isStaticClick = compilerCore.isStaticExp(key) && key.content.toLowerCase() === "onclick";
|
||||
return isStaticClick ? compilerCore.createSimpleExpression(event, true) : key.type !== 4 ? compilerCore.createCompoundExpression([
|
||||
`(`,
|
||||
key,
|
||||
`) === "onClick" ? "${event}" : (`,
|
||||
key,
|
||||
`)`
|
||||
]) : key;
|
||||
};
|
||||
const transformOn = (dir, node, context) => {
|
||||
return compilerCore.transformOn(dir, node, context, (baseResult) => {
|
||||
const { modifiers } = dir;
|
||||
if (!modifiers.length)
|
||||
return baseResult;
|
||||
let { key, value: handlerExp } = baseResult.props[0];
|
||||
const { keyModifiers, nonKeyModifiers, eventOptionModifiers } = resolveModifiers(key, modifiers, context, dir.loc);
|
||||
if (nonKeyModifiers.includes("right")) {
|
||||
key = transformClick(key, `onContextmenu`);
|
||||
}
|
||||
if (nonKeyModifiers.includes("middle")) {
|
||||
key = transformClick(key, `onMouseup`);
|
||||
}
|
||||
if (nonKeyModifiers.length) {
|
||||
handlerExp = compilerCore.createCallExpression(context.helper(V_ON_WITH_MODIFIERS), [
|
||||
handlerExp,
|
||||
JSON.stringify(nonKeyModifiers)
|
||||
]);
|
||||
}
|
||||
if (keyModifiers.length && // if event name is dynamic, always wrap with keys guard
|
||||
(!compilerCore.isStaticExp(key) || isKeyboardEvent(key.content))) {
|
||||
handlerExp = compilerCore.createCallExpression(context.helper(V_ON_WITH_KEYS), [
|
||||
handlerExp,
|
||||
JSON.stringify(keyModifiers)
|
||||
]);
|
||||
}
|
||||
if (eventOptionModifiers.length) {
|
||||
const modifierPostfix = eventOptionModifiers.map(shared.capitalize).join("");
|
||||
key = compilerCore.isStaticExp(key) ? compilerCore.createSimpleExpression(`${key.content}${modifierPostfix}`, true) : compilerCore.createCompoundExpression([`(`, key, `) + "${modifierPostfix}"`]);
|
||||
}
|
||||
return {
|
||||
props: [compilerCore.createObjectProperty(key, handlerExp)]
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
const transformShow = (dir, node, context) => {
|
||||
const { exp, loc } = dir;
|
||||
if (!exp) {
|
||||
context.onError(
|
||||
createDOMCompilerError(61, loc)
|
||||
);
|
||||
}
|
||||
return {
|
||||
props: [],
|
||||
needRuntime: context.helper(V_SHOW)
|
||||
};
|
||||
};
|
||||
|
||||
const expReplaceRE = /__VUE_EXP_START__(.*?)__VUE_EXP_END__/g;
|
||||
const stringifyStatic = (children, context, parent) => {
|
||||
if (context.scopes.vSlot > 0) {
|
||||
return;
|
||||
}
|
||||
let nc = 0;
|
||||
let ec = 0;
|
||||
const currentChunk = [];
|
||||
const stringifyCurrentChunk = (currentIndex) => {
|
||||
if (nc >= 20 || ec >= 5) {
|
||||
const staticCall = compilerCore.createCallExpression(context.helper(compilerCore.CREATE_STATIC), [
|
||||
JSON.stringify(
|
||||
currentChunk.map((node) => stringifyNode(node, context)).join("")
|
||||
).replace(expReplaceRE, `" + $1 + "`),
|
||||
// the 2nd argument indicates the number of DOM nodes this static vnode
|
||||
// will insert / hydrate
|
||||
String(currentChunk.length)
|
||||
]);
|
||||
replaceHoist(currentChunk[0], staticCall, context);
|
||||
if (currentChunk.length > 1) {
|
||||
for (let i2 = 1; i2 < currentChunk.length; i2++) {
|
||||
replaceHoist(currentChunk[i2], null, context);
|
||||
}
|
||||
const deleteCount = currentChunk.length - 1;
|
||||
children.splice(currentIndex - currentChunk.length + 1, deleteCount);
|
||||
return deleteCount;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
};
|
||||
let i = 0;
|
||||
for (; i < children.length; i++) {
|
||||
const child = children[i];
|
||||
const hoisted = getHoistedNode(child);
|
||||
if (hoisted) {
|
||||
const node = child;
|
||||
const result = analyzeNode(node);
|
||||
if (result) {
|
||||
nc += result[0];
|
||||
ec += result[1];
|
||||
currentChunk.push(node);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
i -= stringifyCurrentChunk(i);
|
||||
nc = 0;
|
||||
ec = 0;
|
||||
currentChunk.length = 0;
|
||||
}
|
||||
stringifyCurrentChunk(i);
|
||||
};
|
||||
const getHoistedNode = (node) => (node.type === 1 && node.tagType === 0 || node.type == 12) && node.codegenNode && node.codegenNode.type === 4 && node.codegenNode.hoisted;
|
||||
const dataAriaRE = /^(data|aria)-/;
|
||||
const isStringifiableAttr = (name, ns) => {
|
||||
return (ns === 0 ? shared.isKnownHtmlAttr(name) : ns === 1 ? shared.isKnownSvgAttr(name) : false) || dataAriaRE.test(name);
|
||||
};
|
||||
const replaceHoist = (node, replacement, context) => {
|
||||
const hoistToReplace = node.codegenNode.hoisted;
|
||||
context.hoists[context.hoists.indexOf(hoistToReplace)] = replacement;
|
||||
};
|
||||
const isNonStringifiable = /* @__PURE__ */ shared.makeMap(
|
||||
`caption,thead,tr,th,tbody,td,tfoot,colgroup,col`
|
||||
);
|
||||
function analyzeNode(node) {
|
||||
if (node.type === 1 && isNonStringifiable(node.tag)) {
|
||||
return false;
|
||||
}
|
||||
if (node.type === 12) {
|
||||
return [1, 0];
|
||||
}
|
||||
let nc = 1;
|
||||
let ec = node.props.length > 0 ? 1 : 0;
|
||||
let bailed = false;
|
||||
const bail = () => {
|
||||
bailed = true;
|
||||
return false;
|
||||
};
|
||||
function walk(node2) {
|
||||
for (let i = 0; i < node2.props.length; i++) {
|
||||
const p = node2.props[i];
|
||||
if (p.type === 6 && !isStringifiableAttr(p.name, node2.ns)) {
|
||||
return bail();
|
||||
}
|
||||
if (p.type === 7 && p.name === "bind") {
|
||||
if (p.arg && (p.arg.type === 8 || p.arg.isStatic && !isStringifiableAttr(p.arg.content, node2.ns))) {
|
||||
return bail();
|
||||
}
|
||||
if (p.exp && (p.exp.type === 8 || p.exp.constType < 3)) {
|
||||
return bail();
|
||||
}
|
||||
}
|
||||
}
|
||||
for (let i = 0; i < node2.children.length; i++) {
|
||||
nc++;
|
||||
const child = node2.children[i];
|
||||
if (child.type === 1) {
|
||||
if (child.props.length > 0) {
|
||||
ec++;
|
||||
}
|
||||
walk(child);
|
||||
if (bailed) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return walk(node) ? [nc, ec] : false;
|
||||
}
|
||||
function stringifyNode(node, context) {
|
||||
if (shared.isString(node)) {
|
||||
return node;
|
||||
}
|
||||
if (shared.isSymbol(node)) {
|
||||
return ``;
|
||||
}
|
||||
switch (node.type) {
|
||||
case 1:
|
||||
return stringifyElement(node, context);
|
||||
case 2:
|
||||
return shared.escapeHtml(node.content);
|
||||
case 3:
|
||||
return `<!--${shared.escapeHtml(node.content)}-->`;
|
||||
case 5:
|
||||
return shared.escapeHtml(shared.toDisplayString(evaluateConstant(node.content)));
|
||||
case 8:
|
||||
return shared.escapeHtml(evaluateConstant(node));
|
||||
case 12:
|
||||
return stringifyNode(node.content, context);
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
}
|
||||
function stringifyElement(node, context) {
|
||||
let res = `<${node.tag}`;
|
||||
let innerHTML = "";
|
||||
for (let i = 0; i < node.props.length; i++) {
|
||||
const p = node.props[i];
|
||||
if (p.type === 6) {
|
||||
res += ` ${p.name}`;
|
||||
if (p.value) {
|
||||
res += `="${shared.escapeHtml(p.value.content)}"`;
|
||||
}
|
||||
} else if (p.type === 7) {
|
||||
if (p.name === "bind") {
|
||||
const exp = p.exp;
|
||||
if (exp.content[0] === "_") {
|
||||
res += ` ${p.arg.content}="__VUE_EXP_START__${exp.content}__VUE_EXP_END__"`;
|
||||
continue;
|
||||
}
|
||||
if (shared.isBooleanAttr(p.arg.content) && exp.content === "false") {
|
||||
continue;
|
||||
}
|
||||
let evaluated = evaluateConstant(exp);
|
||||
if (evaluated != null) {
|
||||
const arg = p.arg && p.arg.content;
|
||||
if (arg === "class") {
|
||||
evaluated = shared.normalizeClass(evaluated);
|
||||
} else if (arg === "style") {
|
||||
evaluated = shared.stringifyStyle(shared.normalizeStyle(evaluated));
|
||||
}
|
||||
res += ` ${p.arg.content}="${shared.escapeHtml(
|
||||
evaluated
|
||||
)}"`;
|
||||
}
|
||||
} else if (p.name === "html") {
|
||||
innerHTML = evaluateConstant(p.exp);
|
||||
} else if (p.name === "text") {
|
||||
innerHTML = shared.escapeHtml(
|
||||
shared.toDisplayString(evaluateConstant(p.exp))
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (context.scopeId) {
|
||||
res += ` ${context.scopeId}`;
|
||||
}
|
||||
res += `>`;
|
||||
if (innerHTML) {
|
||||
res += innerHTML;
|
||||
} else {
|
||||
for (let i = 0; i < node.children.length; i++) {
|
||||
res += stringifyNode(node.children[i], context);
|
||||
}
|
||||
}
|
||||
if (!shared.isVoidTag(node.tag)) {
|
||||
res += `</${node.tag}>`;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
function evaluateConstant(exp) {
|
||||
if (exp.type === 4) {
|
||||
return new Function(`return (${exp.content})`)();
|
||||
} else {
|
||||
let res = ``;
|
||||
exp.children.forEach((c) => {
|
||||
if (shared.isString(c) || shared.isSymbol(c)) {
|
||||
return;
|
||||
}
|
||||
if (c.type === 2) {
|
||||
res += c.content;
|
||||
} else if (c.type === 5) {
|
||||
res += shared.toDisplayString(evaluateConstant(c.content));
|
||||
} else {
|
||||
res += evaluateConstant(c);
|
||||
}
|
||||
});
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
const ignoreSideEffectTags = (node, context) => {
|
||||
if (node.type === 1 && node.tagType === 0 && (node.tag === "script" || node.tag === "style")) {
|
||||
context.removeNode();
|
||||
}
|
||||
};
|
||||
|
||||
const DOMNodeTransforms = [
|
||||
transformStyle,
|
||||
...[]
|
||||
];
|
||||
const DOMDirectiveTransforms = {
|
||||
cloak: compilerCore.noopDirectiveTransform,
|
||||
html: transformVHtml,
|
||||
text: transformVText,
|
||||
model: transformModel,
|
||||
// override compiler-core
|
||||
on: transformOn,
|
||||
// override compiler-core
|
||||
show: transformShow
|
||||
};
|
||||
function compile(src, options = {}) {
|
||||
return compilerCore.baseCompile(
|
||||
src,
|
||||
shared.extend({}, parserOptions, options, {
|
||||
nodeTransforms: [
|
||||
// ignore <script> and <tag>
|
||||
// this is not put inside DOMNodeTransforms because that list is used
|
||||
// by compiler-ssr to generate vnode fallback branches
|
||||
ignoreSideEffectTags,
|
||||
...DOMNodeTransforms,
|
||||
...options.nodeTransforms || []
|
||||
],
|
||||
directiveTransforms: shared.extend(
|
||||
{},
|
||||
DOMDirectiveTransforms,
|
||||
options.directiveTransforms || {}
|
||||
),
|
||||
transformHoist: stringifyStatic
|
||||
})
|
||||
);
|
||||
}
|
||||
function parse(template, options = {}) {
|
||||
return compilerCore.baseParse(template, shared.extend({}, parserOptions, options));
|
||||
}
|
||||
|
||||
exports.DOMDirectiveTransforms = DOMDirectiveTransforms;
|
||||
exports.DOMErrorCodes = DOMErrorCodes;
|
||||
exports.DOMErrorMessages = DOMErrorMessages;
|
||||
exports.DOMNodeTransforms = DOMNodeTransforms;
|
||||
exports.TRANSITION = TRANSITION;
|
||||
exports.TRANSITION_GROUP = TRANSITION_GROUP;
|
||||
exports.V_MODEL_CHECKBOX = V_MODEL_CHECKBOX;
|
||||
exports.V_MODEL_DYNAMIC = V_MODEL_DYNAMIC;
|
||||
exports.V_MODEL_RADIO = V_MODEL_RADIO;
|
||||
exports.V_MODEL_SELECT = V_MODEL_SELECT;
|
||||
exports.V_MODEL_TEXT = V_MODEL_TEXT;
|
||||
exports.V_ON_WITH_KEYS = V_ON_WITH_KEYS;
|
||||
exports.V_ON_WITH_MODIFIERS = V_ON_WITH_MODIFIERS;
|
||||
exports.V_SHOW = V_SHOW;
|
||||
exports.compile = compile;
|
||||
exports.createDOMCompilerError = createDOMCompilerError;
|
||||
exports.parse = parse;
|
||||
exports.parserOptions = parserOptions;
|
||||
exports.transformStyle = transformStyle;
|
||||
Object.keys(compilerCore).forEach(function (k) {
|
||||
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) exports[k] = compilerCore[k];
|
||||
});
|
45
node_modules/@vue/compiler-dom/dist/compiler-dom.d.ts
generated
vendored
Normal file
45
node_modules/@vue/compiler-dom/dist/compiler-dom.d.ts
generated
vendored
Normal file
@ -0,0 +1,45 @@
|
||||
import { ParserOptions, NodeTransform, SourceLocation, CompilerError, DirectiveTransform, RootNode, CompilerOptions, CodegenResult } from '@vue/compiler-core';
|
||||
export * from '@vue/compiler-core';
|
||||
|
||||
export declare const parserOptions: ParserOptions;
|
||||
|
||||
export declare const V_MODEL_RADIO: unique symbol;
|
||||
export declare const V_MODEL_CHECKBOX: unique symbol;
|
||||
export declare const V_MODEL_TEXT: unique symbol;
|
||||
export declare const V_MODEL_SELECT: unique symbol;
|
||||
export declare const V_MODEL_DYNAMIC: unique symbol;
|
||||
export declare const V_ON_WITH_MODIFIERS: unique symbol;
|
||||
export declare const V_ON_WITH_KEYS: unique symbol;
|
||||
export declare const V_SHOW: unique symbol;
|
||||
export declare const TRANSITION: unique symbol;
|
||||
export declare const TRANSITION_GROUP: unique symbol;
|
||||
|
||||
export declare const transformStyle: NodeTransform;
|
||||
|
||||
interface DOMCompilerError extends CompilerError {
|
||||
code: DOMErrorCodes;
|
||||
}
|
||||
export declare function createDOMCompilerError(code: DOMErrorCodes, loc?: SourceLocation): DOMCompilerError;
|
||||
export declare enum DOMErrorCodes {
|
||||
X_V_HTML_NO_EXPRESSION = 53,
|
||||
X_V_HTML_WITH_CHILDREN = 54,
|
||||
X_V_TEXT_NO_EXPRESSION = 55,
|
||||
X_V_TEXT_WITH_CHILDREN = 56,
|
||||
X_V_MODEL_ON_INVALID_ELEMENT = 57,
|
||||
X_V_MODEL_ARG_ON_ELEMENT = 58,
|
||||
X_V_MODEL_ON_FILE_INPUT_ELEMENT = 59,
|
||||
X_V_MODEL_UNNECESSARY_VALUE = 60,
|
||||
X_V_SHOW_NO_EXPRESSION = 61,
|
||||
X_TRANSITION_INVALID_CHILDREN = 62,
|
||||
X_IGNORED_SIDE_EFFECT_TAG = 63,
|
||||
__EXTEND_POINT__ = 64
|
||||
}
|
||||
export declare const DOMErrorMessages: {
|
||||
[code: number]: string;
|
||||
};
|
||||
|
||||
export declare const DOMNodeTransforms: NodeTransform[];
|
||||
export declare const DOMDirectiveTransforms: Record<string, DirectiveTransform>;
|
||||
export declare function compile(src: string | RootNode, options?: CompilerOptions): CodegenResult;
|
||||
export declare function parse(template: string, options?: ParserOptions): RootNode;
|
||||
|
6278
node_modules/@vue/compiler-dom/dist/compiler-dom.esm-browser.js
generated
vendored
Normal file
6278
node_modules/@vue/compiler-dom/dist/compiler-dom.esm-browser.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
6
node_modules/@vue/compiler-dom/dist/compiler-dom.esm-browser.prod.js
generated
vendored
Normal file
6
node_modules/@vue/compiler-dom/dist/compiler-dom.esm-browser.prod.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
506
node_modules/@vue/compiler-dom/dist/compiler-dom.esm-bundler.js
generated
vendored
Normal file
506
node_modules/@vue/compiler-dom/dist/compiler-dom.esm-bundler.js
generated
vendored
Normal file
@ -0,0 +1,506 @@
|
||||
/**
|
||||
* @vue/compiler-dom v3.4.15
|
||||
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
||||
* @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';
|
||||
export * from '@vue/compiler-core';
|
||||
import { isVoidTag, isHTMLTag, isSVGTag, isMathMLTag, parseStringStyle, capitalize, makeMap, extend } from '@vue/shared';
|
||||
|
||||
const V_MODEL_RADIO = Symbol(!!(process.env.NODE_ENV !== "production") ? `vModelRadio` : ``);
|
||||
const V_MODEL_CHECKBOX = Symbol(!!(process.env.NODE_ENV !== "production") ? `vModelCheckbox` : ``);
|
||||
const V_MODEL_TEXT = Symbol(!!(process.env.NODE_ENV !== "production") ? `vModelText` : ``);
|
||||
const V_MODEL_SELECT = Symbol(!!(process.env.NODE_ENV !== "production") ? `vModelSelect` : ``);
|
||||
const V_MODEL_DYNAMIC = Symbol(!!(process.env.NODE_ENV !== "production") ? `vModelDynamic` : ``);
|
||||
const V_ON_WITH_MODIFIERS = Symbol(!!(process.env.NODE_ENV !== "production") ? `vOnModifiersGuard` : ``);
|
||||
const V_ON_WITH_KEYS = Symbol(!!(process.env.NODE_ENV !== "production") ? `vOnKeysGuard` : ``);
|
||||
const V_SHOW = Symbol(!!(process.env.NODE_ENV !== "production") ? `vShow` : ``);
|
||||
const TRANSITION = Symbol(!!(process.env.NODE_ENV !== "production") ? `Transition` : ``);
|
||||
const TRANSITION_GROUP = Symbol(!!(process.env.NODE_ENV !== "production") ? `TransitionGroup` : ``);
|
||||
registerRuntimeHelpers({
|
||||
[V_MODEL_RADIO]: `vModelRadio`,
|
||||
[V_MODEL_CHECKBOX]: `vModelCheckbox`,
|
||||
[V_MODEL_TEXT]: `vModelText`,
|
||||
[V_MODEL_SELECT]: `vModelSelect`,
|
||||
[V_MODEL_DYNAMIC]: `vModelDynamic`,
|
||||
[V_ON_WITH_MODIFIERS]: `withModifiers`,
|
||||
[V_ON_WITH_KEYS]: `withKeys`,
|
||||
[V_SHOW]: `vShow`,
|
||||
[TRANSITION]: `Transition`,
|
||||
[TRANSITION_GROUP]: `TransitionGroup`
|
||||
});
|
||||
|
||||
let decoder;
|
||||
function decodeHtmlBrowser(raw, asAttr = false) {
|
||||
if (!decoder) {
|
||||
decoder = document.createElement("div");
|
||||
}
|
||||
if (asAttr) {
|
||||
decoder.innerHTML = `<div foo="${raw.replace(/"/g, """)}">`;
|
||||
return decoder.children[0].getAttribute("foo");
|
||||
} else {
|
||||
decoder.innerHTML = raw;
|
||||
return decoder.textContent;
|
||||
}
|
||||
}
|
||||
|
||||
const parserOptions = {
|
||||
parseMode: "html",
|
||||
isVoidTag,
|
||||
isNativeTag: (tag) => isHTMLTag(tag) || isSVGTag(tag) || isMathMLTag(tag),
|
||||
isPreTag: (tag) => tag === "pre",
|
||||
decodeEntities: decodeHtmlBrowser ,
|
||||
isBuiltInComponent: (tag) => {
|
||||
if (tag === "Transition" || tag === "transition") {
|
||||
return TRANSITION;
|
||||
} else if (tag === "TransitionGroup" || tag === "transition-group") {
|
||||
return TRANSITION_GROUP;
|
||||
}
|
||||
},
|
||||
// https://html.spec.whatwg.org/multipage/parsing.html#tree-construction-dispatcher
|
||||
getNamespace(tag, parent, rootNamespace) {
|
||||
let ns = parent ? parent.ns : rootNamespace;
|
||||
if (parent && ns === 2) {
|
||||
if (parent.tag === "annotation-xml") {
|
||||
if (tag === "svg") {
|
||||
return 1;
|
||||
}
|
||||
if (parent.props.some(
|
||||
(a) => a.type === 6 && a.name === "encoding" && a.value != null && (a.value.content === "text/html" || a.value.content === "application/xhtml+xml")
|
||||
)) {
|
||||
ns = 0;
|
||||
}
|
||||
} else if (/^m(?:[ions]|text)$/.test(parent.tag) && tag !== "mglyph" && tag !== "malignmark") {
|
||||
ns = 0;
|
||||
}
|
||||
} else if (parent && ns === 1) {
|
||||
if (parent.tag === "foreignObject" || parent.tag === "desc" || parent.tag === "title") {
|
||||
ns = 0;
|
||||
}
|
||||
}
|
||||
if (ns === 0) {
|
||||
if (tag === "svg") {
|
||||
return 1;
|
||||
}
|
||||
if (tag === "math") {
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
return ns;
|
||||
}
|
||||
};
|
||||
|
||||
const transformStyle = (node) => {
|
||||
if (node.type === 1) {
|
||||
node.props.forEach((p, i) => {
|
||||
if (p.type === 6 && p.name === "style" && p.value) {
|
||||
node.props[i] = {
|
||||
type: 7,
|
||||
name: `bind`,
|
||||
arg: createSimpleExpression(`style`, true, p.loc),
|
||||
exp: parseInlineCSS(p.value.content, p.loc),
|
||||
modifiers: [],
|
||||
loc: p.loc
|
||||
};
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
const parseInlineCSS = (cssText, loc) => {
|
||||
const normalized = parseStringStyle(cssText);
|
||||
return createSimpleExpression(
|
||||
JSON.stringify(normalized),
|
||||
false,
|
||||
loc,
|
||||
3
|
||||
);
|
||||
};
|
||||
|
||||
function createDOMCompilerError(code, loc) {
|
||||
return createCompilerError(
|
||||
code,
|
||||
loc,
|
||||
!!(process.env.NODE_ENV !== "production") || false ? DOMErrorMessages : void 0
|
||||
);
|
||||
}
|
||||
const DOMErrorCodes = {
|
||||
"X_V_HTML_NO_EXPRESSION": 53,
|
||||
"53": "X_V_HTML_NO_EXPRESSION",
|
||||
"X_V_HTML_WITH_CHILDREN": 54,
|
||||
"54": "X_V_HTML_WITH_CHILDREN",
|
||||
"X_V_TEXT_NO_EXPRESSION": 55,
|
||||
"55": "X_V_TEXT_NO_EXPRESSION",
|
||||
"X_V_TEXT_WITH_CHILDREN": 56,
|
||||
"56": "X_V_TEXT_WITH_CHILDREN",
|
||||
"X_V_MODEL_ON_INVALID_ELEMENT": 57,
|
||||
"57": "X_V_MODEL_ON_INVALID_ELEMENT",
|
||||
"X_V_MODEL_ARG_ON_ELEMENT": 58,
|
||||
"58": "X_V_MODEL_ARG_ON_ELEMENT",
|
||||
"X_V_MODEL_ON_FILE_INPUT_ELEMENT": 59,
|
||||
"59": "X_V_MODEL_ON_FILE_INPUT_ELEMENT",
|
||||
"X_V_MODEL_UNNECESSARY_VALUE": 60,
|
||||
"60": "X_V_MODEL_UNNECESSARY_VALUE",
|
||||
"X_V_SHOW_NO_EXPRESSION": 61,
|
||||
"61": "X_V_SHOW_NO_EXPRESSION",
|
||||
"X_TRANSITION_INVALID_CHILDREN": 62,
|
||||
"62": "X_TRANSITION_INVALID_CHILDREN",
|
||||
"X_IGNORED_SIDE_EFFECT_TAG": 63,
|
||||
"63": "X_IGNORED_SIDE_EFFECT_TAG",
|
||||
"__EXTEND_POINT__": 64,
|
||||
"64": "__EXTEND_POINT__"
|
||||
};
|
||||
const DOMErrorMessages = {
|
||||
[53]: `v-html is missing expression.`,
|
||||
[54]: `v-html will override element children.`,
|
||||
[55]: `v-text is missing expression.`,
|
||||
[56]: `v-text will override element children.`,
|
||||
[57]: `v-model can only be used on <input>, <textarea> and <select> elements.`,
|
||||
[58]: `v-model argument is not supported on plain elements.`,
|
||||
[59]: `v-model cannot be used on file inputs since they are read-only. Use a v-on:change listener instead.`,
|
||||
[60]: `Unnecessary value binding used alongside v-model. It will interfere with v-model's behavior.`,
|
||||
[61]: `v-show is missing expression.`,
|
||||
[62]: `<Transition> expects exactly one child element or component.`,
|
||||
[63]: `Tags with side effect (<script> and <style>) are ignored in client component templates.`
|
||||
};
|
||||
|
||||
const transformVHtml = (dir, node, context) => {
|
||||
const { exp, loc } = dir;
|
||||
if (!exp) {
|
||||
context.onError(
|
||||
createDOMCompilerError(53, loc)
|
||||
);
|
||||
}
|
||||
if (node.children.length) {
|
||||
context.onError(
|
||||
createDOMCompilerError(54, loc)
|
||||
);
|
||||
node.children.length = 0;
|
||||
}
|
||||
return {
|
||||
props: [
|
||||
createObjectProperty(
|
||||
createSimpleExpression(`innerHTML`, true, loc),
|
||||
exp || createSimpleExpression("", true)
|
||||
)
|
||||
]
|
||||
};
|
||||
};
|
||||
|
||||
const transformVText = (dir, node, context) => {
|
||||
const { exp, loc } = dir;
|
||||
if (!exp) {
|
||||
context.onError(
|
||||
createDOMCompilerError(55, loc)
|
||||
);
|
||||
}
|
||||
if (node.children.length) {
|
||||
context.onError(
|
||||
createDOMCompilerError(56, loc)
|
||||
);
|
||||
node.children.length = 0;
|
||||
}
|
||||
return {
|
||||
props: [
|
||||
createObjectProperty(
|
||||
createSimpleExpression(`textContent`, true),
|
||||
exp ? getConstantType(exp, context) > 0 ? exp : createCallExpression(
|
||||
context.helperString(TO_DISPLAY_STRING),
|
||||
[exp],
|
||||
loc
|
||||
) : createSimpleExpression("", true)
|
||||
)
|
||||
]
|
||||
};
|
||||
};
|
||||
|
||||
const transformModel = (dir, node, context) => {
|
||||
const baseResult = transformModel$1(dir, node, context);
|
||||
if (!baseResult.props.length || node.tagType === 1) {
|
||||
return baseResult;
|
||||
}
|
||||
if (dir.arg) {
|
||||
context.onError(
|
||||
createDOMCompilerError(
|
||||
58,
|
||||
dir.arg.loc
|
||||
)
|
||||
);
|
||||
}
|
||||
function checkDuplicatedValue() {
|
||||
const value = findDir(node, "bind");
|
||||
if (value && isStaticArgOf(value.arg, "value")) {
|
||||
context.onError(
|
||||
createDOMCompilerError(
|
||||
60,
|
||||
value.loc
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
const { tag } = node;
|
||||
const isCustomElement = context.isCustomElement(tag);
|
||||
if (tag === "input" || tag === "textarea" || tag === "select" || isCustomElement) {
|
||||
let directiveToUse = V_MODEL_TEXT;
|
||||
let isInvalidType = false;
|
||||
if (tag === "input" || isCustomElement) {
|
||||
const type = findProp(node, `type`);
|
||||
if (type) {
|
||||
if (type.type === 7) {
|
||||
directiveToUse = V_MODEL_DYNAMIC;
|
||||
} else if (type.value) {
|
||||
switch (type.value.content) {
|
||||
case "radio":
|
||||
directiveToUse = V_MODEL_RADIO;
|
||||
break;
|
||||
case "checkbox":
|
||||
directiveToUse = V_MODEL_CHECKBOX;
|
||||
break;
|
||||
case "file":
|
||||
isInvalidType = true;
|
||||
context.onError(
|
||||
createDOMCompilerError(
|
||||
59,
|
||||
dir.loc
|
||||
)
|
||||
);
|
||||
break;
|
||||
default:
|
||||
!!(process.env.NODE_ENV !== "production") && checkDuplicatedValue();
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if (hasDynamicKeyVBind(node)) {
|
||||
directiveToUse = V_MODEL_DYNAMIC;
|
||||
} else {
|
||||
!!(process.env.NODE_ENV !== "production") && checkDuplicatedValue();
|
||||
}
|
||||
} else if (tag === "select") {
|
||||
directiveToUse = V_MODEL_SELECT;
|
||||
} else {
|
||||
!!(process.env.NODE_ENV !== "production") && checkDuplicatedValue();
|
||||
}
|
||||
if (!isInvalidType) {
|
||||
baseResult.needRuntime = context.helper(directiveToUse);
|
||||
}
|
||||
} else {
|
||||
context.onError(
|
||||
createDOMCompilerError(
|
||||
57,
|
||||
dir.loc
|
||||
)
|
||||
);
|
||||
}
|
||||
baseResult.props = baseResult.props.filter(
|
||||
(p) => !(p.key.type === 4 && p.key.content === "modelValue")
|
||||
);
|
||||
return baseResult;
|
||||
};
|
||||
|
||||
const isEventOptionModifier = /* @__PURE__ */ makeMap(`passive,once,capture`);
|
||||
const isNonKeyModifier = /* @__PURE__ */ makeMap(
|
||||
// event propagation management
|
||||
`stop,prevent,self,ctrl,shift,alt,meta,exact,middle`
|
||||
);
|
||||
const maybeKeyModifier = /* @__PURE__ */ makeMap("left,right");
|
||||
const isKeyboardEvent = /* @__PURE__ */ makeMap(
|
||||
`onkeyup,onkeydown,onkeypress`,
|
||||
true
|
||||
);
|
||||
const resolveModifiers = (key, modifiers, context, loc) => {
|
||||
const keyModifiers = [];
|
||||
const nonKeyModifiers = [];
|
||||
const eventOptionModifiers = [];
|
||||
for (let i = 0; i < modifiers.length; i++) {
|
||||
const modifier = modifiers[i];
|
||||
if (modifier === "native" && checkCompatEnabled(
|
||||
"COMPILER_V_ON_NATIVE",
|
||||
context,
|
||||
loc
|
||||
)) {
|
||||
eventOptionModifiers.push(modifier);
|
||||
} else if (isEventOptionModifier(modifier)) {
|
||||
eventOptionModifiers.push(modifier);
|
||||
} else {
|
||||
if (maybeKeyModifier(modifier)) {
|
||||
if (isStaticExp(key)) {
|
||||
if (isKeyboardEvent(key.content)) {
|
||||
keyModifiers.push(modifier);
|
||||
} else {
|
||||
nonKeyModifiers.push(modifier);
|
||||
}
|
||||
} else {
|
||||
keyModifiers.push(modifier);
|
||||
nonKeyModifiers.push(modifier);
|
||||
}
|
||||
} else {
|
||||
if (isNonKeyModifier(modifier)) {
|
||||
nonKeyModifiers.push(modifier);
|
||||
} else {
|
||||
keyModifiers.push(modifier);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return {
|
||||
keyModifiers,
|
||||
nonKeyModifiers,
|
||||
eventOptionModifiers
|
||||
};
|
||||
};
|
||||
const transformClick = (key, event) => {
|
||||
const isStaticClick = isStaticExp(key) && key.content.toLowerCase() === "onclick";
|
||||
return isStaticClick ? createSimpleExpression(event, true) : key.type !== 4 ? createCompoundExpression([
|
||||
`(`,
|
||||
key,
|
||||
`) === "onClick" ? "${event}" : (`,
|
||||
key,
|
||||
`)`
|
||||
]) : key;
|
||||
};
|
||||
const transformOn = (dir, node, context) => {
|
||||
return transformOn$1(dir, node, context, (baseResult) => {
|
||||
const { modifiers } = dir;
|
||||
if (!modifiers.length)
|
||||
return baseResult;
|
||||
let { key, value: handlerExp } = baseResult.props[0];
|
||||
const { keyModifiers, nonKeyModifiers, eventOptionModifiers } = resolveModifiers(key, modifiers, context, dir.loc);
|
||||
if (nonKeyModifiers.includes("right")) {
|
||||
key = transformClick(key, `onContextmenu`);
|
||||
}
|
||||
if (nonKeyModifiers.includes("middle")) {
|
||||
key = transformClick(key, `onMouseup`);
|
||||
}
|
||||
if (nonKeyModifiers.length) {
|
||||
handlerExp = createCallExpression(context.helper(V_ON_WITH_MODIFIERS), [
|
||||
handlerExp,
|
||||
JSON.stringify(nonKeyModifiers)
|
||||
]);
|
||||
}
|
||||
if (keyModifiers.length && // if event name is dynamic, always wrap with keys guard
|
||||
(!isStaticExp(key) || isKeyboardEvent(key.content))) {
|
||||
handlerExp = createCallExpression(context.helper(V_ON_WITH_KEYS), [
|
||||
handlerExp,
|
||||
JSON.stringify(keyModifiers)
|
||||
]);
|
||||
}
|
||||
if (eventOptionModifiers.length) {
|
||||
const modifierPostfix = eventOptionModifiers.map(capitalize).join("");
|
||||
key = isStaticExp(key) ? createSimpleExpression(`${key.content}${modifierPostfix}`, true) : createCompoundExpression([`(`, key, `) + "${modifierPostfix}"`]);
|
||||
}
|
||||
return {
|
||||
props: [createObjectProperty(key, handlerExp)]
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
const transformShow = (dir, node, context) => {
|
||||
const { exp, loc } = dir;
|
||||
if (!exp) {
|
||||
context.onError(
|
||||
createDOMCompilerError(61, loc)
|
||||
);
|
||||
}
|
||||
return {
|
||||
props: [],
|
||||
needRuntime: context.helper(V_SHOW)
|
||||
};
|
||||
};
|
||||
|
||||
const transformTransition = (node, context) => {
|
||||
if (node.type === 1 && node.tagType === 1) {
|
||||
const component = context.isBuiltInComponent(node.tag);
|
||||
if (component === TRANSITION) {
|
||||
return () => {
|
||||
if (!node.children.length) {
|
||||
return;
|
||||
}
|
||||
if (hasMultipleChildren(node)) {
|
||||
context.onError(
|
||||
createDOMCompilerError(
|
||||
62,
|
||||
{
|
||||
start: node.children[0].loc.start,
|
||||
end: node.children[node.children.length - 1].loc.end,
|
||||
source: ""
|
||||
}
|
||||
)
|
||||
);
|
||||
}
|
||||
const child = node.children[0];
|
||||
if (child.type === 1) {
|
||||
for (const p of child.props) {
|
||||
if (p.type === 7 && p.name === "show") {
|
||||
node.props.push({
|
||||
type: 6,
|
||||
name: "persisted",
|
||||
nameLoc: node.loc,
|
||||
value: void 0,
|
||||
loc: node.loc
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
};
|
||||
function hasMultipleChildren(node) {
|
||||
const children = node.children = node.children.filter(
|
||||
(c) => c.type !== 3 && !(c.type === 2 && !c.content.trim())
|
||||
);
|
||||
const child = children[0];
|
||||
return children.length !== 1 || child.type === 11 || child.type === 9 && child.branches.some(hasMultipleChildren);
|
||||
}
|
||||
|
||||
const ignoreSideEffectTags = (node, context) => {
|
||||
if (node.type === 1 && node.tagType === 0 && (node.tag === "script" || node.tag === "style")) {
|
||||
!!(process.env.NODE_ENV !== "production") && context.onError(
|
||||
createDOMCompilerError(
|
||||
63,
|
||||
node.loc
|
||||
)
|
||||
);
|
||||
context.removeNode();
|
||||
}
|
||||
};
|
||||
|
||||
const DOMNodeTransforms = [
|
||||
transformStyle,
|
||||
...!!(process.env.NODE_ENV !== "production") ? [transformTransition] : []
|
||||
];
|
||||
const DOMDirectiveTransforms = {
|
||||
cloak: noopDirectiveTransform,
|
||||
html: transformVHtml,
|
||||
text: transformVText,
|
||||
model: transformModel,
|
||||
// override compiler-core
|
||||
on: transformOn,
|
||||
// override compiler-core
|
||||
show: transformShow
|
||||
};
|
||||
function compile(src, options = {}) {
|
||||
return baseCompile(
|
||||
src,
|
||||
extend({}, parserOptions, options, {
|
||||
nodeTransforms: [
|
||||
// ignore <script> and <tag>
|
||||
// this is not put inside DOMNodeTransforms because that list is used
|
||||
// by compiler-ssr to generate vnode fallback branches
|
||||
ignoreSideEffectTags,
|
||||
...DOMNodeTransforms,
|
||||
...options.nodeTransforms || []
|
||||
],
|
||||
directiveTransforms: extend(
|
||||
{},
|
||||
DOMDirectiveTransforms,
|
||||
options.directiveTransforms || {}
|
||||
),
|
||||
transformHoist: null
|
||||
})
|
||||
);
|
||||
}
|
||||
function parse(template, options = {}) {
|
||||
return baseParse(template, extend({}, parserOptions, options));
|
||||
}
|
||||
|
||||
export { DOMDirectiveTransforms, DOMErrorCodes, DOMErrorMessages, DOMNodeTransforms, TRANSITION, TRANSITION_GROUP, V_MODEL_CHECKBOX, V_MODEL_DYNAMIC, V_MODEL_RADIO, V_MODEL_SELECT, V_MODEL_TEXT, V_ON_WITH_KEYS, V_ON_WITH_MODIFIERS, V_SHOW, compile, createDOMCompilerError, parse, parserOptions, transformStyle };
|
6439
node_modules/@vue/compiler-dom/dist/compiler-dom.global.js
generated
vendored
Normal file
6439
node_modules/@vue/compiler-dom/dist/compiler-dom.global.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
6
node_modules/@vue/compiler-dom/dist/compiler-dom.global.prod.js
generated
vendored
Normal file
6
node_modules/@vue/compiler-dom/dist/compiler-dom.global.prod.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
7
node_modules/@vue/compiler-dom/index.js
generated
vendored
Normal file
7
node_modules/@vue/compiler-dom/index.js
generated
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
'use strict'
|
||||
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
module.exports = require('./dist/compiler-dom.cjs.prod.js')
|
||||
} else {
|
||||
module.exports = require('./dist/compiler-dom.cjs.js')
|
||||
}
|
57
node_modules/@vue/compiler-dom/package.json
generated
vendored
Normal file
57
node_modules/@vue/compiler-dom/package.json
generated
vendored
Normal file
@ -0,0 +1,57 @@
|
||||
{
|
||||
"name": "@vue/compiler-dom",
|
||||
"version": "3.4.15",
|
||||
"description": "@vue/compiler-dom",
|
||||
"main": "index.js",
|
||||
"module": "dist/compiler-dom.esm-bundler.js",
|
||||
"types": "dist/compiler-dom.d.ts",
|
||||
"unpkg": "dist/compiler-dom.global.js",
|
||||
"jsdelivr": "dist/compiler-dom.global.js",
|
||||
"files": [
|
||||
"index.js",
|
||||
"dist"
|
||||
],
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./dist/compiler-dom.d.ts",
|
||||
"node": {
|
||||
"production": "./dist/compiler-dom.cjs.prod.js",
|
||||
"development": "./dist/compiler-dom.cjs.js",
|
||||
"default": "./index.js"
|
||||
},
|
||||
"module": "./dist/compiler-dom.esm-bundler.js",
|
||||
"import": "./dist/compiler-dom.esm-bundler.js",
|
||||
"require": "./index.js"
|
||||
},
|
||||
"./*": "./*"
|
||||
},
|
||||
"sideEffects": false,
|
||||
"buildOptions": {
|
||||
"name": "VueCompilerDOM",
|
||||
"compat": true,
|
||||
"formats": [
|
||||
"esm-bundler",
|
||||
"esm-browser",
|
||||
"cjs",
|
||||
"global"
|
||||
]
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/vuejs/core.git",
|
||||
"directory": "packages/compiler-dom"
|
||||
},
|
||||
"keywords": [
|
||||
"vue"
|
||||
],
|
||||
"author": "Evan You",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/vuejs/core/issues"
|
||||
},
|
||||
"homepage": "https://github.com/vuejs/core/tree/main/packages/compiler-dom#readme",
|
||||
"dependencies": {
|
||||
"@vue/shared": "3.4.15",
|
||||
"@vue/compiler-core": "3.4.15"
|
||||
}
|
||||
}
|
21
node_modules/@vue/language-core/LICENSE
generated
vendored
Normal file
21
node_modules/@vue/language-core/LICENSE
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2021-present Johnson Chu
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
15
node_modules/@vue/language-core/out/generators/script.d.ts
generated
vendored
Normal file
15
node_modules/@vue/language-core/out/generators/script.d.ts
generated
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
import { FileRangeCapabilities, MirrorBehaviorCapabilities } from '@volar/language-core';
|
||||
import * as SourceMaps from '@volar/source-map';
|
||||
import type * as ts from 'typescript/lib/tsserverlibrary';
|
||||
import type * as templateGen from '../generators/template';
|
||||
import type { ScriptRanges } from '../parsers/scriptRanges';
|
||||
import type { ScriptSetupRanges } from '../parsers/scriptSetupRanges';
|
||||
import type { VueCompilerOptions } from '../types';
|
||||
import { Sfc } from '../types';
|
||||
export declare function generate(ts: typeof import('typescript/lib/tsserverlibrary'), fileName: string, script: Sfc['script'], scriptSetup: Sfc['scriptSetup'], styles: Sfc['styles'], // TODO: computed it
|
||||
lang: string, scriptRanges: ScriptRanges | undefined, scriptSetupRanges: ScriptSetupRanges | undefined, htmlGen: ReturnType<typeof templateGen['generate']> | undefined, compilerOptions: ts.CompilerOptions, vueCompilerOptions: VueCompilerOptions, codegenStack: boolean): {
|
||||
codes: SourceMaps.Segment<FileRangeCapabilities>[];
|
||||
codeStacks: SourceMaps.StackNode[];
|
||||
mirrorBehaviorMappings: SourceMaps.Mapping<[MirrorBehaviorCapabilities, MirrorBehaviorCapabilities]>[];
|
||||
};
|
||||
//# sourceMappingURL=script.d.ts.map
|
870
node_modules/@vue/language-core/out/generators/script.js
generated
vendored
Normal file
870
node_modules/@vue/language-core/out/generators/script.js
generated
vendored
Normal file
@ -0,0 +1,870 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.generate = void 0;
|
||||
const language_core_1 = require("@volar/language-core");
|
||||
const source_map_1 = require("@volar/source-map");
|
||||
const muggle = require("muggle-string");
|
||||
const path = require("path-browserify");
|
||||
const shared_1 = require("../utils/shared");
|
||||
const transform_1 = require("../utils/transform");
|
||||
function generate(ts, fileName, script, scriptSetup, styles, // TODO: computed it
|
||||
lang, scriptRanges, scriptSetupRanges, htmlGen, compilerOptions, vueCompilerOptions, codegenStack) {
|
||||
const [codes, codeStacks] = codegenStack ? muggle.track([]) : [[], []];
|
||||
const mirrorBehaviorMappings = [];
|
||||
//#region monkey fix: https://github.com/vuejs/language-tools/pull/2113
|
||||
if (!script && !scriptSetup) {
|
||||
scriptSetup = {
|
||||
content: '',
|
||||
lang: 'ts',
|
||||
name: '',
|
||||
start: 0,
|
||||
end: 0,
|
||||
startTagEnd: 0,
|
||||
endTagStart: 0,
|
||||
generic: undefined,
|
||||
genericOffset: 0,
|
||||
attrs: {},
|
||||
ast: ts.createSourceFile('', '', ts.ScriptTarget.Latest, false, ts.ScriptKind.TS),
|
||||
};
|
||||
scriptSetupRanges = {
|
||||
bindings: [],
|
||||
props: {},
|
||||
emits: {},
|
||||
expose: {},
|
||||
slots: {},
|
||||
defineProp: [],
|
||||
importSectionEndOffset: 0,
|
||||
leadingCommentEndOffset: 0,
|
||||
};
|
||||
}
|
||||
//#endregion
|
||||
const bindingNames = new Set([
|
||||
...scriptRanges?.bindings.map(range => script.content.substring(range.start, range.end)) ?? [],
|
||||
...scriptSetupRanges?.bindings.map(range => scriptSetup.content.substring(range.start, range.end)) ?? [],
|
||||
]);
|
||||
const bypassDefineComponent = lang === 'js' || lang === 'jsx';
|
||||
const usedHelperTypes = {
|
||||
DefinePropsToOptions: false,
|
||||
MergePropDefaults: false,
|
||||
WithTemplateSlots: false,
|
||||
PropsChildren: false,
|
||||
};
|
||||
codes.push(`/* __placeholder__ */\n`);
|
||||
let generatedTemplate = false;
|
||||
generateSrc();
|
||||
generateScriptSetupImports();
|
||||
generateScriptContentBeforeExportDefault();
|
||||
generateScriptSetupAndTemplate();
|
||||
generateHelperTypes();
|
||||
generateScriptContentAfterExportDefault();
|
||||
if (!generatedTemplate) {
|
||||
generateTemplate(false);
|
||||
}
|
||||
if (scriptSetup) {
|
||||
// for code action edits
|
||||
codes.push([
|
||||
'',
|
||||
'scriptSetup',
|
||||
scriptSetup.content.length,
|
||||
{},
|
||||
]);
|
||||
}
|
||||
return {
|
||||
codes,
|
||||
codeStacks,
|
||||
mirrorBehaviorMappings,
|
||||
};
|
||||
function generateHelperTypes() {
|
||||
if (usedHelperTypes.DefinePropsToOptions) {
|
||||
if (compilerOptions.exactOptionalPropertyTypes) {
|
||||
codes.push(`type __VLS_TypePropsToRuntimeProps<T> = { [K in keyof T]-?: {} extends Pick<T, K> ? { type: import('${vueCompilerOptions.lib}').PropType<T[K]> } : { type: import('${vueCompilerOptions.lib}').PropType<T[K]>, required: true } };\n`);
|
||||
}
|
||||
else {
|
||||
codes.push(`type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;\n`);
|
||||
codes.push(`type __VLS_TypePropsToRuntimeProps<T> = { [K in keyof T]-?: {} extends Pick<T, K> ? { type: import('${vueCompilerOptions.lib}').PropType<__VLS_NonUndefinedable<T[K]>> } : { type: import('${vueCompilerOptions.lib}').PropType<T[K]>, required: true } };\n`);
|
||||
}
|
||||
}
|
||||
if (usedHelperTypes.MergePropDefaults) {
|
||||
codes.push(`type __VLS_WithDefaults<P, D> = {
|
||||
// use 'keyof Pick<P, keyof P>' instead of 'keyof P' to keep props jsdoc
|
||||
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
|
||||
default: D[K]
|
||||
}> : P[K]
|
||||
};\n`);
|
||||
codes.push(`type __VLS_Prettify<T> = { [K in keyof T]: T[K]; } & {};\n`);
|
||||
}
|
||||
if (usedHelperTypes.WithTemplateSlots) {
|
||||
codes.push(`type __VLS_WithTemplateSlots<T, S> = T & { new(): {\n`, `${(0, shared_1.getSlotsPropertyName)(vueCompilerOptions.target)}: S;\n`);
|
||||
if (vueCompilerOptions.jsxSlots) {
|
||||
usedHelperTypes.PropsChildren = true;
|
||||
codes.push(`$props: __VLS_PropsChildren<S>;\n`);
|
||||
}
|
||||
codes.push(`} };\n`);
|
||||
}
|
||||
if (usedHelperTypes.PropsChildren) {
|
||||
codes.push(`type __VLS_PropsChildren<S> = { [K in keyof (boolean extends (JSX.ElementChildrenAttribute extends never ? true : false) ? never : JSX.ElementChildrenAttribute)]?: S; };\n`);
|
||||
}
|
||||
}
|
||||
function generateSrc() {
|
||||
if (!script?.src)
|
||||
return;
|
||||
let src = script.src;
|
||||
if (src.endsWith('.d.ts'))
|
||||
src = src.substring(0, src.length - '.d.ts'.length);
|
||||
else if (src.endsWith('.ts'))
|
||||
src = src.substring(0, src.length - '.ts'.length);
|
||||
else if (src.endsWith('.tsx'))
|
||||
src = src.substring(0, src.length - '.tsx'.length) + '.jsx';
|
||||
if (!src.endsWith('.js') && !src.endsWith('.jsx'))
|
||||
src = src + '.js';
|
||||
codes.push(`export * from `);
|
||||
codes.push([
|
||||
`'${src}'`,
|
||||
'script',
|
||||
[script.srcOffset - 1, script.srcOffset + script.src.length + 1],
|
||||
{
|
||||
...language_core_1.FileRangeCapabilities.full,
|
||||
rename: src === script.src ? true : {
|
||||
normalize: undefined,
|
||||
apply(newName) {
|
||||
if (newName.endsWith('.jsx')
|
||||
|| newName.endsWith('.js')) {
|
||||
newName = newName.split('.').slice(0, -1).join('.');
|
||||
}
|
||||
if (script?.src?.endsWith('.d.ts')) {
|
||||
newName = newName + '.d.ts';
|
||||
}
|
||||
else if (script?.src?.endsWith('.ts')) {
|
||||
newName = newName + '.ts';
|
||||
}
|
||||
else if (script?.src?.endsWith('.tsx')) {
|
||||
newName = newName + '.tsx';
|
||||
}
|
||||
return newName;
|
||||
},
|
||||
},
|
||||
},
|
||||
]);
|
||||
codes.push(`;\n`);
|
||||
codes.push(`export { default } from '${src}';\n`);
|
||||
}
|
||||
function generateScriptContentBeforeExportDefault() {
|
||||
if (!script)
|
||||
return;
|
||||
if (!!scriptSetup && scriptRanges?.exportDefault) {
|
||||
addVirtualCode('script', 0, scriptRanges.exportDefault.expression.start);
|
||||
}
|
||||
else {
|
||||
let isExportRawObject = false;
|
||||
if (scriptRanges?.exportDefault) {
|
||||
isExportRawObject = script.content.substring(scriptRanges.exportDefault.expression.start, scriptRanges.exportDefault.expression.end).startsWith('{');
|
||||
}
|
||||
if (isExportRawObject && vueCompilerOptions.optionsWrapper.length === 2 && scriptRanges?.exportDefault) {
|
||||
addVirtualCode('script', 0, scriptRanges.exportDefault.expression.start);
|
||||
codes.push(vueCompilerOptions.optionsWrapper[0]);
|
||||
{
|
||||
codes.push(['', 'script', scriptRanges.exportDefault.expression.start, {
|
||||
__hint: {
|
||||
setting: 'vue.inlayHints.optionsWrapper',
|
||||
label: vueCompilerOptions.optionsWrapper[0],
|
||||
tooltip: [
|
||||
'This is virtual code that is automatically wrapped for type support, it does not affect your runtime behavior, you can customize it via `vueCompilerOptions.optionsWrapper` option in tsconfig / jsconfig.',
|
||||
'To hide it, you can set `"vue.inlayHints.optionsWrapper": false` in IDE settings.',
|
||||
].join('\n\n'),
|
||||
}
|
||||
}]);
|
||||
addVirtualCode('script', scriptRanges.exportDefault.expression.start, scriptRanges.exportDefault.expression.end);
|
||||
codes.push(['', 'script', scriptRanges.exportDefault.expression.end, {
|
||||
__hint: {
|
||||
setting: 'vue.inlayHints.optionsWrapper',
|
||||
label: vueCompilerOptions.optionsWrapper[1],
|
||||
tooltip: '',
|
||||
}
|
||||
}]);
|
||||
}
|
||||
codes.push(vueCompilerOptions.optionsWrapper[1]);
|
||||
addVirtualCode('script', scriptRanges.exportDefault.expression.end, script.content.length);
|
||||
}
|
||||
else {
|
||||
addVirtualCode('script', 0, script.content.length);
|
||||
}
|
||||
}
|
||||
}
|
||||
function generateScriptContentAfterExportDefault() {
|
||||
if (!script)
|
||||
return;
|
||||
if (!!scriptSetup && scriptRanges?.exportDefault) {
|
||||
addVirtualCode('script', scriptRanges.exportDefault.expression.end, script.content.length);
|
||||
}
|
||||
}
|
||||
function generateScriptSetupImports() {
|
||||
if (!scriptSetup)
|
||||
return;
|
||||
if (!scriptSetupRanges)
|
||||
return;
|
||||
codes.push([
|
||||
scriptSetup.content.substring(0, Math.max(scriptSetupRanges.importSectionEndOffset, scriptSetupRanges.leadingCommentEndOffset)) + '\n',
|
||||
'scriptSetup',
|
||||
0,
|
||||
language_core_1.FileRangeCapabilities.full,
|
||||
]);
|
||||
}
|
||||
function generateScriptSetupAndTemplate() {
|
||||
if (!scriptSetup || !scriptSetupRanges) {
|
||||
return;
|
||||
}
|
||||
const definePropMirrors = {};
|
||||
let scriptSetupGeneratedOffset;
|
||||
if (scriptSetup.generic) {
|
||||
if (!scriptRanges?.exportDefault) {
|
||||
codes.push('export default ');
|
||||
}
|
||||
codes.push(`(<`);
|
||||
codes.push([
|
||||
scriptSetup.generic,
|
||||
scriptSetup.name,
|
||||
scriptSetup.genericOffset,
|
||||
language_core_1.FileRangeCapabilities.full,
|
||||
]);
|
||||
if (!scriptSetup.generic.endsWith(',')) {
|
||||
codes.push(`,`);
|
||||
}
|
||||
codes.push(`>`);
|
||||
codes.push('(\n');
|
||||
codes.push(`__VLS_props: Awaited<typeof __VLS_setup>['props'],\n`);
|
||||
codes.push(`__VLS_ctx?: __VLS_Prettify<Pick<Awaited<typeof __VLS_setup>, 'attrs' | 'emit' | 'slots'>>,\n`); // use __VLS_Prettify for less dts code
|
||||
codes.push(`__VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>['expose'],\n`);
|
||||
codes.push('__VLS_setup = (async () => {\n');
|
||||
scriptSetupGeneratedOffset = generateSetupFunction(true, 'none', definePropMirrors);
|
||||
//#region props
|
||||
codes.push(`const __VLS_fnComponent = `);
|
||||
codes.push(`(await import('${vueCompilerOptions.lib}')).defineComponent({\n`);
|
||||
if (scriptSetupRanges.props.define?.arg) {
|
||||
codes.push(`props: `);
|
||||
addExtraReferenceVirtualCode('scriptSetup', scriptSetupRanges.props.define.arg.start, scriptSetupRanges.props.define.arg.end);
|
||||
codes.push(`,\n`);
|
||||
}
|
||||
if (scriptSetupRanges.emits.define) {
|
||||
codes.push(`emits: ({} as __VLS_NormalizeEmits<typeof `, scriptSetupRanges.emits.name ?? '__VLS_emit', `>),\n`);
|
||||
}
|
||||
codes.push(`});\n`);
|
||||
if (scriptSetupRanges.defineProp.length) {
|
||||
codes.push(`const __VLS_defaults = {\n`);
|
||||
for (const defineProp of scriptSetupRanges.defineProp) {
|
||||
if (defineProp.defaultValue) {
|
||||
if (defineProp.name) {
|
||||
codes.push(scriptSetup.content.substring(defineProp.name.start, defineProp.name.end));
|
||||
}
|
||||
else {
|
||||
codes.push('modelValue');
|
||||
}
|
||||
codes.push(`: `);
|
||||
codes.push(scriptSetup.content.substring(defineProp.defaultValue.start, defineProp.defaultValue.end));
|
||||
codes.push(`,\n`);
|
||||
}
|
||||
}
|
||||
codes.push(`};\n`);
|
||||
}
|
||||
codes.push(`let __VLS_fnPropsTypeOnly!: {}`); // TODO: reuse __VLS_fnPropsTypeOnly even without generic, and remove __VLS_propsOption_defineProp
|
||||
if (scriptSetupRanges.props.define?.typeArg) {
|
||||
codes.push(` & `);
|
||||
addVirtualCode('scriptSetup', scriptSetupRanges.props.define.typeArg.start, scriptSetupRanges.props.define.typeArg.end);
|
||||
}
|
||||
if (scriptSetupRanges.defineProp.length) {
|
||||
codes.push(` & {\n`);
|
||||
for (const defineProp of scriptSetupRanges.defineProp) {
|
||||
let propName = 'modelValue';
|
||||
if (defineProp.name) {
|
||||
propName = scriptSetup.content.substring(defineProp.name.start, defineProp.name.end);
|
||||
const propMirrorStart = muggle.getLength(codes);
|
||||
definePropMirrors[propName] = [propMirrorStart, propMirrorStart + propName.length];
|
||||
}
|
||||
codes.push(`${propName}${defineProp.required ? '' : '?'}: `);
|
||||
if (defineProp.type) {
|
||||
codes.push(scriptSetup.content.substring(defineProp.type.start, defineProp.type.end));
|
||||
}
|
||||
else if (defineProp.defaultValue) {
|
||||
codes.push(`typeof __VLS_defaults['`);
|
||||
codes.push(propName);
|
||||
codes.push(`']`);
|
||||
}
|
||||
else {
|
||||
codes.push(`any`);
|
||||
}
|
||||
codes.push(',\n');
|
||||
}
|
||||
codes.push(`}`);
|
||||
}
|
||||
codes.push(`;\n`);
|
||||
codes.push(`let __VLS_fnPropsDefineComponent!: InstanceType<typeof __VLS_fnComponent>['$props']`);
|
||||
codes.push(`;\n`);
|
||||
codes.push(`let __VLS_fnPropsSlots!: `);
|
||||
if (scriptSetupRanges.slots.define && vueCompilerOptions.jsxSlots) {
|
||||
usedHelperTypes.PropsChildren = true;
|
||||
codes.push(`__VLS_PropsChildren<typeof __VLS_slots>`);
|
||||
}
|
||||
else {
|
||||
codes.push(`{}`);
|
||||
}
|
||||
codes.push(`;\n`);
|
||||
codes.push(`let __VLS_defaultProps!: `, `import('${vueCompilerOptions.lib}').VNodeProps`, `& import('${vueCompilerOptions.lib}').AllowedComponentProps`, `& import('${vueCompilerOptions.lib}').ComponentCustomProps`, `;\n`);
|
||||
//#endregion
|
||||
codes.push('return {} as {\n');
|
||||
codes.push(`props: __VLS_Prettify<__VLS_OmitKeepDiscriminatedUnion<typeof __VLS_fnPropsDefineComponent & typeof __VLS_fnPropsTypeOnly, keyof typeof __VLS_defaultProps>> & typeof __VLS_fnPropsSlots & typeof __VLS_defaultProps,\n`);
|
||||
codes.push(`expose(exposed: import('${vueCompilerOptions.lib}').ShallowUnwrapRef<${scriptSetupRanges.expose.define ? 'typeof __VLS_exposed' : '{}'}>): void,\n`);
|
||||
codes.push('attrs: any,\n');
|
||||
codes.push('slots: ReturnType<typeof __VLS_template>,\n');
|
||||
codes.push(`emit: typeof ${scriptSetupRanges.emits.name ?? '__VLS_emit'},\n`);
|
||||
codes.push('};\n');
|
||||
codes.push('})(),\n');
|
||||
codes.push(`) => ({} as import('${vueCompilerOptions.lib}').VNode & { __ctx?: Awaited<typeof __VLS_setup> }))`);
|
||||
}
|
||||
else if (!script) {
|
||||
// no script block, generate script setup code at root
|
||||
scriptSetupGeneratedOffset = generateSetupFunction(false, 'export', definePropMirrors);
|
||||
}
|
||||
else {
|
||||
if (!scriptRanges?.exportDefault) {
|
||||
codes.push('export default ');
|
||||
}
|
||||
codes.push('await (async () => {\n');
|
||||
scriptSetupGeneratedOffset = generateSetupFunction(false, 'return', definePropMirrors);
|
||||
codes.push(`})()`);
|
||||
}
|
||||
if (scriptSetupGeneratedOffset !== undefined) {
|
||||
for (const defineProp of scriptSetupRanges.defineProp) {
|
||||
if (!defineProp.name) {
|
||||
continue;
|
||||
}
|
||||
const propName = scriptSetup.content.substring(defineProp.name.start, defineProp.name.end);
|
||||
const propMirror = definePropMirrors[propName];
|
||||
if (propMirror) {
|
||||
mirrorBehaviorMappings.push({
|
||||
sourceRange: [defineProp.name.start + scriptSetupGeneratedOffset, defineProp.name.end + scriptSetupGeneratedOffset],
|
||||
generatedRange: propMirror,
|
||||
data: [
|
||||
language_core_1.MirrorBehaviorCapabilities.full,
|
||||
language_core_1.MirrorBehaviorCapabilities.full,
|
||||
],
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
function generateSetupFunction(functional, mode, definePropMirrors) {
|
||||
if (!scriptSetupRanges || !scriptSetup) {
|
||||
return;
|
||||
}
|
||||
const definePropProposalA = scriptSetup.content.trimStart().startsWith('// @experimentalDefinePropProposal=kevinEdition') || vueCompilerOptions.experimentalDefinePropProposal === 'kevinEdition';
|
||||
const definePropProposalB = scriptSetup.content.trimStart().startsWith('// @experimentalDefinePropProposal=johnsonEdition') || vueCompilerOptions.experimentalDefinePropProposal === 'johnsonEdition';
|
||||
if (vueCompilerOptions.target >= 3.3) {
|
||||
codes.push('const { ');
|
||||
for (const macro of Object.keys(vueCompilerOptions.macros)) {
|
||||
if (!bindingNames.has(macro)) {
|
||||
codes.push(macro, ', ');
|
||||
}
|
||||
}
|
||||
codes.push(`} = await import('${vueCompilerOptions.lib}');\n`);
|
||||
}
|
||||
if (definePropProposalA) {
|
||||
codes.push(`
|
||||
declare function defineProp<T>(name: string, options: { required: true } & Record<string, unknown>): import('${vueCompilerOptions.lib}').ComputedRef<T>;
|
||||
declare function defineProp<T>(name: string, options: { default: any } & Record<string, unknown>): import('${vueCompilerOptions.lib}').ComputedRef<T>;
|
||||
declare function defineProp<T>(name?: string, options?: any): import('${vueCompilerOptions.lib}').ComputedRef<T | undefined>;
|
||||
`.trim() + '\n');
|
||||
}
|
||||
if (definePropProposalB) {
|
||||
codes.push(`
|
||||
declare function defineProp<T>(value: T | (() => T), required?: boolean, rest?: any): import('${vueCompilerOptions.lib}').ComputedRef<T>;
|
||||
declare function defineProp<T>(value: T | (() => T) | undefined, required: true, rest?: any): import('${vueCompilerOptions.lib}').ComputedRef<T>;
|
||||
declare function defineProp<T>(value?: T | (() => T), required?: boolean, rest?: any): import('${vueCompilerOptions.lib}').ComputedRef<T | undefined>;
|
||||
`.trim() + '\n');
|
||||
}
|
||||
const scriptSetupGeneratedOffset = muggle.getLength(codes) - scriptSetupRanges.importSectionEndOffset;
|
||||
let setupCodeModifies = [];
|
||||
if (scriptSetupRanges.props.define && !scriptSetupRanges.props.name) {
|
||||
const range = scriptSetupRanges.props.withDefaults ?? scriptSetupRanges.props.define;
|
||||
const statement = scriptSetupRanges.props.define.statement;
|
||||
if (statement.start === range.start && statement.end === range.end) {
|
||||
setupCodeModifies.push([() => codes.push(`const __VLS_props = `), range.start, range.start]);
|
||||
}
|
||||
else {
|
||||
setupCodeModifies.push([() => {
|
||||
codes.push(`const __VLS_props = `);
|
||||
addVirtualCode('scriptSetup', range.start, range.end);
|
||||
codes.push(`;\n`);
|
||||
addVirtualCode('scriptSetup', statement.start, range.start);
|
||||
codes.push(`__VLS_props`);
|
||||
}, statement.start, range.end]);
|
||||
}
|
||||
}
|
||||
if (scriptSetupRanges.slots.define && !scriptSetupRanges.slots.name) {
|
||||
setupCodeModifies.push([() => codes.push(`const __VLS_slots = `), scriptSetupRanges.slots.define.start, scriptSetupRanges.slots.define.start]);
|
||||
}
|
||||
if (scriptSetupRanges.emits.define && !scriptSetupRanges.emits.name) {
|
||||
setupCodeModifies.push([() => codes.push(`const __VLS_emit = `), scriptSetupRanges.emits.define.start, scriptSetupRanges.emits.define.start]);
|
||||
}
|
||||
if (scriptSetupRanges.expose.define) {
|
||||
setupCodeModifies.push([() => {
|
||||
if (scriptSetupRanges?.expose.define?.typeArg) {
|
||||
codes.push(`let __VLS_exposed!: `);
|
||||
addExtraReferenceVirtualCode('scriptSetup', scriptSetupRanges.expose.define.typeArg.start, scriptSetupRanges.expose.define.typeArg.end);
|
||||
codes.push(`;\n`);
|
||||
}
|
||||
else if (scriptSetupRanges?.expose.define?.arg) {
|
||||
codes.push(`const __VLS_exposed = `);
|
||||
addExtraReferenceVirtualCode('scriptSetup', scriptSetupRanges.expose.define.arg.start, scriptSetupRanges.expose.define.arg.end);
|
||||
codes.push(`;\n`);
|
||||
}
|
||||
else {
|
||||
codes.push(`const __VLS_exposed = {};\n`);
|
||||
}
|
||||
}, scriptSetupRanges.expose.define.start, scriptSetupRanges.expose.define.start]);
|
||||
}
|
||||
setupCodeModifies = setupCodeModifies.sort((a, b) => a[1] - b[1]);
|
||||
if (setupCodeModifies.length) {
|
||||
addVirtualCode('scriptSetup', scriptSetupRanges.importSectionEndOffset, setupCodeModifies[0][1]);
|
||||
while (setupCodeModifies.length) {
|
||||
const [generate, _, end] = setupCodeModifies.shift();
|
||||
generate();
|
||||
if (setupCodeModifies.length) {
|
||||
const nextStart = setupCodeModifies[0][1];
|
||||
addVirtualCode('scriptSetup', end, nextStart);
|
||||
}
|
||||
else {
|
||||
addVirtualCode('scriptSetup', end);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
addVirtualCode('scriptSetup', scriptSetupRanges.importSectionEndOffset);
|
||||
}
|
||||
if (scriptSetupRanges.props.define?.typeArg && scriptSetupRanges.props.withDefaults?.arg) {
|
||||
// fix https://github.com/vuejs/language-tools/issues/1187
|
||||
codes.push(`const __VLS_withDefaultsArg = (function <T>(t: T) { return t })(`);
|
||||
addExtraReferenceVirtualCode('scriptSetup', scriptSetupRanges.props.withDefaults.arg.start, scriptSetupRanges.props.withDefaults.arg.end);
|
||||
codes.push(`);\n`);
|
||||
}
|
||||
if (!functional && scriptSetupRanges.defineProp.length) {
|
||||
codes.push(`let __VLS_propsOption_defineProp!: {\n`);
|
||||
for (const defineProp of scriptSetupRanges.defineProp) {
|
||||
let propName = 'modelValue';
|
||||
if (defineProp.name && defineProp.nameIsString) {
|
||||
// renaming support
|
||||
addExtraReferenceVirtualCode('scriptSetup', defineProp.name.start, defineProp.name.end);
|
||||
}
|
||||
else if (defineProp.name) {
|
||||
propName = scriptSetup.content.substring(defineProp.name.start, defineProp.name.end);
|
||||
const start = muggle.getLength(codes);
|
||||
definePropMirrors[propName] = [start, start + propName.length];
|
||||
codes.push(propName);
|
||||
}
|
||||
else {
|
||||
codes.push(propName);
|
||||
}
|
||||
codes.push(`: `);
|
||||
let type = 'any';
|
||||
if (!defineProp.nameIsString) {
|
||||
type = `NonNullable<typeof ${propName}['value']>`;
|
||||
}
|
||||
else if (defineProp.type) {
|
||||
type = scriptSetup.content.substring(defineProp.type.start, defineProp.type.end);
|
||||
}
|
||||
if (defineProp.required) {
|
||||
codes.push(`{ required: true, type: import('${vueCompilerOptions.lib}').PropType<${type}> },\n`);
|
||||
}
|
||||
else {
|
||||
codes.push(`import('${vueCompilerOptions.lib}').PropType<${type}>,\n`);
|
||||
}
|
||||
}
|
||||
codes.push(`};\n`);
|
||||
}
|
||||
generateTemplate(functional);
|
||||
if (mode === 'return' || mode === 'export') {
|
||||
if (!vueCompilerOptions.skipTemplateCodegen && (htmlGen?.hasSlot || scriptSetupRanges?.slots.define)) {
|
||||
usedHelperTypes.WithTemplateSlots = true;
|
||||
codes.push(`const __VLS_component = `);
|
||||
generateComponent(functional);
|
||||
codes.push(`;\n`);
|
||||
codes.push(mode === 'return' ? 'return ' : 'export default ');
|
||||
codes.push(`{} as __VLS_WithTemplateSlots<typeof __VLS_component, ReturnType<typeof __VLS_template>>;\n`);
|
||||
}
|
||||
else {
|
||||
codes.push(mode === 'return' ? 'return ' : 'export default ');
|
||||
generateComponent(functional);
|
||||
codes.push(`;\n`);
|
||||
}
|
||||
}
|
||||
return scriptSetupGeneratedOffset;
|
||||
}
|
||||
function generateComponent(functional) {
|
||||
if (!scriptSetupRanges)
|
||||
return;
|
||||
if (scriptRanges?.exportDefault && scriptRanges.exportDefault.expression.start !== scriptRanges.exportDefault.args.start) {
|
||||
// use defineComponent() from user space code if it exist
|
||||
addVirtualCode('script', scriptRanges.exportDefault.expression.start, scriptRanges.exportDefault.args.start);
|
||||
codes.push(`{\n`);
|
||||
}
|
||||
else {
|
||||
codes.push(`(await import('${vueCompilerOptions.lib}')).defineComponent({\n`);
|
||||
}
|
||||
codes.push(`setup() {\n`);
|
||||
codes.push(`return {\n`);
|
||||
generateSetupReturns();
|
||||
if (scriptSetupRanges.expose.define) {
|
||||
codes.push(`...__VLS_exposed,\n`);
|
||||
}
|
||||
codes.push(`};\n`);
|
||||
codes.push(`},\n`);
|
||||
generateComponentOptions(functional);
|
||||
codes.push(`})`);
|
||||
}
|
||||
function generateComponentOptions(functional) {
|
||||
if (scriptSetupRanges && !bypassDefineComponent) {
|
||||
const ranges = scriptSetupRanges;
|
||||
const propsCodegens = [];
|
||||
if (ranges.props.define?.arg) {
|
||||
const arg = ranges.props.define.arg;
|
||||
propsCodegens.push(() => {
|
||||
addExtraReferenceVirtualCode('scriptSetup', arg.start, arg.end);
|
||||
});
|
||||
}
|
||||
if (ranges.props.define?.typeArg) {
|
||||
const typeArg = ranges.props.define.typeArg;
|
||||
propsCodegens.push(() => {
|
||||
usedHelperTypes.DefinePropsToOptions = true;
|
||||
codes.push(`{} as `);
|
||||
if (ranges.props.withDefaults?.arg) {
|
||||
usedHelperTypes.MergePropDefaults = true;
|
||||
codes.push(`__VLS_WithDefaults<`);
|
||||
}
|
||||
codes.push(`__VLS_TypePropsToRuntimeProps<`);
|
||||
if (functional) {
|
||||
codes.push(`typeof __VLS_fnPropsTypeOnly`);
|
||||
}
|
||||
else {
|
||||
addExtraReferenceVirtualCode('scriptSetup', typeArg.start, typeArg.end);
|
||||
}
|
||||
codes.push(`>`);
|
||||
if (ranges.props.withDefaults?.arg) {
|
||||
codes.push(`, typeof __VLS_withDefaultsArg`);
|
||||
codes.push(`>`);
|
||||
}
|
||||
});
|
||||
}
|
||||
if (!functional && ranges.defineProp.length) {
|
||||
propsCodegens.push(() => {
|
||||
codes.push(`__VLS_propsOption_defineProp`);
|
||||
});
|
||||
}
|
||||
if (propsCodegens.length === 1) {
|
||||
codes.push(`props: `);
|
||||
for (const generate of propsCodegens) {
|
||||
generate();
|
||||
}
|
||||
codes.push(`,\n`);
|
||||
}
|
||||
else if (propsCodegens.length >= 2) {
|
||||
codes.push(`props: {\n`);
|
||||
for (const generate of propsCodegens) {
|
||||
codes.push('...');
|
||||
generate();
|
||||
codes.push(',\n');
|
||||
}
|
||||
codes.push(`},\n`);
|
||||
}
|
||||
if (ranges.emits.define) {
|
||||
codes.push(`emits: ({} as __VLS_NormalizeEmits<typeof `, ranges.emits.name ?? '__VLS_emit', `>),\n`);
|
||||
}
|
||||
}
|
||||
if (scriptRanges?.exportDefault?.args) {
|
||||
addVirtualCode('script', scriptRanges.exportDefault.args.start + 1, scriptRanges.exportDefault.args.end - 1);
|
||||
}
|
||||
}
|
||||
function generateSetupReturns() {
|
||||
if (scriptSetupRanges && bypassDefineComponent) {
|
||||
// fill $props
|
||||
if (scriptSetupRanges.props.define) {
|
||||
// NOTE: defineProps is inaccurate for $props
|
||||
codes.push(`$props: __VLS_makeOptional(${scriptSetupRanges.props.name ?? `__VLS_props`}),\n`);
|
||||
codes.push(`...${scriptSetupRanges.props.name ?? `__VLS_props`},\n`);
|
||||
}
|
||||
// fill $emit
|
||||
if (scriptSetupRanges.emits.define) {
|
||||
codes.push(`$emit: ${scriptSetupRanges.emits.name ?? '__VLS_emit'},\n`);
|
||||
}
|
||||
}
|
||||
}
|
||||
function generateTemplate(functional) {
|
||||
generatedTemplate = true;
|
||||
if (!vueCompilerOptions.skipTemplateCodegen) {
|
||||
generateExportOptions();
|
||||
generateConstNameOption();
|
||||
codes.push(`function __VLS_template() {\n`);
|
||||
const templateGened = generateTemplateContext();
|
||||
codes.push(`}\n`);
|
||||
generateComponentForTemplateUsage(functional, templateGened.cssIds);
|
||||
}
|
||||
else {
|
||||
codes.push(`function __VLS_template() {\n`);
|
||||
const templateUsageVars = [...getTemplateUsageVars()];
|
||||
codes.push(`// @ts-ignore\n`);
|
||||
codes.push(`[${templateUsageVars.join(', ')}]\n`);
|
||||
codes.push(`return {};\n`);
|
||||
codes.push(`}\n`);
|
||||
}
|
||||
}
|
||||
function generateComponentForTemplateUsage(functional, cssIds) {
|
||||
if (scriptSetup && scriptSetupRanges) {
|
||||
codes.push(`const __VLS_internalComponent = (await import('${vueCompilerOptions.lib}')).defineComponent({\n`);
|
||||
codes.push(`setup() {\n`);
|
||||
codes.push(`return {\n`);
|
||||
generateSetupReturns();
|
||||
// bindings
|
||||
const templateUsageVars = getTemplateUsageVars();
|
||||
for (const [content, bindings] of [
|
||||
[scriptSetup.content, scriptSetupRanges.bindings],
|
||||
scriptRanges && script
|
||||
? [script.content, scriptRanges.bindings]
|
||||
: ['', []],
|
||||
]) {
|
||||
for (const expose of bindings) {
|
||||
const varName = content.substring(expose.start, expose.end);
|
||||
if (!templateUsageVars.has(varName) && !cssIds.has(varName)) {
|
||||
continue;
|
||||
}
|
||||
const templateStart = (0, source_map_1.getLength)(codes);
|
||||
codes.push(varName);
|
||||
const templateEnd = (0, source_map_1.getLength)(codes);
|
||||
codes.push(`: ${varName} as typeof `);
|
||||
const scriptStart = (0, source_map_1.getLength)(codes);
|
||||
codes.push(varName);
|
||||
const scriptEnd = (0, source_map_1.getLength)(codes);
|
||||
codes.push(',\n');
|
||||
mirrorBehaviorMappings.push({
|
||||
sourceRange: [scriptStart, scriptEnd],
|
||||
generatedRange: [templateStart, templateEnd],
|
||||
data: [
|
||||
language_core_1.MirrorBehaviorCapabilities.full,
|
||||
language_core_1.MirrorBehaviorCapabilities.full,
|
||||
],
|
||||
});
|
||||
}
|
||||
}
|
||||
codes.push(`};\n`); // return {
|
||||
codes.push(`},\n`); // setup() {
|
||||
generateComponentOptions(functional);
|
||||
codes.push(`});\n`); // defineComponent({
|
||||
}
|
||||
else if (script) {
|
||||
codes.push(`let __VLS_internalComponent!: typeof import('./${path.basename(fileName)}')['default'];\n`);
|
||||
}
|
||||
else {
|
||||
codes.push(`const __VLS_internalComponent = (await import('${vueCompilerOptions.lib}')).defineComponent({});\n`);
|
||||
}
|
||||
}
|
||||
function generateExportOptions() {
|
||||
codes.push(`\n`);
|
||||
codes.push(`const __VLS_componentsOption = `);
|
||||
if (script && scriptRanges?.exportDefault?.componentsOption) {
|
||||
const componentsOption = scriptRanges.exportDefault.componentsOption;
|
||||
codes.push([
|
||||
script.content.substring(componentsOption.start, componentsOption.end),
|
||||
'script',
|
||||
componentsOption.start,
|
||||
{
|
||||
references: true,
|
||||
rename: true,
|
||||
},
|
||||
]);
|
||||
}
|
||||
else {
|
||||
codes.push('{}');
|
||||
}
|
||||
codes.push(`;\n`);
|
||||
}
|
||||
function generateConstNameOption() {
|
||||
codes.push(`\n`);
|
||||
if (script && scriptRanges?.exportDefault?.nameOption) {
|
||||
const nameOption = scriptRanges.exportDefault.nameOption;
|
||||
codes.push(`const __VLS_name = `);
|
||||
codes.push(`${script.content.substring(nameOption.start, nameOption.end)} as const`);
|
||||
codes.push(`;\n`);
|
||||
}
|
||||
else if (scriptSetup) {
|
||||
codes.push(`let __VLS_name!: '${path.basename(fileName.substring(0, fileName.lastIndexOf('.')))}';\n`);
|
||||
}
|
||||
else {
|
||||
codes.push(`const __VLS_name = undefined;\n`);
|
||||
}
|
||||
}
|
||||
function generateTemplateContext() {
|
||||
const useGlobalThisTypeInCtx = fileName.endsWith('.html');
|
||||
codes.push(`let __VLS_ctx!: ${useGlobalThisTypeInCtx ? 'typeof globalThis &' : ''}`);
|
||||
codes.push(`InstanceType<__VLS_PickNotAny<typeof __VLS_internalComponent, new () => {}>> & {\n`);
|
||||
/* CSS Module */
|
||||
for (let i = 0; i < styles.length; i++) {
|
||||
const style = styles[i];
|
||||
if (style.module) {
|
||||
codes.push(`${style.module}: Record<string, string> & __VLS_Prettify<{}`);
|
||||
for (const className of style.classNames) {
|
||||
generateCssClassProperty(i, className.text.substring(1), { start: className.offset, end: className.offset + className.text.length }, 'string', false, true);
|
||||
}
|
||||
codes.push('>;\n');
|
||||
}
|
||||
}
|
||||
codes.push(`};\n`);
|
||||
/* Components */
|
||||
codes.push('/* Components */\n');
|
||||
codes.push(`let __VLS_otherComponents!: NonNullable<typeof __VLS_internalComponent extends { components: infer C } ? C : {}> & typeof __VLS_componentsOption;\n`);
|
||||
codes.push(`let __VLS_own!: __VLS_SelfComponent<typeof __VLS_name, typeof __VLS_internalComponent & (new () => { ${(0, shared_1.getSlotsPropertyName)(vueCompilerOptions.target)}: typeof ${scriptSetupRanges?.slots?.name ?? '__VLS_slots'} })>;\n`);
|
||||
codes.push(`let __VLS_localComponents!: typeof __VLS_otherComponents & Omit<typeof __VLS_own, keyof typeof __VLS_otherComponents>;\n`);
|
||||
codes.push(`let __VLS_components!: typeof __VLS_localComponents & __VLS_GlobalComponents & typeof __VLS_ctx;\n`); // for html completion, TS references...
|
||||
/* Style Scoped */
|
||||
codes.push('/* Style Scoped */\n');
|
||||
codes.push('type __VLS_StyleScopedClasses = {}');
|
||||
for (let i = 0; i < styles.length; i++) {
|
||||
const style = styles[i];
|
||||
const option = vueCompilerOptions.experimentalResolveStyleCssClasses;
|
||||
if (option === 'always' || (option === 'scoped' && style.scoped)) {
|
||||
for (const className of style.classNames) {
|
||||
generateCssClassProperty(i, className.text.substring(1), { start: className.offset, end: className.offset + className.text.length }, 'boolean', true, !style.module);
|
||||
}
|
||||
}
|
||||
}
|
||||
codes.push(';\n');
|
||||
codes.push('let __VLS_styleScopedClasses!: __VLS_StyleScopedClasses | keyof __VLS_StyleScopedClasses | (keyof __VLS_StyleScopedClasses)[];\n');
|
||||
codes.push(`/* CSS variable injection */\n`);
|
||||
const cssIds = generateCssVars();
|
||||
codes.push(`/* CSS variable injection end */\n`);
|
||||
if (htmlGen) {
|
||||
muggle.setTracking(false);
|
||||
for (const s of htmlGen.codes) {
|
||||
codes.push(s);
|
||||
}
|
||||
muggle.setTracking(true);
|
||||
for (const s of htmlGen.codeStacks) {
|
||||
codeStacks.push(s);
|
||||
}
|
||||
}
|
||||
if (!htmlGen) {
|
||||
codes.push(`// no template\n`);
|
||||
if (!scriptSetupRanges?.slots.define) {
|
||||
codes.push(`const __VLS_slots = {};\n`);
|
||||
}
|
||||
}
|
||||
codes.push(`return ${scriptSetupRanges?.slots.name ?? '__VLS_slots'};\n`);
|
||||
return { cssIds };
|
||||
function generateCssClassProperty(styleIndex, className, classRange, propertyType, optional, referencesCodeLens) {
|
||||
codes.push(`\n & { `);
|
||||
codes.push([
|
||||
'',
|
||||
'style_' + styleIndex,
|
||||
classRange.start,
|
||||
{
|
||||
references: true,
|
||||
referencesCodeLens,
|
||||
},
|
||||
]);
|
||||
codes.push(`'`);
|
||||
codes.push([
|
||||
className,
|
||||
'style_' + styleIndex,
|
||||
[classRange.start, classRange.end],
|
||||
{
|
||||
references: true,
|
||||
rename: {
|
||||
normalize: normalizeCssRename,
|
||||
apply: applyCssRename,
|
||||
},
|
||||
},
|
||||
]);
|
||||
codes.push(`'`);
|
||||
codes.push([
|
||||
'',
|
||||
'style_' + styleIndex,
|
||||
classRange.end,
|
||||
{},
|
||||
]);
|
||||
codes.push(`${optional ? '?' : ''}: ${propertyType}`);
|
||||
codes.push(` }`);
|
||||
}
|
||||
function generateCssVars() {
|
||||
const emptyLocalVars = new Map();
|
||||
const identifiers = new Set();
|
||||
for (const style of styles) {
|
||||
for (const cssBind of style.cssVars) {
|
||||
(0, transform_1.walkInterpolationFragment)(ts, cssBind.text, ts.createSourceFile('/a.txt', cssBind.text, ts.ScriptTarget.ESNext), (frag, fragOffset, onlyForErrorMapping) => {
|
||||
if (fragOffset === undefined) {
|
||||
codes.push(frag);
|
||||
}
|
||||
else {
|
||||
codes.push([
|
||||
frag,
|
||||
style.name,
|
||||
cssBind.offset + fragOffset,
|
||||
onlyForErrorMapping
|
||||
? { diagnostic: true }
|
||||
: language_core_1.FileRangeCapabilities.full,
|
||||
]);
|
||||
}
|
||||
}, emptyLocalVars, identifiers, vueCompilerOptions);
|
||||
codes.push(';\n');
|
||||
}
|
||||
}
|
||||
return identifiers;
|
||||
}
|
||||
}
|
||||
function getTemplateUsageVars() {
|
||||
const usageVars = new Set();
|
||||
if (htmlGen) {
|
||||
// fix import components unused report
|
||||
for (const varName of bindingNames) {
|
||||
if (!!htmlGen.tagNames[varName] || !!htmlGen.tagNames[(0, shared_1.hyphenateTag)(varName)]) {
|
||||
usageVars.add(varName);
|
||||
}
|
||||
}
|
||||
for (const tag of Object.keys(htmlGen.tagNames)) {
|
||||
if (tag.indexOf('.') >= 0) {
|
||||
usageVars.add(tag.split('.')[0]);
|
||||
}
|
||||
}
|
||||
for (const _id of htmlGen.accessedGlobalVariables) {
|
||||
usageVars.add(_id);
|
||||
}
|
||||
}
|
||||
return usageVars;
|
||||
}
|
||||
function addVirtualCode(vueTag, start, end) {
|
||||
muggle.offsetStack();
|
||||
codes.push([
|
||||
(vueTag === 'script' ? script : scriptSetup).content.substring(start, end),
|
||||
vueTag,
|
||||
start,
|
||||
language_core_1.FileRangeCapabilities.full, // diagnostic also working for setup() returns unused in template checking
|
||||
]);
|
||||
muggle.resetOffsetStack();
|
||||
}
|
||||
function addExtraReferenceVirtualCode(vueTag, start, end) {
|
||||
muggle.offsetStack();
|
||||
codes.push([
|
||||
(vueTag === 'script' ? script : scriptSetup).content.substring(start, end),
|
||||
vueTag,
|
||||
start,
|
||||
{
|
||||
references: true,
|
||||
definition: true,
|
||||
rename: true,
|
||||
},
|
||||
]);
|
||||
muggle.resetOffsetStack();
|
||||
}
|
||||
}
|
||||
exports.generate = generate;
|
||||
function normalizeCssRename(newName) {
|
||||
return newName.startsWith('.') ? newName.slice(1) : newName;
|
||||
}
|
||||
function applyCssRename(newName) {
|
||||
return '.' + newName;
|
||||
}
|
||||
//# sourceMappingURL=script.js.map
|
21
node_modules/@vue/language-core/out/generators/template.d.ts
generated
vendored
Normal file
21
node_modules/@vue/language-core/out/generators/template.d.ts
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
import { FileRangeCapabilities } from '@volar/language-core';
|
||||
import { Segment } from '@volar/source-map';
|
||||
import * as CompilerDOM from '@vue/compiler-dom';
|
||||
import * as muggle from 'muggle-string';
|
||||
import type * as ts from 'typescript/lib/tsserverlibrary';
|
||||
import { Sfc, VueCompilerOptions } from '../types';
|
||||
type Code = Segment<FileRangeCapabilities>;
|
||||
export declare function generate(ts: typeof import('typescript/lib/tsserverlibrary'), compilerOptions: ts.CompilerOptions, vueCompilerOptions: VueCompilerOptions, template: NonNullable<Sfc['template']>, shouldGenerateScopedClasses: boolean, stylesScopedClasses: Set<string>, hasScriptSetupSlots: boolean, slotsAssignName: string | undefined, propsAssignName: string | undefined, codegenStack: boolean): {
|
||||
codes: Code[];
|
||||
codeStacks: muggle.StackNode[];
|
||||
formatCodes: Code[];
|
||||
formatCodeStacks: muggle.StackNode[];
|
||||
cssCodes: Code[];
|
||||
cssCodeStacks: muggle.StackNode[];
|
||||
tagNames: Record<string, number[]>;
|
||||
accessedGlobalVariables: Set<string>;
|
||||
hasSlot: boolean;
|
||||
};
|
||||
export declare function walkElementNodes(node: CompilerDOM.RootNode | CompilerDOM.TemplateChildNode, cb: (node: CompilerDOM.ElementNode) => void): void;
|
||||
export {};
|
||||
//# sourceMappingURL=template.d.ts.map
|
1516
node_modules/@vue/language-core/out/generators/template.js
generated
vendored
Normal file
1516
node_modules/@vue/language-core/out/generators/template.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
16
node_modules/@vue/language-core/out/index.d.ts
generated
vendored
Normal file
16
node_modules/@vue/language-core/out/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
export * from './generators/template';
|
||||
export * from './languageModule';
|
||||
export * from './parsers/scriptSetupRanges';
|
||||
export * from './plugins';
|
||||
export * from './virtualFile/vueFile';
|
||||
export * from './types';
|
||||
export * from './utils/ts';
|
||||
export * from './utils/parseSfc';
|
||||
export * as scriptRanges from './parsers/scriptRanges';
|
||||
export * as sharedTypes from './utils/globalTypes';
|
||||
export * from './utils/shared';
|
||||
export { tsCodegen } from './plugins/vue-tsx';
|
||||
export * from '@volar/language-core';
|
||||
export * from '@volar/source-map';
|
||||
export type * as CompilerDOM from '@vue/compiler-dom';
|
||||
//# sourceMappingURL=index.d.ts.map
|
33
node_modules/@vue/language-core/out/index.js
generated
vendored
Normal file
33
node_modules/@vue/language-core/out/index.js
generated
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
||||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.tsCodegen = exports.sharedTypes = exports.scriptRanges = void 0;
|
||||
__exportStar(require("./generators/template"), exports);
|
||||
__exportStar(require("./languageModule"), exports);
|
||||
__exportStar(require("./parsers/scriptSetupRanges"), exports);
|
||||
__exportStar(require("./plugins"), exports);
|
||||
__exportStar(require("./virtualFile/vueFile"), exports);
|
||||
__exportStar(require("./types"), exports);
|
||||
__exportStar(require("./utils/ts"), exports);
|
||||
__exportStar(require("./utils/parseSfc"), exports);
|
||||
exports.scriptRanges = require("./parsers/scriptRanges");
|
||||
exports.sharedTypes = require("./utils/globalTypes");
|
||||
__exportStar(require("./utils/shared"), exports);
|
||||
var vue_tsx_1 = require("./plugins/vue-tsx");
|
||||
Object.defineProperty(exports, "tsCodegen", { enumerable: true, get: function () { return vue_tsx_1.tsCodegen; } });
|
||||
__exportStar(require("@volar/language-core"), exports);
|
||||
__exportStar(require("@volar/source-map"), exports);
|
||||
//# sourceMappingURL=index.js.map
|
10
node_modules/@vue/language-core/out/languageModule.d.ts
generated
vendored
Normal file
10
node_modules/@vue/language-core/out/languageModule.d.ts
generated
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
import type { Language } from '@volar/language-core';
|
||||
import { VueFile } from './virtualFile/vueFile';
|
||||
import { VueCompilerOptions } from './types';
|
||||
import type * as ts from 'typescript/lib/tsserverlibrary';
|
||||
export declare function createVueLanguage(ts: typeof import('typescript/lib/tsserverlibrary'), compilerOptions?: ts.CompilerOptions, _vueCompilerOptions?: Partial<VueCompilerOptions>, codegenStack?: boolean): Language<VueFile>;
|
||||
/**
|
||||
* @deprecated planed to remove in 2.0, please use createVueLanguage instead of
|
||||
*/
|
||||
export declare function createLanguages(ts: typeof import('typescript/lib/tsserverlibrary'), compilerOptions?: ts.CompilerOptions, vueCompilerOptions?: Partial<VueCompilerOptions>, codegenStack?: boolean): Language[];
|
||||
//# sourceMappingURL=languageModule.d.ts.map
|
99
node_modules/@vue/language-core/out/languageModule.js
generated
vendored
Normal file
99
node_modules/@vue/language-core/out/languageModule.js
generated
vendored
Normal file
@ -0,0 +1,99 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.createLanguages = exports.createVueLanguage = void 0;
|
||||
const path = require("path-browserify");
|
||||
const plugins_1 = require("./plugins");
|
||||
const vueFile_1 = require("./virtualFile/vueFile");
|
||||
const sharedTypes = require("./utils/globalTypes");
|
||||
const ts_1 = require("./utils/ts");
|
||||
const fileRegistries = [];
|
||||
function getVueFileRegistry(key, plugins) {
|
||||
let fileRegistry = fileRegistries.find(r => r.key === key
|
||||
&& r.plugins.length === plugins.length
|
||||
&& r.plugins.every(plugin => plugins.includes(plugin)))?.files;
|
||||
if (!fileRegistry) {
|
||||
fileRegistry = new Map();
|
||||
fileRegistries.push({
|
||||
key: key,
|
||||
plugins: plugins,
|
||||
files: fileRegistry,
|
||||
});
|
||||
}
|
||||
return fileRegistry;
|
||||
}
|
||||
function createVueLanguage(ts, compilerOptions = {}, _vueCompilerOptions = {}, codegenStack = false) {
|
||||
const vueCompilerOptions = (0, ts_1.resolveVueCompilerOptions)(_vueCompilerOptions);
|
||||
const plugins = (0, plugins_1.getDefaultVueLanguagePlugins)(ts, compilerOptions, vueCompilerOptions, codegenStack);
|
||||
const keys = [
|
||||
...Object.keys(vueCompilerOptions)
|
||||
.sort()
|
||||
.filter(key => key !== 'plugins')
|
||||
.map(key => [key, vueCompilerOptions[key]]),
|
||||
[...new Set(plugins.map(plugin => plugin.requiredCompilerOptions ?? []).flat())]
|
||||
.sort()
|
||||
.map(key => [key, compilerOptions[key]]),
|
||||
];
|
||||
const fileRegistry = getVueFileRegistry(JSON.stringify(keys), _vueCompilerOptions.plugins ?? []);
|
||||
const allowLanguageIds = new Set(['vue']);
|
||||
if (vueCompilerOptions.extensions.includes('.md')) {
|
||||
allowLanguageIds.add('markdown');
|
||||
}
|
||||
if (vueCompilerOptions.extensions.includes('.html')) {
|
||||
allowLanguageIds.add('html');
|
||||
}
|
||||
return {
|
||||
createVirtualFile(fileName, snapshot, languageId) {
|
||||
if ((languageId && allowLanguageIds.has(languageId))
|
||||
|| (!languageId && vueCompilerOptions.extensions.some(ext => fileName.endsWith(ext)))) {
|
||||
if (fileRegistry.has(fileName)) {
|
||||
const reusedVueFile = fileRegistry.get(fileName);
|
||||
reusedVueFile.update(snapshot);
|
||||
return reusedVueFile;
|
||||
}
|
||||
const vueFile = new vueFile_1.VueFile(fileName, snapshot, vueCompilerOptions, plugins, ts, codegenStack);
|
||||
fileRegistry.set(fileName, vueFile);
|
||||
return vueFile;
|
||||
}
|
||||
},
|
||||
updateVirtualFile(sourceFile, snapshot) {
|
||||
sourceFile.update(snapshot);
|
||||
},
|
||||
resolveHost(host) {
|
||||
const sharedTypesSnapshot = ts.ScriptSnapshot.fromString(sharedTypes.getTypesCode(vueCompilerOptions));
|
||||
const sharedTypesFileName = path.join(host.rootPath, sharedTypes.baseName);
|
||||
return {
|
||||
...host,
|
||||
resolveModuleName(moduleName, impliedNodeFormat) {
|
||||
if (impliedNodeFormat === ts.ModuleKind.ESNext && vueCompilerOptions.extensions.some(ext => moduleName.endsWith(ext))) {
|
||||
return `${moduleName}.js`;
|
||||
}
|
||||
return host.resolveModuleName?.(moduleName, impliedNodeFormat) ?? moduleName;
|
||||
},
|
||||
getScriptFileNames() {
|
||||
return [
|
||||
sharedTypesFileName,
|
||||
...host.getScriptFileNames(),
|
||||
];
|
||||
},
|
||||
getScriptSnapshot(fileName) {
|
||||
if (fileName === sharedTypesFileName) {
|
||||
return sharedTypesSnapshot;
|
||||
}
|
||||
return host.getScriptSnapshot(fileName);
|
||||
},
|
||||
};
|
||||
},
|
||||
};
|
||||
}
|
||||
exports.createVueLanguage = createVueLanguage;
|
||||
/**
|
||||
* @deprecated planed to remove in 2.0, please use createVueLanguage instead of
|
||||
*/
|
||||
function createLanguages(ts, compilerOptions = {}, vueCompilerOptions = {}, codegenStack = false) {
|
||||
return [
|
||||
createVueLanguage(ts, compilerOptions, vueCompilerOptions, codegenStack),
|
||||
...vueCompilerOptions.experimentalAdditionalLanguageModules?.map(module => require(module)) ?? [],
|
||||
];
|
||||
}
|
||||
exports.createLanguages = createLanguages;
|
||||
//# sourceMappingURL=languageModule.js.map
|
16
node_modules/@vue/language-core/out/parsers/scriptRanges.d.ts
generated
vendored
Normal file
16
node_modules/@vue/language-core/out/parsers/scriptRanges.d.ts
generated
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
import type { TextRange } from '../types';
|
||||
import type * as ts from 'typescript/lib/tsserverlibrary';
|
||||
export interface ScriptRanges extends ReturnType<typeof parseScriptRanges> {
|
||||
}
|
||||
export declare function parseScriptRanges(ts: typeof import('typescript/lib/tsserverlibrary'), ast: ts.SourceFile, hasScriptSetup: boolean, withNode: boolean): {
|
||||
exportDefault: (TextRange & {
|
||||
expression: TextRange;
|
||||
args: TextRange;
|
||||
argsNode: ts.ObjectLiteralExpression | undefined;
|
||||
componentsOption: TextRange | undefined;
|
||||
componentsOptionNode: ts.ObjectLiteralExpression | undefined;
|
||||
nameOption: TextRange | undefined;
|
||||
}) | undefined;
|
||||
bindings: TextRange[];
|
||||
};
|
||||
//# sourceMappingURL=scriptRanges.d.ts.map
|
58
node_modules/@vue/language-core/out/parsers/scriptRanges.js
generated
vendored
Normal file
58
node_modules/@vue/language-core/out/parsers/scriptRanges.js
generated
vendored
Normal file
@ -0,0 +1,58 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.parseScriptRanges = void 0;
|
||||
const scriptSetupRanges_1 = require("./scriptSetupRanges");
|
||||
function parseScriptRanges(ts, ast, hasScriptSetup, withNode) {
|
||||
let exportDefault;
|
||||
const bindings = hasScriptSetup ? (0, scriptSetupRanges_1.parseBindingRanges)(ts, ast) : [];
|
||||
ast.forEachChild(raw => {
|
||||
if (ts.isExportAssignment(raw)) {
|
||||
let node = raw;
|
||||
while (ts.isAsExpression(node.expression) || ts.isParenthesizedExpression(node.expression)) { // fix https://github.com/vuejs/language-tools/issues/1882
|
||||
node = node.expression;
|
||||
}
|
||||
let obj;
|
||||
if (ts.isObjectLiteralExpression(node.expression)) {
|
||||
obj = node.expression;
|
||||
}
|
||||
else if (ts.isCallExpression(node.expression) && node.expression.arguments.length) {
|
||||
const arg0 = node.expression.arguments[0];
|
||||
if (ts.isObjectLiteralExpression(arg0)) {
|
||||
obj = arg0;
|
||||
}
|
||||
}
|
||||
if (obj) {
|
||||
let componentsOptionNode;
|
||||
let nameOptionNode;
|
||||
obj.forEachChild(node => {
|
||||
if (ts.isPropertyAssignment(node) && ts.isIdentifier(node.name)) {
|
||||
if (node.name.escapedText === 'components' && ts.isObjectLiteralExpression(node.initializer)) {
|
||||
componentsOptionNode = node.initializer;
|
||||
}
|
||||
if (node.name.escapedText === 'name') {
|
||||
nameOptionNode = node.initializer;
|
||||
}
|
||||
}
|
||||
});
|
||||
exportDefault = {
|
||||
..._getStartEnd(raw),
|
||||
expression: _getStartEnd(node.expression),
|
||||
args: _getStartEnd(obj),
|
||||
argsNode: withNode ? obj : undefined,
|
||||
componentsOption: componentsOptionNode ? _getStartEnd(componentsOptionNode) : undefined,
|
||||
componentsOptionNode: withNode ? componentsOptionNode : undefined,
|
||||
nameOption: nameOptionNode ? _getStartEnd(nameOptionNode) : undefined,
|
||||
};
|
||||
}
|
||||
}
|
||||
});
|
||||
return {
|
||||
exportDefault,
|
||||
bindings,
|
||||
};
|
||||
function _getStartEnd(node) {
|
||||
return (0, scriptSetupRanges_1.getStartEnd)(node, ast);
|
||||
}
|
||||
}
|
||||
exports.parseScriptRanges = parseScriptRanges;
|
||||
//# sourceMappingURL=scriptRanges.js.map
|
56
node_modules/@vue/language-core/out/parsers/scriptSetupRanges.d.ts
generated
vendored
Normal file
56
node_modules/@vue/language-core/out/parsers/scriptSetupRanges.d.ts
generated
vendored
Normal file
@ -0,0 +1,56 @@
|
||||
import type * as ts from 'typescript/lib/tsserverlibrary';
|
||||
import type { VueCompilerOptions, TextRange } from '../types';
|
||||
export interface ScriptSetupRanges extends ReturnType<typeof parseScriptSetupRanges> {
|
||||
}
|
||||
export declare function parseScriptSetupRanges(ts: typeof import('typescript/lib/tsserverlibrary'), ast: ts.SourceFile, vueCompilerOptions: VueCompilerOptions): {
|
||||
leadingCommentEndOffset: number;
|
||||
importSectionEndOffset: number;
|
||||
bindings: TextRange[];
|
||||
props: {
|
||||
name?: string | undefined;
|
||||
define?: (TextRange & {
|
||||
arg?: TextRange | undefined;
|
||||
typeArg?: TextRange | undefined;
|
||||
} & {
|
||||
statement: TextRange;
|
||||
}) | undefined;
|
||||
withDefaults?: (TextRange & {
|
||||
arg?: TextRange | undefined;
|
||||
}) | undefined;
|
||||
};
|
||||
slots: {
|
||||
name?: string | undefined;
|
||||
define?: (TextRange & {
|
||||
arg?: TextRange | undefined;
|
||||
typeArg?: TextRange | undefined;
|
||||
}) | undefined;
|
||||
};
|
||||
emits: {
|
||||
name?: string | undefined;
|
||||
define?: (TextRange & {
|
||||
arg?: TextRange | undefined;
|
||||
typeArg?: TextRange | undefined;
|
||||
}) | undefined;
|
||||
};
|
||||
expose: {
|
||||
name?: string | undefined;
|
||||
define?: (TextRange & {
|
||||
arg?: TextRange | undefined;
|
||||
typeArg?: TextRange | undefined;
|
||||
}) | undefined;
|
||||
};
|
||||
defineProp: {
|
||||
name: TextRange | undefined;
|
||||
nameIsString: boolean;
|
||||
type: TextRange | undefined;
|
||||
defaultValue: TextRange | undefined;
|
||||
required: boolean;
|
||||
}[];
|
||||
};
|
||||
export declare function parseBindingRanges(ts: typeof import('typescript/lib/tsserverlibrary'), sourceFile: ts.SourceFile): TextRange[];
|
||||
export declare function findBindingVars(ts: typeof import('typescript/lib/tsserverlibrary'), left: ts.BindingName, sourceFile: ts.SourceFile): TextRange[];
|
||||
export declare function getStartEnd(node: ts.Node, sourceFile: ts.SourceFile): {
|
||||
start: number;
|
||||
end: number;
|
||||
};
|
||||
//# sourceMappingURL=scriptSetupRanges.d.ts.map
|
292
node_modules/@vue/language-core/out/parsers/scriptSetupRanges.js
generated
vendored
Normal file
292
node_modules/@vue/language-core/out/parsers/scriptSetupRanges.js
generated
vendored
Normal file
@ -0,0 +1,292 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getStartEnd = exports.findBindingVars = exports.parseBindingRanges = exports.parseScriptSetupRanges = void 0;
|
||||
function parseScriptSetupRanges(ts, ast, vueCompilerOptions) {
|
||||
let foundNonImportExportNode = false;
|
||||
let importSectionEndOffset = 0;
|
||||
const props = {};
|
||||
const slots = {};
|
||||
const emits = {};
|
||||
const expose = {};
|
||||
const definePropProposalA = vueCompilerOptions.experimentalDefinePropProposal === 'kevinEdition' || ast.getFullText().trimStart().startsWith('// @experimentalDefinePropProposal=kevinEdition');
|
||||
const definePropProposalB = vueCompilerOptions.experimentalDefinePropProposal === 'johnsonEdition' || ast.getFullText().trimStart().startsWith('// @experimentalDefinePropProposal=johnsonEdition');
|
||||
const defineProp = [];
|
||||
const bindings = parseBindingRanges(ts, ast);
|
||||
const text = ast.getFullText();
|
||||
const leadingCommentEndOffset = ts.getLeadingCommentRanges(text, 0)?.reverse()[0].end ?? 0;
|
||||
ast.forEachChild(node => {
|
||||
const isTypeExport = (ts.isTypeAliasDeclaration(node) || ts.isInterfaceDeclaration(node)) && node.modifiers?.some(mod => mod.kind === ts.SyntaxKind.ExportKeyword);
|
||||
if (!foundNonImportExportNode
|
||||
&& !ts.isImportDeclaration(node)
|
||||
&& !isTypeExport
|
||||
&& !ts.isEmptyStatement(node)
|
||||
// fix https://github.com/vuejs/language-tools/issues/1223
|
||||
&& !ts.isImportEqualsDeclaration(node)) {
|
||||
const commentRanges = ts.getLeadingCommentRanges(text, node.getFullStart());
|
||||
if (commentRanges?.length) {
|
||||
const commentRange = commentRanges.sort((a, b) => a.pos - b.pos)[0];
|
||||
importSectionEndOffset = commentRange.pos;
|
||||
}
|
||||
else {
|
||||
importSectionEndOffset = node.getStart(ast);
|
||||
}
|
||||
foundNonImportExportNode = true;
|
||||
}
|
||||
});
|
||||
ast.forEachChild(child => visitNode(child, [ast]));
|
||||
return {
|
||||
leadingCommentEndOffset,
|
||||
importSectionEndOffset,
|
||||
bindings,
|
||||
props,
|
||||
slots,
|
||||
emits,
|
||||
expose,
|
||||
defineProp,
|
||||
};
|
||||
function _getStartEnd(node) {
|
||||
return getStartEnd(node, ast);
|
||||
}
|
||||
function parseDefineFunction(node) {
|
||||
return {
|
||||
..._getStartEnd(node),
|
||||
arg: node.arguments.length ? _getStartEnd(node.arguments[0]) : undefined,
|
||||
typeArg: node.typeArguments?.length ? _getStartEnd(node.typeArguments[0]) : undefined,
|
||||
};
|
||||
}
|
||||
function visitNode(node, parents) {
|
||||
const parent = parents[parents.length - 1];
|
||||
if (ts.isCallExpression(node)
|
||||
&& ts.isIdentifier(node.expression)) {
|
||||
const callText = node.expression.getText(ast);
|
||||
if (vueCompilerOptions.macros.defineModel.includes(callText)) {
|
||||
let name;
|
||||
let options;
|
||||
if (node.arguments.length >= 2) {
|
||||
name = _getStartEnd(node.arguments[0]);
|
||||
options = node.arguments[1];
|
||||
}
|
||||
else if (node.arguments.length >= 1) {
|
||||
if (ts.isStringLiteral(node.arguments[0])) {
|
||||
name = _getStartEnd(node.arguments[0]);
|
||||
}
|
||||
else {
|
||||
options = node.arguments[0];
|
||||
}
|
||||
}
|
||||
let required = false;
|
||||
if (options && ts.isObjectLiteralExpression(options)) {
|
||||
for (const property of options.properties) {
|
||||
if (ts.isPropertyAssignment(property) && ts.isIdentifier(property.name) && property.name.getText(ast) === 'required' && property.initializer.kind === ts.SyntaxKind.TrueKeyword) {
|
||||
required = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
defineProp.push({
|
||||
name,
|
||||
nameIsString: true,
|
||||
type: node.typeArguments?.length ? _getStartEnd(node.typeArguments[0]) : undefined,
|
||||
defaultValue: undefined,
|
||||
required,
|
||||
});
|
||||
}
|
||||
else if (callText === 'defineProp') {
|
||||
if (definePropProposalA) {
|
||||
let required = false;
|
||||
if (node.arguments.length >= 2) {
|
||||
const secondArg = node.arguments[1];
|
||||
if (ts.isObjectLiteralExpression(secondArg)) {
|
||||
for (const property of secondArg.properties) {
|
||||
if (ts.isPropertyAssignment(property) && ts.isIdentifier(property.name) && property.name.getText(ast) === 'required' && property.initializer.kind === ts.SyntaxKind.TrueKeyword) {
|
||||
required = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (node.arguments.length >= 1) {
|
||||
defineProp.push({
|
||||
name: _getStartEnd(node.arguments[0]),
|
||||
nameIsString: true,
|
||||
type: node.typeArguments?.length ? _getStartEnd(node.typeArguments[0]) : undefined,
|
||||
defaultValue: undefined,
|
||||
required,
|
||||
});
|
||||
}
|
||||
else if (ts.isVariableDeclaration(parent)) {
|
||||
defineProp.push({
|
||||
name: _getStartEnd(parent.name),
|
||||
nameIsString: false,
|
||||
type: node.typeArguments?.length ? _getStartEnd(node.typeArguments[0]) : undefined,
|
||||
defaultValue: undefined,
|
||||
required,
|
||||
});
|
||||
}
|
||||
}
|
||||
else if (definePropProposalB && ts.isVariableDeclaration(parent)) {
|
||||
defineProp.push({
|
||||
name: _getStartEnd(parent.name),
|
||||
nameIsString: false,
|
||||
defaultValue: node.arguments.length >= 1 ? _getStartEnd(node.arguments[0]) : undefined,
|
||||
type: node.typeArguments?.length ? _getStartEnd(node.typeArguments[0]) : undefined,
|
||||
required: node.arguments.length >= 2 && node.arguments[1].kind === ts.SyntaxKind.TrueKeyword,
|
||||
});
|
||||
}
|
||||
}
|
||||
else if (vueCompilerOptions.macros.defineSlots.includes(callText)) {
|
||||
slots.define = parseDefineFunction(node);
|
||||
if (ts.isVariableDeclaration(parent)) {
|
||||
slots.name = parent.name.getText(ast);
|
||||
}
|
||||
}
|
||||
else if (vueCompilerOptions.macros.defineEmits.includes(callText)) {
|
||||
emits.define = parseDefineFunction(node);
|
||||
if (ts.isVariableDeclaration(parent)) {
|
||||
emits.name = parent.name.getText(ast);
|
||||
}
|
||||
}
|
||||
else if (vueCompilerOptions.macros.defineExpose.includes(callText)) {
|
||||
expose.define = parseDefineFunction(node);
|
||||
}
|
||||
else if (vueCompilerOptions.macros.defineProps.includes(callText)) {
|
||||
let statementRange;
|
||||
for (let i = parents.length - 1; i >= 0; i--) {
|
||||
if (ts.isStatement(parents[i])) {
|
||||
const statement = parents[i];
|
||||
statement.forEachChild(child => {
|
||||
const range = _getStartEnd(child);
|
||||
statementRange ??= range;
|
||||
statementRange.end = range.end;
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!statementRange) {
|
||||
statementRange = _getStartEnd(node);
|
||||
}
|
||||
props.define = {
|
||||
...parseDefineFunction(node),
|
||||
statement: statementRange,
|
||||
};
|
||||
if (ts.isVariableDeclaration(parent)) {
|
||||
props.name = parent.name.getText(ast);
|
||||
}
|
||||
if (node.arguments.length) {
|
||||
props.define.arg = _getStartEnd(node.arguments[0]);
|
||||
}
|
||||
if (node.typeArguments?.length) {
|
||||
props.define.typeArg = _getStartEnd(node.typeArguments[0]);
|
||||
}
|
||||
}
|
||||
else if (vueCompilerOptions.macros.withDefaults.includes(callText)) {
|
||||
props.withDefaults = _getStartEnd(node);
|
||||
if (node.arguments.length >= 2) {
|
||||
const arg = node.arguments[1];
|
||||
props.withDefaults.arg = _getStartEnd(arg);
|
||||
}
|
||||
if (ts.isVariableDeclaration(parent)) {
|
||||
props.name = parent.name.getText(ast);
|
||||
}
|
||||
}
|
||||
}
|
||||
node.forEachChild(child => {
|
||||
parents.push(node);
|
||||
visitNode(child, parents);
|
||||
parents.pop();
|
||||
});
|
||||
}
|
||||
}
|
||||
exports.parseScriptSetupRanges = parseScriptSetupRanges;
|
||||
function parseBindingRanges(ts, sourceFile) {
|
||||
const bindings = [];
|
||||
sourceFile.forEachChild(node => {
|
||||
if (ts.isVariableStatement(node)) {
|
||||
for (const node_2 of node.declarationList.declarations) {
|
||||
const vars = _findBindingVars(node_2.name);
|
||||
for (const _var of vars) {
|
||||
bindings.push(_var);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (ts.isFunctionDeclaration(node)) {
|
||||
if (node.name && ts.isIdentifier(node.name)) {
|
||||
bindings.push(_getStartEnd(node.name));
|
||||
}
|
||||
}
|
||||
else if (ts.isClassDeclaration(node)) {
|
||||
if (node.name) {
|
||||
bindings.push(_getStartEnd(node.name));
|
||||
}
|
||||
}
|
||||
else if (ts.isEnumDeclaration(node)) {
|
||||
bindings.push(_getStartEnd(node.name));
|
||||
}
|
||||
if (ts.isImportDeclaration(node)) {
|
||||
if (node.importClause && !node.importClause.isTypeOnly) {
|
||||
if (node.importClause.name) {
|
||||
bindings.push(_getStartEnd(node.importClause.name));
|
||||
}
|
||||
if (node.importClause.namedBindings) {
|
||||
if (ts.isNamedImports(node.importClause.namedBindings)) {
|
||||
for (const element of node.importClause.namedBindings.elements) {
|
||||
bindings.push(_getStartEnd(element.name));
|
||||
}
|
||||
}
|
||||
else if (ts.isNamespaceImport(node.importClause.namedBindings)) {
|
||||
bindings.push(_getStartEnd(node.importClause.namedBindings.name));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
return bindings;
|
||||
function _getStartEnd(node) {
|
||||
return getStartEnd(node, sourceFile);
|
||||
}
|
||||
function _findBindingVars(left) {
|
||||
return findBindingVars(ts, left, sourceFile);
|
||||
}
|
||||
}
|
||||
exports.parseBindingRanges = parseBindingRanges;
|
||||
function findBindingVars(ts, left, sourceFile) {
|
||||
const vars = [];
|
||||
worker(left);
|
||||
return vars;
|
||||
function worker(_node) {
|
||||
if (ts.isIdentifier(_node)) {
|
||||
vars.push(getStartEnd(_node, sourceFile));
|
||||
}
|
||||
// { ? } = ...
|
||||
// [ ? ] = ...
|
||||
else if (ts.isObjectBindingPattern(_node) || ts.isArrayBindingPattern(_node)) {
|
||||
for (const property of _node.elements) {
|
||||
if (ts.isBindingElement(property)) {
|
||||
worker(property.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
// { foo: ? } = ...
|
||||
else if (ts.isPropertyAssignment(_node)) {
|
||||
worker(_node.initializer);
|
||||
}
|
||||
// { foo } = ...
|
||||
else if (ts.isShorthandPropertyAssignment(_node)) {
|
||||
vars.push(getStartEnd(_node.name, sourceFile));
|
||||
}
|
||||
// { ...? } = ...
|
||||
// [ ...? ] = ...
|
||||
else if (ts.isSpreadAssignment(_node) || ts.isSpreadElement(_node)) {
|
||||
worker(_node.expression);
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.findBindingVars = findBindingVars;
|
||||
function getStartEnd(node, sourceFile) {
|
||||
return {
|
||||
start: node.getStart(sourceFile),
|
||||
end: node.getEnd(),
|
||||
};
|
||||
}
|
||||
exports.getStartEnd = getStartEnd;
|
||||
//# sourceMappingURL=scriptSetupRanges.js.map
|
25
node_modules/@vue/language-core/out/plugins.d.ts
generated
vendored
Normal file
25
node_modules/@vue/language-core/out/plugins.d.ts
generated
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
import type * as ts from 'typescript/lib/tsserverlibrary';
|
||||
import { VueCompilerOptions } from './types';
|
||||
import * as CompilerDOM from '@vue/compiler-dom';
|
||||
export declare function getDefaultVueLanguagePlugins(ts: typeof import('typescript/lib/tsserverlibrary'), compilerOptions: ts.CompilerOptions, vueCompilerOptions: VueCompilerOptions, codegenStack: boolean): {
|
||||
version: 1;
|
||||
name?: string | undefined;
|
||||
order?: number | undefined;
|
||||
requiredCompilerOptions?: string[] | undefined;
|
||||
parseSFC?(fileName: string, content: string): import("@vue/compiler-sfc").SFCParseResult | undefined;
|
||||
updateSFC?(oldResult: import("@vue/compiler-sfc").SFCParseResult, textChange: {
|
||||
start: number;
|
||||
end: number;
|
||||
newText: string;
|
||||
}): import("@vue/compiler-sfc").SFCParseResult | undefined;
|
||||
resolveTemplateCompilerOptions?(options: CompilerDOM.CompilerOptions): CompilerDOM.CompilerOptions;
|
||||
compileSFCTemplate?(lang: string, template: string, options: CompilerDOM.CompilerOptions): CompilerDOM.CodegenResult | undefined;
|
||||
updateSFCTemplate?(oldResult: CompilerDOM.CodegenResult, textChange: {
|
||||
start: number;
|
||||
end: number;
|
||||
newText: string;
|
||||
}): CompilerDOM.CodegenResult | undefined;
|
||||
getEmbeddedFileNames?(fileName: string, sfc: import("./types").Sfc): string[];
|
||||
resolveEmbeddedFile?(fileName: string, sfc: import("./types").Sfc, embeddedFile: import("./virtualFile/embeddedFile").VueEmbeddedFile): void;
|
||||
}[];
|
||||
//# sourceMappingURL=plugins.d.ts.map
|
58
node_modules/@vue/language-core/out/plugins.js
generated
vendored
Normal file
58
node_modules/@vue/language-core/out/plugins.js
generated
vendored
Normal file
@ -0,0 +1,58 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getDefaultVueLanguagePlugins = void 0;
|
||||
const file_html_1 = require("./plugins/file-html");
|
||||
const file_md_1 = require("./plugins/file-md");
|
||||
const file_vue_1 = require("./plugins/file-vue");
|
||||
const vue_sfc_customblocks_1 = require("./plugins/vue-sfc-customblocks");
|
||||
const vue_sfc_scripts_1 = require("./plugins/vue-sfc-scripts");
|
||||
const vue_sfc_styles_1 = require("./plugins/vue-sfc-styles");
|
||||
const vue_sfc_template_1 = require("./plugins/vue-sfc-template");
|
||||
const vue_template_html_1 = require("./plugins/vue-template-html");
|
||||
const vue_tsx_1 = require("./plugins/vue-tsx");
|
||||
const CompilerDOM = require("@vue/compiler-dom");
|
||||
const CompilerVue2 = require("./utils/vue2TemplateCompiler");
|
||||
function getDefaultVueLanguagePlugins(ts, compilerOptions, vueCompilerOptions, codegenStack) {
|
||||
const plugins = [
|
||||
file_md_1.default, // .md for VitePress
|
||||
file_html_1.default, // .html for PetiteVue
|
||||
file_vue_1.default, // .vue and others for Vue
|
||||
vue_template_html_1.default,
|
||||
vue_sfc_styles_1.default,
|
||||
vue_sfc_customblocks_1.default,
|
||||
vue_sfc_scripts_1.default,
|
||||
vue_sfc_template_1.default,
|
||||
vue_tsx_1.default,
|
||||
...vueCompilerOptions.plugins,
|
||||
];
|
||||
const pluginCtx = {
|
||||
modules: {
|
||||
'@vue/compiler-dom': vueCompilerOptions.target < 3
|
||||
? {
|
||||
...CompilerDOM,
|
||||
compile: CompilerVue2.compile,
|
||||
}
|
||||
: CompilerDOM,
|
||||
typescript: ts,
|
||||
},
|
||||
compilerOptions,
|
||||
vueCompilerOptions,
|
||||
codegenStack,
|
||||
};
|
||||
const pluginInstances = plugins
|
||||
.map(plugin => plugin(pluginCtx))
|
||||
.sort((a, b) => {
|
||||
const aOrder = a.order ?? 0;
|
||||
const bOrder = b.order ?? 0;
|
||||
return aOrder - bOrder;
|
||||
});
|
||||
return pluginInstances.filter((plugin) => {
|
||||
const valid = plugin.version >= 1 && plugin.version < 2;
|
||||
if (!valid) {
|
||||
console.warn(`Plugin ${JSON.stringify(plugin.name)} API version incompatible, expected 1.x but got ${JSON.stringify(plugin.version)}`);
|
||||
}
|
||||
return valid;
|
||||
});
|
||||
}
|
||||
exports.getDefaultVueLanguagePlugins = getDefaultVueLanguagePlugins;
|
||||
//# sourceMappingURL=plugins.js.map
|
4
node_modules/@vue/language-core/out/plugins/file-html.d.ts
generated
vendored
Normal file
4
node_modules/@vue/language-core/out/plugins/file-html.d.ts
generated
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
import { VueLanguagePlugin } from '../types';
|
||||
declare const plugin: VueLanguagePlugin;
|
||||
export default plugin;
|
||||
//# sourceMappingURL=file-html.d.ts.map
|
81
node_modules/@vue/language-core/out/plugins/file-html.js
generated
vendored
Normal file
81
node_modules/@vue/language-core/out/plugins/file-html.js
generated
vendored
Normal file
@ -0,0 +1,81 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const sfcBlockReg = /\<(script|style)\b([\s\S]*?)\>([\s\S]*?)\<\/\1\>/g;
|
||||
const langReg = /\blang\s*=\s*(['\"]?)(\S*)\b\1/;
|
||||
const plugin = () => {
|
||||
return {
|
||||
version: 1,
|
||||
parseSFC(fileName, content) {
|
||||
if (fileName.endsWith('.html')) {
|
||||
let sfc = {
|
||||
descriptor: {
|
||||
filename: fileName,
|
||||
source: content,
|
||||
template: null,
|
||||
script: null,
|
||||
scriptSetup: null,
|
||||
styles: [],
|
||||
customBlocks: [],
|
||||
cssVars: [],
|
||||
shouldForceReload: () => false,
|
||||
slotted: false,
|
||||
},
|
||||
errors: [],
|
||||
};
|
||||
let templateContent = content;
|
||||
for (const match of content.matchAll(sfcBlockReg)) {
|
||||
const matchText = match[0];
|
||||
const tag = match[1];
|
||||
const attrs = match[2];
|
||||
const lang = attrs.match(langReg)?.[2];
|
||||
const content = match[3];
|
||||
const contentStart = match.index + matchText.indexOf(content);
|
||||
if (tag === 'style') {
|
||||
sfc.descriptor.styles.push({
|
||||
attrs: {},
|
||||
content,
|
||||
loc: {
|
||||
start: { column: -1, line: -1, offset: contentStart },
|
||||
end: { column: -1, line: -1, offset: contentStart + content.length },
|
||||
source: content,
|
||||
},
|
||||
type: 'style',
|
||||
lang,
|
||||
});
|
||||
}
|
||||
// ignore `<script src="...">`
|
||||
else if (tag === 'script' && attrs.indexOf('src=') === -1) {
|
||||
let type = attrs.indexOf('type=') >= 0 ? 'scriptSetup' : 'script';
|
||||
sfc.descriptor[type] = {
|
||||
attrs: {},
|
||||
content,
|
||||
loc: {
|
||||
start: { column: -1, line: -1, offset: contentStart },
|
||||
end: { column: -1, line: -1, offset: contentStart + content.length },
|
||||
source: content,
|
||||
},
|
||||
type: 'script',
|
||||
lang,
|
||||
};
|
||||
}
|
||||
templateContent = templateContent.substring(0, match.index) + ' '.repeat(matchText.length) + templateContent.substring(match.index + matchText.length);
|
||||
}
|
||||
sfc.descriptor.template = {
|
||||
attrs: {},
|
||||
content: templateContent,
|
||||
loc: {
|
||||
start: { column: -1, line: -1, offset: 0 },
|
||||
end: { column: -1, line: -1, offset: templateContent.length },
|
||||
source: templateContent,
|
||||
},
|
||||
type: 'template',
|
||||
ast: {},
|
||||
};
|
||||
return sfc;
|
||||
}
|
||||
;
|
||||
}
|
||||
};
|
||||
};
|
||||
exports.default = plugin;
|
||||
//# sourceMappingURL=file-html.js.map
|
4
node_modules/@vue/language-core/out/plugins/file-md.d.ts
generated
vendored
Normal file
4
node_modules/@vue/language-core/out/plugins/file-md.d.ts
generated
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
import { VueLanguagePlugin } from '../types';
|
||||
declare const plugin: VueLanguagePlugin;
|
||||
export default plugin;
|
||||
//# sourceMappingURL=file-md.d.ts.map
|
71
node_modules/@vue/language-core/out/plugins/file-md.js
generated
vendored
Normal file
71
node_modules/@vue/language-core/out/plugins/file-md.js
generated
vendored
Normal file
@ -0,0 +1,71 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const source_map_1 = require("@volar/source-map");
|
||||
const parseSfc_1 = require("../utils/parseSfc");
|
||||
const codeblockReg = /```[\s\S]+?```/g;
|
||||
const inlineCodeblockReg = /`[^\n`]+?`/g;
|
||||
const scriptSetupReg = /\\\<[\s\S]+?\>\n?/g;
|
||||
const sfcBlockReg = /\<(script|style)\b[\s\S]*?\>([\s\S]*?)\<\/\1\>/g;
|
||||
const angleBracketReg = /\<\S*\:\S*\>/g;
|
||||
const linkReg = /\[[\s\S]*?\]\([\s\S]*?\)/g;
|
||||
const codeSnippetImportReg = /^\s*<<<\s*.+/gm;
|
||||
const plugin = () => {
|
||||
return {
|
||||
version: 1,
|
||||
parseSFC(fileName, content) {
|
||||
if (fileName.endsWith('.md')) {
|
||||
content = content
|
||||
// code block
|
||||
.replace(codeblockReg, match => '```' + ' '.repeat(match.length - 6) + '```')
|
||||
// inline code block
|
||||
.replace(inlineCodeblockReg, match => `\`${' '.repeat(match.length - 2)}\``)
|
||||
// # \<script setup>
|
||||
.replace(scriptSetupReg, match => ' '.repeat(match.length))
|
||||
// <<< https://vitepress.dev/guide/markdown#import-code-snippets
|
||||
.replace(codeSnippetImportReg, match => ' '.repeat(match.length));
|
||||
const codes = [];
|
||||
for (const match of content.matchAll(sfcBlockReg)) {
|
||||
if (match.index !== undefined) {
|
||||
const matchText = match[0];
|
||||
codes.push([matchText, undefined, match.index]);
|
||||
codes.push('\n\n');
|
||||
content = content.substring(0, match.index) + ' '.repeat(matchText.length) + content.substring(match.index + matchText.length);
|
||||
}
|
||||
}
|
||||
content = content
|
||||
// angle bracket: <http://foo.com>
|
||||
.replace(angleBracketReg, match => ' '.repeat(match.length))
|
||||
// [foo](http://foo.com)
|
||||
.replace(linkReg, match => ' '.repeat(match.length));
|
||||
codes.push('<template>\n');
|
||||
codes.push([content, undefined, 0]);
|
||||
codes.push('\n</template>');
|
||||
const file2VueSourceMap = new source_map_1.SourceMap((0, source_map_1.buildMappings)(codes));
|
||||
const sfc = (0, parseSfc_1.parse)((0, source_map_1.toString)(codes));
|
||||
if (sfc.descriptor.template) {
|
||||
transformRange(sfc.descriptor.template);
|
||||
}
|
||||
if (sfc.descriptor.script) {
|
||||
transformRange(sfc.descriptor.script);
|
||||
}
|
||||
if (sfc.descriptor.scriptSetup) {
|
||||
transformRange(sfc.descriptor.scriptSetup);
|
||||
}
|
||||
for (const style of sfc.descriptor.styles) {
|
||||
transformRange(style);
|
||||
}
|
||||
for (const customBlock of sfc.descriptor.customBlocks) {
|
||||
transformRange(customBlock);
|
||||
}
|
||||
return sfc;
|
||||
function transformRange(block) {
|
||||
block.loc.start.offset = file2VueSourceMap.toSourceOffset(block.loc.start.offset)?.[0] ?? -1;
|
||||
block.loc.end.offset = file2VueSourceMap.toSourceOffset(block.loc.end.offset)?.[0] ?? -1;
|
||||
}
|
||||
}
|
||||
;
|
||||
}
|
||||
};
|
||||
};
|
||||
exports.default = plugin;
|
||||
//# sourceMappingURL=file-md.js.map
|
4
node_modules/@vue/language-core/out/plugins/file-vue.d.ts
generated
vendored
Normal file
4
node_modules/@vue/language-core/out/plugins/file-vue.d.ts
generated
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
import { VueLanguagePlugin } from '../types';
|
||||
declare const plugin: VueLanguagePlugin;
|
||||
export default plugin;
|
||||
//# sourceMappingURL=file-vue.d.ts.map
|
47
node_modules/@vue/language-core/out/plugins/file-vue.js
generated
vendored
Normal file
47
node_modules/@vue/language-core/out/plugins/file-vue.js
generated
vendored
Normal file
@ -0,0 +1,47 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const parseSfc_1 = require("../utils/parseSfc");
|
||||
const plugin = (_ctx) => {
|
||||
return {
|
||||
version: 1,
|
||||
parseSFC(_fileName, content) {
|
||||
return (0, parseSfc_1.parse)(content);
|
||||
},
|
||||
updateSFC(sfc, change) {
|
||||
const blocks = [
|
||||
sfc.descriptor.template,
|
||||
sfc.descriptor.script,
|
||||
sfc.descriptor.scriptSetup,
|
||||
...sfc.descriptor.styles,
|
||||
...sfc.descriptor.customBlocks,
|
||||
].filter((block) => !!block);
|
||||
const hitBlock = blocks.find(block => change.start >= block.loc.start.offset && change.end <= block.loc.end.offset);
|
||||
if (!hitBlock) {
|
||||
return;
|
||||
}
|
||||
const oldContent = hitBlock.content;
|
||||
const newContent = hitBlock.content =
|
||||
hitBlock.content.substring(0, change.start - hitBlock.loc.start.offset)
|
||||
+ change.newText
|
||||
+ hitBlock.content.substring(change.end - hitBlock.loc.start.offset);
|
||||
// #3449
|
||||
const endTagRegex = new RegExp(`</\\s*${hitBlock.type}\\s*>`);
|
||||
const insertedEndTag = !!oldContent.match(endTagRegex) !== !!newContent.match(endTagRegex);
|
||||
if (insertedEndTag) {
|
||||
return;
|
||||
}
|
||||
const lengthDiff = change.newText.length - (change.end - change.start);
|
||||
for (const block of blocks) {
|
||||
if (block.loc.start.offset > change.end) {
|
||||
block.loc.start.offset += lengthDiff;
|
||||
}
|
||||
if (block.loc.end.offset >= change.end) {
|
||||
block.loc.end.offset += lengthDiff;
|
||||
}
|
||||
}
|
||||
return sfc;
|
||||
},
|
||||
};
|
||||
};
|
||||
exports.default = plugin;
|
||||
//# sourceMappingURL=file-vue.js.map
|
4
node_modules/@vue/language-core/out/plugins/vue-sfc-customblocks.d.ts
generated
vendored
Normal file
4
node_modules/@vue/language-core/out/plugins/vue-sfc-customblocks.d.ts
generated
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
import { VueLanguagePlugin } from '../types';
|
||||
declare const plugin: VueLanguagePlugin;
|
||||
export default plugin;
|
||||
//# sourceMappingURL=vue-sfc-customblocks.d.ts.map
|
33
node_modules/@vue/language-core/out/plugins/vue-sfc-customblocks.js
generated
vendored
Normal file
33
node_modules/@vue/language-core/out/plugins/vue-sfc-customblocks.js
generated
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const language_core_1 = require("@volar/language-core");
|
||||
const customBlockReg = /^(.*)\.customBlock_([^_]+)_(\d+)\.([^.]+)$/;
|
||||
const plugin = () => {
|
||||
return {
|
||||
version: 1,
|
||||
getEmbeddedFileNames(fileName, sfc) {
|
||||
const names = [];
|
||||
for (let i = 0; i < sfc.customBlocks.length; i++) {
|
||||
const customBlock = sfc.customBlocks[i];
|
||||
names.push(fileName + '.customBlock_' + customBlock.type + '_' + i + '.' + customBlock.lang);
|
||||
}
|
||||
return names;
|
||||
},
|
||||
resolveEmbeddedFile(_fileName, sfc, embeddedFile) {
|
||||
const match = embeddedFile.fileName.match(customBlockReg);
|
||||
if (match) {
|
||||
const index = parseInt(match[3]);
|
||||
const customBlock = sfc.customBlocks[index];
|
||||
embeddedFile.capabilities = language_core_1.FileCapabilities.full;
|
||||
embeddedFile.content.push([
|
||||
customBlock.content,
|
||||
customBlock.name,
|
||||
0,
|
||||
language_core_1.FileRangeCapabilities.full,
|
||||
]);
|
||||
}
|
||||
},
|
||||
};
|
||||
};
|
||||
exports.default = plugin;
|
||||
//# sourceMappingURL=vue-sfc-customblocks.js.map
|
4
node_modules/@vue/language-core/out/plugins/vue-sfc-scripts.d.ts
generated
vendored
Normal file
4
node_modules/@vue/language-core/out/plugins/vue-sfc-scripts.d.ts
generated
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
import { VueLanguagePlugin } from '../types';
|
||||
declare const plugin: VueLanguagePlugin;
|
||||
export default plugin;
|
||||
//# sourceMappingURL=vue-sfc-scripts.d.ts.map
|
42
node_modules/@vue/language-core/out/plugins/vue-sfc-scripts.js
generated
vendored
Normal file
42
node_modules/@vue/language-core/out/plugins/vue-sfc-scripts.js
generated
vendored
Normal file
@ -0,0 +1,42 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const language_core_1 = require("@volar/language-core");
|
||||
const scriptFormatReg = /^(.*)\.script_format\.([^.]+)$/;
|
||||
const scriptSetupFormatReg = /^(.*)\.scriptSetup_format\.([^.]+)$/;
|
||||
const plugin = () => {
|
||||
return {
|
||||
version: 1,
|
||||
getEmbeddedFileNames(fileName, sfc) {
|
||||
const names = [];
|
||||
if (sfc.script) {
|
||||
names.push(fileName + '.script_format.' + sfc.script.lang);
|
||||
}
|
||||
if (sfc.scriptSetup) {
|
||||
names.push(fileName + '.scriptSetup_format.' + sfc.scriptSetup.lang);
|
||||
}
|
||||
return names;
|
||||
},
|
||||
resolveEmbeddedFile(_fileName, sfc, embeddedFile) {
|
||||
const scriptMatch = embeddedFile.fileName.match(scriptFormatReg);
|
||||
const scriptSetupMatch = embeddedFile.fileName.match(scriptSetupFormatReg);
|
||||
const script = scriptMatch ? sfc.script : scriptSetupMatch ? sfc.scriptSetup : undefined;
|
||||
if (script) {
|
||||
embeddedFile.kind = language_core_1.FileKind.TextFile;
|
||||
embeddedFile.capabilities = {
|
||||
...language_core_1.FileCapabilities.full,
|
||||
diagnostic: false,
|
||||
codeAction: false,
|
||||
inlayHint: false,
|
||||
};
|
||||
embeddedFile.content.push([
|
||||
script.content,
|
||||
script.name,
|
||||
0,
|
||||
{},
|
||||
]);
|
||||
}
|
||||
},
|
||||
};
|
||||
};
|
||||
exports.default = plugin;
|
||||
//# sourceMappingURL=vue-sfc-scripts.js.map
|
4
node_modules/@vue/language-core/out/plugins/vue-sfc-styles.d.ts
generated
vendored
Normal file
4
node_modules/@vue/language-core/out/plugins/vue-sfc-styles.d.ts
generated
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
import { VueLanguagePlugin } from '../types';
|
||||
declare const plugin: VueLanguagePlugin;
|
||||
export default plugin;
|
||||
//# sourceMappingURL=vue-sfc-styles.d.ts.map
|
33
node_modules/@vue/language-core/out/plugins/vue-sfc-styles.js
generated
vendored
Normal file
33
node_modules/@vue/language-core/out/plugins/vue-sfc-styles.js
generated
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const language_core_1 = require("@volar/language-core");
|
||||
const styleReg = /^(.*)\.style_(\d+)\.([^.]+)$/;
|
||||
const plugin = () => {
|
||||
return {
|
||||
version: 1,
|
||||
getEmbeddedFileNames(fileName, sfc) {
|
||||
const names = [];
|
||||
for (let i = 0; i < sfc.styles.length; i++) {
|
||||
const style = sfc.styles[i];
|
||||
names.push(fileName + '.style_' + i + '.' + style.lang);
|
||||
}
|
||||
return names;
|
||||
},
|
||||
resolveEmbeddedFile(_fileName, sfc, embeddedFile) {
|
||||
const match = embeddedFile.fileName.match(styleReg);
|
||||
if (match) {
|
||||
const index = parseInt(match[2]);
|
||||
const style = sfc.styles[index];
|
||||
embeddedFile.capabilities = language_core_1.FileCapabilities.full;
|
||||
embeddedFile.content.push([
|
||||
style.content,
|
||||
style.name,
|
||||
0,
|
||||
language_core_1.FileRangeCapabilities.full,
|
||||
]);
|
||||
}
|
||||
},
|
||||
};
|
||||
};
|
||||
exports.default = plugin;
|
||||
//# sourceMappingURL=vue-sfc-styles.js.map
|
4
node_modules/@vue/language-core/out/plugins/vue-sfc-template.d.ts
generated
vendored
Normal file
4
node_modules/@vue/language-core/out/plugins/vue-sfc-template.d.ts
generated
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
import { VueLanguagePlugin } from '../types';
|
||||
declare const plugin: VueLanguagePlugin;
|
||||
export default plugin;
|
||||
//# sourceMappingURL=vue-sfc-template.d.ts.map
|
29
node_modules/@vue/language-core/out/plugins/vue-sfc-template.js
generated
vendored
Normal file
29
node_modules/@vue/language-core/out/plugins/vue-sfc-template.js
generated
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const language_core_1 = require("@volar/language-core");
|
||||
const templateReg = /^(.*)\.template\.([^.]+)$/;
|
||||
const plugin = () => {
|
||||
return {
|
||||
version: 1,
|
||||
getEmbeddedFileNames(fileName, sfc) {
|
||||
if (sfc.template) {
|
||||
return [fileName + '.template.' + sfc.template.lang];
|
||||
}
|
||||
return [];
|
||||
},
|
||||
resolveEmbeddedFile(_fileName, sfc, embeddedFile) {
|
||||
const match = embeddedFile.fileName.match(templateReg);
|
||||
if (match && sfc.template) {
|
||||
embeddedFile.capabilities = language_core_1.FileCapabilities.full;
|
||||
embeddedFile.content.push([
|
||||
sfc.template.content,
|
||||
sfc.template.name,
|
||||
0,
|
||||
language_core_1.FileRangeCapabilities.full,
|
||||
]);
|
||||
}
|
||||
},
|
||||
};
|
||||
};
|
||||
exports.default = plugin;
|
||||
//# sourceMappingURL=vue-sfc-template.js.map
|
4
node_modules/@vue/language-core/out/plugins/vue-template-html.d.ts
generated
vendored
Normal file
4
node_modules/@vue/language-core/out/plugins/vue-template-html.d.ts
generated
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
import { VueLanguagePlugin } from '../types';
|
||||
declare const plugin: VueLanguagePlugin;
|
||||
export default plugin;
|
||||
//# sourceMappingURL=vue-template-html.d.ts.map
|
169
node_modules/@vue/language-core/out/plugins/vue-template-html.js
generated
vendored
Normal file
169
node_modules/@vue/language-core/out/plugins/vue-template-html.js
generated
vendored
Normal file
@ -0,0 +1,169 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const plugin = ({ modules }) => {
|
||||
return {
|
||||
version: 1,
|
||||
compileSFCTemplate(lang, template, options) {
|
||||
if (lang === 'html') {
|
||||
const compiler = modules['@vue/compiler-dom'];
|
||||
return compiler.compile(template, {
|
||||
...options,
|
||||
comments: true,
|
||||
});
|
||||
}
|
||||
},
|
||||
updateSFCTemplate(oldResult, change) {
|
||||
const CompilerDOM = modules['@vue/compiler-dom'];
|
||||
const lengthDiff = change.newText.length - (change.end - change.start);
|
||||
let hitNodes = [];
|
||||
if (tryUpdateNode(oldResult.ast) && hitNodes.length) {
|
||||
hitNodes = hitNodes.sort((a, b) => a.loc.source.length - b.loc.source.length);
|
||||
const hitNode = hitNodes[0];
|
||||
if (hitNode.type === 4 /* CompilerDOM.NodeTypes.SIMPLE_EXPRESSION */) {
|
||||
return oldResult;
|
||||
}
|
||||
}
|
||||
function tryUpdateNode(node) {
|
||||
if (withinChangeRange(node.loc)) {
|
||||
hitNodes.push(node);
|
||||
}
|
||||
if (tryUpdateNodeLoc(node.loc)) {
|
||||
if (node.type === 0 /* CompilerDOM.NodeTypes.ROOT */) {
|
||||
for (const child of node.children) {
|
||||
if (!tryUpdateNode(child)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (node.type === 1 /* CompilerDOM.NodeTypes.ELEMENT */) {
|
||||
if (withinChangeRange(node.loc)) {
|
||||
// if not self closing, should not hit tag name
|
||||
const start = node.loc.start.offset + 2;
|
||||
const end = node.loc.start.offset + node.loc.source.lastIndexOf('</');
|
||||
if (!withinChangeRange({ start: { offset: start }, end: { offset: end }, source: '' })) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
for (const prop of node.props) {
|
||||
if (!tryUpdateNode(prop)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
for (const child of node.children) {
|
||||
if (!tryUpdateNode(child)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (node.type === 6 /* CompilerDOM.NodeTypes.ATTRIBUTE */) {
|
||||
if (node.value && !tryUpdateNode(node.value)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (node.type === 7 /* CompilerDOM.NodeTypes.DIRECTIVE */) {
|
||||
if (node.arg && withinChangeRange(node.arg.loc) && node.name === 'slot') {
|
||||
return false;
|
||||
}
|
||||
if (node.exp && withinChangeRange(node.exp.loc) && node.name === 'for') { // #2266
|
||||
return false;
|
||||
}
|
||||
if (node.arg && !tryUpdateNode(node.arg)) {
|
||||
return false;
|
||||
}
|
||||
if (node.exp && !tryUpdateNode(node.exp)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (node.type === 12 /* CompilerDOM.NodeTypes.TEXT_CALL */) {
|
||||
if (!tryUpdateNode(node.content)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (node.type === 8 /* CompilerDOM.NodeTypes.COMPOUND_EXPRESSION */) {
|
||||
for (const childNode of node.children) {
|
||||
if (typeof childNode === 'object') {
|
||||
if (!tryUpdateNode(childNode)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (node.type === 9 /* CompilerDOM.NodeTypes.IF */) {
|
||||
for (const branch of node.branches) {
|
||||
if (branch.condition && !tryUpdateNode(branch.condition)) {
|
||||
return false;
|
||||
}
|
||||
for (const child of branch.children) {
|
||||
if (!tryUpdateNode(child)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (node.type === 11 /* CompilerDOM.NodeTypes.FOR */) {
|
||||
for (const child of [
|
||||
node.parseResult.source,
|
||||
node.parseResult.value,
|
||||
node.parseResult.key,
|
||||
node.parseResult.index,
|
||||
]) {
|
||||
if (child && !tryUpdateNode(child)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
for (const child of node.children) {
|
||||
if (!tryUpdateNode(child)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (node.type === 5 /* CompilerDOM.NodeTypes.INTERPOLATION */) {
|
||||
if (!tryUpdateNode(node.content)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (node.type === 4 /* CompilerDOM.NodeTypes.SIMPLE_EXPRESSION */) {
|
||||
if (withinChangeRange(node.loc)) { // TODO: review this (slot name?)
|
||||
if (node.isStatic) {
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
node.content = node.loc.source;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function tryUpdateNodeLoc(loc) {
|
||||
delete loc.__endOffset;
|
||||
if (withinChangeRange(loc)) {
|
||||
loc.source =
|
||||
loc.source.substring(0, change.start - loc.start.offset)
|
||||
+ change.newText
|
||||
+ loc.source.substring(change.end - loc.start.offset);
|
||||
loc.__endOffset = loc.end.offset;
|
||||
loc.end.offset += lengthDiff;
|
||||
return true;
|
||||
}
|
||||
else if (change.end <= loc.start.offset) {
|
||||
loc.__endOffset = loc.end.offset;
|
||||
loc.start.offset += lengthDiff;
|
||||
loc.end.offset += lengthDiff;
|
||||
return true;
|
||||
}
|
||||
else if (change.start >= loc.end.offset) {
|
||||
return true; // no need update
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function withinChangeRange(loc) {
|
||||
const originalLocEnd = loc.__endOffset ?? loc.end.offset;
|
||||
return change.start >= loc.start.offset && change.end <= originalLocEnd;
|
||||
}
|
||||
},
|
||||
};
|
||||
};
|
||||
exports.default = plugin;
|
||||
//# sourceMappingURL=vue-template-html.js.map
|
80
node_modules/@vue/language-core/out/plugins/vue-tsx.d.ts
generated
vendored
Normal file
80
node_modules/@vue/language-core/out/plugins/vue-tsx.d.ts
generated
vendored
Normal file
@ -0,0 +1,80 @@
|
||||
import { Sfc, VueLanguagePlugin } from '../types';
|
||||
import * as muggle from 'muggle-string';
|
||||
export declare const tsCodegen: WeakMap<Sfc, {
|
||||
scriptRanges: () => {
|
||||
exportDefault: (import("../types").TextRange & {
|
||||
expression: import("../types").TextRange;
|
||||
args: import("../types").TextRange;
|
||||
argsNode: import("typescript").ObjectLiteralExpression | undefined;
|
||||
componentsOption: import("../types").TextRange | undefined;
|
||||
componentsOptionNode: import("typescript").ObjectLiteralExpression | undefined;
|
||||
nameOption: import("../types").TextRange | undefined;
|
||||
}) | undefined;
|
||||
bindings: import("../types").TextRange[];
|
||||
} | undefined;
|
||||
scriptSetupRanges: () => {
|
||||
leadingCommentEndOffset: number;
|
||||
importSectionEndOffset: number;
|
||||
bindings: import("../types").TextRange[];
|
||||
props: {
|
||||
name?: string | undefined;
|
||||
define?: (import("../types").TextRange & {
|
||||
arg?: import("../types").TextRange | undefined;
|
||||
typeArg?: import("../types").TextRange | undefined;
|
||||
} & {
|
||||
statement: import("../types").TextRange;
|
||||
}) | undefined;
|
||||
withDefaults?: (import("../types").TextRange & {
|
||||
arg?: import("../types").TextRange | undefined;
|
||||
}) | undefined;
|
||||
};
|
||||
slots: {
|
||||
name?: string | undefined;
|
||||
define?: (import("../types").TextRange & {
|
||||
arg?: import("../types").TextRange | undefined;
|
||||
typeArg?: import("../types").TextRange | undefined;
|
||||
}) | undefined;
|
||||
};
|
||||
emits: {
|
||||
name?: string | undefined;
|
||||
define?: (import("../types").TextRange & {
|
||||
arg?: import("../types").TextRange | undefined;
|
||||
typeArg?: import("../types").TextRange | undefined;
|
||||
}) | undefined;
|
||||
};
|
||||
expose: {
|
||||
name?: string | undefined;
|
||||
define?: (import("../types").TextRange & {
|
||||
arg?: import("../types").TextRange | undefined;
|
||||
typeArg?: import("../types").TextRange | undefined;
|
||||
}) | undefined;
|
||||
};
|
||||
defineProp: {
|
||||
name: import("../types").TextRange | undefined;
|
||||
nameIsString: boolean;
|
||||
type: import("../types").TextRange | undefined;
|
||||
defaultValue: import("../types").TextRange | undefined;
|
||||
required: boolean;
|
||||
}[];
|
||||
} | undefined;
|
||||
lang: () => string;
|
||||
generatedScript: () => {
|
||||
codes: muggle.Segment<import("@volar/language-core").FileRangeCapabilities>[];
|
||||
codeStacks: muggle.StackNode[];
|
||||
mirrorBehaviorMappings: import("@volar/source-map").Mapping<[import("@volar/language-core").MirrorBehaviorCapabilities, import("@volar/language-core").MirrorBehaviorCapabilities]>[];
|
||||
};
|
||||
generatedTemplate: () => {
|
||||
codes: (string | [string, string | undefined, number | [number, number], import("@volar/language-core").FileRangeCapabilities])[];
|
||||
codeStacks: muggle.StackNode[];
|
||||
formatCodes: (string | [string, string | undefined, number | [number, number], import("@volar/language-core").FileRangeCapabilities])[];
|
||||
formatCodeStacks: muggle.StackNode[];
|
||||
cssCodes: (string | [string, string | undefined, number | [number, number], import("@volar/language-core").FileRangeCapabilities])[];
|
||||
cssCodeStacks: muggle.StackNode[];
|
||||
tagNames: Record<string, number[]>;
|
||||
accessedGlobalVariables: Set<string>;
|
||||
hasSlot: boolean;
|
||||
} | undefined;
|
||||
}>;
|
||||
declare const plugin: VueLanguagePlugin;
|
||||
export default plugin;
|
||||
//# sourceMappingURL=vue-tsx.d.ts.map
|
159
node_modules/@vue/language-core/out/plugins/vue-tsx.js
generated
vendored
Normal file
159
node_modules/@vue/language-core/out/plugins/vue-tsx.js
generated
vendored
Normal file
@ -0,0 +1,159 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.tsCodegen = void 0;
|
||||
const computeds_1 = require("computeds");
|
||||
const script_1 = require("../generators/script");
|
||||
const template_1 = require("../generators/template");
|
||||
const scriptRanges_1 = require("../parsers/scriptRanges");
|
||||
const scriptSetupRanges_1 = require("../parsers/scriptSetupRanges");
|
||||
const language_core_1 = require("@volar/language-core");
|
||||
const muggle = require("muggle-string");
|
||||
const templateFormatReg = /^\.template_format\.ts$/;
|
||||
const templateStyleCssReg = /^\.template_style\.css$/;
|
||||
exports.tsCodegen = new WeakMap();
|
||||
const plugin = (ctx) => {
|
||||
return {
|
||||
version: 1,
|
||||
requiredCompilerOptions: [
|
||||
'noPropertyAccessFromIndexSignature',
|
||||
'exactOptionalPropertyTypes',
|
||||
],
|
||||
getEmbeddedFileNames(fileName, sfc) {
|
||||
const tsx = useTsx(fileName, sfc);
|
||||
const fileNames = [];
|
||||
if (['js', 'ts', 'jsx', 'tsx'].includes(tsx.lang())) {
|
||||
fileNames.push(fileName + '.' + tsx.lang());
|
||||
}
|
||||
if (sfc.template) {
|
||||
fileNames.push(fileName + '.template_format.ts');
|
||||
fileNames.push(fileName + '.template_style.css');
|
||||
}
|
||||
return fileNames;
|
||||
},
|
||||
resolveEmbeddedFile(fileName, sfc, embeddedFile) {
|
||||
const _tsx = useTsx(fileName, sfc);
|
||||
const suffix = embeddedFile.fileName.replace(fileName, '');
|
||||
if (suffix === '.' + _tsx.lang()) {
|
||||
embeddedFile.kind = language_core_1.FileKind.TypeScriptHostFile;
|
||||
embeddedFile.capabilities = {
|
||||
...language_core_1.FileCapabilities.full,
|
||||
foldingRange: false,
|
||||
documentFormatting: false,
|
||||
documentSymbol: false,
|
||||
};
|
||||
const tsx = _tsx.generatedScript();
|
||||
if (tsx) {
|
||||
const [content, contentStacks] = ctx.codegenStack ? muggle.track([...tsx.codes], [...tsx.codeStacks]) : [[...tsx.codes], [...tsx.codeStacks]];
|
||||
embeddedFile.content = content;
|
||||
embeddedFile.contentStacks = contentStacks;
|
||||
embeddedFile.mirrorBehaviorMappings = [...tsx.mirrorBehaviorMappings];
|
||||
}
|
||||
}
|
||||
else if (suffix.match(templateFormatReg)) {
|
||||
embeddedFile.parentFileName = fileName + '.template.' + sfc.template?.lang;
|
||||
embeddedFile.kind = language_core_1.FileKind.TextFile;
|
||||
embeddedFile.capabilities = {
|
||||
...language_core_1.FileCapabilities.full,
|
||||
diagnostic: false,
|
||||
foldingRange: false,
|
||||
codeAction: false,
|
||||
inlayHint: false,
|
||||
};
|
||||
const template = _tsx.generatedTemplate();
|
||||
if (template) {
|
||||
const [content, contentStacks] = ctx.codegenStack
|
||||
? muggle.track([...template.formatCodes], [...template.formatCodeStacks])
|
||||
: [[...template.formatCodes], [...template.formatCodeStacks]];
|
||||
embeddedFile.content = content;
|
||||
embeddedFile.contentStacks = contentStacks;
|
||||
}
|
||||
for (const style of sfc.styles) {
|
||||
embeddedFile.content.push('\n\n');
|
||||
for (const cssVar of style.cssVars) {
|
||||
embeddedFile.content.push('(');
|
||||
embeddedFile.content.push([
|
||||
cssVar.text,
|
||||
style.name,
|
||||
cssVar.offset,
|
||||
{},
|
||||
]);
|
||||
embeddedFile.content.push(');\n');
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (suffix.match(templateStyleCssReg)) {
|
||||
embeddedFile.parentFileName = fileName + '.template.' + sfc.template?.lang;
|
||||
const template = _tsx.generatedTemplate();
|
||||
if (template) {
|
||||
const [content, contentStacks] = ctx.codegenStack
|
||||
? muggle.track([...template.cssCodes], [...template.cssCodeStacks])
|
||||
: [[...template.cssCodes], [...template.cssCodeStacks]];
|
||||
embeddedFile.content = content;
|
||||
embeddedFile.contentStacks = contentStacks;
|
||||
}
|
||||
// for color pickers support
|
||||
embeddedFile.capabilities.documentSymbol = true;
|
||||
}
|
||||
},
|
||||
};
|
||||
function useTsx(fileName, sfc) {
|
||||
if (!exports.tsCodegen.has(sfc)) {
|
||||
exports.tsCodegen.set(sfc, createTsx(fileName, sfc, ctx));
|
||||
}
|
||||
return exports.tsCodegen.get(sfc);
|
||||
}
|
||||
};
|
||||
exports.default = plugin;
|
||||
function createTsx(fileName, _sfc, { vueCompilerOptions, compilerOptions, codegenStack, modules }) {
|
||||
const ts = modules.typescript;
|
||||
const lang = (0, computeds_1.computed)(() => {
|
||||
return !_sfc.script && !_sfc.scriptSetup ? 'ts'
|
||||
: _sfc.scriptSetup && _sfc.scriptSetup.lang !== 'js' ? _sfc.scriptSetup.lang
|
||||
: _sfc.script && _sfc.script.lang !== 'js' ? _sfc.script.lang
|
||||
: 'js';
|
||||
});
|
||||
const scriptRanges = (0, computeds_1.computed)(() => _sfc.script
|
||||
? (0, scriptRanges_1.parseScriptRanges)(ts, _sfc.script.ast, !!_sfc.scriptSetup, false)
|
||||
: undefined);
|
||||
const scriptSetupRanges = (0, computeds_1.computed)(() => _sfc.scriptSetup
|
||||
? (0, scriptSetupRanges_1.parseScriptSetupRanges)(ts, _sfc.scriptSetup.ast, vueCompilerOptions)
|
||||
: undefined);
|
||||
const shouldGenerateScopedClasses = (0, computeds_1.computed)(() => {
|
||||
const option = vueCompilerOptions.experimentalResolveStyleCssClasses;
|
||||
return _sfc.styles.some(s => {
|
||||
return option === 'always' || (option === 'scoped' && s.scoped);
|
||||
});
|
||||
});
|
||||
const stylesScopedClasses = (0, computeds_1.computedSet)(() => {
|
||||
const classes = new Set();
|
||||
if (!shouldGenerateScopedClasses()) {
|
||||
return classes;
|
||||
}
|
||||
for (const style of _sfc.styles) {
|
||||
const option = vueCompilerOptions.experimentalResolveStyleCssClasses;
|
||||
if (option === 'always' || (option === 'scoped' && style.scoped)) {
|
||||
for (const className of style.classNames) {
|
||||
classes.add(className.text.substring(1));
|
||||
}
|
||||
}
|
||||
}
|
||||
return classes;
|
||||
});
|
||||
const generatedTemplate = (0, computeds_1.computed)(() => {
|
||||
if (!_sfc.template)
|
||||
return;
|
||||
return (0, template_1.generate)(ts, compilerOptions, vueCompilerOptions, _sfc.template, shouldGenerateScopedClasses(), stylesScopedClasses(), hasScriptSetupSlots(), slotsAssignName(), propsAssignName(), codegenStack);
|
||||
});
|
||||
const hasScriptSetupSlots = (0, computeds_1.computed)(() => !!scriptSetupRanges()?.slots.define);
|
||||
const slotsAssignName = (0, computeds_1.computed)(() => scriptSetupRanges()?.slots.name);
|
||||
const propsAssignName = (0, computeds_1.computed)(() => scriptSetupRanges()?.props.name);
|
||||
const generatedScript = (0, computeds_1.computed)(() => (0, script_1.generate)(ts, fileName, _sfc.script, _sfc.scriptSetup, _sfc.styles, lang(), scriptRanges(), scriptSetupRanges(), generatedTemplate(), compilerOptions, vueCompilerOptions, codegenStack));
|
||||
return {
|
||||
scriptRanges,
|
||||
scriptSetupRanges,
|
||||
lang,
|
||||
generatedScript,
|
||||
generatedTemplate,
|
||||
};
|
||||
}
|
||||
//# sourceMappingURL=vue-tsx.js.map
|
125
node_modules/@vue/language-core/out/types.d.ts
generated
vendored
Normal file
125
node_modules/@vue/language-core/out/types.d.ts
generated
vendored
Normal file
@ -0,0 +1,125 @@
|
||||
import type * as CompilerDOM from '@vue/compiler-dom';
|
||||
import type { SFCParseResult } from '@vue/compiler-sfc';
|
||||
import type * as ts from 'typescript/lib/tsserverlibrary';
|
||||
import type { VueEmbeddedFile } from './virtualFile/embeddedFile';
|
||||
export type { SFCParseResult } from '@vue/compiler-sfc';
|
||||
export type RawVueCompilerOptions = Partial<Omit<VueCompilerOptions, 'target' | 'plugins'>> & {
|
||||
target?: 'auto' | 2 | 2.7 | 3 | 3.3;
|
||||
plugins?: string[];
|
||||
};
|
||||
export interface VueCompilerOptions {
|
||||
target: number;
|
||||
lib: string;
|
||||
extensions: string[];
|
||||
jsxSlots: boolean;
|
||||
strictTemplates: boolean;
|
||||
skipTemplateCodegen: boolean;
|
||||
nativeTags: string[];
|
||||
dataAttributes: string[];
|
||||
htmlAttributes: string[];
|
||||
optionsWrapper: [string, string] | [];
|
||||
macros: {
|
||||
defineProps: string[];
|
||||
defineSlots: string[];
|
||||
defineEmits: string[];
|
||||
defineExpose: string[];
|
||||
defineModel: string[];
|
||||
defineOptions: string[];
|
||||
withDefaults: string[];
|
||||
};
|
||||
plugins: VueLanguagePlugin[];
|
||||
hooks: string[];
|
||||
experimentalDefinePropProposal: 'kevinEdition' | 'johnsonEdition' | false;
|
||||
experimentalResolveStyleCssClasses: 'scoped' | 'always' | 'never';
|
||||
experimentalModelPropName: Record<string, Record<string, boolean | Record<string, string> | Record<string, string>[]>>;
|
||||
experimentalUseElementAccessInTemplate: boolean;
|
||||
experimentalAdditionalLanguageModules: string[];
|
||||
}
|
||||
export type VueLanguagePlugin = (ctx: {
|
||||
modules: {
|
||||
typescript: typeof import('typescript/lib/tsserverlibrary');
|
||||
'@vue/compiler-dom': typeof import('@vue/compiler-dom');
|
||||
};
|
||||
compilerOptions: ts.CompilerOptions;
|
||||
vueCompilerOptions: VueCompilerOptions;
|
||||
codegenStack: boolean;
|
||||
}) => {
|
||||
version: 1;
|
||||
name?: string;
|
||||
order?: number;
|
||||
requiredCompilerOptions?: string[];
|
||||
parseSFC?(fileName: string, content: string): SFCParseResult | undefined;
|
||||
updateSFC?(oldResult: SFCParseResult, textChange: {
|
||||
start: number;
|
||||
end: number;
|
||||
newText: string;
|
||||
}): SFCParseResult | undefined;
|
||||
resolveTemplateCompilerOptions?(options: CompilerDOM.CompilerOptions): CompilerDOM.CompilerOptions;
|
||||
compileSFCTemplate?(lang: string, template: string, options: CompilerDOM.CompilerOptions): CompilerDOM.CodegenResult | undefined;
|
||||
updateSFCTemplate?(oldResult: CompilerDOM.CodegenResult, textChange: {
|
||||
start: number;
|
||||
end: number;
|
||||
newText: string;
|
||||
}): CompilerDOM.CodegenResult | undefined;
|
||||
getEmbeddedFileNames?(fileName: string, sfc: Sfc): string[];
|
||||
resolveEmbeddedFile?(fileName: string, sfc: Sfc, embeddedFile: VueEmbeddedFile): void;
|
||||
};
|
||||
export interface SfcBlock {
|
||||
name: string;
|
||||
start: number;
|
||||
end: number;
|
||||
startTagEnd: number;
|
||||
endTagStart: number;
|
||||
lang: string;
|
||||
content: string;
|
||||
attrs: Record<string, string | true>;
|
||||
}
|
||||
export interface Sfc {
|
||||
template: SfcBlock & {
|
||||
ast: CompilerDOM.RootNode | undefined;
|
||||
errors: CompilerDOM.CompilerError[];
|
||||
warnings: CompilerDOM.CompilerError[];
|
||||
} | undefined;
|
||||
script: (SfcBlock & {
|
||||
src: string | undefined;
|
||||
srcOffset: number;
|
||||
ast: ts.SourceFile;
|
||||
}) | undefined;
|
||||
scriptSetup: SfcBlock & {
|
||||
generic: string | undefined;
|
||||
genericOffset: number;
|
||||
ast: ts.SourceFile;
|
||||
} | undefined;
|
||||
styles: readonly (SfcBlock & {
|
||||
module: string | undefined;
|
||||
scoped: boolean;
|
||||
cssVars: {
|
||||
text: string;
|
||||
offset: number;
|
||||
}[];
|
||||
classNames: {
|
||||
text: string;
|
||||
offset: number;
|
||||
}[];
|
||||
})[];
|
||||
customBlocks: readonly (SfcBlock & {
|
||||
type: string;
|
||||
})[];
|
||||
/**
|
||||
* @deprecated use `template.ast` instead
|
||||
*/
|
||||
templateAst: CompilerDOM.RootNode | undefined;
|
||||
/**
|
||||
* @deprecated use `script.ast` instead
|
||||
*/
|
||||
scriptAst: ts.SourceFile | undefined;
|
||||
/**
|
||||
* @deprecated use `scriptSetup.ast` instead
|
||||
*/
|
||||
scriptSetupAst: ts.SourceFile | undefined;
|
||||
}
|
||||
export interface TextRange {
|
||||
start: number;
|
||||
end: number;
|
||||
}
|
||||
//# sourceMappingURL=types.d.ts.map
|
3
node_modules/@vue/language-core/out/types.js
generated
vendored
Normal file
3
node_modules/@vue/language-core/out/types.js
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
//# sourceMappingURL=types.js.map
|
4
node_modules/@vue/language-core/out/utils/globalTypes.d.ts
generated
vendored
Normal file
4
node_modules/@vue/language-core/out/utils/globalTypes.d.ts
generated
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
import { VueCompilerOptions } from '../types';
|
||||
export declare const baseName = "__VLS_types.d.ts";
|
||||
export declare function getTypesCode(vueCompilerOptions: VueCompilerOptions): string;
|
||||
//# sourceMappingURL=globalTypes.d.ts.map
|
135
node_modules/@vue/language-core/out/utils/globalTypes.js
generated
vendored
Normal file
135
node_modules/@vue/language-core/out/utils/globalTypes.js
generated
vendored
Normal file
@ -0,0 +1,135 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getTypesCode = exports.baseName = void 0;
|
||||
const shared_1 = require("./shared");
|
||||
exports.baseName = '__VLS_types.d.ts';
|
||||
function getTypesCode(vueCompilerOptions) {
|
||||
return `
|
||||
// @ts-nocheck
|
||||
|
||||
type __VLS_IntrinsicElements = __VLS_PickNotAny<import('vue/jsx-runtime').JSX.IntrinsicElements, __VLS_PickNotAny<JSX.IntrinsicElements, Record<string, any>>>;
|
||||
type __VLS_Element = __VLS_PickNotAny<import('vue/jsx-runtime').JSX.Element, JSX.Element>;
|
||||
|
||||
type __VLS_IsAny<T> = 0 extends 1 & T ? true : false;
|
||||
type __VLS_PickNotAny<A, B> = __VLS_IsAny<A> extends true ? B : A;
|
||||
|
||||
type __VLS_Prettify<T> = { [K in keyof T]: T[K]; } & {};
|
||||
|
||||
type __VLS_OmitKeepDiscriminatedUnion<T, K extends keyof any> =
|
||||
T extends any
|
||||
? Pick<T, Exclude<keyof T, K>>
|
||||
: never;
|
||||
|
||||
type __VLS_GlobalComponents =
|
||||
__VLS_PickNotAny<import('vue').GlobalComponents, {}>
|
||||
& __VLS_PickNotAny<import('@vue/runtime-core').GlobalComponents, {}>
|
||||
& __VLS_PickNotAny<import('@vue/runtime-dom').GlobalComponents, {}>
|
||||
& Pick<typeof import('${vueCompilerOptions.lib}'),
|
||||
'Transition'
|
||||
| 'TransitionGroup'
|
||||
| 'KeepAlive'
|
||||
| 'Suspense'
|
||||
| 'Teleport'
|
||||
>;
|
||||
|
||||
declare const __VLS_intrinsicElements: __VLS_IntrinsicElements;
|
||||
|
||||
// v-for
|
||||
declare function __VLS_getVForSourceType(source: number): [number, number, number][];
|
||||
declare function __VLS_getVForSourceType(source: string): [string, number, number][];
|
||||
declare function __VLS_getVForSourceType<T extends any[]>(source: T): [
|
||||
T[number], // item
|
||||
number, // key
|
||||
number, // index
|
||||
][];
|
||||
declare function __VLS_getVForSourceType<T extends { [Symbol.iterator](): Iterator<any> }>(source: T): [
|
||||
T extends { [Symbol.iterator](): Iterator<infer T1> } ? T1 : never, // item
|
||||
number, // key
|
||||
undefined, // index
|
||||
][];
|
||||
declare function __VLS_getVForSourceType<T>(source: T): [
|
||||
T[keyof T], // item
|
||||
keyof T, // key
|
||||
number, // index
|
||||
][];
|
||||
|
||||
declare function __VLS_getSlotParams<T>(slot: T): Parameters<__VLS_PickNotAny<NonNullable<T>, (...args: any[]) => any>>;
|
||||
declare function __VLS_getSlotParam<T>(slot: T): Parameters<__VLS_PickNotAny<NonNullable<T>, (...args: any[]) => any>>[0];
|
||||
declare function __VLS_directiveFunction<T>(dir: T):
|
||||
T extends import('${vueCompilerOptions.lib}').ObjectDirective<infer E, infer V> | import('${vueCompilerOptions.lib}').FunctionDirective<infer E, infer V> ? (value: V) => void
|
||||
: T;
|
||||
declare function __VLS_withScope<T, K>(ctx: T, scope: K): ctx is T & K;
|
||||
declare function __VLS_makeOptional<T>(t: T): { [K in keyof T]?: T[K] };
|
||||
|
||||
type __VLS_SelfComponent<N, C> = string extends N ? {} : N extends string ? { [P in N]: C } : {};
|
||||
type __VLS_WithComponent<N0 extends string, LocalComponents, N1 extends string, N2 extends string, N3 extends string> =
|
||||
N1 extends keyof LocalComponents ? N1 extends N0 ? Pick<LocalComponents, N0> : { [K in N0]: LocalComponents[N1] } :
|
||||
N2 extends keyof LocalComponents ? N2 extends N0 ? Pick<LocalComponents, N0> : { [K in N0]: LocalComponents[N2] } :
|
||||
N3 extends keyof LocalComponents ? N3 extends N0 ? Pick<LocalComponents, N0> : { [K in N0]: LocalComponents[N3] } :
|
||||
N1 extends keyof __VLS_GlobalComponents ? N1 extends N0 ? Pick<__VLS_GlobalComponents, N0> : { [K in N0]: __VLS_GlobalComponents[N1] } :
|
||||
N2 extends keyof __VLS_GlobalComponents ? N2 extends N0 ? Pick<__VLS_GlobalComponents, N0> : { [K in N0]: __VLS_GlobalComponents[N2] } :
|
||||
N3 extends keyof __VLS_GlobalComponents ? N3 extends N0 ? Pick<__VLS_GlobalComponents, N0> : { [K in N0]: __VLS_GlobalComponents[N3] } :
|
||||
${vueCompilerOptions.strictTemplates ? '{}' : '{ [K in N0]: unknown }'}
|
||||
|
||||
type __VLS_FillingEventArg_ParametersLength<E extends (...args: any) => any> = __VLS_IsAny<Parameters<E>> extends true ? -1 : Parameters<E>['length'];
|
||||
type __VLS_FillingEventArg<E> = E extends (...args: any) => any ? __VLS_FillingEventArg_ParametersLength<E> extends 0 ? ($event?: undefined) => ReturnType<E> : E : E;
|
||||
declare function __VLS_asFunctionalComponent<T, K = T extends new (...args: any) => any ? InstanceType<T> : unknown>(t: T, instance?: K):
|
||||
T extends new (...args: any) => any
|
||||
? (props: (K extends { $props: infer Props } ? Props : any)${vueCompilerOptions.strictTemplates ? '' : ' & Record<string, unknown>'}, ctx?: {
|
||||
attrs?: any,
|
||||
slots?: K extends { ${(0, shared_1.getSlotsPropertyName)(vueCompilerOptions.target)}: infer Slots } ? Slots : any,
|
||||
emit?: K extends { $emit: infer Emit } ? Emit : any
|
||||
}) => __VLS_Element & { __ctx?: typeof ctx & { props?: typeof props; expose?(exposed: K): void; } }
|
||||
: T extends () => any ? (props: {}, ctx?: any) => ReturnType<T>
|
||||
: T extends (...args: any) => any ? T
|
||||
: (_: {}${vueCompilerOptions.strictTemplates ? '' : ' & Record<string, unknown>'}, ctx?: any) => { __ctx?: { attrs?: any, expose?: any, slots?: any, emit?: any, props?: {}${vueCompilerOptions.strictTemplates ? '' : ' & Record<string, unknown>'} } };
|
||||
declare function __VLS_elementAsFunctionalComponent<T>(t: T): (_: T${vueCompilerOptions.strictTemplates ? '' : ' & Record<string, unknown>'}, ctx?: any) => { __ctx?: { attrs?: any, expose?: any, slots?: any, emit?: any, props?: T${vueCompilerOptions.strictTemplates ? '' : ' & Record<string, unknown>'} } };
|
||||
declare function __VLS_functionalComponentArgsRest<T extends (...args: any) => any>(t: T): Parameters<T>['length'] extends 2 ? [any] : [];
|
||||
declare function __VLS_pickEvent<E1, E2>(emitEvent: E1, propEvent: E2): __VLS_FillingEventArg<
|
||||
__VLS_PickNotAny<
|
||||
__VLS_AsFunctionOrAny<E2>,
|
||||
__VLS_AsFunctionOrAny<E1>
|
||||
>
|
||||
> | undefined;
|
||||
declare function __VLS_pickFunctionalComponentCtx<T, K>(comp: T, compInstance: K): __VLS_PickNotAny<
|
||||
'__ctx' extends keyof __VLS_PickNotAny<K, {}> ? K extends { __ctx?: infer Ctx } ? Ctx : never : any
|
||||
, T extends (props: any, ctx: infer Ctx) => any ? Ctx : any
|
||||
>;
|
||||
type __VLS_FunctionalComponentProps<T, K> =
|
||||
'__ctx' extends keyof __VLS_PickNotAny<K, {}> ? K extends { __ctx?: { props?: infer P } } ? NonNullable<P> : never
|
||||
: T extends (props: infer P, ...args: any) => any ? P :
|
||||
{};
|
||||
type __VLS_AsFunctionOrAny<F> = unknown extends F ? any : ((...args: any) => any) extends F ? F : any;
|
||||
|
||||
declare function __VLS_normalizeSlot<S>(s: S): S extends () => infer R ? (props: {}) => R : S;
|
||||
|
||||
/**
|
||||
* emit
|
||||
*/
|
||||
// fix https://github.com/vuejs/language-tools/issues/926
|
||||
type __VLS_UnionToIntersection<U> = (U extends unknown ? (arg: U) => unknown : never) extends ((arg: infer P) => unknown) ? P : never;
|
||||
type __VLS_OverloadUnionInner<T, U = unknown> = U & T extends (...args: infer A) => infer R
|
||||
? U extends T
|
||||
? never
|
||||
: __VLS_OverloadUnionInner<T, Pick<T, keyof T> & U & ((...args: A) => R)> | ((...args: A) => R)
|
||||
: never;
|
||||
type __VLS_OverloadUnion<T> = Exclude<
|
||||
__VLS_OverloadUnionInner<(() => never) & T>,
|
||||
T extends () => never ? never : () => never
|
||||
>;
|
||||
type __VLS_ConstructorOverloads<T> = __VLS_OverloadUnion<T> extends infer F
|
||||
? F extends (event: infer E, ...args: infer A) => any
|
||||
? { [K in E & string]: (...args: A) => void; }
|
||||
: never
|
||||
: never;
|
||||
type __VLS_NormalizeEmits<T> = __VLS_Prettify<
|
||||
__VLS_UnionToIntersection<
|
||||
__VLS_ConstructorOverloads<T> & {
|
||||
[K in keyof T]: T[K] extends any[] ? { (...args: T[K]): void } : never
|
||||
}
|
||||
>
|
||||
>;
|
||||
`.trim();
|
||||
}
|
||||
exports.getTypesCode = getTypesCode;
|
||||
//# sourceMappingURL=globalTypes.js.map
|
5
node_modules/@vue/language-core/out/utils/parseCssClassNames.d.ts
generated
vendored
Normal file
5
node_modules/@vue/language-core/out/utils/parseCssClassNames.d.ts
generated
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
export declare function parseCssClassNames(styleContent: string): Generator<{
|
||||
offset: number;
|
||||
text: string;
|
||||
}, void, unknown>;
|
||||
//# sourceMappingURL=parseCssClassNames.d.ts.map
|
19
node_modules/@vue/language-core/out/utils/parseCssClassNames.js
generated
vendored
Normal file
19
node_modules/@vue/language-core/out/utils/parseCssClassNames.js
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.parseCssClassNames = void 0;
|
||||
const parseCssVars_1 = require("./parseCssVars");
|
||||
const cssClassNameReg = /(?=([\.]{1}[a-zA-Z_]+[\w\_\-]*)[\s\.\+\{\>#\:]{1})/g;
|
||||
function* parseCssClassNames(styleContent) {
|
||||
styleContent = (0, parseCssVars_1.clearComments)(styleContent);
|
||||
const matches = styleContent.matchAll(cssClassNameReg);
|
||||
for (const match of matches) {
|
||||
if (match.index !== undefined) {
|
||||
const matchText = match[1];
|
||||
if (matchText !== undefined) {
|
||||
yield { offset: match.index, text: matchText };
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.parseCssClassNames = parseCssClassNames;
|
||||
//# sourceMappingURL=parseCssClassNames.js.map
|
6
node_modules/@vue/language-core/out/utils/parseCssVars.d.ts
generated
vendored
Normal file
6
node_modules/@vue/language-core/out/utils/parseCssVars.d.ts
generated
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
export declare function parseCssVars(styleContent: string): Generator<{
|
||||
offset: number;
|
||||
text: string;
|
||||
}, void, unknown>;
|
||||
export declare function clearComments(css: string): string;
|
||||
//# sourceMappingURL=parseCssVars.d.ts.map
|
28
node_modules/@vue/language-core/out/utils/parseCssVars.js
generated
vendored
Normal file
28
node_modules/@vue/language-core/out/utils/parseCssVars.js
generated
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
"use strict";
|
||||
// https://github.com/vuejs/core/blob/main/packages/compiler-sfc/src/cssVars.ts#L47-L61
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.clearComments = exports.parseCssVars = void 0;
|
||||
const vBindCssVarReg = /\bv-bind\(\s*(?:'([^']+)'|"([^"]+)"|([^'"][^)]*))\s*\)/g;
|
||||
const commentReg1 = /\/\*([\s\S]*?)\*\//g;
|
||||
const commentReg2 = /\/\/([\s\S]*?)\n/g;
|
||||
function* parseCssVars(styleContent) {
|
||||
styleContent = clearComments(styleContent);
|
||||
const matchs = styleContent.matchAll(vBindCssVarReg);
|
||||
for (const match of matchs) {
|
||||
if (match.index !== undefined) {
|
||||
const matchText = match[1] ?? match[2] ?? match[3];
|
||||
if (matchText !== undefined) {
|
||||
const offset = match.index + styleContent.slice(match.index).indexOf(matchText);
|
||||
yield { offset, text: matchText };
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.parseCssVars = parseCssVars;
|
||||
function clearComments(css) {
|
||||
return css
|
||||
.replace(commentReg1, match => `/*${' '.repeat(match.length - 4)}*/`)
|
||||
.replace(commentReg2, match => `//${' '.repeat(match.length - 3)}\n`);
|
||||
}
|
||||
exports.clearComments = clearComments;
|
||||
//# sourceMappingURL=parseCssVars.js.map
|
3
node_modules/@vue/language-core/out/utils/parseSfc.d.ts
generated
vendored
Normal file
3
node_modules/@vue/language-core/out/utils/parseSfc.d.ts
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
import type { SFCParseResult } from '@vue/compiler-sfc';
|
||||
export declare function parse(source: string): SFCParseResult;
|
||||
//# sourceMappingURL=parseSfc.d.ts.map
|
135
node_modules/@vue/language-core/out/utils/parseSfc.js
generated
vendored
Normal file
135
node_modules/@vue/language-core/out/utils/parseSfc.js
generated
vendored
Normal file
@ -0,0 +1,135 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.parse = void 0;
|
||||
const compiler = require("@vue/compiler-dom");
|
||||
function parse(source) {
|
||||
const errors = [];
|
||||
const ast = compiler.parse(source, {
|
||||
// there are no components at SFC parsing level
|
||||
isNativeTag: () => true,
|
||||
// preserve all whitespaces
|
||||
isPreTag: () => true,
|
||||
getTextMode: ({ tag, props }, parent) => {
|
||||
if ((!parent && tag !== 'template')
|
||||
|| (tag === 'template'
|
||||
&& props.some(p => p.type === 6 /* compiler.NodeTypes.ATTRIBUTE */ &&
|
||||
p.name === 'lang' &&
|
||||
p.value &&
|
||||
p.value.content &&
|
||||
p.value.content !== 'html'))) {
|
||||
return 2 /* compiler.TextModes.RAWTEXT */;
|
||||
}
|
||||
else {
|
||||
return 0 /* compiler.TextModes.DATA */;
|
||||
}
|
||||
},
|
||||
onError: e => {
|
||||
errors.push(e);
|
||||
},
|
||||
comments: true,
|
||||
});
|
||||
const descriptor = {
|
||||
filename: 'anonymous.vue',
|
||||
source,
|
||||
template: null,
|
||||
script: null,
|
||||
scriptSetup: null,
|
||||
styles: [],
|
||||
customBlocks: [],
|
||||
cssVars: [],
|
||||
slotted: false,
|
||||
shouldForceReload: () => false,
|
||||
};
|
||||
ast.children.forEach(node => {
|
||||
if (node.type !== 1 /* compiler.NodeTypes.ELEMENT */) {
|
||||
return;
|
||||
}
|
||||
switch (node.tag) {
|
||||
case 'template':
|
||||
const templateBlock = (descriptor.template = createBlock(node, source));
|
||||
templateBlock.ast = node;
|
||||
break;
|
||||
case 'script':
|
||||
const scriptBlock = createBlock(node, source);
|
||||
const isSetup = !!scriptBlock.attrs.setup;
|
||||
if (isSetup && !descriptor.scriptSetup) {
|
||||
descriptor.scriptSetup = scriptBlock;
|
||||
break;
|
||||
}
|
||||
if (!isSetup && !descriptor.script) {
|
||||
descriptor.script = scriptBlock;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'style':
|
||||
const styleBlock = createBlock(node, source);
|
||||
descriptor.styles.push(styleBlock);
|
||||
break;
|
||||
default:
|
||||
descriptor.customBlocks.push(createBlock(node, source));
|
||||
break;
|
||||
}
|
||||
});
|
||||
return {
|
||||
descriptor,
|
||||
errors,
|
||||
};
|
||||
}
|
||||
exports.parse = parse;
|
||||
function createBlock(node, source) {
|
||||
const type = node.tag;
|
||||
let { start, end } = node.loc;
|
||||
let content = '';
|
||||
if (node.children.length) {
|
||||
start = node.children[0].loc.start;
|
||||
end = node.children[node.children.length - 1].loc.end;
|
||||
content = source.slice(start.offset, end.offset);
|
||||
}
|
||||
else {
|
||||
const offset = node.loc.source.indexOf(`</`);
|
||||
if (offset > -1) {
|
||||
start = {
|
||||
line: start.line,
|
||||
column: start.column + offset,
|
||||
offset: start.offset + offset
|
||||
};
|
||||
}
|
||||
end = Object.assign({}, start);
|
||||
}
|
||||
const loc = {
|
||||
source: content,
|
||||
start,
|
||||
end
|
||||
};
|
||||
const attrs = {};
|
||||
const block = {
|
||||
type,
|
||||
content,
|
||||
loc,
|
||||
attrs
|
||||
};
|
||||
node.props.forEach(p => {
|
||||
if (p.type === 6 /* compiler.NodeTypes.ATTRIBUTE */) {
|
||||
attrs[p.name] = p.value ? p.value.content || true : true;
|
||||
if (p.name === 'lang') {
|
||||
block.lang = p.value && p.value.content;
|
||||
}
|
||||
else if (p.name === 'src') {
|
||||
block.src = p.value && p.value.content;
|
||||
}
|
||||
else if (type === 'style') {
|
||||
if (p.name === 'scoped') {
|
||||
block.scoped = true;
|
||||
}
|
||||
else if (p.name === 'module') {
|
||||
block.module = attrs[p.name];
|
||||
}
|
||||
}
|
||||
else if (type === 'script' && p.name === 'setup') {
|
||||
block.setup = attrs.setup;
|
||||
}
|
||||
}
|
||||
});
|
||||
return block;
|
||||
}
|
||||
//# sourceMappingURL=parseSfc.js.map
|
4
node_modules/@vue/language-core/out/utils/shared.d.ts
generated
vendored
Normal file
4
node_modules/@vue/language-core/out/utils/shared.d.ts
generated
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
export declare function getSlotsPropertyName(vueVersion: number): "$scopedSlots" | "$slots";
|
||||
export { hyphenate as hyphenateTag } from '@vue/shared';
|
||||
export declare function hyphenateAttr(str: string): string;
|
||||
//# sourceMappingURL=shared.d.ts.map
|
20
node_modules/@vue/language-core/out/utils/shared.js
generated
vendored
Normal file
20
node_modules/@vue/language-core/out/utils/shared.js
generated
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.hyphenateAttr = exports.hyphenateTag = exports.getSlotsPropertyName = void 0;
|
||||
const shared_1 = require("@vue/shared");
|
||||
function getSlotsPropertyName(vueVersion) {
|
||||
return vueVersion < 3 ? '$scopedSlots' : '$slots';
|
||||
}
|
||||
exports.getSlotsPropertyName = getSlotsPropertyName;
|
||||
var shared_2 = require("@vue/shared");
|
||||
Object.defineProperty(exports, "hyphenateTag", { enumerable: true, get: function () { return shared_2.hyphenate; } });
|
||||
function hyphenateAttr(str) {
|
||||
let hyphencase = (0, shared_1.hyphenate)(str);
|
||||
// fix https://github.com/vuejs/core/issues/8811
|
||||
if (str.length && str[0] !== str[0].toLowerCase()) {
|
||||
hyphencase = '-' + hyphencase;
|
||||
}
|
||||
return hyphencase;
|
||||
}
|
||||
exports.hyphenateAttr = hyphenateAttr;
|
||||
//# sourceMappingURL=shared.js.map
|
9
node_modules/@vue/language-core/out/utils/transform.d.ts
generated
vendored
Normal file
9
node_modules/@vue/language-core/out/utils/transform.d.ts
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
import type * as ts from 'typescript/lib/tsserverlibrary';
|
||||
import { VueCompilerOptions } from '../types';
|
||||
export declare function walkInterpolationFragment(ts: typeof import('typescript/lib/tsserverlibrary'), code: string, ast: ts.SourceFile, cb: (fragment: string, offset: number | undefined, isJustForErrorMapping?: boolean) => void, localVars: Map<string, number>, identifiers: Set<string>, vueOptions: VueCompilerOptions): {
|
||||
text: string;
|
||||
isShorthand: boolean;
|
||||
offset: number;
|
||||
}[];
|
||||
export declare function collectVars(ts: typeof import('typescript/lib/tsserverlibrary'), node: ts.Node, result: string[]): void;
|
||||
//# sourceMappingURL=transform.d.ts.map
|
195
node_modules/@vue/language-core/out/utils/transform.js
generated
vendored
Normal file
195
node_modules/@vue/language-core/out/utils/transform.js
generated
vendored
Normal file
@ -0,0 +1,195 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.collectVars = exports.walkInterpolationFragment = void 0;
|
||||
const shared_1 = require("@vue/shared");
|
||||
function walkInterpolationFragment(ts, code, ast, cb, localVars, identifiers, vueOptions) {
|
||||
let ctxVars = [];
|
||||
const varCb = (id, isShorthand) => {
|
||||
if (localVars.get(id.text) ||
|
||||
// https://github.com/vuejs/core/blob/245230e135152900189f13a4281302de45fdcfaa/packages/compiler-core/src/transforms/transformExpression.ts#L342-L352
|
||||
(0, shared_1.isGloballyWhitelisted)(id.text) ||
|
||||
id.text === 'require' ||
|
||||
id.text.startsWith('__VLS_')) {
|
||||
// localVarOffsets.push(localVar.getStart(ast));
|
||||
}
|
||||
else {
|
||||
ctxVars.push({
|
||||
text: id.text,
|
||||
isShorthand: isShorthand,
|
||||
offset: id.getStart(ast),
|
||||
});
|
||||
identifiers.add(id.text);
|
||||
}
|
||||
};
|
||||
ast.forEachChild(node => walkIdentifiers(ts, node, varCb, localVars));
|
||||
ctxVars = ctxVars.sort((a, b) => a.offset - b.offset);
|
||||
if (ctxVars.length) {
|
||||
if (ctxVars[0].isShorthand) {
|
||||
cb(code.substring(0, ctxVars[0].offset + ctxVars[0].text.length), 0);
|
||||
cb(': ', undefined);
|
||||
}
|
||||
else {
|
||||
cb(code.substring(0, ctxVars[0].offset), 0);
|
||||
}
|
||||
for (let i = 0; i < ctxVars.length - 1; i++) {
|
||||
// fix https://github.com/vuejs/language-tools/issues/1205
|
||||
// fix https://github.com/vuejs/language-tools/issues/1264
|
||||
cb('', ctxVars[i + 1].offset, true);
|
||||
if (vueOptions.experimentalUseElementAccessInTemplate) {
|
||||
const varStart = ctxVars[i].offset;
|
||||
const varEnd = ctxVars[i].offset + ctxVars[i].text.length;
|
||||
cb('__VLS_ctx[', undefined);
|
||||
cb('', varStart, true);
|
||||
cb("'", undefined);
|
||||
cb(code.substring(varStart, varEnd), varStart);
|
||||
cb("'", undefined);
|
||||
cb('', varEnd, true);
|
||||
cb(']', undefined);
|
||||
if (ctxVars[i + 1].isShorthand) {
|
||||
cb(code.substring(varEnd, ctxVars[i + 1].offset + ctxVars[i + 1].text.length), varEnd);
|
||||
cb(': ', undefined);
|
||||
}
|
||||
else {
|
||||
cb(code.substring(varEnd, ctxVars[i + 1].offset), varEnd);
|
||||
}
|
||||
}
|
||||
else {
|
||||
cb('__VLS_ctx.', undefined);
|
||||
if (ctxVars[i + 1].isShorthand) {
|
||||
cb(code.substring(ctxVars[i].offset, ctxVars[i + 1].offset + ctxVars[i + 1].text.length), ctxVars[i].offset);
|
||||
cb(': ', undefined);
|
||||
}
|
||||
else {
|
||||
cb(code.substring(ctxVars[i].offset, ctxVars[i + 1].offset), ctxVars[i].offset);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (vueOptions.experimentalUseElementAccessInTemplate) {
|
||||
const varStart = ctxVars[ctxVars.length - 1].offset;
|
||||
const varEnd = ctxVars[ctxVars.length - 1].offset + ctxVars[ctxVars.length - 1].text.length;
|
||||
cb('__VLS_ctx[', undefined);
|
||||
cb('', varStart, true);
|
||||
cb("'", undefined);
|
||||
cb(code.substring(varStart, varEnd), varStart);
|
||||
cb("'", undefined);
|
||||
cb('', varEnd, true);
|
||||
cb(']', undefined);
|
||||
cb(code.substring(varEnd), varEnd);
|
||||
}
|
||||
else {
|
||||
cb('', ctxVars[ctxVars.length - 1].offset, true);
|
||||
cb('__VLS_ctx.', undefined);
|
||||
cb(code.substring(ctxVars[ctxVars.length - 1].offset), ctxVars[ctxVars.length - 1].offset);
|
||||
}
|
||||
}
|
||||
else {
|
||||
cb(code, 0);
|
||||
}
|
||||
return ctxVars;
|
||||
}
|
||||
exports.walkInterpolationFragment = walkInterpolationFragment;
|
||||
function walkIdentifiers(ts, node, cb, localVars, blockVars = [], isRoot = true) {
|
||||
if (ts.isIdentifier(node)) {
|
||||
cb(node, false);
|
||||
}
|
||||
else if (ts.isShorthandPropertyAssignment(node)) {
|
||||
cb(node.name, true);
|
||||
}
|
||||
else if (ts.isPropertyAccessExpression(node)) {
|
||||
walkIdentifiers(ts, node.expression, cb, localVars, blockVars, false);
|
||||
}
|
||||
else if (ts.isVariableDeclaration(node)) {
|
||||
collectVars(ts, node.name, blockVars);
|
||||
for (const varName of blockVars) {
|
||||
localVars.set(varName, (localVars.get(varName) ?? 0) + 1);
|
||||
}
|
||||
if (node.initializer)
|
||||
walkIdentifiers(ts, node.initializer, cb, localVars, blockVars, false);
|
||||
}
|
||||
else if (ts.isArrowFunction(node) || ts.isFunctionExpression(node)) {
|
||||
const functionArgs = [];
|
||||
for (const param of node.parameters) {
|
||||
collectVars(ts, param.name, functionArgs);
|
||||
if (param.type) {
|
||||
walkIdentifiers(ts, param.type, cb, localVars, blockVars, false);
|
||||
}
|
||||
}
|
||||
for (const varName of functionArgs)
|
||||
localVars.set(varName, (localVars.get(varName) ?? 0) + 1);
|
||||
walkIdentifiers(ts, node.body, cb, localVars, blockVars, false);
|
||||
for (const varName of functionArgs)
|
||||
localVars.set(varName, localVars.get(varName) - 1);
|
||||
}
|
||||
else if (ts.isObjectLiteralExpression(node)) {
|
||||
for (const prop of node.properties) {
|
||||
if (ts.isPropertyAssignment(prop)) {
|
||||
// fix https://github.com/vuejs/language-tools/issues/1176
|
||||
if (ts.isComputedPropertyName(prop.name)) {
|
||||
walkIdentifiers(ts, prop.name.expression, cb, localVars, blockVars, false);
|
||||
}
|
||||
walkIdentifiers(ts, prop.initializer, cb, localVars, blockVars, false);
|
||||
}
|
||||
// fix https://github.com/vuejs/language-tools/issues/1156
|
||||
else if (ts.isShorthandPropertyAssignment(prop)) {
|
||||
walkIdentifiers(ts, prop, cb, localVars, blockVars, false);
|
||||
}
|
||||
// fix https://github.com/vuejs/language-tools/issues/1148#issuecomment-1094378126
|
||||
else if (ts.isSpreadAssignment(prop)) {
|
||||
// TODO: cannot report "Spread types may only be created from object types.ts(2698)"
|
||||
walkIdentifiers(ts, prop.expression, cb, localVars, blockVars, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (ts.isTypeReferenceNode(node)) {
|
||||
// fix https://github.com/vuejs/language-tools/issues/1422
|
||||
node.forEachChild(node => walkIdentifiersInTypeReference(ts, node, cb));
|
||||
}
|
||||
else {
|
||||
const _blockVars = blockVars;
|
||||
if (ts.isBlock(node)) {
|
||||
blockVars = [];
|
||||
}
|
||||
node.forEachChild(node => walkIdentifiers(ts, node, cb, localVars, blockVars, false));
|
||||
if (ts.isBlock(node)) {
|
||||
for (const varName of blockVars) {
|
||||
localVars.set(varName, localVars.get(varName) - 1);
|
||||
}
|
||||
}
|
||||
blockVars = _blockVars;
|
||||
}
|
||||
if (isRoot) {
|
||||
for (const varName of blockVars) {
|
||||
localVars.set(varName, localVars.get(varName) - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
function walkIdentifiersInTypeReference(ts, node, cb) {
|
||||
if (ts.isTypeQueryNode(node) && ts.isIdentifier(node.exprName)) {
|
||||
cb(node.exprName, false);
|
||||
}
|
||||
else {
|
||||
node.forEachChild(node => walkIdentifiersInTypeReference(ts, node, cb));
|
||||
}
|
||||
}
|
||||
function collectVars(ts, node, result) {
|
||||
if (ts.isIdentifier(node)) {
|
||||
result.push(node.text);
|
||||
}
|
||||
else if (ts.isObjectBindingPattern(node)) {
|
||||
for (const el of node.elements) {
|
||||
collectVars(ts, el.name, result);
|
||||
}
|
||||
}
|
||||
else if (ts.isArrayBindingPattern(node)) {
|
||||
for (const el of node.elements) {
|
||||
if (ts.isBindingElement(el)) {
|
||||
collectVars(ts, el.name, result);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
node.forEachChild(node => collectVars(ts, node, result));
|
||||
}
|
||||
}
|
||||
exports.collectVars = collectVars;
|
||||
//# sourceMappingURL=transform.js.map
|
9
node_modules/@vue/language-core/out/utils/ts.d.ts
generated
vendored
Normal file
9
node_modules/@vue/language-core/out/utils/ts.d.ts
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
import type * as ts from 'typescript/lib/tsserverlibrary';
|
||||
import type { VueCompilerOptions } from '../types';
|
||||
export type ParsedCommandLine = ts.ParsedCommandLine & {
|
||||
vueOptions: Partial<VueCompilerOptions>;
|
||||
};
|
||||
export declare function createParsedCommandLineByJson(ts: typeof import('typescript/lib/tsserverlibrary'), parseConfigHost: ts.ParseConfigHost, rootDir: string, json: any, configFileName?: string): ParsedCommandLine;
|
||||
export declare function createParsedCommandLine(ts: typeof import('typescript/lib/tsserverlibrary'), parseConfigHost: ts.ParseConfigHost, tsConfigPath: string): ParsedCommandLine;
|
||||
export declare function resolveVueCompilerOptions(vueOptions: Partial<VueCompilerOptions>): VueCompilerOptions;
|
||||
//# sourceMappingURL=ts.d.ts.map
|
237
node_modules/@vue/language-core/out/utils/ts.js
generated
vendored
Normal file
237
node_modules/@vue/language-core/out/utils/ts.js
generated
vendored
Normal file
@ -0,0 +1,237 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.resolveVueCompilerOptions = exports.createParsedCommandLine = exports.createParsedCommandLineByJson = void 0;
|
||||
const path = require("path-browserify");
|
||||
function createParsedCommandLineByJson(ts, parseConfigHost, rootDir, json, configFileName = rootDir + '/jsconfig.json') {
|
||||
const proxyHost = proxyParseConfigHostForExtendConfigPaths(parseConfigHost);
|
||||
ts.parseJsonConfigFileContent(json, proxyHost.host, rootDir, {}, configFileName);
|
||||
let vueOptions = {};
|
||||
for (const extendPath of proxyHost.extendConfigPaths.reverse()) {
|
||||
try {
|
||||
vueOptions = {
|
||||
...vueOptions,
|
||||
...getPartialVueCompilerOptions(ts, ts.readJsonConfigFile(extendPath, proxyHost.host.readFile)),
|
||||
};
|
||||
}
|
||||
catch (err) { }
|
||||
}
|
||||
const parsed = ts.parseJsonConfigFileContent(json, proxyHost.host, rootDir, {}, configFileName, undefined, (vueOptions.extensions ?? ['.vue']).map(extension => ({
|
||||
extension: extension.slice(1),
|
||||
isMixedContent: true,
|
||||
scriptKind: ts.ScriptKind.Deferred,
|
||||
})));
|
||||
// fix https://github.com/vuejs/language-tools/issues/1786
|
||||
// https://github.com/microsoft/TypeScript/issues/30457
|
||||
// patching ts server broke with outDir + rootDir + composite/incremental
|
||||
parsed.options.outDir = undefined;
|
||||
return {
|
||||
...parsed,
|
||||
vueOptions,
|
||||
};
|
||||
}
|
||||
exports.createParsedCommandLineByJson = createParsedCommandLineByJson;
|
||||
function createParsedCommandLine(ts, parseConfigHost, tsConfigPath) {
|
||||
try {
|
||||
const proxyHost = proxyParseConfigHostForExtendConfigPaths(parseConfigHost);
|
||||
const config = ts.readJsonConfigFile(tsConfigPath, proxyHost.host.readFile);
|
||||
ts.parseJsonSourceFileConfigFileContent(config, proxyHost.host, path.dirname(tsConfigPath), {}, tsConfigPath);
|
||||
let vueOptions = {};
|
||||
for (const extendPath of proxyHost.extendConfigPaths.reverse()) {
|
||||
try {
|
||||
vueOptions = {
|
||||
...vueOptions,
|
||||
...getPartialVueCompilerOptions(ts, ts.readJsonConfigFile(extendPath, proxyHost.host.readFile)),
|
||||
};
|
||||
}
|
||||
catch (err) { }
|
||||
}
|
||||
const parsed = ts.parseJsonSourceFileConfigFileContent(config, proxyHost.host, path.dirname(tsConfigPath), {}, tsConfigPath, undefined, (vueOptions.extensions ?? ['.vue']).map(extension => ({
|
||||
extension: extension.slice(1),
|
||||
isMixedContent: true,
|
||||
scriptKind: ts.ScriptKind.Deferred,
|
||||
})));
|
||||
// fix https://github.com/vuejs/language-tools/issues/1786
|
||||
// https://github.com/microsoft/TypeScript/issues/30457
|
||||
// patching ts server broke with outDir + rootDir + composite/incremental
|
||||
parsed.options.outDir = undefined;
|
||||
return {
|
||||
...parsed,
|
||||
vueOptions,
|
||||
};
|
||||
}
|
||||
catch (err) {
|
||||
// console.warn('Failed to resolve tsconfig path:', tsConfigPath, err);
|
||||
return {
|
||||
fileNames: [],
|
||||
options: {},
|
||||
vueOptions: resolveVueCompilerOptions({}),
|
||||
errors: [],
|
||||
};
|
||||
}
|
||||
}
|
||||
exports.createParsedCommandLine = createParsedCommandLine;
|
||||
function proxyParseConfigHostForExtendConfigPaths(parseConfigHost) {
|
||||
const extendConfigPaths = [];
|
||||
const host = new Proxy(parseConfigHost, {
|
||||
get(target, key) {
|
||||
if (key === 'readFile') {
|
||||
return (fileName) => {
|
||||
if (!fileName.endsWith('/package.json') && !extendConfigPaths.includes(fileName)) {
|
||||
extendConfigPaths.push(fileName);
|
||||
}
|
||||
return target.readFile(fileName);
|
||||
};
|
||||
}
|
||||
return target[key];
|
||||
}
|
||||
});
|
||||
return {
|
||||
host,
|
||||
extendConfigPaths,
|
||||
};
|
||||
}
|
||||
function getPartialVueCompilerOptions(ts, tsConfigSourceFile) {
|
||||
const folder = path.dirname(tsConfigSourceFile.fileName);
|
||||
const obj = ts.convertToObject(tsConfigSourceFile, []);
|
||||
const rawOptions = obj?.vueCompilerOptions ?? {};
|
||||
const result = {
|
||||
...rawOptions,
|
||||
};
|
||||
const target = rawOptions.target ?? 'auto';
|
||||
if (target === 'auto') {
|
||||
const resolvedPath = resolvePath('vue/package.json');
|
||||
if (resolvedPath) {
|
||||
const vuePackageJson = require(resolvedPath);
|
||||
const versionNumbers = vuePackageJson.version.split('.');
|
||||
result.target = Number(versionNumbers[0] + '.' + versionNumbers[1]);
|
||||
}
|
||||
else {
|
||||
// console.warn('Load vue/package.json failed from', folder);
|
||||
}
|
||||
}
|
||||
else {
|
||||
result.target = target;
|
||||
}
|
||||
if (rawOptions.plugins) {
|
||||
const plugins = rawOptions.plugins
|
||||
.map((pluginPath) => {
|
||||
try {
|
||||
const resolvedPath = resolvePath(pluginPath);
|
||||
if (resolvedPath) {
|
||||
return require(resolvedPath);
|
||||
}
|
||||
else {
|
||||
console.warn('Load plugin failed:', pluginPath);
|
||||
}
|
||||
}
|
||||
catch (error) {
|
||||
console.warn('Load plugin failed:', pluginPath, error);
|
||||
}
|
||||
return [];
|
||||
})
|
||||
.flat(Infinity);
|
||||
result.plugins = plugins;
|
||||
}
|
||||
if (rawOptions.hooks) {
|
||||
result.hooks = rawOptions.hooks
|
||||
.map(resolvePath)
|
||||
.filter((hook) => !!hook);
|
||||
}
|
||||
if (rawOptions.experimentalAdditionalLanguageModules) {
|
||||
result.experimentalAdditionalLanguageModules = rawOptions.experimentalAdditionalLanguageModules
|
||||
.map(resolvePath)
|
||||
.filter((module) => !!module);
|
||||
}
|
||||
return result;
|
||||
function resolvePath(scriptPath) {
|
||||
try {
|
||||
if (require?.resolve) {
|
||||
return require.resolve(scriptPath, { paths: [folder] });
|
||||
}
|
||||
else {
|
||||
// console.warn('failed to resolve path:', scriptPath, 'require.resolve is not supported in web');
|
||||
}
|
||||
}
|
||||
catch (error) {
|
||||
// console.warn(error);
|
||||
}
|
||||
}
|
||||
}
|
||||
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element
|
||||
const HTML_TAGS = 'html,body,base,head,link,meta,style,title,address,article,aside,footer,' +
|
||||
'header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,' +
|
||||
'figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,' +
|
||||
'data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,' +
|
||||
'time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,' +
|
||||
'canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,' +
|
||||
'th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,' +
|
||||
'option,output,progress,select,textarea,details,dialog,menu,' +
|
||||
'summary,template,blockquote,iframe,tfoot';
|
||||
// https://developer.mozilla.org/en-US/docs/Web/SVG/Element
|
||||
const SVG_TAGS = 'svg,animate,animateMotion,animateTransform,circle,clipPath,color-profile,' +
|
||||
'defs,desc,discard,ellipse,feBlend,feColorMatrix,feComponentTransfer,' +
|
||||
'feComposite,feConvolveMatrix,feDiffuseLighting,feDisplacementMap,' +
|
||||
'feDistanceLight,feDropShadow,feFlood,feFuncA,feFuncB,feFuncG,feFuncR,' +
|
||||
'feGaussianBlur,feImage,feMerge,feMergeNode,feMorphology,feOffset,' +
|
||||
'fePointLight,feSpecularLighting,feSpotLight,feTile,feTurbulence,filter,' +
|
||||
'foreignObject,g,hatch,hatchpath,image,line,linearGradient,marker,mask,' +
|
||||
'mesh,meshgradient,meshpatch,meshrow,metadata,mpath,path,pattern,' +
|
||||
'polygon,polyline,radialGradient,rect,set,solidcolor,stop,switch,symbol,' +
|
||||
'text,textPath,title,tspan,unknown,use,view';
|
||||
function resolveVueCompilerOptions(vueOptions) {
|
||||
const target = vueOptions.target ?? 3.3;
|
||||
const lib = vueOptions.lib || (target < 2.7 ? '@vue/runtime-dom' : 'vue');
|
||||
return {
|
||||
...vueOptions,
|
||||
target,
|
||||
extensions: vueOptions.extensions ?? ['.vue'],
|
||||
lib,
|
||||
jsxSlots: vueOptions.jsxSlots ?? false,
|
||||
strictTemplates: vueOptions.strictTemplates ?? false,
|
||||
skipTemplateCodegen: vueOptions.skipTemplateCodegen ?? false,
|
||||
nativeTags: vueOptions.nativeTags ?? [...new Set([
|
||||
...HTML_TAGS.split(','),
|
||||
...SVG_TAGS.split(','),
|
||||
// fix https://github.com/johnsoncodehk/volar/issues/1340
|
||||
'hgroup',
|
||||
'slot',
|
||||
'component',
|
||||
])],
|
||||
dataAttributes: vueOptions.dataAttributes ?? [],
|
||||
htmlAttributes: vueOptions.htmlAttributes ?? ['aria-*'],
|
||||
optionsWrapper: vueOptions.optionsWrapper ?? (target >= 2.7
|
||||
? [`(await import('${lib}')).defineComponent(`, `)`]
|
||||
: [`(await import('vue')).default.extend(`, `)`]),
|
||||
macros: {
|
||||
defineProps: ['defineProps'],
|
||||
defineSlots: ['defineSlots'],
|
||||
defineEmits: ['defineEmits'],
|
||||
defineExpose: ['defineExpose'],
|
||||
defineModel: ['defineModel'],
|
||||
defineOptions: ['defineOptions'],
|
||||
withDefaults: ['withDefaults'],
|
||||
...vueOptions.macros,
|
||||
},
|
||||
plugins: vueOptions.plugins ?? [],
|
||||
hooks: vueOptions.hooks ?? [],
|
||||
// experimental
|
||||
experimentalDefinePropProposal: vueOptions.experimentalDefinePropProposal ?? false,
|
||||
experimentalAdditionalLanguageModules: vueOptions.experimentalAdditionalLanguageModules ?? [],
|
||||
experimentalResolveStyleCssClasses: vueOptions.experimentalResolveStyleCssClasses ?? 'scoped',
|
||||
// https://github.com/vuejs/vue-next/blob/master/packages/compiler-dom/src/transforms/vModel.ts#L49-L51
|
||||
// https://vuejs.org/guide/essentials/forms.html#form-input-bindings
|
||||
experimentalModelPropName: vueOptions.experimentalModelPropName ?? {
|
||||
'': {
|
||||
input: true
|
||||
},
|
||||
value: {
|
||||
input: { type: 'text' },
|
||||
textarea: true,
|
||||
select: true
|
||||
}
|
||||
},
|
||||
experimentalUseElementAccessInTemplate: vueOptions.experimentalUseElementAccessInTemplate ?? false,
|
||||
};
|
||||
}
|
||||
exports.resolveVueCompilerOptions = resolveVueCompilerOptions;
|
||||
//# sourceMappingURL=ts.js.map
|
3
node_modules/@vue/language-core/out/utils/vue2TemplateCompiler.d.ts
generated
vendored
Normal file
3
node_modules/@vue/language-core/out/utils/vue2TemplateCompiler.d.ts
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
import * as CompilerDOM from '@vue/compiler-dom';
|
||||
export declare function compile(template: string, options?: CompilerDOM.CompilerOptions): CompilerDOM.CodegenResult;
|
||||
//# sourceMappingURL=vue2TemplateCompiler.d.ts.map
|
86
node_modules/@vue/language-core/out/utils/vue2TemplateCompiler.js
generated
vendored
Normal file
86
node_modules/@vue/language-core/out/utils/vue2TemplateCompiler.js
generated
vendored
Normal file
@ -0,0 +1,86 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.compile = void 0;
|
||||
const CompilerDOM = require("@vue/compiler-dom");
|
||||
const Vue2TemplateCompiler = require('vue-template-compiler/build');
|
||||
function compile(template, options = {}) {
|
||||
const onError = options.onError;
|
||||
const onWarn = options.onWarn;
|
||||
options.onError = (error) => {
|
||||
if (error.code === 33 // :key binding allowed in v-for template child in vue 2
|
||||
|| error.code === 29 // fix https://github.com/vuejs/language-tools/issues/1638
|
||||
) {
|
||||
return;
|
||||
}
|
||||
if (onError) {
|
||||
onError(error);
|
||||
}
|
||||
else {
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
const vue2Result = Vue2TemplateCompiler.compile(template, { outputSourceRange: true });
|
||||
for (const error of vue2Result.errors) {
|
||||
onError?.({
|
||||
code: 'vue-template-compiler',
|
||||
name: '',
|
||||
message: error.msg,
|
||||
loc: {
|
||||
source: '',
|
||||
start: { column: -1, line: -1, offset: error.start },
|
||||
end: { column: -1, line: -1, offset: error.end ?? error.start },
|
||||
},
|
||||
});
|
||||
}
|
||||
for (const error of vue2Result.tips) {
|
||||
onWarn?.({
|
||||
code: 'vue-template-compiler',
|
||||
name: '',
|
||||
message: error.msg,
|
||||
loc: {
|
||||
source: '',
|
||||
start: { column: -1, line: -1, offset: error.start },
|
||||
end: { column: -1, line: -1, offset: error.end ?? error.start },
|
||||
},
|
||||
});
|
||||
}
|
||||
return baseCompile(template, Object.assign({}, CompilerDOM.parserOptions, options, {
|
||||
nodeTransforms: [
|
||||
...CompilerDOM.DOMNodeTransforms,
|
||||
...(options.nodeTransforms || [])
|
||||
],
|
||||
directiveTransforms: Object.assign({}, CompilerDOM.DOMDirectiveTransforms, options.directiveTransforms || {}),
|
||||
}));
|
||||
}
|
||||
exports.compile = compile;
|
||||
function baseCompile(template, options = {}) {
|
||||
const onError = options.onError || ((error) => { throw error; });
|
||||
const isModuleMode = options.mode === 'module';
|
||||
const prefixIdentifiers = options.prefixIdentifiers === true || isModuleMode;
|
||||
if (!prefixIdentifiers && options.cacheHandlers) {
|
||||
onError(CompilerDOM.createCompilerError(49));
|
||||
}
|
||||
if (options.scopeId && !isModuleMode) {
|
||||
onError(CompilerDOM.createCompilerError(50));
|
||||
}
|
||||
const ast = CompilerDOM.baseParse(template, options);
|
||||
const [nodeTransforms, directiveTransforms] = CompilerDOM.getBaseTransformPreset(prefixIdentifiers);
|
||||
// v-for > v-if in vue 2
|
||||
const transformIf = nodeTransforms[1];
|
||||
const transformFor = nodeTransforms[3];
|
||||
nodeTransforms[1] = transformFor;
|
||||
nodeTransforms[3] = transformIf;
|
||||
CompilerDOM.transform(ast, Object.assign({}, options, {
|
||||
prefixIdentifiers,
|
||||
nodeTransforms: [
|
||||
...nodeTransforms,
|
||||
...(options.nodeTransforms || []) // user transforms
|
||||
],
|
||||
directiveTransforms: Object.assign({}, directiveTransforms, options.directiveTransforms || {} // user transforms
|
||||
)
|
||||
}));
|
||||
return CompilerDOM.generate(ast, Object.assign({}, options, {
|
||||
prefixIdentifiers
|
||||
}));
|
||||
}
|
||||
//# sourceMappingURL=vue2TemplateCompiler.js.map
|
4
node_modules/@vue/language-core/out/virtualFile/computedFiles.d.ts
generated
vendored
Normal file
4
node_modules/@vue/language-core/out/virtualFile/computedFiles.d.ts
generated
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
import { VirtualFile } from '@volar/language-core';
|
||||
import type { Sfc, VueLanguagePlugin } from '../types';
|
||||
export declare function computedFiles(plugins: ReturnType<VueLanguagePlugin>[], fileName: string, sfc: Sfc, codegenStack: boolean): () => VirtualFile[];
|
||||
//# sourceMappingURL=computedFiles.d.ts.map
|
204
node_modules/@vue/language-core/out/virtualFile/computedFiles.js
generated
vendored
Normal file
204
node_modules/@vue/language-core/out/virtualFile/computedFiles.js
generated
vendored
Normal file
@ -0,0 +1,204 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.computedFiles = void 0;
|
||||
const source_map_1 = require("@volar/source-map");
|
||||
const muggle = require("muggle-string");
|
||||
const embeddedFile_1 = require("./embeddedFile");
|
||||
const computeds_1 = require("computeds");
|
||||
function computedFiles(plugins, fileName, sfc, codegenStack) {
|
||||
const nameToBlock = (0, computeds_1.computed)(() => {
|
||||
const blocks = {};
|
||||
if (sfc.template) {
|
||||
blocks[sfc.template.name] = sfc.template;
|
||||
}
|
||||
if (sfc.script) {
|
||||
blocks[sfc.script.name] = sfc.script;
|
||||
}
|
||||
if (sfc.scriptSetup) {
|
||||
blocks[sfc.scriptSetup.name] = sfc.scriptSetup;
|
||||
}
|
||||
for (const block of sfc.styles) {
|
||||
blocks[block.name] = block;
|
||||
}
|
||||
for (const block of sfc.customBlocks) {
|
||||
blocks[block.name] = block;
|
||||
}
|
||||
return blocks;
|
||||
});
|
||||
const pluginsResult = plugins.map(plugin => compiledPluginFiles(plugins, plugin, fileName, sfc, nameToBlock, codegenStack));
|
||||
const flatResult = (0, computeds_1.computed)(() => pluginsResult.map(r => r()).flat());
|
||||
const structuredResult = (0, computeds_1.computed)(() => {
|
||||
const embeddedFiles = [];
|
||||
let remain = [...flatResult()];
|
||||
while (remain.length) {
|
||||
const beforeLength = remain.length;
|
||||
consumeRemain();
|
||||
if (beforeLength === remain.length) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (const { file, snapshot, mappings, codegenStacks } of remain) {
|
||||
embeddedFiles.push({
|
||||
...file,
|
||||
snapshot,
|
||||
mappings,
|
||||
codegenStacks,
|
||||
embeddedFiles: [],
|
||||
});
|
||||
console.error('Unable to resolve embedded: ' + file.parentFileName + ' -> ' + file.fileName);
|
||||
}
|
||||
return embeddedFiles;
|
||||
function consumeRemain() {
|
||||
for (let i = remain.length - 1; i >= 0; i--) {
|
||||
const { file, snapshot, mappings, codegenStacks } = remain[i];
|
||||
if (!file.parentFileName) {
|
||||
embeddedFiles.push({
|
||||
...file,
|
||||
snapshot,
|
||||
mappings,
|
||||
codegenStacks,
|
||||
embeddedFiles: [],
|
||||
});
|
||||
remain.splice(i, 1);
|
||||
}
|
||||
else {
|
||||
const parent = findParentStructure(file.parentFileName, embeddedFiles);
|
||||
if (parent) {
|
||||
parent.embeddedFiles.push({
|
||||
...file,
|
||||
snapshot,
|
||||
mappings,
|
||||
codegenStacks,
|
||||
embeddedFiles: [],
|
||||
});
|
||||
remain.splice(i, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
function findParentStructure(fileName, current) {
|
||||
for (const child of current) {
|
||||
if (child.fileName === fileName) {
|
||||
return child;
|
||||
}
|
||||
let parent = findParentStructure(fileName, child.embeddedFiles);
|
||||
if (parent) {
|
||||
return parent;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
return structuredResult;
|
||||
}
|
||||
exports.computedFiles = computedFiles;
|
||||
function compiledPluginFiles(plugins, plugin, fileName, sfc, nameToBlock, codegenStack) {
|
||||
const embeddedFiles = {};
|
||||
const files = (0, computeds_1.computed)(() => {
|
||||
try {
|
||||
if (!plugin.getEmbeddedFileNames) {
|
||||
return Object.values(embeddedFiles);
|
||||
}
|
||||
const embeddedFileNames = plugin.getEmbeddedFileNames(fileName, sfc);
|
||||
for (const oldFileName of Object.keys(embeddedFiles)) {
|
||||
if (!embeddedFileNames.includes(oldFileName)) {
|
||||
delete embeddedFiles[oldFileName];
|
||||
}
|
||||
}
|
||||
for (const embeddedFileName of embeddedFileNames) {
|
||||
if (!embeddedFiles[embeddedFileName]) {
|
||||
embeddedFiles[embeddedFileName] = (0, computeds_1.computed)(() => {
|
||||
const [content, stacks] = codegenStack ? muggle.track([]) : [[], []];
|
||||
const file = new embeddedFile_1.VueEmbeddedFile(embeddedFileName, content, stacks);
|
||||
for (const plugin of plugins) {
|
||||
if (!plugin.resolveEmbeddedFile) {
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
plugin.resolveEmbeddedFile(fileName, sfc, file);
|
||||
}
|
||||
catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
const newText = (0, source_map_1.toString)(file.content);
|
||||
const changeRanges = new Map();
|
||||
const snapshot = {
|
||||
getText: (start, end) => newText.slice(start, end),
|
||||
getLength: () => newText.length,
|
||||
getChangeRange(oldSnapshot) {
|
||||
if (!changeRanges.has(oldSnapshot)) {
|
||||
changeRanges.set(oldSnapshot, undefined);
|
||||
const oldText = oldSnapshot.getText(0, oldSnapshot.getLength());
|
||||
const changeRange = fullDiffTextChangeRange(oldText, newText);
|
||||
if (changeRange) {
|
||||
changeRanges.set(oldSnapshot, changeRange);
|
||||
}
|
||||
}
|
||||
return changeRanges.get(oldSnapshot);
|
||||
},
|
||||
};
|
||||
return {
|
||||
file,
|
||||
snapshot,
|
||||
};
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
return Object.values(embeddedFiles);
|
||||
});
|
||||
return (0, computeds_1.computed)(() => {
|
||||
return files().map(_file => {
|
||||
const { file, snapshot } = _file();
|
||||
const mappings = (0, source_map_1.buildMappings)(file.content);
|
||||
for (const mapping of mappings) {
|
||||
if (mapping.source !== undefined) {
|
||||
const block = nameToBlock()[mapping.source];
|
||||
if (block) {
|
||||
mapping.sourceRange = [
|
||||
mapping.sourceRange[0] + block.startTagEnd,
|
||||
mapping.sourceRange[1] + block.startTagEnd,
|
||||
];
|
||||
}
|
||||
else {
|
||||
// ignore
|
||||
}
|
||||
mapping.source = undefined;
|
||||
}
|
||||
}
|
||||
return {
|
||||
file,
|
||||
snapshot,
|
||||
mappings,
|
||||
codegenStacks: (0, source_map_1.buildStacks)(file.content, file.contentStacks),
|
||||
};
|
||||
});
|
||||
});
|
||||
}
|
||||
function fullDiffTextChangeRange(oldText, newText) {
|
||||
for (let start = 0; start < oldText.length && start < newText.length; start++) {
|
||||
if (oldText[start] !== newText[start]) {
|
||||
let end = oldText.length;
|
||||
for (let i = 0; i < oldText.length - start && i < newText.length - start; i++) {
|
||||
if (oldText[oldText.length - i - 1] !== newText[newText.length - i - 1]) {
|
||||
break;
|
||||
}
|
||||
end--;
|
||||
}
|
||||
let length = end - start;
|
||||
let newLength = length + (newText.length - oldText.length);
|
||||
if (newLength < 0) {
|
||||
length -= newLength;
|
||||
newLength = 0;
|
||||
}
|
||||
return {
|
||||
span: { start, length },
|
||||
newLength,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=computedFiles.js.map
|
6
node_modules/@vue/language-core/out/virtualFile/computedMappings.d.ts
generated
vendored
Normal file
6
node_modules/@vue/language-core/out/virtualFile/computedMappings.d.ts
generated
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
import { FileRangeCapabilities } from '@volar/language-core';
|
||||
import { Mapping } from '@volar/source-map';
|
||||
import type * as ts from 'typescript/lib/tsserverlibrary';
|
||||
import { Sfc } from '../types';
|
||||
export declare function computedMappings(snapshot: () => ts.IScriptSnapshot, sfc: Sfc): () => Mapping<FileRangeCapabilities>[];
|
||||
//# sourceMappingURL=computedMappings.d.ts.map
|
39
node_modules/@vue/language-core/out/virtualFile/computedMappings.js
generated
vendored
Normal file
39
node_modules/@vue/language-core/out/virtualFile/computedMappings.js
generated
vendored
Normal file
@ -0,0 +1,39 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.computedMappings = void 0;
|
||||
const language_core_1 = require("@volar/language-core");
|
||||
const muggle = require("muggle-string");
|
||||
const computeds_1 = require("computeds");
|
||||
function computedMappings(snapshot, sfc) {
|
||||
return (0, computeds_1.computed)(() => {
|
||||
const str = [[snapshot().getText(0, snapshot().getLength()), undefined, 0, language_core_1.FileRangeCapabilities.full]];
|
||||
for (const block of [
|
||||
sfc.script,
|
||||
sfc.scriptSetup,
|
||||
sfc.template,
|
||||
...sfc.styles,
|
||||
...sfc.customBlocks,
|
||||
]) {
|
||||
if (block) {
|
||||
muggle.replaceSourceRange(str, undefined, block.startTagEnd, block.endTagStart, [
|
||||
block.content,
|
||||
undefined,
|
||||
block.startTagEnd,
|
||||
{},
|
||||
]);
|
||||
}
|
||||
}
|
||||
return str.map((m) => {
|
||||
const text = m[0];
|
||||
const start = m[2];
|
||||
const end = start + text.length;
|
||||
return {
|
||||
sourceRange: [start, end],
|
||||
generatedRange: [start, end],
|
||||
data: m[3],
|
||||
};
|
||||
});
|
||||
});
|
||||
}
|
||||
exports.computedMappings = computedMappings;
|
||||
//# sourceMappingURL=computedMappings.js.map
|
5
node_modules/@vue/language-core/out/virtualFile/computedSfc.d.ts
generated
vendored
Normal file
5
node_modules/@vue/language-core/out/virtualFile/computedSfc.d.ts
generated
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
import type { SFCParseResult } from '@vue/compiler-sfc';
|
||||
import type * as ts from 'typescript/lib/tsserverlibrary';
|
||||
import { Sfc, VueLanguagePlugin } from '../types';
|
||||
export declare function computedSfc(ts: typeof import('typescript/lib/tsserverlibrary'), plugins: ReturnType<VueLanguagePlugin>[], fileName: string, snapshot: () => ts.IScriptSnapshot, parsed: () => SFCParseResult | undefined): Sfc;
|
||||
//# sourceMappingURL=computedSfc.d.ts.map
|
197
node_modules/@vue/language-core/out/virtualFile/computedSfc.js
generated
vendored
Normal file
197
node_modules/@vue/language-core/out/virtualFile/computedSfc.js
generated
vendored
Normal file
@ -0,0 +1,197 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.computedSfc = void 0;
|
||||
const parseCssClassNames_1 = require("../utils/parseCssClassNames");
|
||||
const parseCssVars_1 = require("../utils/parseCssVars");
|
||||
const computeds_1 = require("computeds");
|
||||
function computedSfc(ts, plugins, fileName, snapshot, parsed) {
|
||||
const untrackedSnapshot = () => {
|
||||
(0, computeds_1.pauseTracking)();
|
||||
const res = snapshot();
|
||||
(0, computeds_1.resetTracking)();
|
||||
return res;
|
||||
};
|
||||
const template = computedNullableSfcBlock('template', 'html', (0, computeds_1.computed)(() => parsed()?.descriptor.template ?? undefined), (_block, base) => {
|
||||
const compiledAst = computedTemplateAst(base);
|
||||
return mergeObject(base, {
|
||||
get ast() { return compiledAst()?.ast; },
|
||||
get errors() { return compiledAst()?.errors; },
|
||||
get warnings() { return compiledAst()?.warnings; },
|
||||
});
|
||||
});
|
||||
const script = computedNullableSfcBlock('script', 'js', (0, computeds_1.computed)(() => parsed()?.descriptor.script ?? undefined), (block, base) => {
|
||||
const src = (0, computeds_1.computed)(() => block().src);
|
||||
const srcOffset = (0, computeds_1.computed)(() => {
|
||||
const _src = src();
|
||||
return _src ? untrackedSnapshot().getText(0, base.startTagEnd).lastIndexOf(_src) - base.startTagEnd : -1;
|
||||
});
|
||||
const ast = (0, computeds_1.computed)(() => ts.createSourceFile(fileName + '.' + base.lang, base.content, ts.ScriptTarget.Latest));
|
||||
return mergeObject(base, {
|
||||
get src() { return src(); },
|
||||
get srcOffset() { return srcOffset(); },
|
||||
get ast() { return ast(); },
|
||||
});
|
||||
});
|
||||
const scriptSetup = computedNullableSfcBlock('scriptSetup', 'js', (0, computeds_1.computed)(() => parsed()?.descriptor.scriptSetup ?? undefined), (block, base) => {
|
||||
const generic = (0, computeds_1.computed)(() => {
|
||||
const _block = block();
|
||||
return typeof _block.attrs.generic === 'string' ? _block.attrs.generic : undefined;
|
||||
});
|
||||
const genericOffset = (0, computeds_1.computed)(() => {
|
||||
const _generic = generic();
|
||||
return _generic !== undefined ? untrackedSnapshot().getText(0, base.startTagEnd).lastIndexOf(_generic) - base.startTagEnd : -1;
|
||||
});
|
||||
const ast = (0, computeds_1.computed)(() => ts.createSourceFile(fileName + '.' + base.lang, base.content, ts.ScriptTarget.Latest));
|
||||
return mergeObject(base, {
|
||||
get generic() { return generic(); },
|
||||
get genericOffset() { return genericOffset(); },
|
||||
get ast() { return ast(); },
|
||||
});
|
||||
});
|
||||
const styles = (0, computeds_1.computedArray)((0, computeds_1.computed)(() => parsed()?.descriptor.styles ?? []), (block, i) => {
|
||||
const base = computedSfcBlock('style_' + i, 'css', block);
|
||||
const module = (0, computeds_1.computed)(() => typeof block().module === 'string' ? block().module : block().module ? '$style' : undefined);
|
||||
const scoped = (0, computeds_1.computed)(() => !!block().scoped);
|
||||
const cssVars = (0, computeds_1.computed)(() => [...(0, parseCssVars_1.parseCssVars)(base.content)]);
|
||||
const classNames = (0, computeds_1.computed)(() => [...(0, parseCssClassNames_1.parseCssClassNames)(base.content)]);
|
||||
return (0, computeds_1.computed)(() => mergeObject(base, {
|
||||
get module() { return module(); },
|
||||
get scoped() { return scoped(); },
|
||||
get cssVars() { return cssVars(); },
|
||||
get classNames() { return classNames(); },
|
||||
}));
|
||||
});
|
||||
const customBlocks = (0, computeds_1.computedArray)((0, computeds_1.computed)(() => parsed()?.descriptor.customBlocks ?? []), (block, i) => {
|
||||
const base = computedSfcBlock('customBlock_' + i, 'txt', block);
|
||||
const type = (0, computeds_1.computed)(() => block().type);
|
||||
return (0, computeds_1.computed)(() => mergeObject(base, {
|
||||
get type() { return type(); },
|
||||
}));
|
||||
});
|
||||
return {
|
||||
get template() { return template(); },
|
||||
get script() { return script(); },
|
||||
get scriptSetup() { return scriptSetup(); },
|
||||
get styles() { return styles; },
|
||||
get customBlocks() { return customBlocks; },
|
||||
get templateAst() { return template()?.ast; },
|
||||
get scriptAst() { return script()?.ast; },
|
||||
get scriptSetupAst() { return scriptSetup()?.ast; },
|
||||
};
|
||||
function computedTemplateAst(base) {
|
||||
let cache;
|
||||
return (0, computeds_1.computed)(() => {
|
||||
if (cache?.template === base.content) {
|
||||
return {
|
||||
errors: [],
|
||||
warnings: [],
|
||||
ast: cache?.result.ast,
|
||||
};
|
||||
}
|
||||
// incremental update
|
||||
if (cache?.plugin.updateSFCTemplate) {
|
||||
const change = untrackedSnapshot().getChangeRange(cache.snapshot);
|
||||
if (change) {
|
||||
(0, computeds_1.pauseTracking)();
|
||||
const templateOffset = base.startTagEnd;
|
||||
(0, computeds_1.resetTracking)();
|
||||
const newText = untrackedSnapshot().getText(change.span.start, change.span.start + change.newLength);
|
||||
const newResult = cache.plugin.updateSFCTemplate(cache.result, {
|
||||
start: change.span.start - templateOffset,
|
||||
end: change.span.start + change.span.length - templateOffset,
|
||||
newText,
|
||||
});
|
||||
if (newResult) {
|
||||
cache.template = base.content;
|
||||
cache.snapshot = untrackedSnapshot();
|
||||
cache.result = newResult;
|
||||
return {
|
||||
errors: [],
|
||||
warnings: [],
|
||||
ast: newResult.ast,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
const errors = [];
|
||||
const warnings = [];
|
||||
let options = {
|
||||
onError: (err) => errors.push(err),
|
||||
onWarn: (err) => warnings.push(err),
|
||||
expressionPlugins: ['typescript'],
|
||||
};
|
||||
for (const plugin of plugins) {
|
||||
if (plugin.resolveTemplateCompilerOptions) {
|
||||
options = plugin.resolveTemplateCompilerOptions(options);
|
||||
}
|
||||
}
|
||||
for (const plugin of plugins) {
|
||||
let result;
|
||||
try {
|
||||
result = plugin.compileSFCTemplate?.(base.lang, base.content, options);
|
||||
}
|
||||
catch (e) {
|
||||
const err = e;
|
||||
errors.push(err);
|
||||
}
|
||||
if (result || errors.length) {
|
||||
if (result && !errors.length && !warnings.length) {
|
||||
cache = {
|
||||
template: base.content,
|
||||
snapshot: untrackedSnapshot(),
|
||||
result: result,
|
||||
plugin,
|
||||
};
|
||||
}
|
||||
else {
|
||||
cache = undefined;
|
||||
}
|
||||
return {
|
||||
errors,
|
||||
warnings,
|
||||
ast: result?.ast,
|
||||
};
|
||||
}
|
||||
}
|
||||
return {
|
||||
errors,
|
||||
warnings,
|
||||
ast: undefined,
|
||||
};
|
||||
});
|
||||
}
|
||||
function computedNullableSfcBlock(name, defaultLang, block, resolve) {
|
||||
const hasBlock = (0, computeds_1.computed)(() => !!block());
|
||||
return (0, computeds_1.computed)(() => {
|
||||
if (!hasBlock()) {
|
||||
return;
|
||||
}
|
||||
const _block = (0, computeds_1.computed)(() => block());
|
||||
return resolve(_block, computedSfcBlock(name, defaultLang, _block));
|
||||
});
|
||||
}
|
||||
function computedSfcBlock(name, defaultLang, block) {
|
||||
const lang = (0, computeds_1.computed)(() => block().lang ?? defaultLang);
|
||||
const attrs = (0, computeds_1.computed)(() => block().attrs); // TODO: computed it
|
||||
const content = (0, computeds_1.computed)(() => block().content);
|
||||
const startTagEnd = (0, computeds_1.computed)(() => block().loc.start.offset);
|
||||
const endTagStart = (0, computeds_1.computed)(() => block().loc.end.offset);
|
||||
const start = (0, computeds_1.computed)(() => untrackedSnapshot().getText(0, startTagEnd()).lastIndexOf('<' + block().type));
|
||||
const end = (0, computeds_1.computed)(() => endTagStart() + untrackedSnapshot().getText(endTagStart(), untrackedSnapshot().getLength()).indexOf('>') + 1);
|
||||
return {
|
||||
name,
|
||||
get lang() { return lang(); },
|
||||
get attrs() { return attrs(); },
|
||||
get content() { return content(); },
|
||||
get startTagEnd() { return startTagEnd(); },
|
||||
get endTagStart() { return endTagStart(); },
|
||||
get start() { return start(); },
|
||||
get end() { return end(); },
|
||||
};
|
||||
}
|
||||
}
|
||||
exports.computedSfc = computedSfc;
|
||||
function mergeObject(a, b) {
|
||||
return Object.defineProperties(a, Object.getOwnPropertyDescriptors(b));
|
||||
}
|
||||
//# sourceMappingURL=computedSfc.js.map
|
5
node_modules/@vue/language-core/out/virtualFile/computedVueSfc.d.ts
generated
vendored
Normal file
5
node_modules/@vue/language-core/out/virtualFile/computedVueSfc.d.ts
generated
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
import type { SFCParseResult } from '@vue/compiler-sfc';
|
||||
import type * as ts from 'typescript/lib/tsserverlibrary';
|
||||
import { VueLanguagePlugin } from '../types';
|
||||
export declare function computedVueSfc(plugins: ReturnType<VueLanguagePlugin>[], fileName: string, snapshot: () => ts.IScriptSnapshot): () => SFCParseResult | undefined;
|
||||
//# sourceMappingURL=computedVueSfc.d.ts.map
|
41
node_modules/@vue/language-core/out/virtualFile/computedVueSfc.js
generated
vendored
Normal file
41
node_modules/@vue/language-core/out/virtualFile/computedVueSfc.js
generated
vendored
Normal file
@ -0,0 +1,41 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.computedVueSfc = void 0;
|
||||
const computeds_1 = require("computeds");
|
||||
function computedVueSfc(plugins, fileName, snapshot) {
|
||||
let cache;
|
||||
return (0, computeds_1.computed)(() => {
|
||||
// incremental update
|
||||
if (cache?.plugin.updateSFC) {
|
||||
const change = snapshot().getChangeRange(cache.snapshot);
|
||||
if (change) {
|
||||
const newSfc = cache.plugin.updateSFC(cache.sfc, {
|
||||
start: change.span.start,
|
||||
end: change.span.start + change.span.length,
|
||||
newText: snapshot().getText(change.span.start, change.span.start + change.newLength),
|
||||
});
|
||||
if (newSfc) {
|
||||
cache.snapshot = snapshot();
|
||||
// force dirty
|
||||
cache.sfc = JSON.parse(JSON.stringify(newSfc));
|
||||
return cache.sfc;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (const plugin of plugins) {
|
||||
const sfc = plugin.parseSFC?.(fileName, snapshot().getText(0, snapshot().getLength()));
|
||||
if (sfc) {
|
||||
if (!sfc.errors.length) {
|
||||
cache = {
|
||||
snapshot: snapshot(),
|
||||
sfc,
|
||||
plugin,
|
||||
};
|
||||
}
|
||||
return sfc;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
exports.computedVueSfc = computedVueSfc;
|
||||
//# sourceMappingURL=computedVueSfc.js.map
|
13
node_modules/@vue/language-core/out/virtualFile/embeddedFile.d.ts
generated
vendored
Normal file
13
node_modules/@vue/language-core/out/virtualFile/embeddedFile.d.ts
generated
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
import { FileCapabilities, FileKind, FileRangeCapabilities, MirrorBehaviorCapabilities } from '@volar/language-core';
|
||||
import { Mapping, Segment, StackNode } from '@volar/source-map';
|
||||
export declare class VueEmbeddedFile {
|
||||
fileName: string;
|
||||
content: Segment<FileRangeCapabilities>[];
|
||||
contentStacks: StackNode[];
|
||||
parentFileName?: string;
|
||||
kind: FileKind;
|
||||
capabilities: FileCapabilities;
|
||||
mirrorBehaviorMappings: Mapping<[MirrorBehaviorCapabilities, MirrorBehaviorCapabilities]>[];
|
||||
constructor(fileName: string, content: Segment<FileRangeCapabilities>[], contentStacks: StackNode[]);
|
||||
}
|
||||
//# sourceMappingURL=embeddedFile.d.ts.map
|
16
node_modules/@vue/language-core/out/virtualFile/embeddedFile.js
generated
vendored
Normal file
16
node_modules/@vue/language-core/out/virtualFile/embeddedFile.js
generated
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.VueEmbeddedFile = void 0;
|
||||
const language_core_1 = require("@volar/language-core");
|
||||
class VueEmbeddedFile {
|
||||
constructor(fileName, content, contentStacks) {
|
||||
this.fileName = fileName;
|
||||
this.content = content;
|
||||
this.contentStacks = contentStacks;
|
||||
this.kind = language_core_1.FileKind.TextFile;
|
||||
this.capabilities = {};
|
||||
this.mirrorBehaviorMappings = [];
|
||||
}
|
||||
}
|
||||
exports.VueEmbeddedFile = VueEmbeddedFile;
|
||||
//# sourceMappingURL=embeddedFile.js.map
|
28
node_modules/@vue/language-core/out/virtualFile/vueFile.d.ts
generated
vendored
Normal file
28
node_modules/@vue/language-core/out/virtualFile/vueFile.d.ts
generated
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
import { FileCapabilities, FileKind, VirtualFile } from '@volar/language-core';
|
||||
import { Stack } from '@volar/source-map';
|
||||
import type * as ts from 'typescript/lib/tsserverlibrary';
|
||||
import { VueCompilerOptions, VueLanguagePlugin } from '../types';
|
||||
import { Signal } from 'computeds';
|
||||
export declare class VueFile implements VirtualFile {
|
||||
fileName: string;
|
||||
initSnapshot: ts.IScriptSnapshot;
|
||||
vueCompilerOptions: VueCompilerOptions;
|
||||
plugins: ReturnType<VueLanguagePlugin>[];
|
||||
ts: typeof import('typescript/lib/tsserverlibrary');
|
||||
codegenStack: boolean;
|
||||
_snapshot: Signal<ts.IScriptSnapshot>;
|
||||
getVueSfc: () => import("@vue/compiler-sfc").SFCParseResult | undefined;
|
||||
sfc: import("../types").Sfc;
|
||||
getMappings: () => import("@volar/source-map").Mapping<import("@volar/language-core").FileRangeCapabilities>[];
|
||||
getEmbeddedFiles: () => VirtualFile[];
|
||||
capabilities: FileCapabilities;
|
||||
kind: FileKind;
|
||||
codegenStacks: Stack[];
|
||||
get embeddedFiles(): VirtualFile[];
|
||||
get mainScriptName(): string;
|
||||
get snapshot(): ts.IScriptSnapshot;
|
||||
get mappings(): import("@volar/source-map").Mapping<import("@volar/language-core").FileRangeCapabilities>[];
|
||||
constructor(fileName: string, initSnapshot: ts.IScriptSnapshot, vueCompilerOptions: VueCompilerOptions, plugins: ReturnType<VueLanguagePlugin>[], ts: typeof import('typescript/lib/tsserverlibrary'), codegenStack: boolean);
|
||||
update(newSnapshot: ts.IScriptSnapshot): void;
|
||||
}
|
||||
//# sourceMappingURL=vueFile.d.ts.map
|
53
node_modules/@vue/language-core/out/virtualFile/vueFile.js
generated
vendored
Normal file
53
node_modules/@vue/language-core/out/virtualFile/vueFile.js
generated
vendored
Normal file
@ -0,0 +1,53 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.VueFile = void 0;
|
||||
const language_core_1 = require("@volar/language-core");
|
||||
const computedFiles_1 = require("./computedFiles");
|
||||
const computedMappings_1 = require("./computedMappings");
|
||||
const computedSfc_1 = require("./computedSfc");
|
||||
const computedVueSfc_1 = require("./computedVueSfc");
|
||||
const computeds_1 = require("computeds");
|
||||
const jsxReg = /^\.(js|ts)x?$/;
|
||||
class VueFile {
|
||||
get embeddedFiles() {
|
||||
return this.getEmbeddedFiles();
|
||||
}
|
||||
get mainScriptName() {
|
||||
let res = '';
|
||||
(0, language_core_1.forEachEmbeddedFile)(this, file => {
|
||||
if (file.kind === language_core_1.FileKind.TypeScriptHostFile && file.fileName.replace(this.fileName, '').match(jsxReg)) {
|
||||
res = file.fileName;
|
||||
}
|
||||
});
|
||||
return res;
|
||||
}
|
||||
get snapshot() {
|
||||
return this._snapshot();
|
||||
}
|
||||
get mappings() {
|
||||
return this.getMappings();
|
||||
}
|
||||
constructor(fileName, initSnapshot, vueCompilerOptions, plugins, ts, codegenStack) {
|
||||
this.fileName = fileName;
|
||||
this.initSnapshot = initSnapshot;
|
||||
this.vueCompilerOptions = vueCompilerOptions;
|
||||
this.plugins = plugins;
|
||||
this.ts = ts;
|
||||
this.codegenStack = codegenStack;
|
||||
// computeds
|
||||
this.getVueSfc = (0, computedVueSfc_1.computedVueSfc)(this.plugins, this.fileName, () => this._snapshot());
|
||||
this.sfc = (0, computedSfc_1.computedSfc)(this.ts, this.plugins, this.fileName, () => this._snapshot(), this.getVueSfc);
|
||||
this.getMappings = (0, computedMappings_1.computedMappings)(() => this._snapshot(), this.sfc);
|
||||
this.getEmbeddedFiles = (0, computedFiles_1.computedFiles)(this.plugins, this.fileName, this.sfc, this.codegenStack);
|
||||
// others
|
||||
this.capabilities = language_core_1.FileCapabilities.full;
|
||||
this.kind = language_core_1.FileKind.TextFile;
|
||||
this.codegenStacks = [];
|
||||
this._snapshot = (0, computeds_1.signal)(initSnapshot);
|
||||
}
|
||||
update(newSnapshot) {
|
||||
this._snapshot.set(newSnapshot);
|
||||
}
|
||||
}
|
||||
exports.VueFile = VueFile;
|
||||
//# sourceMappingURL=vueFile.js.map
|
41
node_modules/@vue/language-core/package.json
generated
vendored
Normal file
41
node_modules/@vue/language-core/package.json
generated
vendored
Normal file
@ -0,0 +1,41 @@
|
||||
{
|
||||
"name": "@vue/language-core",
|
||||
"version": "1.8.27",
|
||||
"main": "out/index.js",
|
||||
"license": "MIT",
|
||||
"files": [
|
||||
"out/**/*.js",
|
||||
"out/**/*.d.ts"
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/vuejs/language-tools.git",
|
||||
"directory": "packages/language-core"
|
||||
},
|
||||
"dependencies": {
|
||||
"@volar/language-core": "~1.11.1",
|
||||
"@volar/source-map": "~1.11.1",
|
||||
"@vue/compiler-dom": "^3.3.0",
|
||||
"@vue/shared": "^3.3.0",
|
||||
"computeds": "^0.0.1",
|
||||
"minimatch": "^9.0.3",
|
||||
"muggle-string": "^0.3.1",
|
||||
"path-browserify": "^1.0.1",
|
||||
"vue-template-compiler": "^2.7.14"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/minimatch": "^5.1.2",
|
||||
"@types/node": "latest",
|
||||
"@types/path-browserify": "^1.0.1",
|
||||
"@vue/compiler-sfc": "^3.3.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"typescript": "*"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"typescript": {
|
||||
"optional": true
|
||||
}
|
||||
},
|
||||
"gitHead": "09c04807eb19f1261cc429af1b90c6561166ad4f"
|
||||
}
|
21
node_modules/@vue/shared/LICENSE
generated
vendored
Normal file
21
node_modules/@vue/shared/LICENSE
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2018-present, Yuxi (Evan) You
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
3
node_modules/@vue/shared/README.md
generated
vendored
Normal file
3
node_modules/@vue/shared/README.md
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
# @vue/shared
|
||||
|
||||
Internal utility functions and constants shared across `@vue` packages.
|
561
node_modules/@vue/shared/dist/shared.cjs.js
generated
vendored
Normal file
561
node_modules/@vue/shared/dist/shared.cjs.js
generated
vendored
Normal file
@ -0,0 +1,561 @@
|
||||
/**
|
||||
* @vue/shared v3.4.15
|
||||
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
||||
* @license MIT
|
||||
**/
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
function makeMap(str, expectsLowerCase) {
|
||||
const set = new Set(str.split(","));
|
||||
return expectsLowerCase ? (val) => set.has(val.toLowerCase()) : (val) => set.has(val);
|
||||
}
|
||||
|
||||
const EMPTY_OBJ = Object.freeze({}) ;
|
||||
const EMPTY_ARR = Object.freeze([]) ;
|
||||
const NOOP = () => {
|
||||
};
|
||||
const NO = () => false;
|
||||
const isOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // uppercase letter
|
||||
(key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97);
|
||||
const isModelListener = (key) => key.startsWith("onUpdate:");
|
||||
const extend = Object.assign;
|
||||
const remove = (arr, el) => {
|
||||
const i = arr.indexOf(el);
|
||||
if (i > -1) {
|
||||
arr.splice(i, 1);
|
||||
}
|
||||
};
|
||||
const hasOwnProperty = Object.prototype.hasOwnProperty;
|
||||
const hasOwn = (val, key) => hasOwnProperty.call(val, key);
|
||||
const isArray = Array.isArray;
|
||||
const isMap = (val) => toTypeString(val) === "[object Map]";
|
||||
const isSet = (val) => toTypeString(val) === "[object Set]";
|
||||
const isDate = (val) => toTypeString(val) === "[object Date]";
|
||||
const isRegExp = (val) => toTypeString(val) === "[object RegExp]";
|
||||
const isFunction = (val) => typeof val === "function";
|
||||
const isString = (val) => typeof val === "string";
|
||||
const isSymbol = (val) => typeof val === "symbol";
|
||||
const isObject = (val) => val !== null && typeof val === "object";
|
||||
const isPromise = (val) => {
|
||||
return (isObject(val) || isFunction(val)) && isFunction(val.then) && isFunction(val.catch);
|
||||
};
|
||||
const objectToString = Object.prototype.toString;
|
||||
const toTypeString = (value) => objectToString.call(value);
|
||||
const toRawType = (value) => {
|
||||
return toTypeString(value).slice(8, -1);
|
||||
};
|
||||
const isPlainObject = (val) => toTypeString(val) === "[object Object]";
|
||||
const isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key;
|
||||
const isReservedProp = /* @__PURE__ */ makeMap(
|
||||
// the leading comma is intentional so empty string "" is also included
|
||||
",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"
|
||||
);
|
||||
const isBuiltInDirective = /* @__PURE__ */ makeMap(
|
||||
"bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo"
|
||||
);
|
||||
const cacheStringFunction = (fn) => {
|
||||
const cache = /* @__PURE__ */ Object.create(null);
|
||||
return (str) => {
|
||||
const hit = cache[str];
|
||||
return hit || (cache[str] = fn(str));
|
||||
};
|
||||
};
|
||||
const camelizeRE = /-(\w)/g;
|
||||
const camelize = cacheStringFunction((str) => {
|
||||
return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
|
||||
});
|
||||
const hyphenateRE = /\B([A-Z])/g;
|
||||
const hyphenate = cacheStringFunction(
|
||||
(str) => str.replace(hyphenateRE, "-$1").toLowerCase()
|
||||
);
|
||||
const capitalize = cacheStringFunction((str) => {
|
||||
return str.charAt(0).toUpperCase() + str.slice(1);
|
||||
});
|
||||
const toHandlerKey = cacheStringFunction((str) => {
|
||||
const s = str ? `on${capitalize(str)}` : ``;
|
||||
return s;
|
||||
});
|
||||
const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
|
||||
const invokeArrayFns = (fns, arg) => {
|
||||
for (let i = 0; i < fns.length; i++) {
|
||||
fns[i](arg);
|
||||
}
|
||||
};
|
||||
const def = (obj, key, value) => {
|
||||
Object.defineProperty(obj, key, {
|
||||
configurable: true,
|
||||
enumerable: false,
|
||||
value
|
||||
});
|
||||
};
|
||||
const looseToNumber = (val) => {
|
||||
const n = parseFloat(val);
|
||||
return isNaN(n) ? val : n;
|
||||
};
|
||||
const toNumber = (val) => {
|
||||
const n = isString(val) ? Number(val) : NaN;
|
||||
return isNaN(n) ? val : n;
|
||||
};
|
||||
let _globalThis;
|
||||
const getGlobalThis = () => {
|
||||
return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {});
|
||||
};
|
||||
const identRE = /^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/;
|
||||
function genPropsAccessExp(name) {
|
||||
return identRE.test(name) ? `__props.${name}` : `__props[${JSON.stringify(name)}]`;
|
||||
}
|
||||
|
||||
const PatchFlags = {
|
||||
"TEXT": 1,
|
||||
"1": "TEXT",
|
||||
"CLASS": 2,
|
||||
"2": "CLASS",
|
||||
"STYLE": 4,
|
||||
"4": "STYLE",
|
||||
"PROPS": 8,
|
||||
"8": "PROPS",
|
||||
"FULL_PROPS": 16,
|
||||
"16": "FULL_PROPS",
|
||||
"NEED_HYDRATION": 32,
|
||||
"32": "NEED_HYDRATION",
|
||||
"STABLE_FRAGMENT": 64,
|
||||
"64": "STABLE_FRAGMENT",
|
||||
"KEYED_FRAGMENT": 128,
|
||||
"128": "KEYED_FRAGMENT",
|
||||
"UNKEYED_FRAGMENT": 256,
|
||||
"256": "UNKEYED_FRAGMENT",
|
||||
"NEED_PATCH": 512,
|
||||
"512": "NEED_PATCH",
|
||||
"DYNAMIC_SLOTS": 1024,
|
||||
"1024": "DYNAMIC_SLOTS",
|
||||
"DEV_ROOT_FRAGMENT": 2048,
|
||||
"2048": "DEV_ROOT_FRAGMENT",
|
||||
"HOISTED": -1,
|
||||
"-1": "HOISTED",
|
||||
"BAIL": -2,
|
||||
"-2": "BAIL"
|
||||
};
|
||||
const PatchFlagNames = {
|
||||
[1]: `TEXT`,
|
||||
[2]: `CLASS`,
|
||||
[4]: `STYLE`,
|
||||
[8]: `PROPS`,
|
||||
[16]: `FULL_PROPS`,
|
||||
[32]: `NEED_HYDRATION`,
|
||||
[64]: `STABLE_FRAGMENT`,
|
||||
[128]: `KEYED_FRAGMENT`,
|
||||
[256]: `UNKEYED_FRAGMENT`,
|
||||
[512]: `NEED_PATCH`,
|
||||
[1024]: `DYNAMIC_SLOTS`,
|
||||
[2048]: `DEV_ROOT_FRAGMENT`,
|
||||
[-1]: `HOISTED`,
|
||||
[-2]: `BAIL`
|
||||
};
|
||||
|
||||
const ShapeFlags = {
|
||||
"ELEMENT": 1,
|
||||
"1": "ELEMENT",
|
||||
"FUNCTIONAL_COMPONENT": 2,
|
||||
"2": "FUNCTIONAL_COMPONENT",
|
||||
"STATEFUL_COMPONENT": 4,
|
||||
"4": "STATEFUL_COMPONENT",
|
||||
"TEXT_CHILDREN": 8,
|
||||
"8": "TEXT_CHILDREN",
|
||||
"ARRAY_CHILDREN": 16,
|
||||
"16": "ARRAY_CHILDREN",
|
||||
"SLOTS_CHILDREN": 32,
|
||||
"32": "SLOTS_CHILDREN",
|
||||
"TELEPORT": 64,
|
||||
"64": "TELEPORT",
|
||||
"SUSPENSE": 128,
|
||||
"128": "SUSPENSE",
|
||||
"COMPONENT_SHOULD_KEEP_ALIVE": 256,
|
||||
"256": "COMPONENT_SHOULD_KEEP_ALIVE",
|
||||
"COMPONENT_KEPT_ALIVE": 512,
|
||||
"512": "COMPONENT_KEPT_ALIVE",
|
||||
"COMPONENT": 6,
|
||||
"6": "COMPONENT"
|
||||
};
|
||||
|
||||
const SlotFlags = {
|
||||
"STABLE": 1,
|
||||
"1": "STABLE",
|
||||
"DYNAMIC": 2,
|
||||
"2": "DYNAMIC",
|
||||
"FORWARDED": 3,
|
||||
"3": "FORWARDED"
|
||||
};
|
||||
const slotFlagsText = {
|
||||
[1]: "STABLE",
|
||||
[2]: "DYNAMIC",
|
||||
[3]: "FORWARDED"
|
||||
};
|
||||
|
||||
const GLOBALS_ALLOWED = "Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console,Error";
|
||||
const isGloballyAllowed = /* @__PURE__ */ makeMap(GLOBALS_ALLOWED);
|
||||
const isGloballyWhitelisted = isGloballyAllowed;
|
||||
|
||||
const range = 2;
|
||||
function generateCodeFrame(source, start = 0, end = source.length) {
|
||||
let lines = source.split(/(\r?\n)/);
|
||||
const newlineSequences = lines.filter((_, idx) => idx % 2 === 1);
|
||||
lines = lines.filter((_, idx) => idx % 2 === 0);
|
||||
let count = 0;
|
||||
const res = [];
|
||||
for (let i = 0; i < lines.length; i++) {
|
||||
count += lines[i].length + (newlineSequences[i] && newlineSequences[i].length || 0);
|
||||
if (count >= start) {
|
||||
for (let j = i - range; j <= i + range || end > count; j++) {
|
||||
if (j < 0 || j >= lines.length)
|
||||
continue;
|
||||
const line = j + 1;
|
||||
res.push(
|
||||
`${line}${" ".repeat(Math.max(3 - String(line).length, 0))}| ${lines[j]}`
|
||||
);
|
||||
const lineLength = lines[j].length;
|
||||
const newLineSeqLength = newlineSequences[j] && newlineSequences[j].length || 0;
|
||||
if (j === i) {
|
||||
const pad = start - (count - (lineLength + newLineSeqLength));
|
||||
const length = Math.max(
|
||||
1,
|
||||
end > count ? lineLength - pad : end - start
|
||||
);
|
||||
res.push(` | ` + " ".repeat(pad) + "^".repeat(length));
|
||||
} else if (j > i) {
|
||||
if (end > count) {
|
||||
const length = Math.max(Math.min(end - count, lineLength), 1);
|
||||
res.push(` | ` + "^".repeat(length));
|
||||
}
|
||||
count += lineLength + newLineSeqLength;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return res.join("\n");
|
||||
}
|
||||
|
||||
function normalizeStyle(value) {
|
||||
if (isArray(value)) {
|
||||
const res = {};
|
||||
for (let i = 0; i < value.length; i++) {
|
||||
const item = value[i];
|
||||
const normalized = isString(item) ? parseStringStyle(item) : normalizeStyle(item);
|
||||
if (normalized) {
|
||||
for (const key in normalized) {
|
||||
res[key] = normalized[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
return res;
|
||||
} else if (isString(value) || isObject(value)) {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
const listDelimiterRE = /;(?![^(]*\))/g;
|
||||
const propertyDelimiterRE = /:([^]+)/;
|
||||
const styleCommentRE = /\/\*[^]*?\*\//g;
|
||||
function parseStringStyle(cssText) {
|
||||
const ret = {};
|
||||
cssText.replace(styleCommentRE, "").split(listDelimiterRE).forEach((item) => {
|
||||
if (item) {
|
||||
const tmp = item.split(propertyDelimiterRE);
|
||||
tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());
|
||||
}
|
||||
});
|
||||
return ret;
|
||||
}
|
||||
function stringifyStyle(styles) {
|
||||
let ret = "";
|
||||
if (!styles || isString(styles)) {
|
||||
return ret;
|
||||
}
|
||||
for (const key in styles) {
|
||||
const value = styles[key];
|
||||
const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key);
|
||||
if (isString(value) || typeof value === "number") {
|
||||
ret += `${normalizedKey}:${value};`;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
function normalizeClass(value) {
|
||||
let res = "";
|
||||
if (isString(value)) {
|
||||
res = value;
|
||||
} else if (isArray(value)) {
|
||||
for (let i = 0; i < value.length; i++) {
|
||||
const normalized = normalizeClass(value[i]);
|
||||
if (normalized) {
|
||||
res += normalized + " ";
|
||||
}
|
||||
}
|
||||
} else if (isObject(value)) {
|
||||
for (const name in value) {
|
||||
if (value[name]) {
|
||||
res += name + " ";
|
||||
}
|
||||
}
|
||||
}
|
||||
return res.trim();
|
||||
}
|
||||
function normalizeProps(props) {
|
||||
if (!props)
|
||||
return null;
|
||||
let { class: klass, style } = props;
|
||||
if (klass && !isString(klass)) {
|
||||
props.class = normalizeClass(klass);
|
||||
}
|
||||
if (style) {
|
||||
props.style = normalizeStyle(style);
|
||||
}
|
||||
return props;
|
||||
}
|
||||
|
||||
const HTML_TAGS = "html,body,base,head,link,meta,style,title,address,article,aside,footer,header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,summary,template,blockquote,iframe,tfoot";
|
||||
const SVG_TAGS = "svg,animate,animateMotion,animateTransform,circle,clipPath,color-profile,defs,desc,discard,ellipse,feBlend,feColorMatrix,feComponentTransfer,feComposite,feConvolveMatrix,feDiffuseLighting,feDisplacementMap,feDistantLight,feDropShadow,feFlood,feFuncA,feFuncB,feFuncG,feFuncR,feGaussianBlur,feImage,feMerge,feMergeNode,feMorphology,feOffset,fePointLight,feSpecularLighting,feSpotLight,feTile,feTurbulence,filter,foreignObject,g,hatch,hatchpath,image,line,linearGradient,marker,mask,mesh,meshgradient,meshpatch,meshrow,metadata,mpath,path,pattern,polygon,polyline,radialGradient,rect,set,solidcolor,stop,switch,symbol,text,textPath,title,tspan,unknown,use,view";
|
||||
const MATH_TAGS = "annotation,annotation-xml,maction,maligngroup,malignmark,math,menclose,merror,mfenced,mfrac,mfraction,mglyph,mi,mlabeledtr,mlongdiv,mmultiscripts,mn,mo,mover,mpadded,mphantom,mprescripts,mroot,mrow,ms,mscarries,mscarry,msgroup,msline,mspace,msqrt,msrow,mstack,mstyle,msub,msubsup,msup,mtable,mtd,mtext,mtr,munder,munderover,none,semantics";
|
||||
const VOID_TAGS = "area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr";
|
||||
const isHTMLTag = /* @__PURE__ */ makeMap(HTML_TAGS);
|
||||
const isSVGTag = /* @__PURE__ */ makeMap(SVG_TAGS);
|
||||
const isMathMLTag = /* @__PURE__ */ makeMap(MATH_TAGS);
|
||||
const isVoidTag = /* @__PURE__ */ makeMap(VOID_TAGS);
|
||||
|
||||
const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;
|
||||
const isSpecialBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs);
|
||||
const isBooleanAttr = /* @__PURE__ */ makeMap(
|
||||
specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,hidden,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected`
|
||||
);
|
||||
function includeBooleanAttr(value) {
|
||||
return !!value || value === "";
|
||||
}
|
||||
const unsafeAttrCharRE = /[>/="'\u0009\u000a\u000c\u0020]/;
|
||||
const attrValidationCache = {};
|
||||
function isSSRSafeAttrName(name) {
|
||||
if (attrValidationCache.hasOwnProperty(name)) {
|
||||
return attrValidationCache[name];
|
||||
}
|
||||
const isUnsafe = unsafeAttrCharRE.test(name);
|
||||
if (isUnsafe) {
|
||||
console.error(`unsafe attribute name: ${name}`);
|
||||
}
|
||||
return attrValidationCache[name] = !isUnsafe;
|
||||
}
|
||||
const propsToAttrMap = {
|
||||
acceptCharset: "accept-charset",
|
||||
className: "class",
|
||||
htmlFor: "for",
|
||||
httpEquiv: "http-equiv"
|
||||
};
|
||||
const isKnownHtmlAttr = /* @__PURE__ */ makeMap(
|
||||
`accept,accept-charset,accesskey,action,align,allow,alt,async,autocapitalize,autocomplete,autofocus,autoplay,background,bgcolor,border,buffered,capture,challenge,charset,checked,cite,class,code,codebase,color,cols,colspan,content,contenteditable,contextmenu,controls,coords,crossorigin,csp,data,datetime,decoding,default,defer,dir,dirname,disabled,download,draggable,dropzone,enctype,enterkeyhint,for,form,formaction,formenctype,formmethod,formnovalidate,formtarget,headers,height,hidden,high,href,hreflang,http-equiv,icon,id,importance,inert,integrity,ismap,itemprop,keytype,kind,label,lang,language,loading,list,loop,low,manifest,max,maxlength,minlength,media,min,multiple,muted,name,novalidate,open,optimum,pattern,ping,placeholder,poster,preload,radiogroup,readonly,referrerpolicy,rel,required,reversed,rows,rowspan,sandbox,scope,scoped,selected,shape,size,sizes,slot,span,spellcheck,src,srcdoc,srclang,srcset,start,step,style,summary,tabindex,target,title,translate,type,usemap,value,width,wrap`
|
||||
);
|
||||
const isKnownSvgAttr = /* @__PURE__ */ makeMap(
|
||||
`xmlns,accent-height,accumulate,additive,alignment-baseline,alphabetic,amplitude,arabic-form,ascent,attributeName,attributeType,azimuth,baseFrequency,baseline-shift,baseProfile,bbox,begin,bias,by,calcMode,cap-height,class,clip,clipPathUnits,clip-path,clip-rule,color,color-interpolation,color-interpolation-filters,color-profile,color-rendering,contentScriptType,contentStyleType,crossorigin,cursor,cx,cy,d,decelerate,descent,diffuseConstant,direction,display,divisor,dominant-baseline,dur,dx,dy,edgeMode,elevation,enable-background,end,exponent,fill,fill-opacity,fill-rule,filter,filterRes,filterUnits,flood-color,flood-opacity,font-family,font-size,font-size-adjust,font-stretch,font-style,font-variant,font-weight,format,from,fr,fx,fy,g1,g2,glyph-name,glyph-orientation-horizontal,glyph-orientation-vertical,glyphRef,gradientTransform,gradientUnits,hanging,height,href,hreflang,horiz-adv-x,horiz-origin-x,id,ideographic,image-rendering,in,in2,intercept,k,k1,k2,k3,k4,kernelMatrix,kernelUnitLength,kerning,keyPoints,keySplines,keyTimes,lang,lengthAdjust,letter-spacing,lighting-color,limitingConeAngle,local,marker-end,marker-mid,marker-start,markerHeight,markerUnits,markerWidth,mask,maskContentUnits,maskUnits,mathematical,max,media,method,min,mode,name,numOctaves,offset,opacity,operator,order,orient,orientation,origin,overflow,overline-position,overline-thickness,panose-1,paint-order,path,pathLength,patternContentUnits,patternTransform,patternUnits,ping,pointer-events,points,pointsAtX,pointsAtY,pointsAtZ,preserveAlpha,preserveAspectRatio,primitiveUnits,r,radius,referrerPolicy,refX,refY,rel,rendering-intent,repeatCount,repeatDur,requiredExtensions,requiredFeatures,restart,result,rotate,rx,ry,scale,seed,shape-rendering,slope,spacing,specularConstant,specularExponent,speed,spreadMethod,startOffset,stdDeviation,stemh,stemv,stitchTiles,stop-color,stop-opacity,strikethrough-position,strikethrough-thickness,string,stroke,stroke-dasharray,stroke-dashoffset,stroke-linecap,stroke-linejoin,stroke-miterlimit,stroke-opacity,stroke-width,style,surfaceScale,systemLanguage,tabindex,tableValues,target,targetX,targetY,text-anchor,text-decoration,text-rendering,textLength,to,transform,transform-origin,type,u1,u2,underline-position,underline-thickness,unicode,unicode-bidi,unicode-range,units-per-em,v-alphabetic,v-hanging,v-ideographic,v-mathematical,values,vector-effect,version,vert-adv-y,vert-origin-x,vert-origin-y,viewBox,viewTarget,visibility,width,widths,word-spacing,writing-mode,x,x-height,x1,x2,xChannelSelector,xlink:actuate,xlink:arcrole,xlink:href,xlink:role,xlink:show,xlink:title,xlink:type,xmlns:xlink,xml:base,xml:lang,xml:space,y,y1,y2,yChannelSelector,z,zoomAndPan`
|
||||
);
|
||||
function isRenderableAttrValue(value) {
|
||||
if (value == null) {
|
||||
return false;
|
||||
}
|
||||
const type = typeof value;
|
||||
return type === "string" || type === "number" || type === "boolean";
|
||||
}
|
||||
|
||||
const escapeRE = /["'&<>]/;
|
||||
function escapeHtml(string) {
|
||||
const str = "" + string;
|
||||
const match = escapeRE.exec(str);
|
||||
if (!match) {
|
||||
return str;
|
||||
}
|
||||
let html = "";
|
||||
let escaped;
|
||||
let index;
|
||||
let lastIndex = 0;
|
||||
for (index = match.index; index < str.length; index++) {
|
||||
switch (str.charCodeAt(index)) {
|
||||
case 34:
|
||||
escaped = """;
|
||||
break;
|
||||
case 38:
|
||||
escaped = "&";
|
||||
break;
|
||||
case 39:
|
||||
escaped = "'";
|
||||
break;
|
||||
case 60:
|
||||
escaped = "<";
|
||||
break;
|
||||
case 62:
|
||||
escaped = ">";
|
||||
break;
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
if (lastIndex !== index) {
|
||||
html += str.slice(lastIndex, index);
|
||||
}
|
||||
lastIndex = index + 1;
|
||||
html += escaped;
|
||||
}
|
||||
return lastIndex !== index ? html + str.slice(lastIndex, index) : html;
|
||||
}
|
||||
const commentStripRE = /^-?>|<!--|-->|--!>|<!-$/g;
|
||||
function escapeHtmlComment(src) {
|
||||
return src.replace(commentStripRE, "");
|
||||
}
|
||||
|
||||
function looseCompareArrays(a, b) {
|
||||
if (a.length !== b.length)
|
||||
return false;
|
||||
let equal = true;
|
||||
for (let i = 0; equal && i < a.length; i++) {
|
||||
equal = looseEqual(a[i], b[i]);
|
||||
}
|
||||
return equal;
|
||||
}
|
||||
function looseEqual(a, b) {
|
||||
if (a === b)
|
||||
return true;
|
||||
let aValidType = isDate(a);
|
||||
let bValidType = isDate(b);
|
||||
if (aValidType || bValidType) {
|
||||
return aValidType && bValidType ? a.getTime() === b.getTime() : false;
|
||||
}
|
||||
aValidType = isSymbol(a);
|
||||
bValidType = isSymbol(b);
|
||||
if (aValidType || bValidType) {
|
||||
return a === b;
|
||||
}
|
||||
aValidType = isArray(a);
|
||||
bValidType = isArray(b);
|
||||
if (aValidType || bValidType) {
|
||||
return aValidType && bValidType ? looseCompareArrays(a, b) : false;
|
||||
}
|
||||
aValidType = isObject(a);
|
||||
bValidType = isObject(b);
|
||||
if (aValidType || bValidType) {
|
||||
if (!aValidType || !bValidType) {
|
||||
return false;
|
||||
}
|
||||
const aKeysCount = Object.keys(a).length;
|
||||
const bKeysCount = Object.keys(b).length;
|
||||
if (aKeysCount !== bKeysCount) {
|
||||
return false;
|
||||
}
|
||||
for (const key in a) {
|
||||
const aHasKey = a.hasOwnProperty(key);
|
||||
const bHasKey = b.hasOwnProperty(key);
|
||||
if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return String(a) === String(b);
|
||||
}
|
||||
function looseIndexOf(arr, val) {
|
||||
return arr.findIndex((item) => looseEqual(item, val));
|
||||
}
|
||||
|
||||
const toDisplayString = (val) => {
|
||||
return isString(val) ? val : val == null ? "" : isArray(val) || isObject(val) && (val.toString === objectToString || !isFunction(val.toString)) ? JSON.stringify(val, replacer, 2) : String(val);
|
||||
};
|
||||
const replacer = (_key, val) => {
|
||||
if (val && val.__v_isRef) {
|
||||
return replacer(_key, val.value);
|
||||
} else if (isMap(val)) {
|
||||
return {
|
||||
[`Map(${val.size})`]: [...val.entries()].reduce(
|
||||
(entries, [key, val2], i) => {
|
||||
entries[stringifySymbol(key, i) + " =>"] = val2;
|
||||
return entries;
|
||||
},
|
||||
{}
|
||||
)
|
||||
};
|
||||
} else if (isSet(val)) {
|
||||
return {
|
||||
[`Set(${val.size})`]: [...val.values()].map((v) => stringifySymbol(v))
|
||||
};
|
||||
} else if (isSymbol(val)) {
|
||||
return stringifySymbol(val);
|
||||
} else if (isObject(val) && !isArray(val) && !isPlainObject(val)) {
|
||||
return String(val);
|
||||
}
|
||||
return val;
|
||||
};
|
||||
const stringifySymbol = (v, i = "") => {
|
||||
var _a;
|
||||
return isSymbol(v) ? `Symbol(${(_a = v.description) != null ? _a : i})` : v;
|
||||
};
|
||||
|
||||
exports.EMPTY_ARR = EMPTY_ARR;
|
||||
exports.EMPTY_OBJ = EMPTY_OBJ;
|
||||
exports.NO = NO;
|
||||
exports.NOOP = NOOP;
|
||||
exports.PatchFlagNames = PatchFlagNames;
|
||||
exports.PatchFlags = PatchFlags;
|
||||
exports.ShapeFlags = ShapeFlags;
|
||||
exports.SlotFlags = SlotFlags;
|
||||
exports.camelize = camelize;
|
||||
exports.capitalize = capitalize;
|
||||
exports.def = def;
|
||||
exports.escapeHtml = escapeHtml;
|
||||
exports.escapeHtmlComment = escapeHtmlComment;
|
||||
exports.extend = extend;
|
||||
exports.genPropsAccessExp = genPropsAccessExp;
|
||||
exports.generateCodeFrame = generateCodeFrame;
|
||||
exports.getGlobalThis = getGlobalThis;
|
||||
exports.hasChanged = hasChanged;
|
||||
exports.hasOwn = hasOwn;
|
||||
exports.hyphenate = hyphenate;
|
||||
exports.includeBooleanAttr = includeBooleanAttr;
|
||||
exports.invokeArrayFns = invokeArrayFns;
|
||||
exports.isArray = isArray;
|
||||
exports.isBooleanAttr = isBooleanAttr;
|
||||
exports.isBuiltInDirective = isBuiltInDirective;
|
||||
exports.isDate = isDate;
|
||||
exports.isFunction = isFunction;
|
||||
exports.isGloballyAllowed = isGloballyAllowed;
|
||||
exports.isGloballyWhitelisted = isGloballyWhitelisted;
|
||||
exports.isHTMLTag = isHTMLTag;
|
||||
exports.isIntegerKey = isIntegerKey;
|
||||
exports.isKnownHtmlAttr = isKnownHtmlAttr;
|
||||
exports.isKnownSvgAttr = isKnownSvgAttr;
|
||||
exports.isMap = isMap;
|
||||
exports.isMathMLTag = isMathMLTag;
|
||||
exports.isModelListener = isModelListener;
|
||||
exports.isObject = isObject;
|
||||
exports.isOn = isOn;
|
||||
exports.isPlainObject = isPlainObject;
|
||||
exports.isPromise = isPromise;
|
||||
exports.isRegExp = isRegExp;
|
||||
exports.isRenderableAttrValue = isRenderableAttrValue;
|
||||
exports.isReservedProp = isReservedProp;
|
||||
exports.isSSRSafeAttrName = isSSRSafeAttrName;
|
||||
exports.isSVGTag = isSVGTag;
|
||||
exports.isSet = isSet;
|
||||
exports.isSpecialBooleanAttr = isSpecialBooleanAttr;
|
||||
exports.isString = isString;
|
||||
exports.isSymbol = isSymbol;
|
||||
exports.isVoidTag = isVoidTag;
|
||||
exports.looseEqual = looseEqual;
|
||||
exports.looseIndexOf = looseIndexOf;
|
||||
exports.looseToNumber = looseToNumber;
|
||||
exports.makeMap = makeMap;
|
||||
exports.normalizeClass = normalizeClass;
|
||||
exports.normalizeProps = normalizeProps;
|
||||
exports.normalizeStyle = normalizeStyle;
|
||||
exports.objectToString = objectToString;
|
||||
exports.parseStringStyle = parseStringStyle;
|
||||
exports.propsToAttrMap = propsToAttrMap;
|
||||
exports.remove = remove;
|
||||
exports.slotFlagsText = slotFlagsText;
|
||||
exports.stringifyStyle = stringifyStyle;
|
||||
exports.toDisplayString = toDisplayString;
|
||||
exports.toHandlerKey = toHandlerKey;
|
||||
exports.toNumber = toNumber;
|
||||
exports.toRawType = toRawType;
|
||||
exports.toTypeString = toTypeString;
|
561
node_modules/@vue/shared/dist/shared.cjs.prod.js
generated
vendored
Normal file
561
node_modules/@vue/shared/dist/shared.cjs.prod.js
generated
vendored
Normal file
@ -0,0 +1,561 @@
|
||||
/**
|
||||
* @vue/shared v3.4.15
|
||||
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
||||
* @license MIT
|
||||
**/
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
function makeMap(str, expectsLowerCase) {
|
||||
const set = new Set(str.split(","));
|
||||
return expectsLowerCase ? (val) => set.has(val.toLowerCase()) : (val) => set.has(val);
|
||||
}
|
||||
|
||||
const EMPTY_OBJ = {};
|
||||
const EMPTY_ARR = [];
|
||||
const NOOP = () => {
|
||||
};
|
||||
const NO = () => false;
|
||||
const isOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // uppercase letter
|
||||
(key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97);
|
||||
const isModelListener = (key) => key.startsWith("onUpdate:");
|
||||
const extend = Object.assign;
|
||||
const remove = (arr, el) => {
|
||||
const i = arr.indexOf(el);
|
||||
if (i > -1) {
|
||||
arr.splice(i, 1);
|
||||
}
|
||||
};
|
||||
const hasOwnProperty = Object.prototype.hasOwnProperty;
|
||||
const hasOwn = (val, key) => hasOwnProperty.call(val, key);
|
||||
const isArray = Array.isArray;
|
||||
const isMap = (val) => toTypeString(val) === "[object Map]";
|
||||
const isSet = (val) => toTypeString(val) === "[object Set]";
|
||||
const isDate = (val) => toTypeString(val) === "[object Date]";
|
||||
const isRegExp = (val) => toTypeString(val) === "[object RegExp]";
|
||||
const isFunction = (val) => typeof val === "function";
|
||||
const isString = (val) => typeof val === "string";
|
||||
const isSymbol = (val) => typeof val === "symbol";
|
||||
const isObject = (val) => val !== null && typeof val === "object";
|
||||
const isPromise = (val) => {
|
||||
return (isObject(val) || isFunction(val)) && isFunction(val.then) && isFunction(val.catch);
|
||||
};
|
||||
const objectToString = Object.prototype.toString;
|
||||
const toTypeString = (value) => objectToString.call(value);
|
||||
const toRawType = (value) => {
|
||||
return toTypeString(value).slice(8, -1);
|
||||
};
|
||||
const isPlainObject = (val) => toTypeString(val) === "[object Object]";
|
||||
const isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key;
|
||||
const isReservedProp = /* @__PURE__ */ makeMap(
|
||||
// the leading comma is intentional so empty string "" is also included
|
||||
",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"
|
||||
);
|
||||
const isBuiltInDirective = /* @__PURE__ */ makeMap(
|
||||
"bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo"
|
||||
);
|
||||
const cacheStringFunction = (fn) => {
|
||||
const cache = /* @__PURE__ */ Object.create(null);
|
||||
return (str) => {
|
||||
const hit = cache[str];
|
||||
return hit || (cache[str] = fn(str));
|
||||
};
|
||||
};
|
||||
const camelizeRE = /-(\w)/g;
|
||||
const camelize = cacheStringFunction((str) => {
|
||||
return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
|
||||
});
|
||||
const hyphenateRE = /\B([A-Z])/g;
|
||||
const hyphenate = cacheStringFunction(
|
||||
(str) => str.replace(hyphenateRE, "-$1").toLowerCase()
|
||||
);
|
||||
const capitalize = cacheStringFunction((str) => {
|
||||
return str.charAt(0).toUpperCase() + str.slice(1);
|
||||
});
|
||||
const toHandlerKey = cacheStringFunction((str) => {
|
||||
const s = str ? `on${capitalize(str)}` : ``;
|
||||
return s;
|
||||
});
|
||||
const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
|
||||
const invokeArrayFns = (fns, arg) => {
|
||||
for (let i = 0; i < fns.length; i++) {
|
||||
fns[i](arg);
|
||||
}
|
||||
};
|
||||
const def = (obj, key, value) => {
|
||||
Object.defineProperty(obj, key, {
|
||||
configurable: true,
|
||||
enumerable: false,
|
||||
value
|
||||
});
|
||||
};
|
||||
const looseToNumber = (val) => {
|
||||
const n = parseFloat(val);
|
||||
return isNaN(n) ? val : n;
|
||||
};
|
||||
const toNumber = (val) => {
|
||||
const n = isString(val) ? Number(val) : NaN;
|
||||
return isNaN(n) ? val : n;
|
||||
};
|
||||
let _globalThis;
|
||||
const getGlobalThis = () => {
|
||||
return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {});
|
||||
};
|
||||
const identRE = /^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/;
|
||||
function genPropsAccessExp(name) {
|
||||
return identRE.test(name) ? `__props.${name}` : `__props[${JSON.stringify(name)}]`;
|
||||
}
|
||||
|
||||
const PatchFlags = {
|
||||
"TEXT": 1,
|
||||
"1": "TEXT",
|
||||
"CLASS": 2,
|
||||
"2": "CLASS",
|
||||
"STYLE": 4,
|
||||
"4": "STYLE",
|
||||
"PROPS": 8,
|
||||
"8": "PROPS",
|
||||
"FULL_PROPS": 16,
|
||||
"16": "FULL_PROPS",
|
||||
"NEED_HYDRATION": 32,
|
||||
"32": "NEED_HYDRATION",
|
||||
"STABLE_FRAGMENT": 64,
|
||||
"64": "STABLE_FRAGMENT",
|
||||
"KEYED_FRAGMENT": 128,
|
||||
"128": "KEYED_FRAGMENT",
|
||||
"UNKEYED_FRAGMENT": 256,
|
||||
"256": "UNKEYED_FRAGMENT",
|
||||
"NEED_PATCH": 512,
|
||||
"512": "NEED_PATCH",
|
||||
"DYNAMIC_SLOTS": 1024,
|
||||
"1024": "DYNAMIC_SLOTS",
|
||||
"DEV_ROOT_FRAGMENT": 2048,
|
||||
"2048": "DEV_ROOT_FRAGMENT",
|
||||
"HOISTED": -1,
|
||||
"-1": "HOISTED",
|
||||
"BAIL": -2,
|
||||
"-2": "BAIL"
|
||||
};
|
||||
const PatchFlagNames = {
|
||||
[1]: `TEXT`,
|
||||
[2]: `CLASS`,
|
||||
[4]: `STYLE`,
|
||||
[8]: `PROPS`,
|
||||
[16]: `FULL_PROPS`,
|
||||
[32]: `NEED_HYDRATION`,
|
||||
[64]: `STABLE_FRAGMENT`,
|
||||
[128]: `KEYED_FRAGMENT`,
|
||||
[256]: `UNKEYED_FRAGMENT`,
|
||||
[512]: `NEED_PATCH`,
|
||||
[1024]: `DYNAMIC_SLOTS`,
|
||||
[2048]: `DEV_ROOT_FRAGMENT`,
|
||||
[-1]: `HOISTED`,
|
||||
[-2]: `BAIL`
|
||||
};
|
||||
|
||||
const ShapeFlags = {
|
||||
"ELEMENT": 1,
|
||||
"1": "ELEMENT",
|
||||
"FUNCTIONAL_COMPONENT": 2,
|
||||
"2": "FUNCTIONAL_COMPONENT",
|
||||
"STATEFUL_COMPONENT": 4,
|
||||
"4": "STATEFUL_COMPONENT",
|
||||
"TEXT_CHILDREN": 8,
|
||||
"8": "TEXT_CHILDREN",
|
||||
"ARRAY_CHILDREN": 16,
|
||||
"16": "ARRAY_CHILDREN",
|
||||
"SLOTS_CHILDREN": 32,
|
||||
"32": "SLOTS_CHILDREN",
|
||||
"TELEPORT": 64,
|
||||
"64": "TELEPORT",
|
||||
"SUSPENSE": 128,
|
||||
"128": "SUSPENSE",
|
||||
"COMPONENT_SHOULD_KEEP_ALIVE": 256,
|
||||
"256": "COMPONENT_SHOULD_KEEP_ALIVE",
|
||||
"COMPONENT_KEPT_ALIVE": 512,
|
||||
"512": "COMPONENT_KEPT_ALIVE",
|
||||
"COMPONENT": 6,
|
||||
"6": "COMPONENT"
|
||||
};
|
||||
|
||||
const SlotFlags = {
|
||||
"STABLE": 1,
|
||||
"1": "STABLE",
|
||||
"DYNAMIC": 2,
|
||||
"2": "DYNAMIC",
|
||||
"FORWARDED": 3,
|
||||
"3": "FORWARDED"
|
||||
};
|
||||
const slotFlagsText = {
|
||||
[1]: "STABLE",
|
||||
[2]: "DYNAMIC",
|
||||
[3]: "FORWARDED"
|
||||
};
|
||||
|
||||
const GLOBALS_ALLOWED = "Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console,Error";
|
||||
const isGloballyAllowed = /* @__PURE__ */ makeMap(GLOBALS_ALLOWED);
|
||||
const isGloballyWhitelisted = isGloballyAllowed;
|
||||
|
||||
const range = 2;
|
||||
function generateCodeFrame(source, start = 0, end = source.length) {
|
||||
let lines = source.split(/(\r?\n)/);
|
||||
const newlineSequences = lines.filter((_, idx) => idx % 2 === 1);
|
||||
lines = lines.filter((_, idx) => idx % 2 === 0);
|
||||
let count = 0;
|
||||
const res = [];
|
||||
for (let i = 0; i < lines.length; i++) {
|
||||
count += lines[i].length + (newlineSequences[i] && newlineSequences[i].length || 0);
|
||||
if (count >= start) {
|
||||
for (let j = i - range; j <= i + range || end > count; j++) {
|
||||
if (j < 0 || j >= lines.length)
|
||||
continue;
|
||||
const line = j + 1;
|
||||
res.push(
|
||||
`${line}${" ".repeat(Math.max(3 - String(line).length, 0))}| ${lines[j]}`
|
||||
);
|
||||
const lineLength = lines[j].length;
|
||||
const newLineSeqLength = newlineSequences[j] && newlineSequences[j].length || 0;
|
||||
if (j === i) {
|
||||
const pad = start - (count - (lineLength + newLineSeqLength));
|
||||
const length = Math.max(
|
||||
1,
|
||||
end > count ? lineLength - pad : end - start
|
||||
);
|
||||
res.push(` | ` + " ".repeat(pad) + "^".repeat(length));
|
||||
} else if (j > i) {
|
||||
if (end > count) {
|
||||
const length = Math.max(Math.min(end - count, lineLength), 1);
|
||||
res.push(` | ` + "^".repeat(length));
|
||||
}
|
||||
count += lineLength + newLineSeqLength;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return res.join("\n");
|
||||
}
|
||||
|
||||
function normalizeStyle(value) {
|
||||
if (isArray(value)) {
|
||||
const res = {};
|
||||
for (let i = 0; i < value.length; i++) {
|
||||
const item = value[i];
|
||||
const normalized = isString(item) ? parseStringStyle(item) : normalizeStyle(item);
|
||||
if (normalized) {
|
||||
for (const key in normalized) {
|
||||
res[key] = normalized[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
return res;
|
||||
} else if (isString(value) || isObject(value)) {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
const listDelimiterRE = /;(?![^(]*\))/g;
|
||||
const propertyDelimiterRE = /:([^]+)/;
|
||||
const styleCommentRE = /\/\*[^]*?\*\//g;
|
||||
function parseStringStyle(cssText) {
|
||||
const ret = {};
|
||||
cssText.replace(styleCommentRE, "").split(listDelimiterRE).forEach((item) => {
|
||||
if (item) {
|
||||
const tmp = item.split(propertyDelimiterRE);
|
||||
tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());
|
||||
}
|
||||
});
|
||||
return ret;
|
||||
}
|
||||
function stringifyStyle(styles) {
|
||||
let ret = "";
|
||||
if (!styles || isString(styles)) {
|
||||
return ret;
|
||||
}
|
||||
for (const key in styles) {
|
||||
const value = styles[key];
|
||||
const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key);
|
||||
if (isString(value) || typeof value === "number") {
|
||||
ret += `${normalizedKey}:${value};`;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
function normalizeClass(value) {
|
||||
let res = "";
|
||||
if (isString(value)) {
|
||||
res = value;
|
||||
} else if (isArray(value)) {
|
||||
for (let i = 0; i < value.length; i++) {
|
||||
const normalized = normalizeClass(value[i]);
|
||||
if (normalized) {
|
||||
res += normalized + " ";
|
||||
}
|
||||
}
|
||||
} else if (isObject(value)) {
|
||||
for (const name in value) {
|
||||
if (value[name]) {
|
||||
res += name + " ";
|
||||
}
|
||||
}
|
||||
}
|
||||
return res.trim();
|
||||
}
|
||||
function normalizeProps(props) {
|
||||
if (!props)
|
||||
return null;
|
||||
let { class: klass, style } = props;
|
||||
if (klass && !isString(klass)) {
|
||||
props.class = normalizeClass(klass);
|
||||
}
|
||||
if (style) {
|
||||
props.style = normalizeStyle(style);
|
||||
}
|
||||
return props;
|
||||
}
|
||||
|
||||
const HTML_TAGS = "html,body,base,head,link,meta,style,title,address,article,aside,footer,header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,summary,template,blockquote,iframe,tfoot";
|
||||
const SVG_TAGS = "svg,animate,animateMotion,animateTransform,circle,clipPath,color-profile,defs,desc,discard,ellipse,feBlend,feColorMatrix,feComponentTransfer,feComposite,feConvolveMatrix,feDiffuseLighting,feDisplacementMap,feDistantLight,feDropShadow,feFlood,feFuncA,feFuncB,feFuncG,feFuncR,feGaussianBlur,feImage,feMerge,feMergeNode,feMorphology,feOffset,fePointLight,feSpecularLighting,feSpotLight,feTile,feTurbulence,filter,foreignObject,g,hatch,hatchpath,image,line,linearGradient,marker,mask,mesh,meshgradient,meshpatch,meshrow,metadata,mpath,path,pattern,polygon,polyline,radialGradient,rect,set,solidcolor,stop,switch,symbol,text,textPath,title,tspan,unknown,use,view";
|
||||
const MATH_TAGS = "annotation,annotation-xml,maction,maligngroup,malignmark,math,menclose,merror,mfenced,mfrac,mfraction,mglyph,mi,mlabeledtr,mlongdiv,mmultiscripts,mn,mo,mover,mpadded,mphantom,mprescripts,mroot,mrow,ms,mscarries,mscarry,msgroup,msline,mspace,msqrt,msrow,mstack,mstyle,msub,msubsup,msup,mtable,mtd,mtext,mtr,munder,munderover,none,semantics";
|
||||
const VOID_TAGS = "area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr";
|
||||
const isHTMLTag = /* @__PURE__ */ makeMap(HTML_TAGS);
|
||||
const isSVGTag = /* @__PURE__ */ makeMap(SVG_TAGS);
|
||||
const isMathMLTag = /* @__PURE__ */ makeMap(MATH_TAGS);
|
||||
const isVoidTag = /* @__PURE__ */ makeMap(VOID_TAGS);
|
||||
|
||||
const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;
|
||||
const isSpecialBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs);
|
||||
const isBooleanAttr = /* @__PURE__ */ makeMap(
|
||||
specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,hidden,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected`
|
||||
);
|
||||
function includeBooleanAttr(value) {
|
||||
return !!value || value === "";
|
||||
}
|
||||
const unsafeAttrCharRE = /[>/="'\u0009\u000a\u000c\u0020]/;
|
||||
const attrValidationCache = {};
|
||||
function isSSRSafeAttrName(name) {
|
||||
if (attrValidationCache.hasOwnProperty(name)) {
|
||||
return attrValidationCache[name];
|
||||
}
|
||||
const isUnsafe = unsafeAttrCharRE.test(name);
|
||||
if (isUnsafe) {
|
||||
console.error(`unsafe attribute name: ${name}`);
|
||||
}
|
||||
return attrValidationCache[name] = !isUnsafe;
|
||||
}
|
||||
const propsToAttrMap = {
|
||||
acceptCharset: "accept-charset",
|
||||
className: "class",
|
||||
htmlFor: "for",
|
||||
httpEquiv: "http-equiv"
|
||||
};
|
||||
const isKnownHtmlAttr = /* @__PURE__ */ makeMap(
|
||||
`accept,accept-charset,accesskey,action,align,allow,alt,async,autocapitalize,autocomplete,autofocus,autoplay,background,bgcolor,border,buffered,capture,challenge,charset,checked,cite,class,code,codebase,color,cols,colspan,content,contenteditable,contextmenu,controls,coords,crossorigin,csp,data,datetime,decoding,default,defer,dir,dirname,disabled,download,draggable,dropzone,enctype,enterkeyhint,for,form,formaction,formenctype,formmethod,formnovalidate,formtarget,headers,height,hidden,high,href,hreflang,http-equiv,icon,id,importance,inert,integrity,ismap,itemprop,keytype,kind,label,lang,language,loading,list,loop,low,manifest,max,maxlength,minlength,media,min,multiple,muted,name,novalidate,open,optimum,pattern,ping,placeholder,poster,preload,radiogroup,readonly,referrerpolicy,rel,required,reversed,rows,rowspan,sandbox,scope,scoped,selected,shape,size,sizes,slot,span,spellcheck,src,srcdoc,srclang,srcset,start,step,style,summary,tabindex,target,title,translate,type,usemap,value,width,wrap`
|
||||
);
|
||||
const isKnownSvgAttr = /* @__PURE__ */ makeMap(
|
||||
`xmlns,accent-height,accumulate,additive,alignment-baseline,alphabetic,amplitude,arabic-form,ascent,attributeName,attributeType,azimuth,baseFrequency,baseline-shift,baseProfile,bbox,begin,bias,by,calcMode,cap-height,class,clip,clipPathUnits,clip-path,clip-rule,color,color-interpolation,color-interpolation-filters,color-profile,color-rendering,contentScriptType,contentStyleType,crossorigin,cursor,cx,cy,d,decelerate,descent,diffuseConstant,direction,display,divisor,dominant-baseline,dur,dx,dy,edgeMode,elevation,enable-background,end,exponent,fill,fill-opacity,fill-rule,filter,filterRes,filterUnits,flood-color,flood-opacity,font-family,font-size,font-size-adjust,font-stretch,font-style,font-variant,font-weight,format,from,fr,fx,fy,g1,g2,glyph-name,glyph-orientation-horizontal,glyph-orientation-vertical,glyphRef,gradientTransform,gradientUnits,hanging,height,href,hreflang,horiz-adv-x,horiz-origin-x,id,ideographic,image-rendering,in,in2,intercept,k,k1,k2,k3,k4,kernelMatrix,kernelUnitLength,kerning,keyPoints,keySplines,keyTimes,lang,lengthAdjust,letter-spacing,lighting-color,limitingConeAngle,local,marker-end,marker-mid,marker-start,markerHeight,markerUnits,markerWidth,mask,maskContentUnits,maskUnits,mathematical,max,media,method,min,mode,name,numOctaves,offset,opacity,operator,order,orient,orientation,origin,overflow,overline-position,overline-thickness,panose-1,paint-order,path,pathLength,patternContentUnits,patternTransform,patternUnits,ping,pointer-events,points,pointsAtX,pointsAtY,pointsAtZ,preserveAlpha,preserveAspectRatio,primitiveUnits,r,radius,referrerPolicy,refX,refY,rel,rendering-intent,repeatCount,repeatDur,requiredExtensions,requiredFeatures,restart,result,rotate,rx,ry,scale,seed,shape-rendering,slope,spacing,specularConstant,specularExponent,speed,spreadMethod,startOffset,stdDeviation,stemh,stemv,stitchTiles,stop-color,stop-opacity,strikethrough-position,strikethrough-thickness,string,stroke,stroke-dasharray,stroke-dashoffset,stroke-linecap,stroke-linejoin,stroke-miterlimit,stroke-opacity,stroke-width,style,surfaceScale,systemLanguage,tabindex,tableValues,target,targetX,targetY,text-anchor,text-decoration,text-rendering,textLength,to,transform,transform-origin,type,u1,u2,underline-position,underline-thickness,unicode,unicode-bidi,unicode-range,units-per-em,v-alphabetic,v-hanging,v-ideographic,v-mathematical,values,vector-effect,version,vert-adv-y,vert-origin-x,vert-origin-y,viewBox,viewTarget,visibility,width,widths,word-spacing,writing-mode,x,x-height,x1,x2,xChannelSelector,xlink:actuate,xlink:arcrole,xlink:href,xlink:role,xlink:show,xlink:title,xlink:type,xmlns:xlink,xml:base,xml:lang,xml:space,y,y1,y2,yChannelSelector,z,zoomAndPan`
|
||||
);
|
||||
function isRenderableAttrValue(value) {
|
||||
if (value == null) {
|
||||
return false;
|
||||
}
|
||||
const type = typeof value;
|
||||
return type === "string" || type === "number" || type === "boolean";
|
||||
}
|
||||
|
||||
const escapeRE = /["'&<>]/;
|
||||
function escapeHtml(string) {
|
||||
const str = "" + string;
|
||||
const match = escapeRE.exec(str);
|
||||
if (!match) {
|
||||
return str;
|
||||
}
|
||||
let html = "";
|
||||
let escaped;
|
||||
let index;
|
||||
let lastIndex = 0;
|
||||
for (index = match.index; index < str.length; index++) {
|
||||
switch (str.charCodeAt(index)) {
|
||||
case 34:
|
||||
escaped = """;
|
||||
break;
|
||||
case 38:
|
||||
escaped = "&";
|
||||
break;
|
||||
case 39:
|
||||
escaped = "'";
|
||||
break;
|
||||
case 60:
|
||||
escaped = "<";
|
||||
break;
|
||||
case 62:
|
||||
escaped = ">";
|
||||
break;
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
if (lastIndex !== index) {
|
||||
html += str.slice(lastIndex, index);
|
||||
}
|
||||
lastIndex = index + 1;
|
||||
html += escaped;
|
||||
}
|
||||
return lastIndex !== index ? html + str.slice(lastIndex, index) : html;
|
||||
}
|
||||
const commentStripRE = /^-?>|<!--|-->|--!>|<!-$/g;
|
||||
function escapeHtmlComment(src) {
|
||||
return src.replace(commentStripRE, "");
|
||||
}
|
||||
|
||||
function looseCompareArrays(a, b) {
|
||||
if (a.length !== b.length)
|
||||
return false;
|
||||
let equal = true;
|
||||
for (let i = 0; equal && i < a.length; i++) {
|
||||
equal = looseEqual(a[i], b[i]);
|
||||
}
|
||||
return equal;
|
||||
}
|
||||
function looseEqual(a, b) {
|
||||
if (a === b)
|
||||
return true;
|
||||
let aValidType = isDate(a);
|
||||
let bValidType = isDate(b);
|
||||
if (aValidType || bValidType) {
|
||||
return aValidType && bValidType ? a.getTime() === b.getTime() : false;
|
||||
}
|
||||
aValidType = isSymbol(a);
|
||||
bValidType = isSymbol(b);
|
||||
if (aValidType || bValidType) {
|
||||
return a === b;
|
||||
}
|
||||
aValidType = isArray(a);
|
||||
bValidType = isArray(b);
|
||||
if (aValidType || bValidType) {
|
||||
return aValidType && bValidType ? looseCompareArrays(a, b) : false;
|
||||
}
|
||||
aValidType = isObject(a);
|
||||
bValidType = isObject(b);
|
||||
if (aValidType || bValidType) {
|
||||
if (!aValidType || !bValidType) {
|
||||
return false;
|
||||
}
|
||||
const aKeysCount = Object.keys(a).length;
|
||||
const bKeysCount = Object.keys(b).length;
|
||||
if (aKeysCount !== bKeysCount) {
|
||||
return false;
|
||||
}
|
||||
for (const key in a) {
|
||||
const aHasKey = a.hasOwnProperty(key);
|
||||
const bHasKey = b.hasOwnProperty(key);
|
||||
if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return String(a) === String(b);
|
||||
}
|
||||
function looseIndexOf(arr, val) {
|
||||
return arr.findIndex((item) => looseEqual(item, val));
|
||||
}
|
||||
|
||||
const toDisplayString = (val) => {
|
||||
return isString(val) ? val : val == null ? "" : isArray(val) || isObject(val) && (val.toString === objectToString || !isFunction(val.toString)) ? JSON.stringify(val, replacer, 2) : String(val);
|
||||
};
|
||||
const replacer = (_key, val) => {
|
||||
if (val && val.__v_isRef) {
|
||||
return replacer(_key, val.value);
|
||||
} else if (isMap(val)) {
|
||||
return {
|
||||
[`Map(${val.size})`]: [...val.entries()].reduce(
|
||||
(entries, [key, val2], i) => {
|
||||
entries[stringifySymbol(key, i) + " =>"] = val2;
|
||||
return entries;
|
||||
},
|
||||
{}
|
||||
)
|
||||
};
|
||||
} else if (isSet(val)) {
|
||||
return {
|
||||
[`Set(${val.size})`]: [...val.values()].map((v) => stringifySymbol(v))
|
||||
};
|
||||
} else if (isSymbol(val)) {
|
||||
return stringifySymbol(val);
|
||||
} else if (isObject(val) && !isArray(val) && !isPlainObject(val)) {
|
||||
return String(val);
|
||||
}
|
||||
return val;
|
||||
};
|
||||
const stringifySymbol = (v, i = "") => {
|
||||
var _a;
|
||||
return isSymbol(v) ? `Symbol(${(_a = v.description) != null ? _a : i})` : v;
|
||||
};
|
||||
|
||||
exports.EMPTY_ARR = EMPTY_ARR;
|
||||
exports.EMPTY_OBJ = EMPTY_OBJ;
|
||||
exports.NO = NO;
|
||||
exports.NOOP = NOOP;
|
||||
exports.PatchFlagNames = PatchFlagNames;
|
||||
exports.PatchFlags = PatchFlags;
|
||||
exports.ShapeFlags = ShapeFlags;
|
||||
exports.SlotFlags = SlotFlags;
|
||||
exports.camelize = camelize;
|
||||
exports.capitalize = capitalize;
|
||||
exports.def = def;
|
||||
exports.escapeHtml = escapeHtml;
|
||||
exports.escapeHtmlComment = escapeHtmlComment;
|
||||
exports.extend = extend;
|
||||
exports.genPropsAccessExp = genPropsAccessExp;
|
||||
exports.generateCodeFrame = generateCodeFrame;
|
||||
exports.getGlobalThis = getGlobalThis;
|
||||
exports.hasChanged = hasChanged;
|
||||
exports.hasOwn = hasOwn;
|
||||
exports.hyphenate = hyphenate;
|
||||
exports.includeBooleanAttr = includeBooleanAttr;
|
||||
exports.invokeArrayFns = invokeArrayFns;
|
||||
exports.isArray = isArray;
|
||||
exports.isBooleanAttr = isBooleanAttr;
|
||||
exports.isBuiltInDirective = isBuiltInDirective;
|
||||
exports.isDate = isDate;
|
||||
exports.isFunction = isFunction;
|
||||
exports.isGloballyAllowed = isGloballyAllowed;
|
||||
exports.isGloballyWhitelisted = isGloballyWhitelisted;
|
||||
exports.isHTMLTag = isHTMLTag;
|
||||
exports.isIntegerKey = isIntegerKey;
|
||||
exports.isKnownHtmlAttr = isKnownHtmlAttr;
|
||||
exports.isKnownSvgAttr = isKnownSvgAttr;
|
||||
exports.isMap = isMap;
|
||||
exports.isMathMLTag = isMathMLTag;
|
||||
exports.isModelListener = isModelListener;
|
||||
exports.isObject = isObject;
|
||||
exports.isOn = isOn;
|
||||
exports.isPlainObject = isPlainObject;
|
||||
exports.isPromise = isPromise;
|
||||
exports.isRegExp = isRegExp;
|
||||
exports.isRenderableAttrValue = isRenderableAttrValue;
|
||||
exports.isReservedProp = isReservedProp;
|
||||
exports.isSSRSafeAttrName = isSSRSafeAttrName;
|
||||
exports.isSVGTag = isSVGTag;
|
||||
exports.isSet = isSet;
|
||||
exports.isSpecialBooleanAttr = isSpecialBooleanAttr;
|
||||
exports.isString = isString;
|
||||
exports.isSymbol = isSymbol;
|
||||
exports.isVoidTag = isVoidTag;
|
||||
exports.looseEqual = looseEqual;
|
||||
exports.looseIndexOf = looseIndexOf;
|
||||
exports.looseToNumber = looseToNumber;
|
||||
exports.makeMap = makeMap;
|
||||
exports.normalizeClass = normalizeClass;
|
||||
exports.normalizeProps = normalizeProps;
|
||||
exports.normalizeStyle = normalizeStyle;
|
||||
exports.objectToString = objectToString;
|
||||
exports.parseStringStyle = parseStringStyle;
|
||||
exports.propsToAttrMap = propsToAttrMap;
|
||||
exports.remove = remove;
|
||||
exports.slotFlagsText = slotFlagsText;
|
||||
exports.stringifyStyle = stringifyStyle;
|
||||
exports.toDisplayString = toDisplayString;
|
||||
exports.toHandlerKey = toHandlerKey;
|
||||
exports.toNumber = toNumber;
|
||||
exports.toRawType = toRawType;
|
||||
exports.toTypeString = toTypeString;
|
323
node_modules/@vue/shared/dist/shared.d.ts
generated
vendored
Normal file
323
node_modules/@vue/shared/dist/shared.d.ts
generated
vendored
Normal file
@ -0,0 +1,323 @@
|
||||
/**
|
||||
* Make a map and return a function for checking if a key
|
||||
* is in that map.
|
||||
* IMPORTANT: all calls of this function must be prefixed with
|
||||
* \/\*#\_\_PURE\_\_\*\/
|
||||
* So that rollup can tree-shake them if necessary.
|
||||
*/
|
||||
export declare function makeMap(str: string, expectsLowerCase?: boolean): (key: string) => boolean;
|
||||
|
||||
export declare const EMPTY_OBJ: {
|
||||
readonly [key: string]: any;
|
||||
};
|
||||
export declare const EMPTY_ARR: readonly never[];
|
||||
export declare const NOOP: () => void;
|
||||
/**
|
||||
* Always return false.
|
||||
*/
|
||||
export declare const NO: () => boolean;
|
||||
export declare const isOn: (key: string) => boolean;
|
||||
export declare const isModelListener: (key: string) => boolean;
|
||||
export declare const extend: {
|
||||
<T extends {}, U>(target: T, source: U): T & U;
|
||||
<T_1 extends {}, U_1, V>(target: T_1, source1: U_1, source2: V): T_1 & U_1 & V;
|
||||
<T_2 extends {}, U_2, V_1, W>(target: T_2, source1: U_2, source2: V_1, source3: W): T_2 & U_2 & V_1 & W;
|
||||
(target: object, ...sources: any[]): any;
|
||||
};
|
||||
export declare const remove: <T>(arr: T[], el: T) => void;
|
||||
export declare const hasOwn: (val: object, key: string | symbol) => key is never;
|
||||
export declare const isArray: (arg: any) => arg is any[];
|
||||
export declare const isMap: (val: unknown) => val is Map<any, any>;
|
||||
export declare const isSet: (val: unknown) => val is Set<any>;
|
||||
export declare const isDate: (val: unknown) => val is Date;
|
||||
export declare const isRegExp: (val: unknown) => val is RegExp;
|
||||
export declare const isFunction: (val: unknown) => val is Function;
|
||||
export declare const isString: (val: unknown) => val is string;
|
||||
export declare const isSymbol: (val: unknown) => val is symbol;
|
||||
export declare const isObject: (val: unknown) => val is Record<any, any>;
|
||||
export declare const isPromise: <T = any>(val: unknown) => val is Promise<T>;
|
||||
export declare const objectToString: () => string;
|
||||
export declare const toTypeString: (value: unknown) => string;
|
||||
export declare const toRawType: (value: unknown) => string;
|
||||
export declare const isPlainObject: (val: unknown) => val is object;
|
||||
export declare const isIntegerKey: (key: unknown) => boolean;
|
||||
export declare const isReservedProp: (key: string) => boolean;
|
||||
export declare const isBuiltInDirective: (key: string) => boolean;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export declare const camelize: (str: string) => string;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export declare const hyphenate: (str: string) => string;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export declare const capitalize: <T extends string>(str: T) => Capitalize<T>;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export declare const toHandlerKey: <T extends string>(str: T) => T extends "" ? "" : `on${Capitalize<T>}`;
|
||||
export declare const hasChanged: (value: any, oldValue: any) => boolean;
|
||||
export declare const invokeArrayFns: (fns: Function[], arg?: any) => void;
|
||||
export declare const def: (obj: object, key: string | symbol, value: any) => void;
|
||||
/**
|
||||
* "123-foo" will be parsed to 123
|
||||
* This is used for the .number modifier in v-model
|
||||
*/
|
||||
export declare const looseToNumber: (val: any) => any;
|
||||
/**
|
||||
* Only concerns number-like strings
|
||||
* "123-foo" will be returned as-is
|
||||
*/
|
||||
export declare const toNumber: (val: any) => any;
|
||||
export declare const getGlobalThis: () => any;
|
||||
export declare function genPropsAccessExp(name: string): string;
|
||||
|
||||
/**
|
||||
* Patch flags are optimization hints generated by the compiler.
|
||||
* when a block with dynamicChildren is encountered during diff, the algorithm
|
||||
* enters "optimized mode". In this mode, we know that the vdom is produced by
|
||||
* a render function generated by the compiler, so the algorithm only needs to
|
||||
* handle updates explicitly marked by these patch flags.
|
||||
*
|
||||
* Patch flags can be combined using the | bitwise operator and can be checked
|
||||
* using the & operator, e.g.
|
||||
*
|
||||
* ```js
|
||||
* const flag = TEXT | CLASS
|
||||
* if (flag & TEXT) { ... }
|
||||
* ```
|
||||
*
|
||||
* Check the `patchElement` function in '../../runtime-core/src/renderer.ts' to see how the
|
||||
* flags are handled during diff.
|
||||
*/
|
||||
export declare enum PatchFlags {
|
||||
/**
|
||||
* Indicates an element with dynamic textContent (children fast path)
|
||||
*/
|
||||
TEXT = 1,
|
||||
/**
|
||||
* Indicates an element with dynamic class binding.
|
||||
*/
|
||||
CLASS = 2,
|
||||
/**
|
||||
* Indicates an element with dynamic style
|
||||
* The compiler pre-compiles static string styles into static objects
|
||||
* + detects and hoists inline static objects
|
||||
* e.g. `style="color: red"` and `:style="{ color: 'red' }"` both get hoisted
|
||||
* as:
|
||||
* ```js
|
||||
* const style = { color: 'red' }
|
||||
* render() { return e('div', { style }) }
|
||||
* ```
|
||||
*/
|
||||
STYLE = 4,
|
||||
/**
|
||||
* Indicates an element that has non-class/style dynamic props.
|
||||
* Can also be on a component that has any dynamic props (includes
|
||||
* class/style). when this flag is present, the vnode also has a dynamicProps
|
||||
* array that contains the keys of the props that may change so the runtime
|
||||
* can diff them faster (without having to worry about removed props)
|
||||
*/
|
||||
PROPS = 8,
|
||||
/**
|
||||
* Indicates an element with props with dynamic keys. When keys change, a full
|
||||
* diff is always needed to remove the old key. This flag is mutually
|
||||
* exclusive with CLASS, STYLE and PROPS.
|
||||
*/
|
||||
FULL_PROPS = 16,
|
||||
/**
|
||||
* Indicates an element that requires props hydration
|
||||
* (but not necessarily patching)
|
||||
* e.g. event listeners & v-bind with prop modifier
|
||||
*/
|
||||
NEED_HYDRATION = 32,
|
||||
/**
|
||||
* Indicates a fragment whose children order doesn't change.
|
||||
*/
|
||||
STABLE_FRAGMENT = 64,
|
||||
/**
|
||||
* Indicates a fragment with keyed or partially keyed children
|
||||
*/
|
||||
KEYED_FRAGMENT = 128,
|
||||
/**
|
||||
* Indicates a fragment with unkeyed children.
|
||||
*/
|
||||
UNKEYED_FRAGMENT = 256,
|
||||
/**
|
||||
* Indicates an element that only needs non-props patching, e.g. ref or
|
||||
* directives (onVnodeXXX hooks). since every patched vnode checks for refs
|
||||
* and onVnodeXXX hooks, it simply marks the vnode so that a parent block
|
||||
* will track it.
|
||||
*/
|
||||
NEED_PATCH = 512,
|
||||
/**
|
||||
* Indicates a component with dynamic slots (e.g. slot that references a v-for
|
||||
* iterated value, or dynamic slot names).
|
||||
* Components with this flag are always force updated.
|
||||
*/
|
||||
DYNAMIC_SLOTS = 1024,
|
||||
/**
|
||||
* Indicates a fragment that was created only because the user has placed
|
||||
* comments at the root level of a template. This is a dev-only flag since
|
||||
* comments are stripped in production.
|
||||
*/
|
||||
DEV_ROOT_FRAGMENT = 2048,
|
||||
/**
|
||||
* SPECIAL FLAGS -------------------------------------------------------------
|
||||
* Special flags are negative integers. They are never matched against using
|
||||
* bitwise operators (bitwise matching should only happen in branches where
|
||||
* patchFlag > 0), and are mutually exclusive. When checking for a special
|
||||
* flag, simply check patchFlag === FLAG.
|
||||
*/
|
||||
/**
|
||||
* Indicates a hoisted static vnode. This is a hint for hydration to skip
|
||||
* the entire sub tree since static content never needs to be updated.
|
||||
*/
|
||||
HOISTED = -1,
|
||||
/**
|
||||
* A special flag that indicates that the diffing algorithm should bail out
|
||||
* of optimized mode. For example, on block fragments created by renderSlot()
|
||||
* when encountering non-compiler generated slots (i.e. manually written
|
||||
* render functions, which should always be fully diffed)
|
||||
* OR manually cloneVNodes
|
||||
*/
|
||||
BAIL = -2
|
||||
}
|
||||
/**
|
||||
* dev only flag -> name mapping
|
||||
*/
|
||||
export declare const PatchFlagNames: Record<PatchFlags, string>;
|
||||
|
||||
export declare enum ShapeFlags {
|
||||
ELEMENT = 1,
|
||||
FUNCTIONAL_COMPONENT = 2,
|
||||
STATEFUL_COMPONENT = 4,
|
||||
TEXT_CHILDREN = 8,
|
||||
ARRAY_CHILDREN = 16,
|
||||
SLOTS_CHILDREN = 32,
|
||||
TELEPORT = 64,
|
||||
SUSPENSE = 128,
|
||||
COMPONENT_SHOULD_KEEP_ALIVE = 256,
|
||||
COMPONENT_KEPT_ALIVE = 512,
|
||||
COMPONENT = 6
|
||||
}
|
||||
|
||||
export declare enum SlotFlags {
|
||||
/**
|
||||
* Stable slots that only reference slot props or context state. The slot
|
||||
* can fully capture its own dependencies so when passed down the parent won't
|
||||
* need to force the child to update.
|
||||
*/
|
||||
STABLE = 1,
|
||||
/**
|
||||
* Slots that reference scope variables (v-for or an outer slot prop), or
|
||||
* has conditional structure (v-if, v-for). The parent will need to force
|
||||
* the child to update because the slot does not fully capture its dependencies.
|
||||
*/
|
||||
DYNAMIC = 2,
|
||||
/**
|
||||
* `<slot/>` being forwarded into a child component. Whether the parent needs
|
||||
* to update the child is dependent on what kind of slots the parent itself
|
||||
* received. This has to be refined at runtime, when the child's vnode
|
||||
* is being created (in `normalizeChildren`)
|
||||
*/
|
||||
FORWARDED = 3
|
||||
}
|
||||
/**
|
||||
* Dev only
|
||||
*/
|
||||
export declare const slotFlagsText: {
|
||||
1: string;
|
||||
2: string;
|
||||
3: string;
|
||||
};
|
||||
|
||||
export declare const isGloballyAllowed: (key: string) => boolean;
|
||||
/** @deprecated use `isGloballyAllowed` instead */
|
||||
export declare const isGloballyWhitelisted: (key: string) => boolean;
|
||||
|
||||
export declare function generateCodeFrame(source: string, start?: number, end?: number): string;
|
||||
|
||||
export type NormalizedStyle = Record<string, string | number>;
|
||||
export declare function normalizeStyle(value: unknown): NormalizedStyle | string | undefined;
|
||||
export declare function parseStringStyle(cssText: string): NormalizedStyle;
|
||||
export declare function stringifyStyle(styles: NormalizedStyle | string | undefined): string;
|
||||
export declare function normalizeClass(value: unknown): string;
|
||||
export declare function normalizeProps(props: Record<string, any> | null): Record<string, any> | null;
|
||||
|
||||
/**
|
||||
* Compiler only.
|
||||
* Do NOT use in runtime code paths unless behind `__DEV__` flag.
|
||||
*/
|
||||
export declare const isHTMLTag: (key: string) => boolean;
|
||||
/**
|
||||
* Compiler only.
|
||||
* Do NOT use in runtime code paths unless behind `__DEV__` flag.
|
||||
*/
|
||||
export declare const isSVGTag: (key: string) => boolean;
|
||||
/**
|
||||
* Compiler only.
|
||||
* Do NOT use in runtime code paths unless behind `__DEV__` flag.
|
||||
*/
|
||||
export declare const isMathMLTag: (key: string) => boolean;
|
||||
/**
|
||||
* Compiler only.
|
||||
* Do NOT use in runtime code paths unless behind `__DEV__` flag.
|
||||
*/
|
||||
export declare const isVoidTag: (key: string) => boolean;
|
||||
|
||||
export declare const isSpecialBooleanAttr: (key: string) => boolean;
|
||||
/**
|
||||
* The full list is needed during SSR to produce the correct initial markup.
|
||||
*/
|
||||
export declare const isBooleanAttr: (key: string) => boolean;
|
||||
/**
|
||||
* Boolean attributes should be included if the value is truthy or ''.
|
||||
* e.g. `<select multiple>` compiles to `{ multiple: '' }`
|
||||
*/
|
||||
export declare function includeBooleanAttr(value: unknown): boolean;
|
||||
export declare function isSSRSafeAttrName(name: string): boolean;
|
||||
export declare const propsToAttrMap: Record<string, string | undefined>;
|
||||
/**
|
||||
* Known attributes, this is used for stringification of runtime static nodes
|
||||
* so that we don't stringify bindings that cannot be set from HTML.
|
||||
* Don't also forget to allow `data-*` and `aria-*`!
|
||||
* Generated from https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes
|
||||
*/
|
||||
export declare const isKnownHtmlAttr: (key: string) => boolean;
|
||||
/**
|
||||
* Generated from https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute
|
||||
*/
|
||||
export declare const isKnownSvgAttr: (key: string) => boolean;
|
||||
/**
|
||||
* Shared between server-renderer and runtime-core hydration logic
|
||||
*/
|
||||
export declare function isRenderableAttrValue(value: unknown): boolean;
|
||||
|
||||
export declare function escapeHtml(string: unknown): string;
|
||||
export declare function escapeHtmlComment(src: string): string;
|
||||
|
||||
export declare function looseEqual(a: any, b: any): boolean;
|
||||
export declare function looseIndexOf(arr: any[], val: any): number;
|
||||
|
||||
/**
|
||||
* For converting {{ interpolation }} values to displayed strings.
|
||||
* @private
|
||||
*/
|
||||
export declare const toDisplayString: (val: unknown) => string;
|
||||
|
||||
export type Prettify<T> = {
|
||||
[K in keyof T]: T[K];
|
||||
} & {};
|
||||
export type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
|
||||
export type LooseRequired<T> = {
|
||||
[P in keyof (T & Required<T>)]: T[P];
|
||||
};
|
||||
export type IfAny<T, Y, N> = 0 extends 1 & T ? Y : N;
|
||||
export type Awaited<T> = T extends null | undefined ? T : T extends object & {
|
||||
then(onfulfilled: infer F, ...args: infer _): any;
|
||||
} ? F extends (value: infer V, ...args: infer _) => any ? Awaited<V> : never : T;
|
||||
|
490
node_modules/@vue/shared/dist/shared.esm-bundler.js
generated
vendored
Normal file
490
node_modules/@vue/shared/dist/shared.esm-bundler.js
generated
vendored
Normal file
@ -0,0 +1,490 @@
|
||||
/**
|
||||
* @vue/shared v3.4.15
|
||||
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
||||
* @license MIT
|
||||
**/
|
||||
function makeMap(str, expectsLowerCase) {
|
||||
const set = new Set(str.split(","));
|
||||
return expectsLowerCase ? (val) => set.has(val.toLowerCase()) : (val) => set.has(val);
|
||||
}
|
||||
|
||||
const EMPTY_OBJ = !!(process.env.NODE_ENV !== "production") ? Object.freeze({}) : {};
|
||||
const EMPTY_ARR = !!(process.env.NODE_ENV !== "production") ? Object.freeze([]) : [];
|
||||
const NOOP = () => {
|
||||
};
|
||||
const NO = () => false;
|
||||
const isOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // uppercase letter
|
||||
(key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97);
|
||||
const isModelListener = (key) => key.startsWith("onUpdate:");
|
||||
const extend = Object.assign;
|
||||
const remove = (arr, el) => {
|
||||
const i = arr.indexOf(el);
|
||||
if (i > -1) {
|
||||
arr.splice(i, 1);
|
||||
}
|
||||
};
|
||||
const hasOwnProperty = Object.prototype.hasOwnProperty;
|
||||
const hasOwn = (val, key) => hasOwnProperty.call(val, key);
|
||||
const isArray = Array.isArray;
|
||||
const isMap = (val) => toTypeString(val) === "[object Map]";
|
||||
const isSet = (val) => toTypeString(val) === "[object Set]";
|
||||
const isDate = (val) => toTypeString(val) === "[object Date]";
|
||||
const isRegExp = (val) => toTypeString(val) === "[object RegExp]";
|
||||
const isFunction = (val) => typeof val === "function";
|
||||
const isString = (val) => typeof val === "string";
|
||||
const isSymbol = (val) => typeof val === "symbol";
|
||||
const isObject = (val) => val !== null && typeof val === "object";
|
||||
const isPromise = (val) => {
|
||||
return (isObject(val) || isFunction(val)) && isFunction(val.then) && isFunction(val.catch);
|
||||
};
|
||||
const objectToString = Object.prototype.toString;
|
||||
const toTypeString = (value) => objectToString.call(value);
|
||||
const toRawType = (value) => {
|
||||
return toTypeString(value).slice(8, -1);
|
||||
};
|
||||
const isPlainObject = (val) => toTypeString(val) === "[object Object]";
|
||||
const isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key;
|
||||
const isReservedProp = /* @__PURE__ */ makeMap(
|
||||
// the leading comma is intentional so empty string "" is also included
|
||||
",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"
|
||||
);
|
||||
const isBuiltInDirective = /* @__PURE__ */ makeMap(
|
||||
"bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo"
|
||||
);
|
||||
const cacheStringFunction = (fn) => {
|
||||
const cache = /* @__PURE__ */ Object.create(null);
|
||||
return (str) => {
|
||||
const hit = cache[str];
|
||||
return hit || (cache[str] = fn(str));
|
||||
};
|
||||
};
|
||||
const camelizeRE = /-(\w)/g;
|
||||
const camelize = cacheStringFunction((str) => {
|
||||
return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
|
||||
});
|
||||
const hyphenateRE = /\B([A-Z])/g;
|
||||
const hyphenate = cacheStringFunction(
|
||||
(str) => str.replace(hyphenateRE, "-$1").toLowerCase()
|
||||
);
|
||||
const capitalize = cacheStringFunction((str) => {
|
||||
return str.charAt(0).toUpperCase() + str.slice(1);
|
||||
});
|
||||
const toHandlerKey = cacheStringFunction((str) => {
|
||||
const s = str ? `on${capitalize(str)}` : ``;
|
||||
return s;
|
||||
});
|
||||
const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
|
||||
const invokeArrayFns = (fns, arg) => {
|
||||
for (let i = 0; i < fns.length; i++) {
|
||||
fns[i](arg);
|
||||
}
|
||||
};
|
||||
const def = (obj, key, value) => {
|
||||
Object.defineProperty(obj, key, {
|
||||
configurable: true,
|
||||
enumerable: false,
|
||||
value
|
||||
});
|
||||
};
|
||||
const looseToNumber = (val) => {
|
||||
const n = parseFloat(val);
|
||||
return isNaN(n) ? val : n;
|
||||
};
|
||||
const toNumber = (val) => {
|
||||
const n = isString(val) ? Number(val) : NaN;
|
||||
return isNaN(n) ? val : n;
|
||||
};
|
||||
let _globalThis;
|
||||
const getGlobalThis = () => {
|
||||
return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {});
|
||||
};
|
||||
const identRE = /^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/;
|
||||
function genPropsAccessExp(name) {
|
||||
return identRE.test(name) ? `__props.${name}` : `__props[${JSON.stringify(name)}]`;
|
||||
}
|
||||
|
||||
const PatchFlags = {
|
||||
"TEXT": 1,
|
||||
"1": "TEXT",
|
||||
"CLASS": 2,
|
||||
"2": "CLASS",
|
||||
"STYLE": 4,
|
||||
"4": "STYLE",
|
||||
"PROPS": 8,
|
||||
"8": "PROPS",
|
||||
"FULL_PROPS": 16,
|
||||
"16": "FULL_PROPS",
|
||||
"NEED_HYDRATION": 32,
|
||||
"32": "NEED_HYDRATION",
|
||||
"STABLE_FRAGMENT": 64,
|
||||
"64": "STABLE_FRAGMENT",
|
||||
"KEYED_FRAGMENT": 128,
|
||||
"128": "KEYED_FRAGMENT",
|
||||
"UNKEYED_FRAGMENT": 256,
|
||||
"256": "UNKEYED_FRAGMENT",
|
||||
"NEED_PATCH": 512,
|
||||
"512": "NEED_PATCH",
|
||||
"DYNAMIC_SLOTS": 1024,
|
||||
"1024": "DYNAMIC_SLOTS",
|
||||
"DEV_ROOT_FRAGMENT": 2048,
|
||||
"2048": "DEV_ROOT_FRAGMENT",
|
||||
"HOISTED": -1,
|
||||
"-1": "HOISTED",
|
||||
"BAIL": -2,
|
||||
"-2": "BAIL"
|
||||
};
|
||||
const PatchFlagNames = {
|
||||
[1]: `TEXT`,
|
||||
[2]: `CLASS`,
|
||||
[4]: `STYLE`,
|
||||
[8]: `PROPS`,
|
||||
[16]: `FULL_PROPS`,
|
||||
[32]: `NEED_HYDRATION`,
|
||||
[64]: `STABLE_FRAGMENT`,
|
||||
[128]: `KEYED_FRAGMENT`,
|
||||
[256]: `UNKEYED_FRAGMENT`,
|
||||
[512]: `NEED_PATCH`,
|
||||
[1024]: `DYNAMIC_SLOTS`,
|
||||
[2048]: `DEV_ROOT_FRAGMENT`,
|
||||
[-1]: `HOISTED`,
|
||||
[-2]: `BAIL`
|
||||
};
|
||||
|
||||
const ShapeFlags = {
|
||||
"ELEMENT": 1,
|
||||
"1": "ELEMENT",
|
||||
"FUNCTIONAL_COMPONENT": 2,
|
||||
"2": "FUNCTIONAL_COMPONENT",
|
||||
"STATEFUL_COMPONENT": 4,
|
||||
"4": "STATEFUL_COMPONENT",
|
||||
"TEXT_CHILDREN": 8,
|
||||
"8": "TEXT_CHILDREN",
|
||||
"ARRAY_CHILDREN": 16,
|
||||
"16": "ARRAY_CHILDREN",
|
||||
"SLOTS_CHILDREN": 32,
|
||||
"32": "SLOTS_CHILDREN",
|
||||
"TELEPORT": 64,
|
||||
"64": "TELEPORT",
|
||||
"SUSPENSE": 128,
|
||||
"128": "SUSPENSE",
|
||||
"COMPONENT_SHOULD_KEEP_ALIVE": 256,
|
||||
"256": "COMPONENT_SHOULD_KEEP_ALIVE",
|
||||
"COMPONENT_KEPT_ALIVE": 512,
|
||||
"512": "COMPONENT_KEPT_ALIVE",
|
||||
"COMPONENT": 6,
|
||||
"6": "COMPONENT"
|
||||
};
|
||||
|
||||
const SlotFlags = {
|
||||
"STABLE": 1,
|
||||
"1": "STABLE",
|
||||
"DYNAMIC": 2,
|
||||
"2": "DYNAMIC",
|
||||
"FORWARDED": 3,
|
||||
"3": "FORWARDED"
|
||||
};
|
||||
const slotFlagsText = {
|
||||
[1]: "STABLE",
|
||||
[2]: "DYNAMIC",
|
||||
[3]: "FORWARDED"
|
||||
};
|
||||
|
||||
const GLOBALS_ALLOWED = "Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console,Error";
|
||||
const isGloballyAllowed = /* @__PURE__ */ makeMap(GLOBALS_ALLOWED);
|
||||
const isGloballyWhitelisted = isGloballyAllowed;
|
||||
|
||||
const range = 2;
|
||||
function generateCodeFrame(source, start = 0, end = source.length) {
|
||||
let lines = source.split(/(\r?\n)/);
|
||||
const newlineSequences = lines.filter((_, idx) => idx % 2 === 1);
|
||||
lines = lines.filter((_, idx) => idx % 2 === 0);
|
||||
let count = 0;
|
||||
const res = [];
|
||||
for (let i = 0; i < lines.length; i++) {
|
||||
count += lines[i].length + (newlineSequences[i] && newlineSequences[i].length || 0);
|
||||
if (count >= start) {
|
||||
for (let j = i - range; j <= i + range || end > count; j++) {
|
||||
if (j < 0 || j >= lines.length)
|
||||
continue;
|
||||
const line = j + 1;
|
||||
res.push(
|
||||
`${line}${" ".repeat(Math.max(3 - String(line).length, 0))}| ${lines[j]}`
|
||||
);
|
||||
const lineLength = lines[j].length;
|
||||
const newLineSeqLength = newlineSequences[j] && newlineSequences[j].length || 0;
|
||||
if (j === i) {
|
||||
const pad = start - (count - (lineLength + newLineSeqLength));
|
||||
const length = Math.max(
|
||||
1,
|
||||
end > count ? lineLength - pad : end - start
|
||||
);
|
||||
res.push(` | ` + " ".repeat(pad) + "^".repeat(length));
|
||||
} else if (j > i) {
|
||||
if (end > count) {
|
||||
const length = Math.max(Math.min(end - count, lineLength), 1);
|
||||
res.push(` | ` + "^".repeat(length));
|
||||
}
|
||||
count += lineLength + newLineSeqLength;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return res.join("\n");
|
||||
}
|
||||
|
||||
function normalizeStyle(value) {
|
||||
if (isArray(value)) {
|
||||
const res = {};
|
||||
for (let i = 0; i < value.length; i++) {
|
||||
const item = value[i];
|
||||
const normalized = isString(item) ? parseStringStyle(item) : normalizeStyle(item);
|
||||
if (normalized) {
|
||||
for (const key in normalized) {
|
||||
res[key] = normalized[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
return res;
|
||||
} else if (isString(value) || isObject(value)) {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
const listDelimiterRE = /;(?![^(]*\))/g;
|
||||
const propertyDelimiterRE = /:([^]+)/;
|
||||
const styleCommentRE = /\/\*[^]*?\*\//g;
|
||||
function parseStringStyle(cssText) {
|
||||
const ret = {};
|
||||
cssText.replace(styleCommentRE, "").split(listDelimiterRE).forEach((item) => {
|
||||
if (item) {
|
||||
const tmp = item.split(propertyDelimiterRE);
|
||||
tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());
|
||||
}
|
||||
});
|
||||
return ret;
|
||||
}
|
||||
function stringifyStyle(styles) {
|
||||
let ret = "";
|
||||
if (!styles || isString(styles)) {
|
||||
return ret;
|
||||
}
|
||||
for (const key in styles) {
|
||||
const value = styles[key];
|
||||
const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key);
|
||||
if (isString(value) || typeof value === "number") {
|
||||
ret += `${normalizedKey}:${value};`;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
function normalizeClass(value) {
|
||||
let res = "";
|
||||
if (isString(value)) {
|
||||
res = value;
|
||||
} else if (isArray(value)) {
|
||||
for (let i = 0; i < value.length; i++) {
|
||||
const normalized = normalizeClass(value[i]);
|
||||
if (normalized) {
|
||||
res += normalized + " ";
|
||||
}
|
||||
}
|
||||
} else if (isObject(value)) {
|
||||
for (const name in value) {
|
||||
if (value[name]) {
|
||||
res += name + " ";
|
||||
}
|
||||
}
|
||||
}
|
||||
return res.trim();
|
||||
}
|
||||
function normalizeProps(props) {
|
||||
if (!props)
|
||||
return null;
|
||||
let { class: klass, style } = props;
|
||||
if (klass && !isString(klass)) {
|
||||
props.class = normalizeClass(klass);
|
||||
}
|
||||
if (style) {
|
||||
props.style = normalizeStyle(style);
|
||||
}
|
||||
return props;
|
||||
}
|
||||
|
||||
const HTML_TAGS = "html,body,base,head,link,meta,style,title,address,article,aside,footer,header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,summary,template,blockquote,iframe,tfoot";
|
||||
const SVG_TAGS = "svg,animate,animateMotion,animateTransform,circle,clipPath,color-profile,defs,desc,discard,ellipse,feBlend,feColorMatrix,feComponentTransfer,feComposite,feConvolveMatrix,feDiffuseLighting,feDisplacementMap,feDistantLight,feDropShadow,feFlood,feFuncA,feFuncB,feFuncG,feFuncR,feGaussianBlur,feImage,feMerge,feMergeNode,feMorphology,feOffset,fePointLight,feSpecularLighting,feSpotLight,feTile,feTurbulence,filter,foreignObject,g,hatch,hatchpath,image,line,linearGradient,marker,mask,mesh,meshgradient,meshpatch,meshrow,metadata,mpath,path,pattern,polygon,polyline,radialGradient,rect,set,solidcolor,stop,switch,symbol,text,textPath,title,tspan,unknown,use,view";
|
||||
const MATH_TAGS = "annotation,annotation-xml,maction,maligngroup,malignmark,math,menclose,merror,mfenced,mfrac,mfraction,mglyph,mi,mlabeledtr,mlongdiv,mmultiscripts,mn,mo,mover,mpadded,mphantom,mprescripts,mroot,mrow,ms,mscarries,mscarry,msgroup,msline,mspace,msqrt,msrow,mstack,mstyle,msub,msubsup,msup,mtable,mtd,mtext,mtr,munder,munderover,none,semantics";
|
||||
const VOID_TAGS = "area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr";
|
||||
const isHTMLTag = /* @__PURE__ */ makeMap(HTML_TAGS);
|
||||
const isSVGTag = /* @__PURE__ */ makeMap(SVG_TAGS);
|
||||
const isMathMLTag = /* @__PURE__ */ makeMap(MATH_TAGS);
|
||||
const isVoidTag = /* @__PURE__ */ makeMap(VOID_TAGS);
|
||||
|
||||
const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;
|
||||
const isSpecialBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs);
|
||||
const isBooleanAttr = /* @__PURE__ */ makeMap(
|
||||
specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,hidden,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected`
|
||||
);
|
||||
function includeBooleanAttr(value) {
|
||||
return !!value || value === "";
|
||||
}
|
||||
const unsafeAttrCharRE = /[>/="'\u0009\u000a\u000c\u0020]/;
|
||||
const attrValidationCache = {};
|
||||
function isSSRSafeAttrName(name) {
|
||||
if (attrValidationCache.hasOwnProperty(name)) {
|
||||
return attrValidationCache[name];
|
||||
}
|
||||
const isUnsafe = unsafeAttrCharRE.test(name);
|
||||
if (isUnsafe) {
|
||||
console.error(`unsafe attribute name: ${name}`);
|
||||
}
|
||||
return attrValidationCache[name] = !isUnsafe;
|
||||
}
|
||||
const propsToAttrMap = {
|
||||
acceptCharset: "accept-charset",
|
||||
className: "class",
|
||||
htmlFor: "for",
|
||||
httpEquiv: "http-equiv"
|
||||
};
|
||||
const isKnownHtmlAttr = /* @__PURE__ */ makeMap(
|
||||
`accept,accept-charset,accesskey,action,align,allow,alt,async,autocapitalize,autocomplete,autofocus,autoplay,background,bgcolor,border,buffered,capture,challenge,charset,checked,cite,class,code,codebase,color,cols,colspan,content,contenteditable,contextmenu,controls,coords,crossorigin,csp,data,datetime,decoding,default,defer,dir,dirname,disabled,download,draggable,dropzone,enctype,enterkeyhint,for,form,formaction,formenctype,formmethod,formnovalidate,formtarget,headers,height,hidden,high,href,hreflang,http-equiv,icon,id,importance,inert,integrity,ismap,itemprop,keytype,kind,label,lang,language,loading,list,loop,low,manifest,max,maxlength,minlength,media,min,multiple,muted,name,novalidate,open,optimum,pattern,ping,placeholder,poster,preload,radiogroup,readonly,referrerpolicy,rel,required,reversed,rows,rowspan,sandbox,scope,scoped,selected,shape,size,sizes,slot,span,spellcheck,src,srcdoc,srclang,srcset,start,step,style,summary,tabindex,target,title,translate,type,usemap,value,width,wrap`
|
||||
);
|
||||
const isKnownSvgAttr = /* @__PURE__ */ makeMap(
|
||||
`xmlns,accent-height,accumulate,additive,alignment-baseline,alphabetic,amplitude,arabic-form,ascent,attributeName,attributeType,azimuth,baseFrequency,baseline-shift,baseProfile,bbox,begin,bias,by,calcMode,cap-height,class,clip,clipPathUnits,clip-path,clip-rule,color,color-interpolation,color-interpolation-filters,color-profile,color-rendering,contentScriptType,contentStyleType,crossorigin,cursor,cx,cy,d,decelerate,descent,diffuseConstant,direction,display,divisor,dominant-baseline,dur,dx,dy,edgeMode,elevation,enable-background,end,exponent,fill,fill-opacity,fill-rule,filter,filterRes,filterUnits,flood-color,flood-opacity,font-family,font-size,font-size-adjust,font-stretch,font-style,font-variant,font-weight,format,from,fr,fx,fy,g1,g2,glyph-name,glyph-orientation-horizontal,glyph-orientation-vertical,glyphRef,gradientTransform,gradientUnits,hanging,height,href,hreflang,horiz-adv-x,horiz-origin-x,id,ideographic,image-rendering,in,in2,intercept,k,k1,k2,k3,k4,kernelMatrix,kernelUnitLength,kerning,keyPoints,keySplines,keyTimes,lang,lengthAdjust,letter-spacing,lighting-color,limitingConeAngle,local,marker-end,marker-mid,marker-start,markerHeight,markerUnits,markerWidth,mask,maskContentUnits,maskUnits,mathematical,max,media,method,min,mode,name,numOctaves,offset,opacity,operator,order,orient,orientation,origin,overflow,overline-position,overline-thickness,panose-1,paint-order,path,pathLength,patternContentUnits,patternTransform,patternUnits,ping,pointer-events,points,pointsAtX,pointsAtY,pointsAtZ,preserveAlpha,preserveAspectRatio,primitiveUnits,r,radius,referrerPolicy,refX,refY,rel,rendering-intent,repeatCount,repeatDur,requiredExtensions,requiredFeatures,restart,result,rotate,rx,ry,scale,seed,shape-rendering,slope,spacing,specularConstant,specularExponent,speed,spreadMethod,startOffset,stdDeviation,stemh,stemv,stitchTiles,stop-color,stop-opacity,strikethrough-position,strikethrough-thickness,string,stroke,stroke-dasharray,stroke-dashoffset,stroke-linecap,stroke-linejoin,stroke-miterlimit,stroke-opacity,stroke-width,style,surfaceScale,systemLanguage,tabindex,tableValues,target,targetX,targetY,text-anchor,text-decoration,text-rendering,textLength,to,transform,transform-origin,type,u1,u2,underline-position,underline-thickness,unicode,unicode-bidi,unicode-range,units-per-em,v-alphabetic,v-hanging,v-ideographic,v-mathematical,values,vector-effect,version,vert-adv-y,vert-origin-x,vert-origin-y,viewBox,viewTarget,visibility,width,widths,word-spacing,writing-mode,x,x-height,x1,x2,xChannelSelector,xlink:actuate,xlink:arcrole,xlink:href,xlink:role,xlink:show,xlink:title,xlink:type,xmlns:xlink,xml:base,xml:lang,xml:space,y,y1,y2,yChannelSelector,z,zoomAndPan`
|
||||
);
|
||||
function isRenderableAttrValue(value) {
|
||||
if (value == null) {
|
||||
return false;
|
||||
}
|
||||
const type = typeof value;
|
||||
return type === "string" || type === "number" || type === "boolean";
|
||||
}
|
||||
|
||||
const escapeRE = /["'&<>]/;
|
||||
function escapeHtml(string) {
|
||||
const str = "" + string;
|
||||
const match = escapeRE.exec(str);
|
||||
if (!match) {
|
||||
return str;
|
||||
}
|
||||
let html = "";
|
||||
let escaped;
|
||||
let index;
|
||||
let lastIndex = 0;
|
||||
for (index = match.index; index < str.length; index++) {
|
||||
switch (str.charCodeAt(index)) {
|
||||
case 34:
|
||||
escaped = """;
|
||||
break;
|
||||
case 38:
|
||||
escaped = "&";
|
||||
break;
|
||||
case 39:
|
||||
escaped = "'";
|
||||
break;
|
||||
case 60:
|
||||
escaped = "<";
|
||||
break;
|
||||
case 62:
|
||||
escaped = ">";
|
||||
break;
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
if (lastIndex !== index) {
|
||||
html += str.slice(lastIndex, index);
|
||||
}
|
||||
lastIndex = index + 1;
|
||||
html += escaped;
|
||||
}
|
||||
return lastIndex !== index ? html + str.slice(lastIndex, index) : html;
|
||||
}
|
||||
const commentStripRE = /^-?>|<!--|-->|--!>|<!-$/g;
|
||||
function escapeHtmlComment(src) {
|
||||
return src.replace(commentStripRE, "");
|
||||
}
|
||||
|
||||
function looseCompareArrays(a, b) {
|
||||
if (a.length !== b.length)
|
||||
return false;
|
||||
let equal = true;
|
||||
for (let i = 0; equal && i < a.length; i++) {
|
||||
equal = looseEqual(a[i], b[i]);
|
||||
}
|
||||
return equal;
|
||||
}
|
||||
function looseEqual(a, b) {
|
||||
if (a === b)
|
||||
return true;
|
||||
let aValidType = isDate(a);
|
||||
let bValidType = isDate(b);
|
||||
if (aValidType || bValidType) {
|
||||
return aValidType && bValidType ? a.getTime() === b.getTime() : false;
|
||||
}
|
||||
aValidType = isSymbol(a);
|
||||
bValidType = isSymbol(b);
|
||||
if (aValidType || bValidType) {
|
||||
return a === b;
|
||||
}
|
||||
aValidType = isArray(a);
|
||||
bValidType = isArray(b);
|
||||
if (aValidType || bValidType) {
|
||||
return aValidType && bValidType ? looseCompareArrays(a, b) : false;
|
||||
}
|
||||
aValidType = isObject(a);
|
||||
bValidType = isObject(b);
|
||||
if (aValidType || bValidType) {
|
||||
if (!aValidType || !bValidType) {
|
||||
return false;
|
||||
}
|
||||
const aKeysCount = Object.keys(a).length;
|
||||
const bKeysCount = Object.keys(b).length;
|
||||
if (aKeysCount !== bKeysCount) {
|
||||
return false;
|
||||
}
|
||||
for (const key in a) {
|
||||
const aHasKey = a.hasOwnProperty(key);
|
||||
const bHasKey = b.hasOwnProperty(key);
|
||||
if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return String(a) === String(b);
|
||||
}
|
||||
function looseIndexOf(arr, val) {
|
||||
return arr.findIndex((item) => looseEqual(item, val));
|
||||
}
|
||||
|
||||
const toDisplayString = (val) => {
|
||||
return isString(val) ? val : val == null ? "" : isArray(val) || isObject(val) && (val.toString === objectToString || !isFunction(val.toString)) ? JSON.stringify(val, replacer, 2) : String(val);
|
||||
};
|
||||
const replacer = (_key, val) => {
|
||||
if (val && val.__v_isRef) {
|
||||
return replacer(_key, val.value);
|
||||
} else if (isMap(val)) {
|
||||
return {
|
||||
[`Map(${val.size})`]: [...val.entries()].reduce(
|
||||
(entries, [key, val2], i) => {
|
||||
entries[stringifySymbol(key, i) + " =>"] = val2;
|
||||
return entries;
|
||||
},
|
||||
{}
|
||||
)
|
||||
};
|
||||
} else if (isSet(val)) {
|
||||
return {
|
||||
[`Set(${val.size})`]: [...val.values()].map((v) => stringifySymbol(v))
|
||||
};
|
||||
} else if (isSymbol(val)) {
|
||||
return stringifySymbol(val);
|
||||
} else if (isObject(val) && !isArray(val) && !isPlainObject(val)) {
|
||||
return String(val);
|
||||
}
|
||||
return val;
|
||||
};
|
||||
const stringifySymbol = (v, i = "") => {
|
||||
var _a;
|
||||
return isSymbol(v) ? `Symbol(${(_a = v.description) != null ? _a : i})` : v;
|
||||
};
|
||||
|
||||
export { EMPTY_ARR, EMPTY_OBJ, NO, NOOP, PatchFlagNames, PatchFlags, ShapeFlags, SlotFlags, camelize, capitalize, def, escapeHtml, escapeHtmlComment, extend, genPropsAccessExp, generateCodeFrame, getGlobalThis, hasChanged, hasOwn, hyphenate, includeBooleanAttr, invokeArrayFns, isArray, isBooleanAttr, isBuiltInDirective, isDate, isFunction, isGloballyAllowed, isGloballyWhitelisted, isHTMLTag, isIntegerKey, isKnownHtmlAttr, isKnownSvgAttr, isMap, isMathMLTag, isModelListener, isObject, isOn, isPlainObject, isPromise, isRegExp, isRenderableAttrValue, isReservedProp, isSSRSafeAttrName, isSVGTag, isSet, isSpecialBooleanAttr, isString, isSymbol, isVoidTag, looseEqual, looseIndexOf, looseToNumber, makeMap, normalizeClass, normalizeProps, normalizeStyle, objectToString, parseStringStyle, propsToAttrMap, remove, slotFlagsText, stringifyStyle, toDisplayString, toHandlerKey, toNumber, toRawType, toTypeString };
|
7
node_modules/@vue/shared/index.js
generated
vendored
Normal file
7
node_modules/@vue/shared/index.js
generated
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
'use strict'
|
||||
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
module.exports = require('./dist/shared.cjs.prod.js')
|
||||
} else {
|
||||
module.exports = require('./dist/shared.cjs.js')
|
||||
}
|
47
node_modules/@vue/shared/package.json
generated
vendored
Normal file
47
node_modules/@vue/shared/package.json
generated
vendored
Normal file
@ -0,0 +1,47 @@
|
||||
{
|
||||
"name": "@vue/shared",
|
||||
"version": "3.4.15",
|
||||
"description": "internal utils shared across @vue packages",
|
||||
"main": "index.js",
|
||||
"module": "dist/shared.esm-bundler.js",
|
||||
"types": "dist/shared.d.ts",
|
||||
"files": [
|
||||
"index.js",
|
||||
"dist"
|
||||
],
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./dist/shared.d.ts",
|
||||
"node": {
|
||||
"production": "./dist/shared.cjs.prod.js",
|
||||
"development": "./dist/shared.cjs.js",
|
||||
"default": "./index.js"
|
||||
},
|
||||
"module": "./dist/shared.esm-bundler.js",
|
||||
"import": "./dist/shared.esm-bundler.js",
|
||||
"require": "./index.js"
|
||||
},
|
||||
"./*": "./*"
|
||||
},
|
||||
"sideEffects": false,
|
||||
"buildOptions": {
|
||||
"formats": [
|
||||
"esm-bundler",
|
||||
"cjs"
|
||||
]
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/vuejs/core.git",
|
||||
"directory": "packages/shared"
|
||||
},
|
||||
"keywords": [
|
||||
"vue"
|
||||
],
|
||||
"author": "Evan You",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/vuejs/core/issues"
|
||||
},
|
||||
"homepage": "https://github.com/vuejs/core/tree/main/packages/shared#readme"
|
||||
}
|
Reference in New Issue
Block a user