前端 uni-app 重写: 9页面 H5

This commit is contained in:
zhiqui
2026-11-15 15:09:37 +08:00
parent 513b53672e
commit ea7c2529e9
24104 changed files with 3667749 additions and 0 deletions
@@ -0,0 +1,20 @@
The MIT License (MIT)
Copyright (c) 2020 kazuya kawaguchi
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.
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,11 @@
{
"name": "@intlify/core-base",
"version": "11.4.6",
"license": "MIT",
"module": "dist/core-base.mjs",
"exports": {
".": "./dist/core-base.mjs",
"./package.json": "./package.json"
},
"sideEffects": false
}
@@ -0,0 +1,20 @@
The MIT License (MIT)
Copyright (c) 2020 kazuya kawaguchi
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.
@@ -0,0 +1,11 @@
{
"name": "@intlify/message-compiler",
"version": "11.4.6",
"license": "MIT",
"module": "dist/message-compiler.mjs",
"exports": {
".": "./dist/message-compiler.mjs",
"./package.json": "./package.json"
},
"sideEffects": false
}
@@ -0,0 +1,20 @@
The MIT License (MIT)
Copyright (c) 2020 kazuya kawaguchi
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.
@@ -0,0 +1,333 @@
/*!
* shared v11.4.6
* (c) 2026 kazuya kawaguchi
* Released under the MIT License.
*/
function warn(msg, err) {
if (typeof console !== 'undefined') {
console.warn(`[intlify] ` + msg);
/* istanbul ignore if */
if (err) {
console.warn(err.stack);
}
}
}
const hasWarned = {};
function warnOnce(msg) {
if (!hasWarned[msg]) {
hasWarned[msg] = true;
warn(msg);
}
}
/**
* Original Utilities
* written by kazuya kawaguchi
*/
const inBrowser = typeof window !== 'undefined';
let mark;
let measure;
if ((process.env.NODE_ENV !== 'production')) {
const perf = inBrowser && window.performance;
if (perf &&
perf.mark &&
perf.measure &&
perf.clearMarks &&
// @ts-ignore browser compat
perf.clearMeasures) {
mark = (tag) => {
perf.mark(tag);
};
measure = (name, startTag, endTag) => {
perf.measure(name, startTag, endTag);
perf.clearMarks(startTag);
perf.clearMarks(endTag);
};
}
}
const RE_ARGS = /\{([0-9a-zA-Z]+)\}/g;
/* eslint-disable */
function format(message, ...args) {
if (args.length === 1 && isObject(args[0])) {
args = args[0];
}
if (!args || !args.hasOwnProperty) {
args = {};
}
return message.replace(RE_ARGS, (match, identifier) => {
return args.hasOwnProperty(identifier) ? args[identifier] : '';
});
}
const makeSymbol = (name, shareable = false) => !shareable ? Symbol(name) : Symbol.for(name);
const generateFormatCacheKey = (locale, key, source) => friendlyJSONstringify({ l: locale, k: key, s: source });
const friendlyJSONstringify = (json) => JSON.stringify(json)
.replace(/\u2028/g, '\\u2028')
.replace(/\u2029/g, '\\u2029')
.replace(/\u0027/g, '\\u0027');
const isNumber = (val) => typeof val === 'number' && isFinite(val);
const isDate = (val) => toTypeString(val) === '[object Date]';
const isRegExp = (val) => toTypeString(val) === '[object RegExp]';
const isEmptyObject = (val) => isPlainObject(val) && Object.keys(val).length === 0;
const assign = Object.assign;
const _create = Object.create;
const create = (obj = null) => _create(obj);
let _globalThis;
const getGlobalThis = () => {
// prettier-ignore
return (_globalThis ||
(_globalThis =
typeof globalThis !== 'undefined'
? globalThis
: typeof self !== 'undefined'
? self
: typeof window !== 'undefined'
? window
: typeof global !== 'undefined'
? global
: create()));
};
function escapeHtml(rawText) {
return rawText
.replace(/&/g, '&') // escape `&` first to avoid double escaping
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;')
.replace(/"/g, '&quot;')
.replace(/'/g, '&apos;')
.replace(/\//g, '&#x2F;') // escape `/` to prevent closing tags or JavaScript URLs
.replace(/=/g, '&#x3D;'); // escape `=` to prevent attribute injection
}
function escapeAttributeValue(value) {
return value
.replace(/&(?![a-zA-Z0-9#]{2,6};)/g, '&amp;') // escape unescaped `&`
.replace(/"/g, '&quot;')
.replace(/'/g, '&apos;')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;');
}
const javascriptSchemePattern = /^\s*javascript\s*(?::|&#0*58;?|&#x0*3a;?|&colon;?)/i;
const urlAttributePattern = /^(?:href|src|action|formaction)$/i;
function hasJavascriptScheme(value) {
return javascriptSchemePattern.test(value);
}
function sanitizeStyleValue(value) {
const urlPattern = /url\s*\(/gi;
let sanitized = '';
let cursor = 0;
let match;
while ((match = urlPattern.exec(value)) !== null) {
const urlStart = match.index;
const openParenIndex = urlPattern.lastIndex - 1;
let index = openParenIndex + 1;
let depth = 1;
let quote = null;
for (; index < value.length; index++) {
const char = value[index];
if (quote) {
if (char === quote) {
quote = null;
}
continue;
}
if (char === '"' || char === "'") {
quote = char;
}
else if (char === '(') {
depth++;
}
else if (char === ')') {
depth--;
if (depth === 0) {
break;
}
}
}
if (depth !== 0) {
break;
}
const rawUrlValue = value.slice(openParenIndex + 1, index).trim();
const unquotedUrlValue = (rawUrlValue.startsWith('"') && rawUrlValue.endsWith('"')) ||
(rawUrlValue.startsWith("'") && rawUrlValue.endsWith("'"))
? rawUrlValue.slice(1, -1).trim()
: rawUrlValue;
sanitized += value.slice(cursor, urlStart);
sanitized += hasJavascriptScheme(unquotedUrlValue)
? 'url(about:blank)'
: value.slice(urlStart, index + 1);
cursor = index + 1;
}
return sanitized + value.slice(cursor);
}
function sanitizeAttributeValue(attrName, value) {
if (urlAttributePattern.test(attrName) && hasJavascriptScheme(value)) {
return 'about:blank';
}
const sanitizedValue = attrName.toLowerCase() === 'style' ? sanitizeStyleValue(value) : value;
return escapeAttributeValue(sanitizedValue);
}
function sanitizeTranslatedHtml(html) {
// Escape dangerous characters in attribute values
// Process attributes with double quotes
html = html.replace(/([\w:-]+)\s*=\s*"([^"]*)"/g, (_, attrName, attrValue) => `${attrName}="${sanitizeAttributeValue(attrName, attrValue)}"`);
// Process attributes with single quotes
html = html.replace(/([\w:-]+)\s*=\s*'([^']*)'/g, (_, attrName, attrValue) => `${attrName}='${sanitizeAttributeValue(attrName, attrValue)}'`);
// Detect and neutralize event handler attributes
const eventHandlerPattern = /\s*on\w+\s*=\s*["']?[^"'>]+["']?/gi;
if (eventHandlerPattern.test(html)) {
if ((process.env.NODE_ENV !== 'production')) {
warn('Potentially dangerous event handlers detected in translation. ' +
'Consider removing onclick, onerror, etc. from your translation messages.');
}
// Neutralize event handler attributes by escaping 'on'
html = html.replace(/(\s+)(on)(\w+\s*=)/gi, '$1&#111;n$3');
}
// Disable javascript: URLs in unquoted attributes
html = html.replace(/(\s+(?:href|src|action|formaction)\s*=\s*)([^\s"'=<>`]+)/gi, (match, prefix, attrValue) => hasJavascriptScheme(attrValue) ? `${prefix}about:blank` : match);
return html;
}
const hasOwnProperty = Object.prototype.hasOwnProperty;
function hasOwn(obj, key) {
return hasOwnProperty.call(obj, key);
}
/* eslint-enable */
/**
* Useful Utilities By Evan you
* Modified by kazuya kawaguchi
* MIT License
* https://github.com/vuejs/vue-next/blob/master/packages/shared/src/index.ts
* https://github.com/vuejs/vue-next/blob/master/packages/shared/src/codeframe.ts
*/
const isArray = Array.isArray;
const isFunction = (val) => typeof val === 'function';
const isString = (val) => typeof val === 'string';
const isBoolean = (val) => typeof val === 'boolean';
const isSymbol = (val) => typeof val === 'symbol';
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const isObject = (val) => val !== null && typeof val === 'object';
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const isPromise = (val) => {
return isObject(val) && isFunction(val.then) && isFunction(val.catch);
};
const objectToString = Object.prototype.toString;
const toTypeString = (value) => objectToString.call(value);
const isPlainObject = (val) => toTypeString(val) === '[object Object]';
// for converting list and named values to displayed strings.
const toDisplayString = (val) => {
return val == null
? ''
: isArray(val) || (isPlainObject(val) && val.toString === objectToString)
? JSON.stringify(val, null, 2)
: String(val);
};
function join(items, separator = '') {
return items.reduce((str, item, index) => (index === 0 ? str + item : str + separator + item), '');
}
const RANGE = 2;
function generateCodeFrame(source, start = 0, end = source.length) {
const lines = source.split(/\r?\n/);
let count = 0;
const res = [];
for (let i = 0; i < lines.length; i++) {
count += lines[i].length + 1;
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(3 - String(line).length)}| ${lines[j]}`);
const lineLength = lines[j].length;
if (j === i) {
// push underline
const pad = start - (count - lineLength) + 1;
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 + 1;
}
}
break;
}
}
return res.join('\n');
}
/**
* Event emitter, forked from the below:
* - original repository url: https://github.com/developit/mitt
* - code url: https://github.com/developit/mitt/blob/master/src/index.ts
* - author: Jason Miller (https://github.com/developit)
* - license: MIT
*/
/**
* Create a event emitter
*
* @returns An event emitter
*/
function createEmitter() {
const events = new Map();
const emitter = {
events,
on(event, handler) {
const handlers = events.get(event);
const added = handlers && handlers.push(handler);
if (!added) {
events.set(event, [handler]);
}
},
off(event, handler) {
const handlers = events.get(event);
if (handlers) {
handlers.splice(handlers.indexOf(handler) >>> 0, 1);
}
},
emit(event, payload) {
(events.get(event) || [])
.slice()
.map(handler => handler(payload));
(events.get('*') || [])
.slice()
.map(handler => handler(event, payload));
}
};
return emitter;
}
const isNotObjectOrIsArray = (val) => !isObject(val) || isArray(val);
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function deepCopy(src, des) {
// src and des should both be objects, and none of them can be a array
if (isNotObjectOrIsArray(src) || isNotObjectOrIsArray(des)) {
throw new Error('Invalid value');
}
const stack = [{ src, des }];
while (stack.length) {
const { src, des } = stack.pop();
// using `Object.keys` which skips prototype properties
Object.keys(src).forEach(key => {
if (key === '__proto__') {
return;
}
// if src[key] is an object/array, set des[key]
// to empty object/array to prevent setting by reference
if (isObject(src[key]) && !isObject(des[key])) {
des[key] = Array.isArray(src[key]) ? [] : create();
}
if (isNotObjectOrIsArray(des[key]) || isNotObjectOrIsArray(src[key])) {
// replace with src[key] when:
// src[key] or des[key] is not an object, or
// src[key] or des[key] is an array
des[key] = src[key];
}
else {
// src[key] and des[key] are both objects, merge them
stack.push({ src: src[key], des: des[key] });
}
});
}
}
export { assign, create, createEmitter, deepCopy, escapeHtml, format, friendlyJSONstringify, generateCodeFrame, generateFormatCacheKey, getGlobalThis, hasOwn, inBrowser, isArray, isBoolean, isDate, isEmptyObject, isFunction, isNumber, isObject, isPlainObject, isPromise, isRegExp, isString, isSymbol, join, makeSymbol, mark, measure, objectToString, sanitizeTranslatedHtml, toDisplayString, toTypeString, warn, warnOnce };
@@ -0,0 +1,11 @@
{
"name": "@intlify/shared",
"version": "11.4.6",
"license": "MIT",
"module": "dist/shared.mjs",
"exports": {
".": "./dist/shared.mjs",
"./package.json": "./package.json"
},
"sideEffects": false
}
@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2023 webfansplz
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.
@@ -0,0 +1,26 @@
// uni-app x 暂不支持 @vue/devtools-api,保留新旧版本的运行时导出以兼容依赖加载
export function addCustomCommand() {}
export function addCustomTab() {}
export function onDevToolsClientConnected() {
return Promise.resolve()
}
export function onDevToolsConnected() {
return Promise.resolve()
}
export function removeCustomCommand() {}
export function setupDevToolsPlugin() {}
export const setupDevtoolsPlugin = setupDevToolsPlugin
export function isPerformanceSupported() {
return false
}
export function now() {
return Date.now()
}
@@ -0,0 +1,12 @@
{
"name": "@vue/devtools-api",
"version": "7.7.10",
"type": "module",
"license": "MIT",
"module": "dist/index.js",
"exports": {
".": "./dist/index.js",
"./package.json": "./package.json"
},
"sideEffects": false
}
@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2019-present, Yuxi (Evan) You and Vite contributors
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.
@@ -0,0 +1,278 @@
# @vitejs/plugin-vue [![npm](https://img.shields.io/npm/v/@vitejs/plugin-vue.svg)](https://npmjs.com/package/@vitejs/plugin-vue)
> Note: as of `vue` 3.2.13+ and `@vitejs/plugin-vue` 1.9.0+, `@vue/compiler-sfc` is no longer required as a peer dependency.
```js
// vite.config.js
import vue from '@vitejs/plugin-vue'
export default {
plugins: [vue()],
}
```
For JSX / TSX support, [`@vitejs/plugin-vue-jsx`](https://github.com/vitejs/vite-plugin-vue/tree/main/packages/plugin-vue-jsx) is also needed.
## Options
```ts
export interface Options {
include?: string | RegExp | (string | RegExp)[]
exclude?: string | RegExp | (string | RegExp)[]
isProduction?: boolean
/**
* Requires @vitejs/plugin-vue@^5.1.0
*/
features?: {
/**
* Enable reactive destructure for `defineProps`.
* - Available in Vue 3.4 and later.
* - **default:** `false` in Vue 3.4 (**experimental**), `true` in Vue 3.5+
*/
propsDestructure?: boolean
/**
* Transform Vue SFCs into custom elements.
* - `true`: all `*.vue` imports are converted into custom elements
* - `string | RegExp`: matched files are converted into custom elements
* - **default:** /\.ce\.vue$/
*/
customElement?: boolean | string | RegExp | (string | RegExp)[]
/**
* Set to `false` to disable Options API support and allow related code in
* Vue core to be dropped via dead-code elimination in production builds,
* resulting in smaller bundles.
* - **default:** `true`
*/
optionsAPI?: boolean
/**
* Set to `true` to enable devtools support in production builds.
* Results in slightly larger bundles.
* - **default:** `false`
*/
prodDevtools?: boolean
/**
* Set to `true` to enable detailed information for hydration mismatch
* errors in production builds. Results in slightly larger bundles.
* - **default:** `false`
*/
prodHydrationMismatchDetails?: boolean
/**
* Customize the component ID generation strategy.
* - `'filepath'`: hash the file path (relative to the project root)
* - `'filepath-source'`: hash the file path and the source code
* - `function`: custom function that takes the file path, source code,
* whether in production mode, and the default hash function as arguments
* - **default:** `'filepath'` in development, `'filepath-source'` in production
*/
componentIdGenerator?:
| 'filepath'
| 'filepath-source'
| ((
filepath: string,
source: string,
isProduction: boolean | undefined,
getHash: (text: string) => string,
) => string)
}
// `script`, `template` and `style` are lower-level compiler options
// to pass on to respective APIs of `vue/compiler-sfc`
script?: Partial<
Omit<
SFCScriptCompileOptions,
| 'id'
| 'isProd'
| 'inlineTemplate'
| 'templateOptions'
| 'sourceMap'
| 'genDefaultAs'
| 'customElement'
>
>
template?: Partial<
Omit<
SFCTemplateCompileOptions,
| 'id'
| 'source'
| 'ast'
| 'filename'
| 'scoped'
| 'slotted'
| 'isProd'
| 'inMap'
| 'ssr'
| 'ssrCssVars'
| 'preprocessLang'
>
>
style?: Partial<
Omit<
SFCStyleCompileOptions,
| 'filename'
| 'id'
| 'isProd'
| 'source'
| 'scoped'
| 'cssDevSourcemap'
| 'postcssOptions'
| 'map'
| 'postcssPlugins'
| 'preprocessCustomRequire'
| 'preprocessLang'
| 'preprocessOptions'
>
>
/**
* Use custom compiler-sfc instance. Can be used to force a specific version.
*/
compiler?: typeof _compiler
/**
* @deprecated moved to `features.customElement`.
*/
customElements?: boolean | string | RegExp | (string | RegExp)[]
}
```
## Asset URL handling
When `@vitejs/plugin-vue` compiles the `<template>` blocks in SFCs, it also converts any encountered asset URLs into ESM imports.
For example, the following template snippet:
```vue
<img src="../image.png" />
```
Is the same as:
```vue
<script setup>
import _imports_0 from '../image.png'
</script>
<img :src="_imports_0" />
```
By default the following tag/attribute combinations are transformed, and can be configured using the `template.transformAssetUrls` option.
```js
{
video: ['src', 'poster'],
source: ['src'],
img: ['src'],
image: ['xlink:href', 'href'],
use: ['xlink:href', 'href']
}
```
Note that only attribute values that are static strings are transformed. Otherwise, you'd need to import the asset manually, e.g. `import imgUrl from '../image.png'`.
## Example for passing options to `vue/compiler-sfc`:
```ts
import vue from '@vitejs/plugin-vue'
export default {
plugins: [
vue({
template: {
compilerOptions: {
// ...
},
transformAssetUrls: {
// ...
},
},
}),
],
}
```
## Example for transforming custom blocks
```ts
import vue from '@vitejs/plugin-vue'
import yaml from 'js-yaml'
const vueI18nPlugin = {
name: 'vue-i18n',
transform(code, id) {
// if .vue file don't have <i18n> block, just return
if (!/vue&type=i18n/.test(id)) {
return
}
// parse yaml
if (/\.ya?ml$/.test(id)) {
code = JSON.stringify(yaml.load(code.trim()))
}
// mount the value on the i18n property of the component instance
return `export default Comp => {
Comp.i18n = ${code}
}`
},
}
export default {
plugins: [vue(), vueI18nPlugin],
}
```
Create a file named `Demo.vue`, add `lang="yaml"` to the `<i18n>` blocks, then you can use the syntax of `YAML`:
```vue
<template>Hello</template>
<i18n lang="yaml">
message: 'world'
fullWord: 'hello world'
</i18n>
```
`message` is mounted on the i18n property of the component instance, you can use like this:
```vue
<script setup lang="ts">
import Demo from 'components/Demo.vue'
</script>
<template>
<Demo /> {{ Demo.i18n.message }}
<div>{{ Demo.i18n.fullWord }}</div>
</template>
```
## Using Vue SFCs as Custom Elements
> Requires `vue@^3.2.0` & `@vitejs/plugin-vue@^1.4.0`
Vue 3.2 introduces the `defineCustomElement` method, which works with SFCs. By default, `<style>` tags inside SFCs are extracted and merged into CSS files during build. However when shipping a library of custom elements, it may be desirable to inline the styles as JavaScript strings and inject them into the custom elements' shadow root instead.
Starting in 1.4.0, files ending with `*.ce.vue` will be compiled in "custom elements" mode: its `<style>` tags are compiled into inlined CSS strings and attached to the component as its `styles` property:
```js
import { defineCustomElement } from 'vue'
import Example from './Example.ce.vue'
console.log(Example.styles) // ['/* css content */']
// register
customElements.define('my-example', defineCustomElement(Example))
```
Note in custom elements mode there is no need to use `<style scoped>` since the CSS is already scoped inside the shadow DOM.
The `customElement` plugin option can be used to configure the behavior:
- `{ customElement: true }` will import all `*.vue` files in custom element mode.
- Use a string or regex pattern to change how files should be loaded as Custom Elements (this check is applied after `include` and `exclude` matches).
## License
MIT
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,143 @@
import { Plugin, ViteDevServer } from 'vite';
import * as _compiler from 'vue/compiler-sfc';
import { SFCDescriptor, SFCScriptCompileOptions, SFCTemplateCompileOptions, SFCStyleCompileOptions } from 'vue/compiler-sfc';
interface StartOfSourceMap {
file?: string;
sourceRoot?: string;
}
interface RawSourceMap extends StartOfSourceMap {
version: string;
sources: string[];
names: string[];
sourcesContent?: string[];
mappings: string;
}
interface UniAppXVaporScriptTransformInput {
code: string;
id: string;
lang?: string;
}
type UniAppXVaporSfcTransform = (descriptor: SFCDescriptor) => void;
interface UniAppXVaporScriptTransformResult {
code: string;
map?: RawSourceMap;
meta?: Record<string, unknown>;
}
type UniAppXVaporScriptTransform = (input: UniAppXVaporScriptTransformInput) => UniAppXVaporScriptTransformResult | undefined;
interface VueQuery {
vue?: boolean;
src?: string;
type?: 'script' | 'template' | 'style' | 'custom';
index?: number;
lang?: string;
raw?: boolean;
url?: boolean;
scoped?: boolean;
id?: string;
}
declare function parseVueRequest(id: string): {
filename: string;
query: VueQuery;
};
interface Options {
include?: string | RegExp | (string | RegExp)[];
exclude?: string | RegExp | (string | RegExp)[];
/**
* In Vite, this option follows Vite's config.
*/
isProduction?: boolean;
script?: Partial<Omit<SFCScriptCompileOptions, 'id' | 'isProd' | 'inlineTemplate' | 'templateOptions' | 'sourceMap' | 'genDefaultAs' | 'customElement' | 'defineModel' | 'propsDestructure'>> & {
/**
* @deprecated defineModel is now a stable feature and always enabled if
* using Vue 3.4 or above.
*/
defineModel?: boolean;
/**
* @deprecated moved to `features.propsDestructure`.
*/
propsDestructure?: boolean;
};
template?: Partial<Omit<SFCTemplateCompileOptions, 'id' | 'source' | 'ast' | 'filename' | 'scoped' | 'slotted' | 'isProd' | 'inMap' | 'ssr' | 'ssrCssVars' | 'preprocessLang'>>;
style?: Partial<Omit<SFCStyleCompileOptions, 'filename' | 'id' | 'isProd' | 'source' | 'scoped' | 'cssDevSourcemap' | 'postcssOptions' | 'map' | 'postcssPlugins' | 'preprocessCustomRequire' | 'preprocessLang' | 'preprocessOptions'>>;
/**
* Use custom compiler-sfc instance. Can be used to force a specific version.
*/
compiler?: typeof _compiler;
/** uni-app x Vapor 脚本转换扩展点。 */
readonly uniAppXVaporScriptTransform?: UniAppXVaporScriptTransform;
/** uni-app x App DOM2 SFC descriptor 预处理扩展点。 */
readonly uniAppXVaporSfcTransform?: UniAppXVaporSfcTransform;
/**
* Requires @vitejs/plugin-vue@^5.1.0
*/
features?: {
/**
* Enable reactive destructure for `defineProps`.
* - Available in Vue 3.4 and later.
* - **default:** `false` in Vue 3.4 (**experimental**), `true` in Vue 3.5+
*/
propsDestructure?: boolean;
/**
* Transform Vue SFCs into custom elements.
* - `true`: all `*.vue` imports are converted into custom elements
* - `string | RegExp`: matched files are converted into custom elements
* - **default:** /\.ce\.vue$/
*/
customElement?: boolean | string | RegExp | (string | RegExp)[];
/**
* Set to `false` to disable Options API support and allow related code in
* Vue core to be dropped via dead-code elimination in production builds,
* resulting in smaller bundles.
* - **default:** `true`
*/
optionsAPI?: boolean;
/**
* Set to `true` to enable devtools support in production builds.
* Results in slightly larger bundles.
* - **default:** `false`
*/
prodDevtools?: boolean;
/**
* Set to `true` to enable detailed information for hydration mismatch
* errors in production builds. Results in slightly larger bundles.
* - **default:** `false`
*/
prodHydrationMismatchDetails?: boolean;
/**
* Customize the component ID generation strategy.
* - `'filepath'`: hash the file path (relative to the project root)
* - `'filepath-source'`: hash the file path and the source code
* - `function`: custom function that takes the file path, source code,
* whether in production mode, and the default hash function as arguments
* - **default:** `'filepath'` in development, `'filepath-source'` in production
*/
componentIdGenerator?: 'filepath' | 'filepath-source' | ((filepath: string, source: string, isProduction: boolean | undefined, getHash: (text: string) => string) => string);
};
/**
* @deprecated moved to `features.customElement`.
*/
customElement?: boolean | string | RegExp | (string | RegExp)[];
}
interface ResolvedOptions extends Options {
compiler: typeof _compiler;
root: string;
sourceMap: boolean;
cssDevSourcemap: boolean;
devServer?: ViteDevServer;
devToolsEnabled?: boolean;
}
interface Api {
get options(): ResolvedOptions;
set options(value: ResolvedOptions);
version: string;
}
declare function vuePlugin(rawOptions?: Options): Plugin<Api>;
// @ts-ignore
export = vuePlugin;
export { type Api, type Options, type ResolvedOptions, type VueQuery, parseVueRequest };
@@ -0,0 +1,141 @@
import { Plugin, ViteDevServer } from 'vite';
import * as _compiler from 'vue/compiler-sfc';
import { SFCDescriptor, SFCScriptCompileOptions, SFCTemplateCompileOptions, SFCStyleCompileOptions } from 'vue/compiler-sfc';
interface StartOfSourceMap {
file?: string;
sourceRoot?: string;
}
interface RawSourceMap extends StartOfSourceMap {
version: string;
sources: string[];
names: string[];
sourcesContent?: string[];
mappings: string;
}
interface UniAppXVaporScriptTransformInput {
code: string;
id: string;
lang?: string;
}
type UniAppXVaporSfcTransform = (descriptor: SFCDescriptor) => void;
interface UniAppXVaporScriptTransformResult {
code: string;
map?: RawSourceMap;
meta?: Record<string, unknown>;
}
type UniAppXVaporScriptTransform = (input: UniAppXVaporScriptTransformInput) => UniAppXVaporScriptTransformResult | undefined;
interface VueQuery {
vue?: boolean;
src?: string;
type?: 'script' | 'template' | 'style' | 'custom';
index?: number;
lang?: string;
raw?: boolean;
url?: boolean;
scoped?: boolean;
id?: string;
}
declare function parseVueRequest(id: string): {
filename: string;
query: VueQuery;
};
interface Options {
include?: string | RegExp | (string | RegExp)[];
exclude?: string | RegExp | (string | RegExp)[];
/**
* In Vite, this option follows Vite's config.
*/
isProduction?: boolean;
script?: Partial<Omit<SFCScriptCompileOptions, 'id' | 'isProd' | 'inlineTemplate' | 'templateOptions' | 'sourceMap' | 'genDefaultAs' | 'customElement' | 'defineModel' | 'propsDestructure'>> & {
/**
* @deprecated defineModel is now a stable feature and always enabled if
* using Vue 3.4 or above.
*/
defineModel?: boolean;
/**
* @deprecated moved to `features.propsDestructure`.
*/
propsDestructure?: boolean;
};
template?: Partial<Omit<SFCTemplateCompileOptions, 'id' | 'source' | 'ast' | 'filename' | 'scoped' | 'slotted' | 'isProd' | 'inMap' | 'ssr' | 'ssrCssVars' | 'preprocessLang'>>;
style?: Partial<Omit<SFCStyleCompileOptions, 'filename' | 'id' | 'isProd' | 'source' | 'scoped' | 'cssDevSourcemap' | 'postcssOptions' | 'map' | 'postcssPlugins' | 'preprocessCustomRequire' | 'preprocessLang' | 'preprocessOptions'>>;
/**
* Use custom compiler-sfc instance. Can be used to force a specific version.
*/
compiler?: typeof _compiler;
/** uni-app x Vapor 脚本转换扩展点。 */
readonly uniAppXVaporScriptTransform?: UniAppXVaporScriptTransform;
/** uni-app x App DOM2 SFC descriptor 预处理扩展点。 */
readonly uniAppXVaporSfcTransform?: UniAppXVaporSfcTransform;
/**
* Requires @vitejs/plugin-vue@^5.1.0
*/
features?: {
/**
* Enable reactive destructure for `defineProps`.
* - Available in Vue 3.4 and later.
* - **default:** `false` in Vue 3.4 (**experimental**), `true` in Vue 3.5+
*/
propsDestructure?: boolean;
/**
* Transform Vue SFCs into custom elements.
* - `true`: all `*.vue` imports are converted into custom elements
* - `string | RegExp`: matched files are converted into custom elements
* - **default:** /\.ce\.vue$/
*/
customElement?: boolean | string | RegExp | (string | RegExp)[];
/**
* Set to `false` to disable Options API support and allow related code in
* Vue core to be dropped via dead-code elimination in production builds,
* resulting in smaller bundles.
* - **default:** `true`
*/
optionsAPI?: boolean;
/**
* Set to `true` to enable devtools support in production builds.
* Results in slightly larger bundles.
* - **default:** `false`
*/
prodDevtools?: boolean;
/**
* Set to `true` to enable detailed information for hydration mismatch
* errors in production builds. Results in slightly larger bundles.
* - **default:** `false`
*/
prodHydrationMismatchDetails?: boolean;
/**
* Customize the component ID generation strategy.
* - `'filepath'`: hash the file path (relative to the project root)
* - `'filepath-source'`: hash the file path and the source code
* - `function`: custom function that takes the file path, source code,
* whether in production mode, and the default hash function as arguments
* - **default:** `'filepath'` in development, `'filepath-source'` in production
*/
componentIdGenerator?: 'filepath' | 'filepath-source' | ((filepath: string, source: string, isProduction: boolean | undefined, getHash: (text: string) => string) => string);
};
/**
* @deprecated moved to `features.customElement`.
*/
customElement?: boolean | string | RegExp | (string | RegExp)[];
}
interface ResolvedOptions extends Options {
compiler: typeof _compiler;
root: string;
sourceMap: boolean;
cssDevSourcemap: boolean;
devServer?: ViteDevServer;
devToolsEnabled?: boolean;
}
interface Api {
get options(): ResolvedOptions;
set options(value: ResolvedOptions);
version: string;
}
declare function vuePlugin(rawOptions?: Options): Plugin<Api>;
export { type Api, type Options, type ResolvedOptions, type VueQuery, vuePlugin as default, parseVueRequest };
@@ -0,0 +1,143 @@
import { Plugin, ViteDevServer } from 'vite';
import * as _compiler from 'vue/compiler-sfc';
import { SFCDescriptor, SFCScriptCompileOptions, SFCTemplateCompileOptions, SFCStyleCompileOptions } from 'vue/compiler-sfc';
interface StartOfSourceMap {
file?: string;
sourceRoot?: string;
}
interface RawSourceMap extends StartOfSourceMap {
version: string;
sources: string[];
names: string[];
sourcesContent?: string[];
mappings: string;
}
interface UniAppXVaporScriptTransformInput {
code: string;
id: string;
lang?: string;
}
type UniAppXVaporSfcTransform = (descriptor: SFCDescriptor) => void;
interface UniAppXVaporScriptTransformResult {
code: string;
map?: RawSourceMap;
meta?: Record<string, unknown>;
}
type UniAppXVaporScriptTransform = (input: UniAppXVaporScriptTransformInput) => UniAppXVaporScriptTransformResult | undefined;
interface VueQuery {
vue?: boolean;
src?: string;
type?: 'script' | 'template' | 'style' | 'custom';
index?: number;
lang?: string;
raw?: boolean;
url?: boolean;
scoped?: boolean;
id?: string;
}
declare function parseVueRequest(id: string): {
filename: string;
query: VueQuery;
};
interface Options {
include?: string | RegExp | (string | RegExp)[];
exclude?: string | RegExp | (string | RegExp)[];
/**
* In Vite, this option follows Vite's config.
*/
isProduction?: boolean;
script?: Partial<Omit<SFCScriptCompileOptions, 'id' | 'isProd' | 'inlineTemplate' | 'templateOptions' | 'sourceMap' | 'genDefaultAs' | 'customElement' | 'defineModel' | 'propsDestructure'>> & {
/**
* @deprecated defineModel is now a stable feature and always enabled if
* using Vue 3.4 or above.
*/
defineModel?: boolean;
/**
* @deprecated moved to `features.propsDestructure`.
*/
propsDestructure?: boolean;
};
template?: Partial<Omit<SFCTemplateCompileOptions, 'id' | 'source' | 'ast' | 'filename' | 'scoped' | 'slotted' | 'isProd' | 'inMap' | 'ssr' | 'ssrCssVars' | 'preprocessLang'>>;
style?: Partial<Omit<SFCStyleCompileOptions, 'filename' | 'id' | 'isProd' | 'source' | 'scoped' | 'cssDevSourcemap' | 'postcssOptions' | 'map' | 'postcssPlugins' | 'preprocessCustomRequire' | 'preprocessLang' | 'preprocessOptions'>>;
/**
* Use custom compiler-sfc instance. Can be used to force a specific version.
*/
compiler?: typeof _compiler;
/** uni-app x Vapor 脚本转换扩展点。 */
readonly uniAppXVaporScriptTransform?: UniAppXVaporScriptTransform;
/** uni-app x App DOM2 SFC descriptor 预处理扩展点。 */
readonly uniAppXVaporSfcTransform?: UniAppXVaporSfcTransform;
/**
* Requires @vitejs/plugin-vue@^5.1.0
*/
features?: {
/**
* Enable reactive destructure for `defineProps`.
* - Available in Vue 3.4 and later.
* - **default:** `false` in Vue 3.4 (**experimental**), `true` in Vue 3.5+
*/
propsDestructure?: boolean;
/**
* Transform Vue SFCs into custom elements.
* - `true`: all `*.vue` imports are converted into custom elements
* - `string | RegExp`: matched files are converted into custom elements
* - **default:** /\.ce\.vue$/
*/
customElement?: boolean | string | RegExp | (string | RegExp)[];
/**
* Set to `false` to disable Options API support and allow related code in
* Vue core to be dropped via dead-code elimination in production builds,
* resulting in smaller bundles.
* - **default:** `true`
*/
optionsAPI?: boolean;
/**
* Set to `true` to enable devtools support in production builds.
* Results in slightly larger bundles.
* - **default:** `false`
*/
prodDevtools?: boolean;
/**
* Set to `true` to enable detailed information for hydration mismatch
* errors in production builds. Results in slightly larger bundles.
* - **default:** `false`
*/
prodHydrationMismatchDetails?: boolean;
/**
* Customize the component ID generation strategy.
* - `'filepath'`: hash the file path (relative to the project root)
* - `'filepath-source'`: hash the file path and the source code
* - `function`: custom function that takes the file path, source code,
* whether in production mode, and the default hash function as arguments
* - **default:** `'filepath'` in development, `'filepath-source'` in production
*/
componentIdGenerator?: 'filepath' | 'filepath-source' | ((filepath: string, source: string, isProduction: boolean | undefined, getHash: (text: string) => string) => string);
};
/**
* @deprecated moved to `features.customElement`.
*/
customElement?: boolean | string | RegExp | (string | RegExp)[];
}
interface ResolvedOptions extends Options {
compiler: typeof _compiler;
root: string;
sourceMap: boolean;
cssDevSourcemap: boolean;
devServer?: ViteDevServer;
devToolsEnabled?: boolean;
}
interface Api {
get options(): ResolvedOptions;
set options(value: ResolvedOptions);
version: string;
}
declare function vuePlugin(rawOptions?: Options): Plugin<Api>;
// @ts-ignore
export = vuePlugin;
export { type Api, type Options, type ResolvedOptions, type VueQuery, parseVueRequest };
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,50 @@
{
"name": "@vitejs/plugin-vue",
"version": "5.2.4",
"type": "commonjs",
"license": "MIT",
"author": "Evan You",
"files": [
"dist"
],
"main": "./dist/index.cjs",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"exports": {
".": {
"import": "./dist/index.mjs",
"require": "./dist/index.cjs"
}
},
"engines": {
"node": "^18.0.0 || >=20.0.0"
},
"repository": {
"type": "git",
"url": "git+https://github.com/vitejs/vite-plugin-vue.git",
"directory": "packages/plugin-vue"
},
"bugs": {
"url": "https://github.com/vitejs/vite-plugin-vue/issues"
},
"homepage": "https://github.com/vitejs/vite-plugin-vue/tree/main/packages/plugin-vue#readme",
"peerDependencies": {
"vite": "^5.0.0 || ^6.0.0",
"vue": "^3.2.25"
},
"devDependencies": {
"@jridgewell/gen-mapping": "^0.3.8",
"@jridgewell/trace-mapping": "^0.3.25",
"debug": "^4.4.0",
"rollup": "^4.40.2",
"slash": "^5.1.0",
"source-map-js": "^1.2.1",
"vite": "^6.3.5",
"vue": "^3.5.13"
},
"scripts": {
"dev": "unbuild --stub",
"build": "unbuild && pnpm run patch-cjs",
"patch-cjs": "tsx ../../scripts/patchCJS.ts"
}
}
@@ -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.
@@ -0,0 +1 @@
# @vue/compiler-core
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large Load Diff
@@ -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')
}
@@ -0,0 +1,58 @@
{
"name": "@vue/compiler-core",
"version": "3.6.0-alpha.2",
"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": "catalog:",
"@vue/shared": "workspace:*",
"entities": "^4.5.0",
"estree-walker": "catalog:",
"source-map-js": "catalog:"
},
"devDependencies": {
"@babel/types": "catalog:"
}
}
@@ -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.
@@ -0,0 +1 @@
# @vue/compiler-dom
@@ -0,0 +1,766 @@
/**
* @vue/compiler-dom v3.6.0-rc.14
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT
**/
Object.defineProperties(exports, {
__esModule: { value: true },
[Symbol.toStringTag]: { value: "Module" }
});
let _vue_compiler_core = require("@vue/compiler-core");
let _vue_shared = require("@vue/shared");
//#region packages/compiler-dom/src/runtimeHelpers.ts
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`);
(0, _vue_compiler_core.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`
});
//#endregion
//#region packages/compiler-dom/src/parserOptions.ts
const parserOptions = {
parseMode: "html",
isVoidTag: _vue_shared.isVoidTag,
isNativeTag: (tag) => (0, _vue_shared.isHTMLTag)(tag) || (0, _vue_shared.isSVGTag)(tag) || (0, _vue_shared.isMathMLTag)(tag),
isPreTag: (tag) => tag === "pre",
isIgnoreNewlineTag: (tag) => tag === "pre" || tag === "textarea",
decodeEntities: void 0,
isBuiltInComponent: (tag) => {
if (tag === "Transition" || tag === "transition") return TRANSITION;
else if (tag === "TransitionGroup" || tag === "transition-group") return TRANSITION_GROUP;
},
getNamespace(tag, parent, rootNamespace) {
let ns = parent ? parent.ns : rootNamespace;
if (parent && ns === 2) {
if (parent.tag === "annotation-xml") {
if ((0, _vue_shared.isSVGTag)(tag)) 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 ((0, _vue_shared.isSVGTag)(tag)) return 1;
if ((0, _vue_shared.isMathMLTag)(tag)) return 2;
}
return ns;
}
};
//#endregion
//#region packages/compiler-dom/src/transforms/transformStyle.ts
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: (0, _vue_compiler_core.createSimpleExpression)(`style`, true, p.loc),
exp: parseInlineCSS(p.value.content, p.loc),
modifiers: [],
loc: p.loc
};
});
};
const parseInlineCSS = (cssText, loc) => {
const normalized = (0, _vue_shared.parseStringStyle)(cssText);
return (0, _vue_compiler_core.createSimpleExpression)(JSON.stringify(normalized), false, loc, 3);
};
//#endregion
//#region packages/compiler-dom/src/errors.ts
function createDOMCompilerError(code, loc) {
return (0, _vue_compiler_core.createCompilerError)(code, loc, DOMErrorMessages);
}
const DOMErrorCodes = {
"X_V_HTML_NO_EXPRESSION": 54,
"54": "X_V_HTML_NO_EXPRESSION",
"X_V_HTML_WITH_CHILDREN": 55,
"55": "X_V_HTML_WITH_CHILDREN",
"X_V_TEXT_NO_EXPRESSION": 56,
"56": "X_V_TEXT_NO_EXPRESSION",
"X_V_TEXT_WITH_CHILDREN": 57,
"57": "X_V_TEXT_WITH_CHILDREN",
"X_V_MODEL_ON_INVALID_ELEMENT": 58,
"58": "X_V_MODEL_ON_INVALID_ELEMENT",
"X_V_MODEL_ARG_ON_ELEMENT": 59,
"59": "X_V_MODEL_ARG_ON_ELEMENT",
"X_V_MODEL_ON_FILE_INPUT_ELEMENT": 60,
"60": "X_V_MODEL_ON_FILE_INPUT_ELEMENT",
"X_V_MODEL_UNNECESSARY_VALUE": 61,
"61": "X_V_MODEL_UNNECESSARY_VALUE",
"X_V_SHOW_NO_EXPRESSION": 62,
"62": "X_V_SHOW_NO_EXPRESSION",
"X_TRANSITION_INVALID_CHILDREN": 63,
"63": "X_TRANSITION_INVALID_CHILDREN",
"X_IGNORED_SIDE_EFFECT_TAG": 64,
"64": "X_IGNORED_SIDE_EFFECT_TAG",
"__EXTEND_POINT__": 65,
"65": "__EXTEND_POINT__"
};
const DOMErrorMessages = {
[54]: `v-html is missing expression.`,
[55]: `v-html will override element children.`,
[56]: `v-text is missing expression.`,
[57]: `v-text will override element children.`,
[58]: `v-model can only be used on <input>, <textarea> and <select> elements.`,
[59]: `v-model argument is not supported on plain elements.`,
[60]: `v-model cannot be used on file inputs since they are read-only. Use a v-on:change listener instead.`,
[61]: `Unnecessary value binding used alongside v-model. It will interfere with v-model's behavior.`,
[62]: `v-show is missing expression.`,
[63]: `<Transition> expects exactly one child element or component.`,
[64]: `Tags with side effect (<script> and <style>) are ignored in client component templates.`,
[65]: ``
};
//#endregion
//#region packages/compiler-dom/src/transforms/vHtml.ts
const transformVHtml = (dir, node, context) => {
const { exp, loc } = dir;
if (!exp) context.onError(createDOMCompilerError(54, loc));
if (node.children.length) {
context.onError(createDOMCompilerError(55, loc));
node.children.length = 0;
}
return { props: [(0, _vue_compiler_core.createObjectProperty)((0, _vue_compiler_core.createSimpleExpression)(`innerHTML`, true, loc), exp || (0, _vue_compiler_core.createSimpleExpression)("", true))] };
};
//#endregion
//#region packages/compiler-dom/src/transforms/vText.ts
const transformVText = (dir, node, context) => {
const { exp, loc } = dir;
if (!exp) context.onError(createDOMCompilerError(56, loc));
if (node.children.length) {
context.onError(createDOMCompilerError(57, loc));
node.children.length = 0;
}
return { props: [(0, _vue_compiler_core.createObjectProperty)((0, _vue_compiler_core.createSimpleExpression)(`textContent`, true), exp ? (0, _vue_compiler_core.getConstantType)(exp, context) > 0 ? exp : (0, _vue_compiler_core.createCallExpression)(context.helperString(_vue_compiler_core.TO_DISPLAY_STRING), [exp], loc) : (0, _vue_compiler_core.createSimpleExpression)("", true))] };
};
//#endregion
//#region packages/compiler-dom/src/transforms/vModel.ts
const transformModel = (dir, node, context) => {
const baseResult = (0, _vue_compiler_core.transformModel)(dir, node, context);
if (!baseResult.props.length || node.tagType === 1) return baseResult;
if (dir.arg) context.onError(createDOMCompilerError(59, dir.arg.loc));
function checkDuplicatedValue() {
const value = (0, _vue_compiler_core.findDir)(node, "bind");
if (value && (0, _vue_compiler_core.isStaticArgOf)(value.arg, "value")) context.onError(createDOMCompilerError(61, 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 = (0, _vue_compiler_core.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(60, dir.loc));
break;
default: checkDuplicatedValue();
}
} else if ((0, _vue_compiler_core.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(58, dir.loc));
baseResult.props = baseResult.props.filter((p) => !(p.key.type === 4 && p.key.content === "modelValue"));
return baseResult;
};
//#endregion
//#region packages/compiler-dom/src/transforms/vOn.ts
const isEventOptionModifier = /*@__PURE__*/ (0, _vue_shared.makeMap)(`passive,once,capture`);
const isNonKeyModifier = /*@__PURE__*/ (0, _vue_shared.makeMap)("stop,prevent,self,ctrl,shift,alt,meta,exact,middle");
const maybeKeyModifier = /*@__PURE__*/ (0, _vue_shared.makeMap)("left,right");
const isKeyboardEvent = /*@__PURE__*/ (0, _vue_shared.makeMap)(`onkeyup,onkeydown,onkeypress`);
const resolveModifiers = (key, modifiers, context, loc) => {
const keyModifiers = [];
const nonKeyModifiers = [];
const eventOptionModifiers = [];
for (let i = 0; i < modifiers.length; i++) {
const modifier = modifiers[i].content;
if (modifier === "delegate") {
if (context) {
const error = /* @__PURE__ */ new SyntaxError(`.delegate modifier is only supported in Vapor components.`);
error.loc = modifiers[i].loc;
context.onWarn(error);
}
continue;
}
if (modifier === "native" && context && (0, _vue_compiler_core.checkCompatEnabled)("COMPILER_V_ON_NATIVE", context, loc)) eventOptionModifiers.push(modifier);
else if (isEventOptionModifier(modifier)) eventOptionModifiers.push(modifier);
else {
const keyString = (0, _vue_shared.isString)(key) ? key : (0, _vue_compiler_core.isStaticExp)(key) ? key.content : null;
if (maybeKeyModifier(modifier)) {
if (keyString) {
if (isKeyboardEvent(keyString.toLowerCase())) 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) => {
return (0, _vue_compiler_core.isStaticExp)(key) && key.content.toLowerCase() === "onclick" ? (0, _vue_compiler_core.createSimpleExpression)(event, true) : key.type !== 4 ? (0, _vue_compiler_core.createCompoundExpression)([
`(`,
key,
`) === "onClick" ? "${event}" : (`,
key,
`)`
]) : key;
};
const transformOn = (dir, node, context) => {
return (0, _vue_compiler_core.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 = (0, _vue_compiler_core.createCallExpression)(context.helper(V_ON_WITH_MODIFIERS), [handlerExp, JSON.stringify(nonKeyModifiers)]);
if (keyModifiers.length && (!(0, _vue_compiler_core.isStaticExp)(key) || isKeyboardEvent(key.content.toLowerCase()))) handlerExp = (0, _vue_compiler_core.createCallExpression)(context.helper(V_ON_WITH_KEYS), [handlerExp, JSON.stringify(keyModifiers)]);
if (eventOptionModifiers.length) {
const modifierPostfix = eventOptionModifiers.map(_vue_shared.capitalize).join("");
key = (0, _vue_compiler_core.isStaticExp)(key) ? (0, _vue_compiler_core.createSimpleExpression)(`${key.content}${modifierPostfix}`, true) : (0, _vue_compiler_core.createCompoundExpression)([
`(`,
key,
`) + "${modifierPostfix}"`
]);
}
return { props: [(0, _vue_compiler_core.createObjectProperty)(key, handlerExp)] };
});
};
//#endregion
//#region packages/compiler-dom/src/transforms/vShow.ts
const transformShow = (dir, node, context) => {
const { exp, loc } = dir;
if (!exp) context.onError(createDOMCompilerError(62, loc));
return {
props: [],
needRuntime: context.helper(V_SHOW)
};
};
//#endregion
//#region packages/compiler-dom/src/transforms/Transition.ts
const transformTransition = (node, context) => {
if (node.type === 1 && node.tagType === 1) {
if (context.isBuiltInComponent(node.tag) === TRANSITION) return postTransformTransition(node, context.onError);
}
};
function postTransformTransition(node, onError, hasMultipleChildren = defaultHasMultipleChildren) {
return () => {
if (!node.children.length) return;
if (hasMultipleChildren(node)) onError(createDOMCompilerError(63, {
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 && !(0, _vue_compiler_core.findDir)(child, "if")) {
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 defaultHasMultipleChildren(node) {
const children = node.children = node.children.filter((c) => !(0, _vue_compiler_core.isCommentOrWhitespace)(c));
const child = children[0];
return children.length !== 1 || child.type === 11 || child.type === 9 && child.branches.some(defaultHasMultipleChildren);
}
//#endregion
//#region packages/compiler-dom/src/transforms/stringifyStatic.ts
/**
* This module is Node-only.
*/
/**
* Regex for replacing placeholders for embedded constant variables
* (e.g. import URL string constants generated by compiler-sfc)
*/
const expReplaceRE = /__VUE_EXP_START__(.*?)__VUE_EXP_END__/g;
/**
* Turn eligible hoisted static trees into stringified static nodes, e.g.
*
* ```js
* const _hoisted_1 = createStaticVNode(`<div class="foo">bar</div>`)
* ```
*
* A single static vnode can contain stringified content for **multiple**
* consecutive nodes (element and plain text), called a "chunk".
* `@vue/runtime-dom` will create the content via innerHTML in a hidden
* container element and insert all the nodes in place. The call must also
* provide the number of nodes contained in the chunk so that during hydration
* we can know how many nodes the static vnode should adopt.
*
* The optimization scans a children list that contains hoisted nodes, and
* tries to find the largest chunk of consecutive hoisted nodes before running
* into a non-hoisted node or the end of the list. A chunk is then converted
* into a single static vnode and replaces the hoisted expression of the first
* node in the chunk. Other nodes in the chunk are considered "merged" and
* therefore removed from both the hoist list and the children array.
*
* This optimization is only performed in Node.js.
*/
const stringifyStatic = (children, context, parent) => {
if (context.scopes.vSlot > 0) return;
const isParentCached = parent.type === 1 && parent.codegenNode && parent.codegenNode.type === 13 && parent.codegenNode.children && !(0, _vue_shared.isArray)(parent.codegenNode.children) && parent.codegenNode.children.type === 20;
let nc = 0;
let ec = 0;
const currentChunk = [];
const stringifyCurrentChunk = (currentIndex) => {
if (nc >= 20 || ec >= 5) {
const staticCall = (0, _vue_compiler_core.createCallExpression)(context.helper(_vue_compiler_core.CREATE_STATIC), [JSON.stringify(currentChunk.map((node) => stringifyNode(node, context)).join("")).replace(expReplaceRE, `" + $1 + "`), String(currentChunk.length)]);
const deleteCount = currentChunk.length - 1;
if (isParentCached) children.splice(currentIndex - currentChunk.length, currentChunk.length, staticCall);
else {
currentChunk[0].codegenNode.value = staticCall;
if (currentChunk.length > 1) {
children.splice(currentIndex - currentChunk.length + 1, deleteCount);
const cacheIndex = context.cached.indexOf(currentChunk[currentChunk.length - 1].codegenNode);
if (cacheIndex > -1) {
for (let i = cacheIndex; i < context.cached.length; i++) {
const c = context.cached[i];
if (c) c.index -= deleteCount;
}
context.cached.splice(cacheIndex - deleteCount + 1, deleteCount);
}
}
}
return deleteCount;
}
return 0;
};
let i = 0;
for (; i < children.length; i++) {
const child = children[i];
if (isParentCached || getCachedNode(child)) {
const result = analyzeNode(child);
if (result) {
nc += result[0];
ec += result[1];
currentChunk.push(child);
continue;
}
}
i -= stringifyCurrentChunk(i);
nc = 0;
ec = 0;
currentChunk.length = 0;
}
stringifyCurrentChunk(i);
};
const getCachedNode = (node) => {
if ((node.type === 1 && node.tagType === 0 || node.type === 12) && node.codegenNode && node.codegenNode.type === 20) return node.codegenNode;
};
const dataAriaRE = /^(?:data|aria)-/;
const isStringifiableAttr = (name, ns) => {
return (ns === 0 ? (0, _vue_shared.isKnownHtmlAttr)(name) : ns === 1 ? (0, _vue_shared.isKnownSvgAttr)(name) : ns === 2 ? (0, _vue_shared.isKnownMathMLAttr)(name) : false) || dataAriaRE.test(name);
};
const isNonStringifiable = /*@__PURE__*/ (0, _vue_shared.makeMap)(`caption,thead,tr,th,tbody,td,tfoot,colgroup,col`);
/**
* for a cached node, analyze it and return:
* - false: bailed (contains non-stringifiable props or runtime constant)
* - [nc, ec] where
* - nc is the number of nodes inside
* - ec is the number of element with bindings inside
*/
function analyzeNode(node) {
if (node.type === 1 && isNonStringifiable(node.tag)) return false;
if (node.type === 1 && (0, _vue_compiler_core.findDir)(node, "once", true)) 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(node) {
const isOptionTag = node.tag === "option" && node.ns === 0;
for (let i = 0; i < node.props.length; i++) {
const p = node.props[i];
if (p.type === 6 && !isStringifiableAttr(p.name, node.ns)) return bail();
if (p.type === 7 && p.name === "bind") {
if (p.arg && (p.arg.type === 8 || p.arg.isStatic && !isStringifiableAttr(p.arg.content, node.ns))) return bail();
if (p.exp && (p.exp.type === 8 || p.exp.constType < 3)) return bail();
if (isOptionTag && (0, _vue_compiler_core.isStaticArgOf)(p.arg, "value") && p.exp && !p.exp.isStatic) return bail();
}
}
for (let i = 0; i < node.children.length; i++) {
nc++;
const child = node.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 ((0, _vue_shared.isString)(node)) return node;
if ((0, _vue_shared.isSymbol)(node)) return ``;
switch (node.type) {
case 1: return stringifyElement(node, context);
case 2: return (0, _vue_shared.escapeHtml)(node.content);
case 3: return `<!--${(0, _vue_shared.escapeHtml)(node.content)}-->`;
case 5: return (0, _vue_shared.escapeHtml)((0, _vue_shared.toDisplayString)(evaluateConstant(node.content)));
case 8: return (0, _vue_shared.escapeHtml)(evaluateConstant(node));
case 12: return stringifyNode(node.content, context);
default: return "";
}
}
function stringifyElement(node, context) {
let res = `<${node.tag}`;
let innerHTML = void 0;
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 += `="${(0, _vue_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 (((0, _vue_shared.isBooleanAttr)(p.arg.content) || p.arg.content === "hidden") && exp.content === "false") continue;
let evaluated = evaluateConstant(exp);
if (evaluated != null) {
const arg = p.arg && p.arg.content;
if (arg === "hidden" && typeof evaluated === "number" && !(0, _vue_shared.includeBooleanAttr)(evaluated)) continue;
if (arg === "class") evaluated = (0, _vue_shared.normalizeClass)(evaluated);
else if (arg === "style") evaluated = (0, _vue_shared.stringifyStyle)((0, _vue_shared.normalizeStyle)(evaluated));
res += ` ${p.arg.content}="${(0, _vue_shared.escapeHtml)(evaluated)}"`;
}
} else if (p.name === "html") {
var _evaluateConstant;
innerHTML = (_evaluateConstant = evaluateConstant(p.exp)) !== null && _evaluateConstant !== void 0 ? _evaluateConstant : "";
} else if (p.name === "text") innerHTML = (0, _vue_shared.escapeHtml)((0, _vue_shared.toDisplayString)(evaluateConstant(p.exp)));
}
}
if (context.scopeId) res += ` ${context.scopeId}`;
res += `>`;
if (innerHTML !== void 0) res += innerHTML;
else for (let i = 0; i < node.children.length; i++) res += stringifyNode(node.children[i], context);
if (!(0, _vue_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 ((0, _vue_shared.isString)(c) || (0, _vue_shared.isSymbol)(c)) return;
if (c.type === 2) res += c.content;
else if (c.type === 5) res += (0, _vue_shared.toDisplayString)(evaluateConstant(c.content));
else res += evaluateConstant(c);
});
return res;
}
}
//#endregion
//#region packages/compiler-dom/src/transforms/ignoreSideEffectTags.ts
const ignoreSideEffectTags = (node, context) => {
if (node.type === 1 && node.tagType === 0 && (node.tag === "script" || node.tag === "style")) {
context.onError(createDOMCompilerError(64, node.loc));
context.removeNode();
}
};
//#endregion
//#region packages/compiler-dom/src/htmlNesting.ts
/**
* Copied from https://github.com/MananTank/validate-html-nesting
* with ISC license
*
* To avoid runtime dependency on validate-html-nesting
* This file should not change very often in the original repo
* but we may need to keep it up-to-date from time to time.
*/
/**
* returns true if given parent-child nesting is valid HTML
*/
function isValidHTMLNesting(parent, child) {
if (parent === "template") return true;
if (parent in onlyValidChildren) return onlyValidChildren[parent].has(child);
if (child in onlyValidParents) return onlyValidParents[child].has(parent);
if (parent in knownInvalidChildren) {
if (knownInvalidChildren[parent].has(child)) return false;
}
if (child in knownInvalidParents) {
if (knownInvalidParents[child].has(parent)) return false;
}
return true;
}
const headings = /* @__PURE__ */ new Set([
"h1",
"h2",
"h3",
"h4",
"h5",
"h6"
]);
const emptySet = /* @__PURE__ */ new Set([]);
/**
* maps element to set of elements that can be it's children, no other */
const onlyValidChildren = {
head: /* @__PURE__ */ new Set([
"base",
"basefront",
"bgsound",
"link",
"meta",
"title",
"noscript",
"noframes",
"style",
"script",
"template"
]),
optgroup: /* @__PURE__ */ new Set(["option"]),
select: /* @__PURE__ */ new Set([
"optgroup",
"option",
"hr"
]),
table: /* @__PURE__ */ new Set([
"caption",
"colgroup",
"tbody",
"tfoot",
"thead"
]),
tr: /* @__PURE__ */ new Set(["td", "th"]),
colgroup: /* @__PURE__ */ new Set(["col"]),
tbody: /* @__PURE__ */ new Set(["tr"]),
thead: /* @__PURE__ */ new Set(["tr"]),
tfoot: /* @__PURE__ */ new Set(["tr"]),
script: emptySet,
iframe: emptySet,
option: emptySet,
textarea: emptySet,
style: emptySet,
title: emptySet
};
/** maps elements to set of elements which can be it's parent, no other */
const onlyValidParents = {
html: emptySet,
body: /* @__PURE__ */ new Set(["html"]),
head: /* @__PURE__ */ new Set(["html"]),
td: /* @__PURE__ */ new Set(["tr"]),
colgroup: /* @__PURE__ */ new Set(["table"]),
caption: /* @__PURE__ */ new Set(["table"]),
tbody: /* @__PURE__ */ new Set(["table"]),
tfoot: /* @__PURE__ */ new Set(["table"]),
col: /* @__PURE__ */ new Set(["colgroup"]),
th: /* @__PURE__ */ new Set(["tr"]),
thead: /* @__PURE__ */ new Set(["table"]),
tr: /* @__PURE__ */ new Set([
"tbody",
"thead",
"tfoot"
]),
dd: /* @__PURE__ */ new Set(["dl", "div"]),
dt: /* @__PURE__ */ new Set(["dl", "div"]),
figcaption: /* @__PURE__ */ new Set(["figure"]),
summary: /* @__PURE__ */ new Set(["details"]),
area: /* @__PURE__ */ new Set(["map"])
};
/** maps element to set of elements that can not be it's children, others can */
const knownInvalidChildren = {
p: /* @__PURE__ */ new Set([
"address",
"article",
"aside",
"blockquote",
"center",
"details",
"dialog",
"dir",
"div",
"dl",
"fieldset",
"figure",
"footer",
"form",
"h1",
"h2",
"h3",
"h4",
"h5",
"h6",
"header",
"hgroup",
"hr",
"li",
"main",
"nav",
"menu",
"ol",
"p",
"pre",
"section",
"table",
"ul"
]),
svg: /* @__PURE__ */ new Set([
"b",
"blockquote",
"br",
"code",
"dd",
"div",
"dl",
"dt",
"em",
"embed",
"h1",
"h2",
"h3",
"h4",
"h5",
"h6",
"hr",
"i",
"img",
"li",
"menu",
"meta",
"ol",
"p",
"pre",
"ruby",
"s",
"small",
"span",
"strong",
"sub",
"sup",
"table",
"u",
"ul",
"var"
])
};
/** maps element to set of elements that can not be it's parent, others can */
const knownInvalidParents = {
a: /* @__PURE__ */ new Set(["a"]),
button: /* @__PURE__ */ new Set(["button"]),
dd: /* @__PURE__ */ new Set(["dd", "dt"]),
dt: /* @__PURE__ */ new Set(["dd", "dt"]),
form: /* @__PURE__ */ new Set(["form"]),
li: /* @__PURE__ */ new Set(["li"]),
h1: headings,
h2: headings,
h3: headings,
h4: headings,
h5: headings,
h6: headings
};
//#endregion
//#region packages/compiler-dom/src/transforms/validateHtmlNesting.ts
const validateHtmlNesting = (node, context) => {
if (node.type === 1 && node.tagType === 0 && context.parent && context.parent.type === 1 && context.parent.tagType === 0 && !isValidHTMLNesting(context.parent.tag, node.tag)) {
const error = /* @__PURE__ */ new SyntaxError(`<${node.tag}> cannot be child of <${context.parent.tag}>, according to HTML specifications. This can cause hydration errors or potentially disrupt future functionality.`);
error.loc = node.loc;
context.onWarn(error);
}
};
//#endregion
//#region packages/compiler-dom/src/index.ts
const DOMNodeTransforms = [
transformStyle,
transformTransition,
...[validateHtmlNesting]
];
const DOMDirectiveTransforms = {
cloak: _vue_compiler_core.noopDirectiveTransform,
html: transformVHtml,
text: transformVText,
model: transformModel,
on: transformOn,
show: transformShow
};
function compile(src, options = {}) {
return (0, _vue_compiler_core.baseCompile)(src, (0, _vue_shared.extend)({}, parserOptions, options, {
nodeTransforms: [
ignoreSideEffectTags,
...DOMNodeTransforms,
...options.nodeTransforms || []
],
directiveTransforms: (0, _vue_shared.extend)({}, DOMDirectiveTransforms, options.directiveTransforms || {}),
transformHoist: stringifyStatic
}));
}
function parse(template, options = {}) {
return (0, _vue_compiler_core.baseParse)(template, (0, _vue_shared.extend)({}, parserOptions, options));
}
//#endregion
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.isKeyboardEvent = isKeyboardEvent;
exports.isValidHTMLNesting = isValidHTMLNesting;
exports.parse = parse;
exports.parserOptions = parserOptions;
exports.postTransformTransition = postTransformTransition;
exports.resolveModifiers = resolveModifiers;
exports.transformStyle = transformStyle;
Object.keys(_vue_compiler_core).forEach(function(k) {
if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
enumerable: true,
get: function() {
return _vue_compiler_core[k];
}
});
});
@@ -0,0 +1,742 @@
/**
* @vue/compiler-dom v3.6.0-rc.14
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT
**/
Object.defineProperties(exports, {
__esModule: { value: true },
[Symbol.toStringTag]: { value: "Module" }
});
let _vue_compiler_core = require("@vue/compiler-core");
let _vue_shared = require("@vue/shared");
//#region packages/compiler-dom/src/runtimeHelpers.ts
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(``);
(0, _vue_compiler_core.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`
});
//#endregion
//#region packages/compiler-dom/src/parserOptions.ts
const parserOptions = {
parseMode: "html",
isVoidTag: _vue_shared.isVoidTag,
isNativeTag: (tag) => (0, _vue_shared.isHTMLTag)(tag) || (0, _vue_shared.isSVGTag)(tag) || (0, _vue_shared.isMathMLTag)(tag),
isPreTag: (tag) => tag === "pre",
isIgnoreNewlineTag: (tag) => tag === "pre" || tag === "textarea",
decodeEntities: void 0,
isBuiltInComponent: (tag) => {
if (tag === "Transition" || tag === "transition") return TRANSITION;
else if (tag === "TransitionGroup" || tag === "transition-group") return TRANSITION_GROUP;
},
getNamespace(tag, parent, rootNamespace) {
let ns = parent ? parent.ns : rootNamespace;
if (parent && ns === 2) {
if (parent.tag === "annotation-xml") {
if ((0, _vue_shared.isSVGTag)(tag)) 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 ((0, _vue_shared.isSVGTag)(tag)) return 1;
if ((0, _vue_shared.isMathMLTag)(tag)) return 2;
}
return ns;
}
};
//#endregion
//#region packages/compiler-dom/src/transforms/transformStyle.ts
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: (0, _vue_compiler_core.createSimpleExpression)(`style`, true, p.loc),
exp: parseInlineCSS(p.value.content, p.loc),
modifiers: [],
loc: p.loc
};
});
};
const parseInlineCSS = (cssText, loc) => {
const normalized = (0, _vue_shared.parseStringStyle)(cssText);
return (0, _vue_compiler_core.createSimpleExpression)(JSON.stringify(normalized), false, loc, 3);
};
//#endregion
//#region packages/compiler-dom/src/errors.ts
function createDOMCompilerError(code, loc) {
return (0, _vue_compiler_core.createCompilerError)(code, loc, DOMErrorMessages);
}
const DOMErrorCodes = {
"X_V_HTML_NO_EXPRESSION": 54,
"54": "X_V_HTML_NO_EXPRESSION",
"X_V_HTML_WITH_CHILDREN": 55,
"55": "X_V_HTML_WITH_CHILDREN",
"X_V_TEXT_NO_EXPRESSION": 56,
"56": "X_V_TEXT_NO_EXPRESSION",
"X_V_TEXT_WITH_CHILDREN": 57,
"57": "X_V_TEXT_WITH_CHILDREN",
"X_V_MODEL_ON_INVALID_ELEMENT": 58,
"58": "X_V_MODEL_ON_INVALID_ELEMENT",
"X_V_MODEL_ARG_ON_ELEMENT": 59,
"59": "X_V_MODEL_ARG_ON_ELEMENT",
"X_V_MODEL_ON_FILE_INPUT_ELEMENT": 60,
"60": "X_V_MODEL_ON_FILE_INPUT_ELEMENT",
"X_V_MODEL_UNNECESSARY_VALUE": 61,
"61": "X_V_MODEL_UNNECESSARY_VALUE",
"X_V_SHOW_NO_EXPRESSION": 62,
"62": "X_V_SHOW_NO_EXPRESSION",
"X_TRANSITION_INVALID_CHILDREN": 63,
"63": "X_TRANSITION_INVALID_CHILDREN",
"X_IGNORED_SIDE_EFFECT_TAG": 64,
"64": "X_IGNORED_SIDE_EFFECT_TAG",
"__EXTEND_POINT__": 65,
"65": "__EXTEND_POINT__"
};
const DOMErrorMessages = {
[54]: `v-html is missing expression.`,
[55]: `v-html will override element children.`,
[56]: `v-text is missing expression.`,
[57]: `v-text will override element children.`,
[58]: `v-model can only be used on <input>, <textarea> and <select> elements.`,
[59]: `v-model argument is not supported on plain elements.`,
[60]: `v-model cannot be used on file inputs since they are read-only. Use a v-on:change listener instead.`,
[61]: `Unnecessary value binding used alongside v-model. It will interfere with v-model's behavior.`,
[62]: `v-show is missing expression.`,
[63]: `<Transition> expects exactly one child element or component.`,
[64]: `Tags with side effect (<script> and <style>) are ignored in client component templates.`,
[65]: ``
};
//#endregion
//#region packages/compiler-dom/src/transforms/vHtml.ts
const transformVHtml = (dir, node, context) => {
const { exp, loc } = dir;
if (!exp) context.onError(createDOMCompilerError(54, loc));
if (node.children.length) {
context.onError(createDOMCompilerError(55, loc));
node.children.length = 0;
}
return { props: [(0, _vue_compiler_core.createObjectProperty)((0, _vue_compiler_core.createSimpleExpression)(`innerHTML`, true, loc), exp || (0, _vue_compiler_core.createSimpleExpression)("", true))] };
};
//#endregion
//#region packages/compiler-dom/src/transforms/vText.ts
const transformVText = (dir, node, context) => {
const { exp, loc } = dir;
if (!exp) context.onError(createDOMCompilerError(56, loc));
if (node.children.length) {
context.onError(createDOMCompilerError(57, loc));
node.children.length = 0;
}
return { props: [(0, _vue_compiler_core.createObjectProperty)((0, _vue_compiler_core.createSimpleExpression)(`textContent`, true), exp ? (0, _vue_compiler_core.getConstantType)(exp, context) > 0 ? exp : (0, _vue_compiler_core.createCallExpression)(context.helperString(_vue_compiler_core.TO_DISPLAY_STRING), [exp], loc) : (0, _vue_compiler_core.createSimpleExpression)("", true))] };
};
//#endregion
//#region packages/compiler-dom/src/transforms/vModel.ts
const transformModel = (dir, node, context) => {
const baseResult = (0, _vue_compiler_core.transformModel)(dir, node, context);
if (!baseResult.props.length || node.tagType === 1) return baseResult;
if (dir.arg) context.onError(createDOMCompilerError(59, 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 = (0, _vue_compiler_core.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(60, dir.loc));
}
} else if ((0, _vue_compiler_core.hasDynamicKeyVBind)(node)) directiveToUse = V_MODEL_DYNAMIC;
} else if (tag === "select") directiveToUse = V_MODEL_SELECT;
if (!isInvalidType) baseResult.needRuntime = context.helper(directiveToUse);
} else context.onError(createDOMCompilerError(58, dir.loc));
baseResult.props = baseResult.props.filter((p) => !(p.key.type === 4 && p.key.content === "modelValue"));
return baseResult;
};
//#endregion
//#region packages/compiler-dom/src/transforms/vOn.ts
const isEventOptionModifier = /*@__PURE__*/ (0, _vue_shared.makeMap)(`passive,once,capture`);
const isNonKeyModifier = /*@__PURE__*/ (0, _vue_shared.makeMap)("stop,prevent,self,ctrl,shift,alt,meta,exact,middle");
const maybeKeyModifier = /*@__PURE__*/ (0, _vue_shared.makeMap)("left,right");
const isKeyboardEvent = /*@__PURE__*/ (0, _vue_shared.makeMap)(`onkeyup,onkeydown,onkeypress`);
const resolveModifiers = (key, modifiers, context, loc) => {
const keyModifiers = [];
const nonKeyModifiers = [];
const eventOptionModifiers = [];
for (let i = 0; i < modifiers.length; i++) {
const modifier = modifiers[i].content;
if (modifier === "delegate") {
if (context) {
const error = /* @__PURE__ */ new SyntaxError(`.delegate modifier is only supported in Vapor components.`);
error.loc = modifiers[i].loc;
context.onWarn(error);
}
continue;
}
if (modifier === "native" && context && (0, _vue_compiler_core.checkCompatEnabled)("COMPILER_V_ON_NATIVE", context, loc)) eventOptionModifiers.push(modifier);
else if (isEventOptionModifier(modifier)) eventOptionModifiers.push(modifier);
else {
const keyString = (0, _vue_shared.isString)(key) ? key : (0, _vue_compiler_core.isStaticExp)(key) ? key.content : null;
if (maybeKeyModifier(modifier)) {
if (keyString) {
if (isKeyboardEvent(keyString.toLowerCase())) 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) => {
return (0, _vue_compiler_core.isStaticExp)(key) && key.content.toLowerCase() === "onclick" ? (0, _vue_compiler_core.createSimpleExpression)(event, true) : key.type !== 4 ? (0, _vue_compiler_core.createCompoundExpression)([
`(`,
key,
`) === "onClick" ? "${event}" : (`,
key,
`)`
]) : key;
};
const transformOn = (dir, node, context) => {
return (0, _vue_compiler_core.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 = (0, _vue_compiler_core.createCallExpression)(context.helper(V_ON_WITH_MODIFIERS), [handlerExp, JSON.stringify(nonKeyModifiers)]);
if (keyModifiers.length && (!(0, _vue_compiler_core.isStaticExp)(key) || isKeyboardEvent(key.content.toLowerCase()))) handlerExp = (0, _vue_compiler_core.createCallExpression)(context.helper(V_ON_WITH_KEYS), [handlerExp, JSON.stringify(keyModifiers)]);
if (eventOptionModifiers.length) {
const modifierPostfix = eventOptionModifiers.map(_vue_shared.capitalize).join("");
key = (0, _vue_compiler_core.isStaticExp)(key) ? (0, _vue_compiler_core.createSimpleExpression)(`${key.content}${modifierPostfix}`, true) : (0, _vue_compiler_core.createCompoundExpression)([
`(`,
key,
`) + "${modifierPostfix}"`
]);
}
return { props: [(0, _vue_compiler_core.createObjectProperty)(key, handlerExp)] };
});
};
//#endregion
//#region packages/compiler-dom/src/transforms/vShow.ts
const transformShow = (dir, node, context) => {
const { exp, loc } = dir;
if (!exp) context.onError(createDOMCompilerError(62, loc));
return {
props: [],
needRuntime: context.helper(V_SHOW)
};
};
//#endregion
//#region packages/compiler-dom/src/transforms/Transition.ts
const transformTransition = (node, context) => {
if (node.type === 1 && node.tagType === 1) {
if (context.isBuiltInComponent(node.tag) === TRANSITION) return postTransformTransition(node, context.onError);
}
};
function postTransformTransition(node, onError, hasMultipleChildren = defaultHasMultipleChildren) {
return () => {
if (!node.children.length) return;
hasMultipleChildren(node);
const child = node.children[0];
if (child.type === 1 && !(0, _vue_compiler_core.findDir)(child, "if")) {
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 defaultHasMultipleChildren(node) {
const children = node.children = node.children.filter((c) => !(0, _vue_compiler_core.isCommentOrWhitespace)(c));
const child = children[0];
return children.length !== 1 || child.type === 11 || child.type === 9 && child.branches.some(defaultHasMultipleChildren);
}
//#endregion
//#region packages/compiler-dom/src/transforms/stringifyStatic.ts
/**
* This module is Node-only.
*/
/**
* Regex for replacing placeholders for embedded constant variables
* (e.g. import URL string constants generated by compiler-sfc)
*/
const expReplaceRE = /__VUE_EXP_START__(.*?)__VUE_EXP_END__/g;
/**
* Turn eligible hoisted static trees into stringified static nodes, e.g.
*
* ```js
* const _hoisted_1 = createStaticVNode(`<div class="foo">bar</div>`)
* ```
*
* A single static vnode can contain stringified content for **multiple**
* consecutive nodes (element and plain text), called a "chunk".
* `@vue/runtime-dom` will create the content via innerHTML in a hidden
* container element and insert all the nodes in place. The call must also
* provide the number of nodes contained in the chunk so that during hydration
* we can know how many nodes the static vnode should adopt.
*
* The optimization scans a children list that contains hoisted nodes, and
* tries to find the largest chunk of consecutive hoisted nodes before running
* into a non-hoisted node or the end of the list. A chunk is then converted
* into a single static vnode and replaces the hoisted expression of the first
* node in the chunk. Other nodes in the chunk are considered "merged" and
* therefore removed from both the hoist list and the children array.
*
* This optimization is only performed in Node.js.
*/
const stringifyStatic = (children, context, parent) => {
if (context.scopes.vSlot > 0) return;
const isParentCached = parent.type === 1 && parent.codegenNode && parent.codegenNode.type === 13 && parent.codegenNode.children && !(0, _vue_shared.isArray)(parent.codegenNode.children) && parent.codegenNode.children.type === 20;
let nc = 0;
let ec = 0;
const currentChunk = [];
const stringifyCurrentChunk = (currentIndex) => {
if (nc >= 20 || ec >= 5) {
const staticCall = (0, _vue_compiler_core.createCallExpression)(context.helper(_vue_compiler_core.CREATE_STATIC), [JSON.stringify(currentChunk.map((node) => stringifyNode(node, context)).join("")).replace(expReplaceRE, `" + $1 + "`), String(currentChunk.length)]);
const deleteCount = currentChunk.length - 1;
if (isParentCached) children.splice(currentIndex - currentChunk.length, currentChunk.length, staticCall);
else {
currentChunk[0].codegenNode.value = staticCall;
if (currentChunk.length > 1) {
children.splice(currentIndex - currentChunk.length + 1, deleteCount);
const cacheIndex = context.cached.indexOf(currentChunk[currentChunk.length - 1].codegenNode);
if (cacheIndex > -1) {
for (let i = cacheIndex; i < context.cached.length; i++) {
const c = context.cached[i];
if (c) c.index -= deleteCount;
}
context.cached.splice(cacheIndex - deleteCount + 1, deleteCount);
}
}
}
return deleteCount;
}
return 0;
};
let i = 0;
for (; i < children.length; i++) {
const child = children[i];
if (isParentCached || getCachedNode(child)) {
const result = analyzeNode(child);
if (result) {
nc += result[0];
ec += result[1];
currentChunk.push(child);
continue;
}
}
i -= stringifyCurrentChunk(i);
nc = 0;
ec = 0;
currentChunk.length = 0;
}
stringifyCurrentChunk(i);
};
const getCachedNode = (node) => {
if ((node.type === 1 && node.tagType === 0 || node.type === 12) && node.codegenNode && node.codegenNode.type === 20) return node.codegenNode;
};
const dataAriaRE = /^(?:data|aria)-/;
const isStringifiableAttr = (name, ns) => {
return (ns === 0 ? (0, _vue_shared.isKnownHtmlAttr)(name) : ns === 1 ? (0, _vue_shared.isKnownSvgAttr)(name) : ns === 2 ? (0, _vue_shared.isKnownMathMLAttr)(name) : false) || dataAriaRE.test(name);
};
const isNonStringifiable = /*@__PURE__*/ (0, _vue_shared.makeMap)(`caption,thead,tr,th,tbody,td,tfoot,colgroup,col`);
/**
* for a cached node, analyze it and return:
* - false: bailed (contains non-stringifiable props or runtime constant)
* - [nc, ec] where
* - nc is the number of nodes inside
* - ec is the number of element with bindings inside
*/
function analyzeNode(node) {
if (node.type === 1 && isNonStringifiable(node.tag)) return false;
if (node.type === 1 && (0, _vue_compiler_core.findDir)(node, "once", true)) 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(node) {
const isOptionTag = node.tag === "option" && node.ns === 0;
for (let i = 0; i < node.props.length; i++) {
const p = node.props[i];
if (p.type === 6 && !isStringifiableAttr(p.name, node.ns)) return bail();
if (p.type === 7 && p.name === "bind") {
if (p.arg && (p.arg.type === 8 || p.arg.isStatic && !isStringifiableAttr(p.arg.content, node.ns))) return bail();
if (p.exp && (p.exp.type === 8 || p.exp.constType < 3)) return bail();
if (isOptionTag && (0, _vue_compiler_core.isStaticArgOf)(p.arg, "value") && p.exp && !p.exp.isStatic) return bail();
}
}
for (let i = 0; i < node.children.length; i++) {
nc++;
const child = node.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 ((0, _vue_shared.isString)(node)) return node;
if ((0, _vue_shared.isSymbol)(node)) return ``;
switch (node.type) {
case 1: return stringifyElement(node, context);
case 2: return (0, _vue_shared.escapeHtml)(node.content);
case 3: return `<!--${(0, _vue_shared.escapeHtml)(node.content)}-->`;
case 5: return (0, _vue_shared.escapeHtml)((0, _vue_shared.toDisplayString)(evaluateConstant(node.content)));
case 8: return (0, _vue_shared.escapeHtml)(evaluateConstant(node));
case 12: return stringifyNode(node.content, context);
default: return "";
}
}
function stringifyElement(node, context) {
let res = `<${node.tag}`;
let innerHTML = void 0;
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 += `="${(0, _vue_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 (((0, _vue_shared.isBooleanAttr)(p.arg.content) || p.arg.content === "hidden") && exp.content === "false") continue;
let evaluated = evaluateConstant(exp);
if (evaluated != null) {
const arg = p.arg && p.arg.content;
if (arg === "hidden" && typeof evaluated === "number" && !(0, _vue_shared.includeBooleanAttr)(evaluated)) continue;
if (arg === "class") evaluated = (0, _vue_shared.normalizeClass)(evaluated);
else if (arg === "style") evaluated = (0, _vue_shared.stringifyStyle)((0, _vue_shared.normalizeStyle)(evaluated));
res += ` ${p.arg.content}="${(0, _vue_shared.escapeHtml)(evaluated)}"`;
}
} else if (p.name === "html") {
var _evaluateConstant;
innerHTML = (_evaluateConstant = evaluateConstant(p.exp)) !== null && _evaluateConstant !== void 0 ? _evaluateConstant : "";
} else if (p.name === "text") innerHTML = (0, _vue_shared.escapeHtml)((0, _vue_shared.toDisplayString)(evaluateConstant(p.exp)));
}
}
if (context.scopeId) res += ` ${context.scopeId}`;
res += `>`;
if (innerHTML !== void 0) res += innerHTML;
else for (let i = 0; i < node.children.length; i++) res += stringifyNode(node.children[i], context);
if (!(0, _vue_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 ((0, _vue_shared.isString)(c) || (0, _vue_shared.isSymbol)(c)) return;
if (c.type === 2) res += c.content;
else if (c.type === 5) res += (0, _vue_shared.toDisplayString)(evaluateConstant(c.content));
else res += evaluateConstant(c);
});
return res;
}
}
//#endregion
//#region packages/compiler-dom/src/transforms/ignoreSideEffectTags.ts
const ignoreSideEffectTags = (node, context) => {
if (node.type === 1 && node.tagType === 0 && (node.tag === "script" || node.tag === "style")) context.removeNode();
};
//#endregion
//#region packages/compiler-dom/src/htmlNesting.ts
/**
* Copied from https://github.com/MananTank/validate-html-nesting
* with ISC license
*
* To avoid runtime dependency on validate-html-nesting
* This file should not change very often in the original repo
* but we may need to keep it up-to-date from time to time.
*/
/**
* returns true if given parent-child nesting is valid HTML
*/
function isValidHTMLNesting(parent, child) {
if (parent === "template") return true;
if (parent in onlyValidChildren) return onlyValidChildren[parent].has(child);
if (child in onlyValidParents) return onlyValidParents[child].has(parent);
if (parent in knownInvalidChildren) {
if (knownInvalidChildren[parent].has(child)) return false;
}
if (child in knownInvalidParents) {
if (knownInvalidParents[child].has(parent)) return false;
}
return true;
}
const headings = /* @__PURE__ */ new Set([
"h1",
"h2",
"h3",
"h4",
"h5",
"h6"
]);
const emptySet = /* @__PURE__ */ new Set([]);
/**
* maps element to set of elements that can be it's children, no other */
const onlyValidChildren = {
head: /* @__PURE__ */ new Set([
"base",
"basefront",
"bgsound",
"link",
"meta",
"title",
"noscript",
"noframes",
"style",
"script",
"template"
]),
optgroup: /* @__PURE__ */ new Set(["option"]),
select: /* @__PURE__ */ new Set([
"optgroup",
"option",
"hr"
]),
table: /* @__PURE__ */ new Set([
"caption",
"colgroup",
"tbody",
"tfoot",
"thead"
]),
tr: /* @__PURE__ */ new Set(["td", "th"]),
colgroup: /* @__PURE__ */ new Set(["col"]),
tbody: /* @__PURE__ */ new Set(["tr"]),
thead: /* @__PURE__ */ new Set(["tr"]),
tfoot: /* @__PURE__ */ new Set(["tr"]),
script: emptySet,
iframe: emptySet,
option: emptySet,
textarea: emptySet,
style: emptySet,
title: emptySet
};
/** maps elements to set of elements which can be it's parent, no other */
const onlyValidParents = {
html: emptySet,
body: /* @__PURE__ */ new Set(["html"]),
head: /* @__PURE__ */ new Set(["html"]),
td: /* @__PURE__ */ new Set(["tr"]),
colgroup: /* @__PURE__ */ new Set(["table"]),
caption: /* @__PURE__ */ new Set(["table"]),
tbody: /* @__PURE__ */ new Set(["table"]),
tfoot: /* @__PURE__ */ new Set(["table"]),
col: /* @__PURE__ */ new Set(["colgroup"]),
th: /* @__PURE__ */ new Set(["tr"]),
thead: /* @__PURE__ */ new Set(["table"]),
tr: /* @__PURE__ */ new Set([
"tbody",
"thead",
"tfoot"
]),
dd: /* @__PURE__ */ new Set(["dl", "div"]),
dt: /* @__PURE__ */ new Set(["dl", "div"]),
figcaption: /* @__PURE__ */ new Set(["figure"]),
summary: /* @__PURE__ */ new Set(["details"]),
area: /* @__PURE__ */ new Set(["map"])
};
/** maps element to set of elements that can not be it's children, others can */
const knownInvalidChildren = {
p: /* @__PURE__ */ new Set([
"address",
"article",
"aside",
"blockquote",
"center",
"details",
"dialog",
"dir",
"div",
"dl",
"fieldset",
"figure",
"footer",
"form",
"h1",
"h2",
"h3",
"h4",
"h5",
"h6",
"header",
"hgroup",
"hr",
"li",
"main",
"nav",
"menu",
"ol",
"p",
"pre",
"section",
"table",
"ul"
]),
svg: /* @__PURE__ */ new Set([
"b",
"blockquote",
"br",
"code",
"dd",
"div",
"dl",
"dt",
"em",
"embed",
"h1",
"h2",
"h3",
"h4",
"h5",
"h6",
"hr",
"i",
"img",
"li",
"menu",
"meta",
"ol",
"p",
"pre",
"ruby",
"s",
"small",
"span",
"strong",
"sub",
"sup",
"table",
"u",
"ul",
"var"
])
};
/** maps element to set of elements that can not be it's parent, others can */
const knownInvalidParents = {
a: /* @__PURE__ */ new Set(["a"]),
button: /* @__PURE__ */ new Set(["button"]),
dd: /* @__PURE__ */ new Set(["dd", "dt"]),
dt: /* @__PURE__ */ new Set(["dd", "dt"]),
form: /* @__PURE__ */ new Set(["form"]),
li: /* @__PURE__ */ new Set(["li"]),
h1: headings,
h2: headings,
h3: headings,
h4: headings,
h5: headings,
h6: headings
};
//#endregion
//#region packages/compiler-dom/src/index.ts
const DOMNodeTransforms = [
transformStyle,
transformTransition,
...[]
];
const DOMDirectiveTransforms = {
cloak: _vue_compiler_core.noopDirectiveTransform,
html: transformVHtml,
text: transformVText,
model: transformModel,
on: transformOn,
show: transformShow
};
function compile(src, options = {}) {
return (0, _vue_compiler_core.baseCompile)(src, (0, _vue_shared.extend)({}, parserOptions, options, {
nodeTransforms: [
ignoreSideEffectTags,
...DOMNodeTransforms,
...options.nodeTransforms || []
],
directiveTransforms: (0, _vue_shared.extend)({}, DOMDirectiveTransforms, options.directiveTransforms || {}),
transformHoist: stringifyStatic
}));
}
function parse(template, options = {}) {
return (0, _vue_compiler_core.baseParse)(template, (0, _vue_shared.extend)({}, parserOptions, options));
}
//#endregion
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.isKeyboardEvent = isKeyboardEvent;
exports.isValidHTMLNesting = isValidHTMLNesting;
exports.parse = parse;
exports.parserOptions = parserOptions;
exports.postTransformTransition = postTransformTransition;
exports.resolveModifiers = resolveModifiers;
exports.transformStyle = transformStyle;
Object.keys(_vue_compiler_core).forEach(function(k) {
if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
enumerable: true,
get: function() {
return _vue_compiler_core[k];
}
});
});
@@ -0,0 +1,72 @@
import { CodegenResult, CompilerError, CompilerOptions, ComponentNode, DirectiveTransform, ExpressionNode, NodeTransform, ParserOptions, RootNode, SimpleExpressionNode, SourceLocation, TransformContext } from "@vue/compiler-core";
export * from "@vue/compiler-core";
//#region temp/packages/compiler-dom/src/parserOptions.d.ts
export declare const parserOptions: ParserOptions;
//#endregion
//#region temp/packages/compiler-dom/src/runtimeHelpers.d.ts
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;
//#endregion
//#region temp/packages/compiler-dom/src/transforms/transformStyle.d.ts
export declare const transformStyle: NodeTransform;
//#endregion
//#region temp/packages/compiler-dom/src/errors.d.ts
interface DOMCompilerError extends CompilerError {
code: DOMErrorCodes;
}
export declare function createDOMCompilerError(code: DOMErrorCodes, loc?: SourceLocation): DOMCompilerError;
export declare enum DOMErrorCodes {
X_V_HTML_NO_EXPRESSION = 54,
X_V_HTML_WITH_CHILDREN = 55,
X_V_TEXT_NO_EXPRESSION = 56,
X_V_TEXT_WITH_CHILDREN = 57,
X_V_MODEL_ON_INVALID_ELEMENT = 58,
X_V_MODEL_ARG_ON_ELEMENT = 59,
X_V_MODEL_ON_FILE_INPUT_ELEMENT = 60,
X_V_MODEL_UNNECESSARY_VALUE = 61,
X_V_SHOW_NO_EXPRESSION = 62,
X_TRANSITION_INVALID_CHILDREN = 63,
X_IGNORED_SIDE_EFFECT_TAG = 64,
__EXTEND_POINT__ = 65
}
export declare const DOMErrorMessages: Record<DOMErrorCodes, string>;
//#endregion
//#region temp/packages/compiler-dom/src/transforms/vOn.d.ts
export declare const isKeyboardEvent: (key: string) => boolean;
export declare const resolveModifiers: (key: ExpressionNode | string, modifiers: SimpleExpressionNode[], context: TransformContext | null, loc: SourceLocation) => {
keyModifiers: string[];
nonKeyModifiers: string[];
eventOptionModifiers: string[];
};
//#endregion
//#region temp/packages/compiler-dom/src/htmlNesting.d.ts
/**
* Copied from https://github.com/MananTank/validate-html-nesting
* with ISC license
*
* To avoid runtime dependency on validate-html-nesting
* This file should not change very often in the original repo
* but we may need to keep it up-to-date from time to time.
*/
/**
* returns true if given parent-child nesting is valid HTML
*/
export declare function isValidHTMLNesting(parent: string, child: string): boolean;
//#endregion
//#region temp/packages/compiler-dom/src/transforms/Transition.d.ts
export declare function postTransformTransition(node: ComponentNode, onError: (error: CompilerError) => void, hasMultipleChildren?: (node: ComponentNode) => boolean): () => void;
//#endregion
//#region temp/packages/compiler-dom/src/index.d.ts
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;
//#endregion
File diff suppressed because one or more lines are too long
@@ -0,0 +1,553 @@
/**
* @vue/compiler-dom v3.6.0-rc.14
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT
**/
import { TO_DISPLAY_STRING, baseCompile, baseParse, checkCompatEnabled, createCallExpression, createCompilerError, createCompoundExpression, createObjectProperty, createSimpleExpression, findDir, findProp, getConstantType, hasDynamicKeyVBind, isCommentOrWhitespace, isStaticArgOf, isStaticExp, noopDirectiveTransform, registerRuntimeHelpers, transformModel, transformOn } from "@vue/compiler-core";
import { capitalize, extend, isHTMLTag, isMathMLTag, isSVGTag, isString, isVoidTag, makeMap, parseStringStyle } from "@vue/shared";
export * from "@vue/compiler-core";
//#region packages/compiler-dom/src/runtimeHelpers.ts
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`
});
//#endregion
//#region packages/compiler-dom/src/decodeHtmlBrowser.ts
let decoder;
function decodeHtmlBrowser(raw, asAttr = false) {
if (!decoder) decoder = document.createElement("div");
if (asAttr) {
decoder.innerHTML = `<div foo="${raw.replace(/"/g, "&quot;")}">`;
return decoder.children[0].getAttribute("foo");
} else {
decoder.innerHTML = raw;
return decoder.textContent;
}
}
//#endregion
//#region packages/compiler-dom/src/parserOptions.ts
const parserOptions = {
parseMode: "html",
isVoidTag,
isNativeTag: (tag) => isHTMLTag(tag) || isSVGTag(tag) || isMathMLTag(tag),
isPreTag: (tag) => tag === "pre",
isIgnoreNewlineTag: (tag) => tag === "pre" || tag === "textarea",
decodeEntities: decodeHtmlBrowser,
isBuiltInComponent: (tag) => {
if (tag === "Transition" || tag === "transition") return TRANSITION;
else if (tag === "TransitionGroup" || tag === "transition-group") return TRANSITION_GROUP;
},
getNamespace(tag, parent, rootNamespace) {
let ns = parent ? parent.ns : rootNamespace;
if (parent && ns === 2) {
if (parent.tag === "annotation-xml") {
if (isSVGTag(tag)) 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 (isSVGTag(tag)) return 1;
if (isMathMLTag(tag)) return 2;
}
return ns;
}
};
//#endregion
//#region packages/compiler-dom/src/transforms/transformStyle.ts
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);
};
//#endregion
//#region packages/compiler-dom/src/errors.ts
function createDOMCompilerError(code, loc) {
return createCompilerError(code, loc, !!(process.env.NODE_ENV !== "production") || false ? DOMErrorMessages : void 0);
}
const DOMErrorCodes = {
"X_V_HTML_NO_EXPRESSION": 54,
"54": "X_V_HTML_NO_EXPRESSION",
"X_V_HTML_WITH_CHILDREN": 55,
"55": "X_V_HTML_WITH_CHILDREN",
"X_V_TEXT_NO_EXPRESSION": 56,
"56": "X_V_TEXT_NO_EXPRESSION",
"X_V_TEXT_WITH_CHILDREN": 57,
"57": "X_V_TEXT_WITH_CHILDREN",
"X_V_MODEL_ON_INVALID_ELEMENT": 58,
"58": "X_V_MODEL_ON_INVALID_ELEMENT",
"X_V_MODEL_ARG_ON_ELEMENT": 59,
"59": "X_V_MODEL_ARG_ON_ELEMENT",
"X_V_MODEL_ON_FILE_INPUT_ELEMENT": 60,
"60": "X_V_MODEL_ON_FILE_INPUT_ELEMENT",
"X_V_MODEL_UNNECESSARY_VALUE": 61,
"61": "X_V_MODEL_UNNECESSARY_VALUE",
"X_V_SHOW_NO_EXPRESSION": 62,
"62": "X_V_SHOW_NO_EXPRESSION",
"X_TRANSITION_INVALID_CHILDREN": 63,
"63": "X_TRANSITION_INVALID_CHILDREN",
"X_IGNORED_SIDE_EFFECT_TAG": 64,
"64": "X_IGNORED_SIDE_EFFECT_TAG",
"__EXTEND_POINT__": 65,
"65": "__EXTEND_POINT__"
};
const DOMErrorMessages = {
[54]: `v-html is missing expression.`,
[55]: `v-html will override element children.`,
[56]: `v-text is missing expression.`,
[57]: `v-text will override element children.`,
[58]: `v-model can only be used on <input>, <textarea> and <select> elements.`,
[59]: `v-model argument is not supported on plain elements.`,
[60]: `v-model cannot be used on file inputs since they are read-only. Use a v-on:change listener instead.`,
[61]: `Unnecessary value binding used alongside v-model. It will interfere with v-model's behavior.`,
[62]: `v-show is missing expression.`,
[63]: `<Transition> expects exactly one child element or component.`,
[64]: `Tags with side effect (<script> and <style>) are ignored in client component templates.`,
[65]: ``
};
//#endregion
//#region packages/compiler-dom/src/transforms/vHtml.ts
const transformVHtml = (dir, node, context) => {
const { exp, loc } = dir;
if (!exp) context.onError(createDOMCompilerError(54, loc));
if (node.children.length) {
context.onError(createDOMCompilerError(55, loc));
node.children.length = 0;
}
return { props: [createObjectProperty(createSimpleExpression(`innerHTML`, true, loc), exp || createSimpleExpression("", true))] };
};
//#endregion
//#region packages/compiler-dom/src/transforms/vText.ts
const transformVText = (dir, node, context) => {
const { exp, loc } = dir;
if (!exp) context.onError(createDOMCompilerError(56, loc));
if (node.children.length) {
context.onError(createDOMCompilerError(57, 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))] };
};
//#endregion
//#region packages/compiler-dom/src/transforms/vModel.ts
const transformModel$1 = (dir, node, context) => {
const baseResult = transformModel(dir, node, context);
if (!baseResult.props.length || node.tagType === 1) return baseResult;
if (dir.arg) context.onError(createDOMCompilerError(59, dir.arg.loc));
function checkDuplicatedValue() {
const value = findDir(node, "bind");
if (value && isStaticArgOf(value.arg, "value")) context.onError(createDOMCompilerError(61, 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(60, dir.loc));
break;
default: process.env.NODE_ENV !== "production" && checkDuplicatedValue();
}
} 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(58, dir.loc));
baseResult.props = baseResult.props.filter((p) => !(p.key.type === 4 && p.key.content === "modelValue"));
return baseResult;
};
//#endregion
//#region packages/compiler-dom/src/transforms/vOn.ts
const isEventOptionModifier = /*@__PURE__*/ makeMap(`passive,once,capture`);
const isNonKeyModifier = /*@__PURE__*/ makeMap("stop,prevent,self,ctrl,shift,alt,meta,exact,middle");
const maybeKeyModifier = /*@__PURE__*/ makeMap("left,right");
const isKeyboardEvent = /*@__PURE__*/ makeMap(`onkeyup,onkeydown,onkeypress`);
const resolveModifiers = (key, modifiers, context, loc) => {
const keyModifiers = [];
const nonKeyModifiers = [];
const eventOptionModifiers = [];
for (let i = 0; i < modifiers.length; i++) {
const modifier = modifiers[i].content;
if (modifier === "delegate") {
if (context) {
const error = /* @__PURE__ */ new SyntaxError(`.delegate modifier is only supported in Vapor components.`);
error.loc = modifiers[i].loc;
context.onWarn(error);
}
continue;
}
if (modifier === "native" && context && checkCompatEnabled("COMPILER_V_ON_NATIVE", context, loc)) eventOptionModifiers.push(modifier);
else if (isEventOptionModifier(modifier)) eventOptionModifiers.push(modifier);
else {
const keyString = isString(key) ? key : isStaticExp(key) ? key.content : null;
if (maybeKeyModifier(modifier)) {
if (keyString) {
if (isKeyboardEvent(keyString.toLowerCase())) 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) => {
return isStaticExp(key) && key.content.toLowerCase() === "onclick" ? createSimpleExpression(event, true) : key.type !== 4 ? createCompoundExpression([
`(`,
key,
`) === "onClick" ? "${event}" : (`,
key,
`)`
]) : key;
};
const transformOn$1 = (dir, node, context) => {
return 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 = createCallExpression(context.helper(V_ON_WITH_MODIFIERS), [handlerExp, JSON.stringify(nonKeyModifiers)]);
if (keyModifiers.length && (!isStaticExp(key) || isKeyboardEvent(key.content.toLowerCase()))) 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)] };
});
};
//#endregion
//#region packages/compiler-dom/src/transforms/vShow.ts
const transformShow = (dir, node, context) => {
const { exp, loc } = dir;
if (!exp) context.onError(createDOMCompilerError(62, loc));
return {
props: [],
needRuntime: context.helper(V_SHOW)
};
};
//#endregion
//#region packages/compiler-dom/src/transforms/Transition.ts
const transformTransition = (node, context) => {
if (node.type === 1 && node.tagType === 1) {
if (context.isBuiltInComponent(node.tag) === TRANSITION) return postTransformTransition(node, context.onError);
}
};
function postTransformTransition(node, onError, hasMultipleChildren = defaultHasMultipleChildren) {
return () => {
if (!node.children.length) return;
const multipleChildren = hasMultipleChildren(node);
if (!!(process.env.NODE_ENV !== "production") && multipleChildren) onError(createDOMCompilerError(63, {
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 && !findDir(child, "if")) {
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 defaultHasMultipleChildren(node) {
const children = node.children = node.children.filter((c) => !isCommentOrWhitespace(c));
const child = children[0];
return children.length !== 1 || child.type === 11 || child.type === 9 && child.branches.some(defaultHasMultipleChildren);
}
//#endregion
//#region packages/compiler-dom/src/transforms/ignoreSideEffectTags.ts
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(64, node.loc));
context.removeNode();
}
};
//#endregion
//#region packages/compiler-dom/src/htmlNesting.ts
/**
* Copied from https://github.com/MananTank/validate-html-nesting
* with ISC license
*
* To avoid runtime dependency on validate-html-nesting
* This file should not change very often in the original repo
* but we may need to keep it up-to-date from time to time.
*/
/**
* returns true if given parent-child nesting is valid HTML
*/
function isValidHTMLNesting(parent, child) {
if (parent === "template") return true;
if (parent in onlyValidChildren) return onlyValidChildren[parent].has(child);
if (child in onlyValidParents) return onlyValidParents[child].has(parent);
if (parent in knownInvalidChildren) {
if (knownInvalidChildren[parent].has(child)) return false;
}
if (child in knownInvalidParents) {
if (knownInvalidParents[child].has(parent)) return false;
}
return true;
}
const headings = /* @__PURE__ */ new Set([
"h1",
"h2",
"h3",
"h4",
"h5",
"h6"
]);
const emptySet = /* @__PURE__ */ new Set([]);
/**
* maps element to set of elements that can be it's children, no other */
const onlyValidChildren = {
head: /* @__PURE__ */ new Set([
"base",
"basefront",
"bgsound",
"link",
"meta",
"title",
"noscript",
"noframes",
"style",
"script",
"template"
]),
optgroup: /* @__PURE__ */ new Set(["option"]),
select: /* @__PURE__ */ new Set([
"optgroup",
"option",
"hr"
]),
table: /* @__PURE__ */ new Set([
"caption",
"colgroup",
"tbody",
"tfoot",
"thead"
]),
tr: /* @__PURE__ */ new Set(["td", "th"]),
colgroup: /* @__PURE__ */ new Set(["col"]),
tbody: /* @__PURE__ */ new Set(["tr"]),
thead: /* @__PURE__ */ new Set(["tr"]),
tfoot: /* @__PURE__ */ new Set(["tr"]),
script: emptySet,
iframe: emptySet,
option: emptySet,
textarea: emptySet,
style: emptySet,
title: emptySet
};
/** maps elements to set of elements which can be it's parent, no other */
const onlyValidParents = {
html: emptySet,
body: /* @__PURE__ */ new Set(["html"]),
head: /* @__PURE__ */ new Set(["html"]),
td: /* @__PURE__ */ new Set(["tr"]),
colgroup: /* @__PURE__ */ new Set(["table"]),
caption: /* @__PURE__ */ new Set(["table"]),
tbody: /* @__PURE__ */ new Set(["table"]),
tfoot: /* @__PURE__ */ new Set(["table"]),
col: /* @__PURE__ */ new Set(["colgroup"]),
th: /* @__PURE__ */ new Set(["tr"]),
thead: /* @__PURE__ */ new Set(["table"]),
tr: /* @__PURE__ */ new Set([
"tbody",
"thead",
"tfoot"
]),
dd: /* @__PURE__ */ new Set(["dl", "div"]),
dt: /* @__PURE__ */ new Set(["dl", "div"]),
figcaption: /* @__PURE__ */ new Set(["figure"]),
summary: /* @__PURE__ */ new Set(["details"]),
area: /* @__PURE__ */ new Set(["map"])
};
/** maps element to set of elements that can not be it's children, others can */
const knownInvalidChildren = {
p: /* @__PURE__ */ new Set([
"address",
"article",
"aside",
"blockquote",
"center",
"details",
"dialog",
"dir",
"div",
"dl",
"fieldset",
"figure",
"footer",
"form",
"h1",
"h2",
"h3",
"h4",
"h5",
"h6",
"header",
"hgroup",
"hr",
"li",
"main",
"nav",
"menu",
"ol",
"p",
"pre",
"section",
"table",
"ul"
]),
svg: /* @__PURE__ */ new Set([
"b",
"blockquote",
"br",
"code",
"dd",
"div",
"dl",
"dt",
"em",
"embed",
"h1",
"h2",
"h3",
"h4",
"h5",
"h6",
"hr",
"i",
"img",
"li",
"menu",
"meta",
"ol",
"p",
"pre",
"ruby",
"s",
"small",
"span",
"strong",
"sub",
"sup",
"table",
"u",
"ul",
"var"
])
};
/** maps element to set of elements that can not be it's parent, others can */
const knownInvalidParents = {
a: /* @__PURE__ */ new Set(["a"]),
button: /* @__PURE__ */ new Set(["button"]),
dd: /* @__PURE__ */ new Set(["dd", "dt"]),
dt: /* @__PURE__ */ new Set(["dd", "dt"]),
form: /* @__PURE__ */ new Set(["form"]),
li: /* @__PURE__ */ new Set(["li"]),
h1: headings,
h2: headings,
h3: headings,
h4: headings,
h5: headings,
h6: headings
};
//#endregion
//#region packages/compiler-dom/src/transforms/validateHtmlNesting.ts
const validateHtmlNesting = (node, context) => {
if (node.type === 1 && node.tagType === 0 && context.parent && context.parent.type === 1 && context.parent.tagType === 0 && !isValidHTMLNesting(context.parent.tag, node.tag)) {
const error = /* @__PURE__ */ new SyntaxError(`<${node.tag}> cannot be child of <${context.parent.tag}>, according to HTML specifications. This can cause hydration errors or potentially disrupt future functionality.`);
error.loc = node.loc;
context.onWarn(error);
}
};
//#endregion
//#region packages/compiler-dom/src/index.ts
const DOMNodeTransforms = [
transformStyle,
transformTransition,
...!!(process.env.NODE_ENV !== "production") ? [validateHtmlNesting] : []
];
const DOMDirectiveTransforms = {
cloak: noopDirectiveTransform,
html: transformVHtml,
text: transformVText,
model: transformModel$1,
on: transformOn$1,
show: transformShow
};
function compile(src, options = {}) {
return baseCompile(src, extend({}, parserOptions, options, {
nodeTransforms: [
ignoreSideEffectTags,
...DOMNodeTransforms,
...options.nodeTransforms || []
],
directiveTransforms: extend({}, DOMDirectiveTransforms, options.directiveTransforms || {}),
transformHoist: null
}));
}
function parse(template, options = {}) {
return baseParse(template, extend({}, parserOptions, options));
}
//#endregion
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, isKeyboardEvent, isValidHTMLNesting, parse, parserOptions, postTransformTransition, resolveModifiers, transformStyle };
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
@@ -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')
}
@@ -0,0 +1,57 @@
{
"name": "@vue/compiler-dom",
"version": "3.6.0-alpha.2",
"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": "workspace:*",
"@vue/compiler-core": "workspace:*"
}
}
@@ -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.
@@ -0,0 +1,80 @@
# @vue/compiler-sfc
> Lower level utilities for compiling Vue Single File Components
**Note: as of 3.2.13+, this package is included as a dependency of the main `vue` package and can be accessed as `vue/compiler-sfc`. This means you no longer need to explicitly install this package and ensure its version match that of `vue`'s. Just use the main `vue/compiler-sfc` deep import instead.**
This package contains lower level utilities that you can use if you are writing a plugin / transform for a bundler or module system that compiles Vue Single File Components (SFCs) into JavaScript. It is used in [vue-loader](https://github.com/vuejs/vue-loader) and [@vitejs/plugin-vue](https://github.com/vitejs/vite-plugin-vue/tree/main/packages/plugin-vue).
## API
The API is intentionally low-level due to the various considerations when integrating Vue SFCs in a build system:
- Separate hot-module replacement (HMR) for script, template and styles
- template updates should not reset component state
- style updates should be performed without component re-render
- Leveraging the tool's plugin system for pre-processor handling. e.g. `<style lang="scss">` should be processed by the corresponding webpack loader.
- In some cases, transformers of each block in an SFC do not share the same execution context. For example, when used with `thread-loader` or other parallelized configurations, the template sub-loader in `vue-loader` may not have access to the full SFC and its descriptor.
The general idea is to generate a facade module that imports the individual blocks of the component. The trick is the module imports itself with different query strings so that the build system can handle each request as "virtual" modules:
```
+--------------------+
| |
| script transform |
+----->+ |
| +--------------------+
|
+--------------------+ | +--------------------+
| | | | |
| facade transform +----------->+ template transform |
| | | | |
+--------------------+ | +--------------------+
|
| +--------------------+
+----->+ |
| style transform |
| |
+--------------------+
```
Where the facade module looks like this:
```js
// main script
import script from '/project/foo.vue?vue&type=script'
// template compiled to render function
import { render } from '/project/foo.vue?vue&type=template&id=xxxxxx'
// css
import '/project/foo.vue?vue&type=style&index=0&id=xxxxxx'
// attach render function to script
script.render = render
// attach additional metadata
// some of these should be dev only
script.__file = 'example.vue'
script.__scopeId = 'xxxxxx'
// additional tooling-specific HMR handling code
// using __VUE_HMR_API__ global
export default script
```
### High Level Workflow
1. In facade transform, parse the source into descriptor with the `parse` API and generate the above facade module code based on the descriptor;
2. In script transform, use `compileScript` to process the script. This handles features like `<script setup>` and CSS variable injection. Alternatively, this can be done directly in the facade module (with the code inlined instead of imported), but it will require rewriting `export default` to a temp variable (a `rewriteDefault` convenience API is provided for this purpose) so additional options can be attached to the exported object.
3. In template transform, use `compileTemplate` to compile the raw template into render function code.
4. In style transform, use `compileStyle` to compile raw CSS to handle `<style scoped>`, `<style module>` and CSS variable injection.
Options needed for these APIs can be passed via the query string.
For detailed API references and options, check out the source type definitions. For actual usage of these APIs, check out [@vitejs/plugin-vue](https://github.com/vitejs/vite-plugin-vue/tree/main/packages/plugin-vue) or [vue-loader](https://github.com/vuejs/vue-loader/tree/next).
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,515 @@
import { BaseCodegenResult, BindingMetadata, BindingMetadata as BindingMetadata$1, CompilerError, CompilerError as CompilerError$1, CompilerOptions, CompilerOptions as CompilerOptions$1, ParserOptions, RawSourceMap, RootNode, SourceLocation, extractIdentifiers, generateCodeFrame, isInDestructureAssignment, isStaticProperty, walkIdentifiers } from "@vue/compiler-core";
import { ParserPlugin, parse as babelParse } from "@babel/parser";
import "source-map-js";
import "lru-cache";
import { LazyResult, Result } from "postcss";
import MagicString, { default as MagicString$1 } from "magic-string";
import { CallExpression, Expression, Node, ObjectPattern, Program, Statement, TSCallSignatureDeclaration, TSFunctionType, TSMethodSignature, TSModuleDeclaration, TSPropertySignature, TSType } from "@babel/types";
import "@vue/shared";
import TS from "typescript";
//#region temp/packages/compiler-sfc/src/template/transformAssetUrl.d.ts
export interface AssetURLTagConfig {
[name: string]: string[];
}
export interface AssetURLOptions {
/**
* If base is provided, instead of transforming relative asset urls into
* imports, they will be directly rewritten to absolute urls.
*/
base?: string | null;
/**
* If true, also processes absolute urls.
*/
includeAbsolute?: boolean;
tags?: AssetURLTagConfig;
}
//#endregion
//#region temp/packages/compiler-sfc/src/compileTemplate.d.ts
export interface TemplateCompiler {
compile(source: string | RootNode, options: CompilerOptions$1): BaseCodegenResult;
parse(template: string, options: ParserOptions): RootNode;
}
export interface SFCTemplateCompileResults {
code: string;
ast?: unknown;
preamble?: string;
multiRoot?: boolean;
source: string;
tips: string[];
errors: (string | CompilerError$1)[];
map?: RawSourceMap;
helpers?: Set<string | symbol>;
}
export interface SFCTemplateCompileOptions {
source: string;
ast?: RootNode;
filename: string;
id: string;
scoped?: boolean;
slotted?: boolean;
isProd?: boolean;
vapor?: boolean;
ssr?: boolean;
ssrCssVars?: string[];
inMap?: RawSourceMap;
compiler?: TemplateCompiler;
compilerOptions?: CompilerOptions$1;
preprocessLang?: string;
preprocessOptions?: any;
/**
* In some cases, compiler-sfc may not be inside the project root (e.g. when
* linked or globally installed). In such cases a custom `require` can be
* passed to correctly resolve the preprocessors.
*/
preprocessCustomRequire?: (id: string) => any;
/**
* Configure what tags/attributes to transform into asset url imports,
* or disable the transform altogether with `false`.
*/
transformAssetUrls?: AssetURLOptions | AssetURLTagConfig | boolean;
}
export declare function compileTemplate(options: SFCTemplateCompileOptions): SFCTemplateCompileResults;
//#endregion
//#region temp/packages/compiler-sfc/src/compileScript.d.ts
export interface SFCScriptCompileOptions {
/**
* Scope ID for prefixing injected CSS variables.
* This must be consistent with the `id` passed to `compileStyle`.
*/
id: string;
/**
* Production mode. Used to determine whether to generate hashed CSS variables
*/
isProd?: boolean;
/**
* Enable/disable source map. Defaults to true.
*/
sourceMap?: boolean;
/**
* https://babeljs.io/docs/en/babel-parser#plugins
*/
babelParserPlugins?: ParserPlugin[];
/**
* A list of files to parse for global types to be made available for type
* resolving in SFC macros. The list must be fully resolved file system paths.
*/
globalTypeFiles?: string[];
/**
* Compile the template and inline the resulting render function
* directly inside setup().
* - Only affects `<script setup>`
* - This should only be used in production because it prevents the template
* from being hot-reloaded separately from component state.
*/
inlineTemplate?: boolean;
/**
* Generate the final component as a variable instead of default export.
* This is useful in e.g. @vitejs/plugin-vue where the script needs to be
* placed inside the main module.
*/
genDefaultAs?: string;
/**
* Options for template compilation when inlining. Note these are options that
* would normally be passed to `compiler-sfc`'s own `compileTemplate()`, not
* options passed to `compiler-dom`.
*/
templateOptions?: Partial<SFCTemplateCompileOptions>;
/**
* Hoist <script setup> static constants.
* - Only enables when one `<script setup>` exists.
* @default true
*/
hoistStatic?: boolean;
/**
* Set to `false` to disable reactive destructure for `defineProps` (pre-3.5
* behavior), or set to `'error'` to throw hard error on props destructures.
* @default true
*/
propsDestructure?: boolean | "error";
/**
* File system access methods to be used when resolving types
* imported in SFC macros. Defaults to ts.sys in Node.js, can be overwritten
* to use a virtual file system for use in browsers (e.g. in REPLs)
*/
fs?: {
fileExists(file: string): boolean;
readFile(file: string): string | undefined;
realpath?(file: string): string;
};
/**
* Transform Vue SFCs into custom elements.
*/
customElement?: boolean | ((filename: string) => boolean);
/**
* Force to use of Vapor mode.
*/
vapor?: boolean;
}
interface ImportBinding {
isType: boolean;
imported: string;
local: string;
source: string;
isFromSetup: boolean;
isUsedInTemplate: boolean;
}
/**
* Compile `<script setup>`
* It requires the whole SFC descriptor because we need to handle and merge
* normal `<script>` + `<script setup>` if both are present.
*/
export declare function compileScript(sfc: SFCDescriptor, options: SFCScriptCompileOptions): SFCScriptBlock;
//#endregion
//#region temp/packages/compiler-sfc/src/parse.d.ts
export interface SFCParseOptions {
filename?: string;
sourceMap?: boolean;
sourceRoot?: string;
pad?: boolean | "line" | "space";
ignoreEmpty?: boolean;
compiler?: TemplateCompiler;
templateParseOptions?: ParserOptions & {
dom2?: boolean;
root?: string;
};
}
export interface SFCBlock {
type: string;
content: string;
attrs: Record<string, string | true>;
loc: SourceLocation;
map?: RawSourceMap;
lang?: string;
src?: string;
}
export interface SFCTemplateBlock extends SFCBlock {
type: "template";
ast?: RootNode;
}
export interface SFCScriptBlock extends SFCBlock {
type: "script";
setup?: string | boolean;
bindings?: BindingMetadata$1;
imports?: Record<string, ImportBinding>;
scriptAst?: import("@babel/types").Statement[];
scriptSetupAst?: import("@babel/types").Statement[];
warnings?: string[];
/**
* Fully resolved dependency file paths (unix slashes) with imported types
* used in macros, used for HMR cache busting in @vitejs/plugin-vue and
* vue-loader.
*/
deps?: string[];
}
export interface SFCStyleBlock extends SFCBlock {
type: "style";
scoped?: boolean;
module?: string | boolean;
}
export interface SFCDescriptor {
filename: string;
source: string;
template: SFCTemplateBlock | null;
script: SFCScriptBlock | null;
scriptSetup: SFCScriptBlock | null;
styles: SFCStyleBlock[];
customBlocks: SFCBlock[];
cssVars: string[];
/**
* whether the SFC uses :slotted() modifier.
* this is used as a compiler optimization hint.
*/
slotted: boolean;
vapor?: boolean;
/**
* compare with an existing descriptor to determine whether HMR should perform
* a reload vs. re-render.
*
* Note: this comparison assumes the prev/next script are already identical,
* and only checks the special case where <script setup lang="ts"> unused import
* pruning result changes due to template changes.
*/
shouldForceReload: (prevImports: Record<string, ImportBinding>) => boolean;
scriptCppBlocks: SFCScriptCppBlock[];
}
export interface SFCParseResult {
descriptor: SFCDescriptor;
errors: (CompilerError$1 | SyntaxError)[];
}
export declare function parse(source: string, options?: SFCParseOptions): SFCParseResult;
export interface SFCScriptCppBlock {
src: string;
module: string;
className: string;
namespace: string;
errors?: SyntaxError[];
}
//#endregion
//#region temp/packages/compiler-sfc/src/style/preprocessors.d.ts
type PreprocessLang = "less" | "sass" | "scss" | "styl" | "stylus";
//#endregion
//#region temp/packages/compiler-sfc/src/compileStyle.d.ts
export interface SFCStyleCompileOptions {
source: string;
filename: string;
id: string;
scoped?: boolean;
trim?: boolean;
isProd?: boolean;
inMap?: RawSourceMap;
preprocessLang?: PreprocessLang;
preprocessOptions?: any;
preprocessCustomRequire?: (id: string) => any;
postcssOptions?: any;
postcssPlugins?: any[];
/**
* @deprecated use `inMap` instead.
*/
map?: RawSourceMap;
}
/**
* Aligns with postcss-modules
* https://github.com/css-modules/postcss-modules
*/
interface CSSModulesOptions {
scopeBehaviour?: "global" | "local";
generateScopedName?: string | ((name: string, filename: string, css: string) => string);
hashPrefix?: string;
localsConvention?: "camelCase" | "camelCaseOnly" | "dashes" | "dashesOnly";
exportGlobals?: boolean;
globalModulePaths?: RegExp[];
}
export interface SFCAsyncStyleCompileOptions extends SFCStyleCompileOptions {
isAsync?: boolean;
modules?: boolean;
modulesOptions?: CSSModulesOptions;
}
export interface SFCStyleCompileResults {
code: string;
map: RawSourceMap | undefined;
rawResult: Result | LazyResult | undefined;
errors: Error[];
modules?: Record<string, string>;
dependencies: Set<string>;
}
export declare function compileStyle(options: SFCStyleCompileOptions): SFCStyleCompileResults;
export declare function compileStyleAsync(options: SFCAsyncStyleCompileOptions): Promise<SFCStyleCompileResults>;
//#endregion
//#region temp/packages/compiler-sfc/src/rewriteDefault.d.ts
export declare function rewriteDefault(input: string, as: string, parserPlugins?: ParserPlugin[]): string;
/**
* Utility for rewriting `export default` in a script block into a variable
* declaration so that we can inject things into it
*/
export declare function rewriteDefaultAST(ast: Statement[], s: MagicString$1, as: string): void;
//#endregion
//#region temp/packages/compiler-sfc/src/script/defineProps.d.ts
type PropsDestructureBindings = Record<string, {
local: string;
default?: Expression;
}>;
export declare function extractRuntimeProps(ctx: TypeResolveContext): string | undefined;
//#endregion
//#region temp/packages/compiler-sfc/src/script/defineModel.d.ts
interface ModelDecl {
type: TSType | undefined;
options: string | undefined;
identifier: string | undefined;
runtimeOptionNodes: Node[];
}
//#endregion
//#region temp/packages/compiler-core/src/options.d.ts
declare enum BindingTypes {
/**
* returned from data()
*/
DATA = "data",
/**
* declared as a prop
*/
PROPS = "props",
/**
* a local alias of a `<script setup>` destructured prop.
* the original is stored in __propsAliases of the bindingMetadata object.
*/
PROPS_ALIASED = "props-aliased",
/**
* a let binding (may or may not be a ref)
*/
SETUP_LET = "setup-let",
/**
* a const binding that can never be a ref.
* these bindings don't need `unref()` calls when processed in inlined
* template expressions.
*/
SETUP_CONST = "setup-const",
/**
* a const binding that does not need `unref()`, but may be mutated.
*/
SETUP_REACTIVE_CONST = "setup-reactive-const",
/**
* a const binding that may be a ref.
*/
SETUP_MAYBE_REF = "setup-maybe-ref",
/**
* bindings that are guaranteed to be refs
*/
SETUP_REF = "setup-ref",
/**
* declared by other options, e.g. computed, inject
*/
OPTIONS = "options",
/**
* a literal constant, e.g. 'foo', 1, true
*/
LITERAL_CONST = "literal-const"
}
type BindingMetadata$2 = {
[key: string]: BindingTypes | undefined;
} & {
__isScriptSetup?: boolean;
__propsAliases?: Record<string, string>;
};
//#endregion
//#region temp/packages/compiler-sfc/src/script/context.d.ts
export declare class ScriptCompileContext {
descriptor: SFCDescriptor;
options: Partial<SFCScriptCompileOptions>;
isJS: boolean;
isTS: boolean;
isUTS: boolean;
isCE: boolean;
scriptAst: Program | null;
scriptSetupAst: Program | null;
source: string;
filename: string;
s: MagicString$1;
startOffset: number | undefined;
endOffset: number | undefined;
scope?: TypeScope;
globalScopes?: TypeScope[];
userImports: Record<string, ImportBinding>;
hasDefinePropsCall: boolean;
hasDefineEmitCall: boolean;
hasDefineExposeCall: boolean;
hasDefaultExportName: boolean;
hasDefaultExportRender: boolean;
hasDefineOptionsCall: boolean;
hasDefineSlotsCall: boolean;
hasDefineModelCall: boolean;
propsCall: CallExpression | undefined;
propsDecl: Node | undefined;
propsRuntimeDecl: Node | undefined;
propsTypeDecl: Node | undefined;
propsDestructureDecl: ObjectPattern | undefined;
propsDestructuredBindings: PropsDestructureBindings;
propsDestructureRestId: string | undefined;
propsRuntimeDefaults: Node | undefined;
emitsRuntimeDecl: Node | undefined;
emitsTypeDecl: Node | undefined;
emitDecl: Node | undefined;
modelDecls: Record<string, ModelDecl>;
optionsRuntimeDecl: Node | undefined;
bindingMetadata: BindingMetadata$2;
helperImports: Set<string>;
helper(key: string): string;
/**
* to be exposed on compiled script block for HMR cache busting
*/
deps?: Set<string>;
/**
* cache for resolved fs
*/
fs?: NonNullable<SFCScriptCompileOptions["fs"]>;
constructor(descriptor: SFCDescriptor, options: Partial<SFCScriptCompileOptions>);
getString(node: Node, scriptSetup?: boolean): string;
warn(msg: string, node: Node, scope?: TypeScope): void;
error(msg: string, node: Node, scope?: TypeScope): never;
}
//#endregion
//#region temp/packages/compiler-sfc/src/script/resolveType.d.ts
export type SimpleTypeResolveOptions = Partial<Pick<SFCScriptCompileOptions, "globalTypeFiles" | "fs" | "babelParserPlugins" | "isProd">>;
/**
* TypeResolveContext is compatible with ScriptCompileContext
* but also allows a simpler version of it with minimal required properties
* when resolveType needs to be used in a non-SFC context, e.g. in a babel
* plugin. The simplest context can be just:
* ```ts
* const ctx: SimpleTypeResolveContext = {
* filename: '...',
* source: '...',
* options: {},
* error() {},
* ast: []
* }
* ```
*/
export type SimpleTypeResolveContext = Pick<ScriptCompileContext, "source" | "filename" | "error" | "warn" | "helper" | "getString" | "propsTypeDecl" | "propsRuntimeDefaults" | "propsDestructuredBindings" | "emitsTypeDecl" | "isCE"> & Partial<Pick<ScriptCompileContext, "scope" | "globalScopes" | "deps" | "fs">> & {
ast: Statement[];
options: SimpleTypeResolveOptions;
};
export type TypeResolveContext = (ScriptCompileContext | SimpleTypeResolveContext) & {
silentOnExtendsFailure?: boolean;
};
type Import = Pick<ImportBinding, "source" | "imported">;
interface WithScope {
_ownerScope: TypeScope;
}
type ScopeTypeNode = Node & WithScope & {
_ns?: TSModuleDeclaration & WithScope;
};
declare class TypeScope {
filename: string;
source: string;
offset: number;
imports: Record<string, Import>;
types: Record<string, ScopeTypeNode>;
declares: Record<string, ScopeTypeNode>;
constructor(filename: string, source: string, offset?: number, imports?: Record<string, Import>, types?: Record<string, ScopeTypeNode>, declares?: Record<string, ScopeTypeNode>);
isGenericScope: boolean;
resolvedImportSources: Record<string, string>;
exportedTypes: Record<string, ScopeTypeNode>;
exportedDeclares: Record<string, ScopeTypeNode>;
}
interface MaybeWithScope {
_ownerScope?: TypeScope;
}
interface ResolvedElements {
props: Record<string, (TSPropertySignature | TSMethodSignature) & {
_ownerScope: TypeScope;
}>;
calls?: (TSCallSignatureDeclaration | TSFunctionType)[];
}
/**
* Resolve arbitrary type node to a list of type elements that can be then
* mapped to runtime props or emits.
*/
export declare function resolveTypeElements(ctx: TypeResolveContext, node: Node & MaybeWithScope & {
_resolvedElements?: ResolvedElements;
}, scope?: TypeScope, typeParameters?: Record<string, Node>): ResolvedElements;
/**
* @private
*/
export declare function registerTS(_loadTS: () => typeof TS): void;
/**
* @private
*/
export declare function invalidateTypeCache(filename: string): void;
export declare function inferRuntimeType(ctx: TypeResolveContext, node: Node & MaybeWithScope, scope?: TypeScope, isKeyOf?: boolean, typeParameters?: Record<string, Node>): string[];
//#endregion
//#region temp/packages/compiler-sfc/src/script/defineEmits.d.ts
export declare function extractRuntimeEmits(ctx: TypeResolveContext): Set<string>;
//#endregion
//#region temp/packages/compiler-sfc/src/index.d.ts
export declare const version: string;
export declare const parseCache: Map<string, SFCParseResult>;
export declare const errorMessages: Record<number, string>;
export declare const walk: any;
/**
* @deprecated this is preserved to avoid breaking vite-plugin-vue < 5.0
* with reactivityTransform: true. The desired behavior should be silently
* ignoring the option instead of breaking.
*/
export declare const shouldTransformRef: () => boolean;
//#endregion
export { type BindingMetadata, type CompilerError, type CompilerOptions, MagicString, babelParse, extractIdentifiers, generateCodeFrame, isInDestructureAssignment, isStaticProperty, walkIdentifiers };
File diff suppressed because one or more lines are too long
@@ -0,0 +1,68 @@
{
"name": "@vue/compiler-sfc",
"version": "3.6.0-alpha.2",
"description": "@vue/compiler-sfc",
"main": "dist/compiler-sfc.cjs.js",
"module": "dist/compiler-sfc.esm-browser.js",
"types": "dist/compiler-sfc.d.ts",
"files": [
"dist"
],
"exports": {
".": {
"types": "./dist/compiler-sfc.d.ts",
"node": "./dist/compiler-sfc.cjs.js",
"module": "./dist/compiler-sfc.esm-browser.js",
"import": "./dist/compiler-sfc.esm-browser.js",
"require": "./dist/compiler-sfc.cjs.js"
},
"./*": "./*"
},
"buildOptions": {
"name": "VueCompilerSFC",
"formats": [
"cjs",
"esm-browser"
],
"prod": false,
"enableNonBrowserBranches": true
},
"repository": {
"type": "git",
"url": "git+https://github.com/vuejs/core.git",
"directory": "packages/compiler-sfc"
},
"keywords": [
"vue"
],
"author": "Evan You",
"license": "MIT",
"bugs": {
"url": "https://github.com/vuejs/core/issues"
},
"homepage": "https://github.com/vuejs/core/tree/main/packages/compiler-sfc#readme",
"dependencies": {
"@babel/parser": "catalog:",
"@vue/compiler-core": "workspace:*",
"@vue/compiler-dom": "workspace:*",
"@vue/compiler-ssr": "workspace:*",
"@vue/compiler-vapor": "workspace:*",
"@vue/shared": "workspace:*",
"estree-walker": "catalog:",
"magic-string": "catalog:",
"postcss": "^8.5.6",
"source-map-js": "catalog:"
},
"devDependencies": {
"@babel/types": "catalog:",
"@vue/consolidate": "^1.0.0",
"hash-sum": "^2.0.0",
"lru-cache": "10.1.0",
"merge-source-map": "^1.1.0",
"minimatch": "~10.0.3",
"postcss-modules": "^6.0.1",
"postcss-selector-parser": "^7.1.0",
"pug": "^3.0.3",
"sass": "^1.89.2"
}
}
File diff suppressed because one or more lines are too long
@@ -0,0 +1,56 @@
{
"name": "@vue/compiler-vapor-dom2",
"version": "3.6.0-alpha.2",
"description": "@vue/compiler-vapor-dom2",
"main": "dist/compiler-vapor-dom2.cjs.js",
"module": "dist/compiler-vapor-dom2.esm-bundler.js",
"types": "dist/compiler-vapor-dom2.d.ts",
"files": [
"dist"
],
"sideEffects": false,
"exports": {
".": {
"types": "./dist/compiler-vapor-dom2.d.ts",
"node": "./dist/compiler-vapor-dom2.cjs.js",
"module": "./dist/compiler-vapor-dom2.esm-browser.js",
"import": "./dist/compiler-vapor-dom2.esm-browser.js",
"require": "./dist/compiler-vapor-dom2.cjs.js"
},
"./*": "./*"
},
"buildOptions": {
"formats": [
"cjs",
"esm-browser"
],
"prod": false,
"enableNonBrowserBranches": true
},
"repository": {
"type": "git",
"url": "git+https://github.com/vuejs/core.git",
"directory": "packages/compiler-vapor-dom2"
},
"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-vapor-dom2#readme",
"dependencies": {
"@babel/parser": "catalog:",
"@vue/compiler-dom": "workspace:*",
"@vue/compiler-vapor": "workspace:*",
"@vue/shared": "workspace:*",
"estree-walker": "catalog:",
"source-map-js": "catalog:",
"vue": "workspace:*"
},
"devDependencies": {
"@vue/compiler-sfc": "workspace:*"
}
}
@@ -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.
@@ -0,0 +1 @@
# @vue/compiler-vapor
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
@@ -0,0 +1,51 @@
{
"name": "@vue/compiler-vapor",
"version": "3.6.0-alpha.2",
"description": "@vue/compiler-vapor",
"main": "dist/compiler-vapor.cjs.js",
"module": "dist/compiler-vapor.esm-bundler.js",
"types": "dist/compiler-vapor.d.ts",
"files": [
"dist"
],
"sideEffects": false,
"exports": {
".": {
"types": "./dist/compiler-vapor.d.ts",
"node": "./dist/compiler-vapor.cjs.js",
"module": "./dist/compiler-vapor.esm-browser.js",
"import": "./dist/compiler-vapor.esm-browser.js",
"require": "./dist/compiler-vapor.cjs.js"
},
"./*": "./*"
},
"buildOptions": {
"formats": [
"cjs",
"esm-browser"
],
"prod": false,
"enableNonBrowserBranches": true
},
"repository": {
"type": "git",
"url": "git+https://github.com/vuejs/core.git",
"directory": "packages/compiler-vapor"
},
"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-vapor#readme",
"dependencies": {
"@babel/parser": "catalog:",
"@vue/compiler-dom": "workspace:*",
"@vue/shared": "workspace:*",
"estree-walker": "catalog:",
"source-map-js": "catalog:"
}
}
@@ -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.
@@ -0,0 +1,3 @@
# @vue/shared
Internal utility functions and constants shared across `@vue` packages.
@@ -0,0 +1,917 @@
/**
* @vue/shared v3.6.0-rc.14
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT
**/
Object.defineProperties(exports, {
__esModule: { value: true },
[Symbol.toStringTag]: { value: "Module" }
});
//#region packages/shared/src/makeMap.ts
/**
* 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 they can be tree-shaken if necessary.
*/
/*@__NO_SIDE_EFFECTS__*/
function makeMap(str) {
const map = Object.create(null);
for (const key of str.split(",")) map[key] = 1;
return (val) => val in map;
}
//#endregion
//#region packages/shared/src/general.ts
const EMPTY_OBJ = Object.freeze({});
const EMPTY_ARR = Object.freeze([]);
const NOOP = () => {};
/**
* Always return true.
*/
const YES = () => true;
/**
* Always return false.
*/
const NO = () => false;
const isOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && (key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97);
const isNativeOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && key.charCodeAt(2) > 96 && key.charCodeAt(2) < 123;
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 || typeof key === "number" && Number.isInteger(key) && key >= 0;
const isReservedProp = /*@__PURE__*/ makeMap(",key,ref,ref_for,ref_key,__cid,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted");
const isBuiltInTag = /*#__PURE__*/ makeMap("slot,component");
const isBuiltInDirective = /*@__PURE__*/ makeMap("bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo");
const cacheStringFunction = (fn) => {
const cache = Object.create(null);
return ((str) => {
return cache[str] || (cache[str] = fn(str));
});
};
const camelizeRE = /-(\w)/g;
const camelizeReplacer = (_, c) => c ? c.toUpperCase() : "";
/**
* @private
*/
const camelize = cacheStringFunction((str) => str.replace(camelizeRE, camelizeReplacer));
const hyphenateRE = /\B([A-Z])/g;
/**
* @private
*/
const hyphenate = cacheStringFunction((str) => str.replace(hyphenateRE, "-$1").toLowerCase());
/**
* @private
*/
const capitalize = cacheStringFunction((str) => {
return str.charAt(0).toUpperCase() + str.slice(1);
});
/**
* @private
*/
const toHandlerKey = cacheStringFunction((str) => {
return str ? `on${capitalize(str)}` : ``;
});
/**
* #13070 When v-model and v-model:model directives are used together,
* they will generate the same modelModifiers prop,
* so a `$` suffix is added to avoid conflicts.
* @private
*/
const getModifierPropName = (name) => {
return `${name === "modelValue" || name === "model-value" ? "model" : name}Modifiers${name === "model" ? "$" : ""}`;
};
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, writable = false) => {
Object.defineProperty(obj, key, {
configurable: true,
enumerable: false,
writable,
value
});
};
/**
* "123-foo" will be parsed to 123
* This is used for the .number modifier in v-model
*/
const looseToNumber = (val) => {
const n = parseFloat(val);
return isNaN(n) ? val : n;
};
/**
* Only concerns number-like strings
* "123-foo" will be returned as-is
*/
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)}]`;
}
function genCacheKey(source, options) {
return source + JSON.stringify(options, (_, val) => typeof val === "function" ? val.toString() : val);
}
function canSetValueDirectly(tagName) {
return tagName !== "PROGRESS" && !tagName.includes("-");
}
//#endregion
//#region packages/shared/src/patchFlags.ts
/**
* 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.
*/
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",
"CACHED": -1,
"-1": "CACHED",
"BAIL": -2,
"-2": "BAIL"
};
/**
* dev only flag -> name mapping
*/
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]: `CACHED`,
[-2]: `BAIL`
};
//#endregion
//#region packages/shared/src/shapeFlags.ts
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",
"SLOT_FALLBACK": 1024,
"1024": "SLOT_FALLBACK",
"COMPONENT": 6,
"6": "COMPONENT"
};
//#endregion
//#region packages/shared/src/slotFlags.ts
const SlotFlags = {
"STABLE": 1,
"1": "STABLE",
"DYNAMIC": 2,
"2": "DYNAMIC",
"FORWARDED": 3,
"3": "FORWARDED"
};
/**
* Dev only
*/
const slotFlagsText = {
[1]: "STABLE",
[2]: "DYNAMIC",
[3]: "FORWARDED"
};
const isGloballyAllowed = /*@__PURE__*/ makeMap("Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console,Error,Symbol");
/** @deprecated use `isGloballyAllowed` instead */
const isGloballyWhitelisted = isGloballyAllowed;
//#endregion
//#region packages/shared/src/codeframe.ts
const range = 2;
function generateCodeFrame(source, start = 0, end = source.length) {
start = Math.max(0, Math.min(start, source.length));
end = Math.max(0, Math.min(end, source.length));
if (start > end) return "";
let lines = source.split(/(\r?\n)/);
const newlineSequences = lines.filter((_, idx) => idx % 2 === 1);
lines = lines.filter((_, idx) => idx % 2 === 0);
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");
}
//#endregion
//#region packages/shared/src/normalizeProp.ts
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, (match) => match.startsWith("/*") ? "" : match).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) {
if (!styles) return "";
if (isString(styles)) return styles;
let ret = "";
for (const key in styles) {
const value = styles[key];
if (isString(value) || typeof value === "number") {
const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key);
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;
}
//#endregion
//#region packages/shared/src/domTagConfig.ts
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 FORMATTING_TAGS = "a,b,big,code,em,font,i,nobr,s,small,strike,strong,tt,u";
const ALWAYS_CLOSE_TAGS = "title,style,script,noscript,template,object,table,button,textarea,select,iframe,fieldset,form,foreignObject,desc,mi,mo,mn,ms,mtext,annotation-xml";
/**
* Compiler only.
* Do NOT use in runtime code paths unless behind `__DEV__` flag.
*/
const isHTMLTag = /*@__PURE__*/ makeMap(HTML_TAGS);
/**
* Compiler only.
* Do NOT use in runtime code paths unless behind `__DEV__` flag.
*/
const isSVGTag = /*@__PURE__*/ makeMap(SVG_TAGS);
/**
* Compiler only.
* Do NOT use in runtime code paths unless behind `__DEV__` flag.
*/
const isMathMLTag = /*@__PURE__*/ makeMap(MATH_TAGS);
/**
* Compiler only.
* Do NOT use in runtime code paths unless behind `__DEV__` flag.
*/
const isVoidTag = /*@__PURE__*/ makeMap(VOID_TAGS);
/**
* Compiler only.
* Do NOT use in runtime code paths unless behind `__DEV__` flag.
*/
const isFormattingTag = /*@__PURE__*/ makeMap(FORMATTING_TAGS);
/**
* Compiler only.
* Do NOT use in runtime code paths unless behind `__DEV__` flag.
*/
const isAlwaysCloseTag = /*@__PURE__*/ makeMap(ALWAYS_CLOSE_TAGS);
//#endregion
//#region packages/shared/src/domAttrConfig.ts
/**
* On the client we only need to offer special cases for boolean attributes that
* have different names from their corresponding dom properties:
* - itemscope -> N/A
* - allowfullscreen -> allowFullscreen
* - formnovalidate -> formNoValidate
* - ismap -> isMap
* - nomodule -> noModule
* - novalidate -> noValidate
* - playsinline -> playsInline
* - readonly -> readOnly
*/
const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,playsinline,readonly`;
const isSpecialBooleanAttr = /*@__PURE__*/ makeMap(specialBooleanAttrs);
/**
* The full list is needed during SSR to produce the correct initial markup.
*/
const isBooleanAttr = /*@__PURE__*/ makeMap(specialBooleanAttrs + ",async,autofocus,autoplay,controls,default,defer,disabled,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected");
/**
* Boolean attributes should be included if the value is truthy or ''.
* e.g. `<select multiple>` compiles to `{ multiple: '' }`
*/
function includeBooleanAttr(value) {
return !!value || value === "";
}
const unsafeAttrCharRE = /[>/="'\u0009\u000a\u000c\u000d\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"
};
/**
* Known attributes, this is used for stringification of runtime static nodes
* so that we don't stringify bindings that cannot be set from HTML.
* Don't also forget to allow `data-*` and `aria-*`!
* Generated from https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes
*/
const isKnownHtmlAttr = /*@__PURE__*/ makeMap("accept,accept-charset,accesskey,action,align,allow,alt,async,autocapitalize,autocomplete,autofocus,autoplay,background,bgcolor,border,buffered,capture,challenge,charset,checked,cite,class,code,codebase,color,cols,colspan,content,contenteditable,contextmenu,controls,coords,crossorigin,csp,data,datetime,decoding,default,defer,dir,dirname,disabled,download,draggable,dropzone,enctype,enterkeyhint,for,form,formaction,formenctype,formmethod,formnovalidate,formtarget,headers,height,hidden,high,href,hreflang,http-equiv,icon,id,importance,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");
/**
* Generated from https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute
*/
const isKnownSvgAttr = /*@__PURE__*/ makeMap("xmlns,accent-height,accumulate,additive,alignment-baseline,alphabetic,amplitude,arabic-form,ascent,attributeName,attributeType,azimuth,baseFrequency,baseline-shift,baseProfile,bbox,begin,bias,by,calcMode,cap-height,class,clip,clipPathUnits,clip-path,clip-rule,color,color-interpolation,color-interpolation-filters,color-profile,color-rendering,contentScriptType,contentStyleType,crossorigin,cursor,cx,cy,d,decelerate,descent,diffuseConstant,direction,display,divisor,dominant-baseline,dur,dx,dy,edgeMode,elevation,enable-background,end,exponent,fill,fill-opacity,fill-rule,filter,filterRes,filterUnits,flood-color,flood-opacity,font-family,font-size,font-size-adjust,font-stretch,font-style,font-variant,font-weight,format,from,fr,fx,fy,g1,g2,glyph-name,glyph-orientation-horizontal,glyph-orientation-vertical,glyphRef,gradientTransform,gradientUnits,hanging,height,href,hreflang,horiz-adv-x,horiz-origin-x,id,ideographic,image-rendering,in,in2,intercept,k,k1,k2,k3,k4,kernelMatrix,kernelUnitLength,kerning,keyPoints,keySplines,keyTimes,lang,lengthAdjust,letter-spacing,lighting-color,limitingConeAngle,local,marker-end,marker-mid,marker-start,markerHeight,markerUnits,markerWidth,mask,maskContentUnits,maskUnits,mathematical,max,media,method,min,mode,name,numOctaves,offset,opacity,operator,order,orient,orientation,origin,overflow,overline-position,overline-thickness,panose-1,paint-order,path,pathLength,patternContentUnits,patternTransform,patternUnits,ping,pointer-events,points,pointsAtX,pointsAtY,pointsAtZ,preserveAlpha,preserveAspectRatio,primitiveUnits,r,radius,referrerPolicy,refX,refY,rel,rendering-intent,repeatCount,repeatDur,requiredExtensions,requiredFeatures,restart,result,rotate,rx,ry,scale,seed,shape-rendering,slope,spacing,specularConstant,specularExponent,speed,spreadMethod,startOffset,stdDeviation,stemh,stemv,stitchTiles,stop-color,stop-opacity,strikethrough-position,strikethrough-thickness,string,stroke,stroke-dasharray,stroke-dashoffset,stroke-linecap,stroke-linejoin,stroke-miterlimit,stroke-opacity,stroke-width,style,surfaceScale,systemLanguage,tabindex,tableValues,target,targetX,targetY,text-anchor,text-decoration,text-rendering,textLength,to,transform,transform-origin,type,u1,u2,underline-position,underline-thickness,unicode,unicode-bidi,unicode-range,units-per-em,v-alphabetic,v-hanging,v-ideographic,v-mathematical,values,vector-effect,version,vert-adv-y,vert-origin-x,vert-origin-y,viewBox,viewTarget,visibility,width,widths,word-spacing,writing-mode,x,x-height,x1,x2,xChannelSelector,xlink:actuate,xlink:arcrole,xlink:href,xlink:role,xlink:show,xlink:title,xlink:type,xmlns:xlink,xml:base,xml:lang,xml:space,y,y1,y2,yChannelSelector,z,zoomAndPan");
/**
* Generated from https://developer.mozilla.org/en-US/docs/Web/MathML/Attribute
*/
const isKnownMathMLAttr = /*@__PURE__*/ makeMap("accent,accentunder,actiontype,align,alignmentscope,altimg,altimg-height,altimg-valign,altimg-width,alttext,bevelled,close,columnsalign,columnlines,columnspan,denomalign,depth,dir,display,displaystyle,encoding,equalcolumns,equalrows,fence,fontstyle,fontweight,form,frame,framespacing,groupalign,height,href,id,indentalign,indentalignfirst,indentalignlast,indentshift,indentshiftfirst,indentshiftlast,indextype,justify,largetop,largeop,lquote,lspace,mathbackground,mathcolor,mathsize,mathvariant,maxsize,minlabelspacing,mode,other,overflow,position,rowalign,rowlines,rowspan,rquote,rspace,scriptlevel,scriptminsize,scriptsizemultiplier,selection,separator,separators,shift,side,src,stackalign,stretchy,subscriptshift,superscriptshift,symmetric,voffset,width,widths,xlink:href,xlink:show,xlink:type,xmlns");
/**
* Shared between server-renderer and runtime-core hydration logic
*/
function isRenderableAttrValue(value) {
if (value == null) return false;
const type = typeof value;
return type === "string" || type === "number" || type === "boolean";
}
function shouldSetAsAttr(tagName, key) {
if (key === "spellcheck" || key === "draggable" || key === "translate" || key === "autocorrect") return true;
if (key === "form") return true;
if (key === "list" && tagName === "INPUT") return true;
if (key === "type" && tagName === "TEXTAREA") return true;
if ((key === "width" || key === "height") && (tagName === "IMG" || tagName === "VIDEO" || tagName === "CANVAS" || tagName === "SOURCE")) return true;
if (key === "sandbox" && tagName === "IFRAME") return true;
return false;
}
//#endregion
//#region packages/shared/src/domNamespace.ts
const Namespaces = {
"HTML": 0,
"0": "HTML",
"SVG": 1,
"1": "SVG",
"MATH_ML": 2,
"2": "MATH_ML"
};
//#endregion
//#region packages/shared/src/escapeHtml.ts
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 = "&quot;";
break;
case 38:
escaped = "&amp;";
break;
case 39:
escaped = "&#39;";
break;
case 60:
escaped = "&lt;";
break;
case 62:
escaped = "&gt;";
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) {
let prev;
do {
prev = src;
src = src.replace(commentStripRE, "");
} while (src !== prev);
return src;
}
const cssVarNameEscapeSymbolsRE = /[ !"#$%&'()*+,./:;<=>?@[\\\]^`{|}~]/g;
function getEscapedCssVarName(key, doubleEscape) {
return key.replace(cssVarNameEscapeSymbolsRE, (s) => doubleEscape ? s === "\"" ? "\\\\\\\"" : `\\\\${s}` : `\\${s}`);
}
//#endregion
//#region packages/shared/src/looseEqual.ts
function looseCompareArrays(a, b, seen) {
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], seen);
return equal;
}
function looseCompareCollections(a, b, seen) {
if (a.size !== b.size) return false;
const candidates = Array.from(b);
const matched = new Uint8Array(candidates.length);
for (const item of a) {
let index = -1;
for (let i = 0; i < candidates.length; i++) if (!matched[i] && looseEqual(item, candidates[i], seen)) {
index = i;
break;
}
if (index < 0) return false;
matched[index] = 1;
}
return true;
}
function looseCompareObjects(a, b, seen) {
let aValidType = isMap(a);
let bValidType = isMap(b);
if (aValidType || bValidType) return aValidType && bValidType ? looseCompareCollections(a, b, seen) : false;
aValidType = isSet(a);
bValidType = isSet(b);
if (aValidType || bValidType) return aValidType && bValidType ? looseCompareCollections(a, b, seen) : false;
if (Object.keys(a).length !== Object.keys(b).length) 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], seen)) return false;
}
return String(a) === String(b);
}
function looseCompareNested(a, b, seen, compare) {
if (!seen) seen = [/* @__PURE__ */ new Map(), /* @__PURE__ */ new Map()];
const [seenA, seenB] = seen;
if (seenA.has(a) || seenB.has(b)) return seenA.get(a) === b && seenB.get(b) === a;
seenA.set(a, b);
seenB.set(b, a);
const equal = compare(a, b, seen);
seenA.delete(a);
seenB.delete(b);
return equal;
}
function looseEqual(a, b, seen) {
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 ? looseCompareNested(a, b, seen, looseCompareArrays) : false;
aValidType = isObject(a);
bValidType = isObject(b);
if (aValidType || bValidType) {
if (!aValidType || !bValidType) return false;
return looseCompareNested(a, b, seen, looseCompareObjects);
}
return String(a) === String(b);
}
function looseIndexOf(arr, val) {
return arr.findIndex((item) => looseEqual(item, val));
}
//#endregion
//#region packages/shared/src/toDisplayString.ts
const isRef = (val) => {
return !!(val && val["__v_isRef"] === true);
};
/**
* For converting {{ interpolation }} values to displayed strings.
* @private
*/
const toDisplayString = (val) => {
switch (typeof val) {
case "string": return val;
case "object": if (val) {
if (isRef(val)) return toDisplayString(val.value);
else if (isArray(val) || val.toString === objectToString || !isFunction(val.toString)) return JSON.stringify(val, replacer, 2);
}
default: return val == null ? "" : String(val);
}
};
const replacer = (_key, val) => {
if (isRef(val)) return replacer(_key, val.value);
else if (isMap(val)) return { [`Map(${val.size})`]: [...val.entries()].reduce((entries, [key, val], i) => {
entries[stringifySymbol(key, i) + " =>"] = val;
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 _description;
return isSymbol(v) ? `Symbol(${(_description = v.description) !== null && _description !== void 0 ? _description : i})` : v;
};
//#endregion
//#region packages/shared/src/subSequence.ts
function getSequence(arr) {
const p = arr.slice();
const result = [0];
let i, j, u, v, c;
const len = arr.length;
for (i = 0; i < len; i++) {
const arrI = arr[i];
if (arrI !== 0) {
j = result[result.length - 1];
if (arr[j] < arrI) {
p[i] = j;
result.push(i);
continue;
}
u = 0;
v = result.length - 1;
while (u < v) {
c = u + v >> 1;
if (arr[result[c]] < arrI) u = c + 1;
else v = c;
}
if (arrI < arr[result[u]]) {
if (u > 0) p[i] = result[u - 1];
result[u] = i;
}
}
}
u = result.length;
v = result[u - 1];
while (u-- > 0) {
result[u] = v;
v = p[v];
}
return result;
}
//#endregion
//#region packages/shared/src/cssVars.ts
/**
* Normalize CSS var value created by `v-bind` in `<style>` block
* See https://github.com/vuejs/core/pull/12461#issuecomment-2495804664
*/
function normalizeCssVarValue(value) {
if (value == null) return "initial";
if (typeof value === "string") return value === "" ? " " : value;
if (typeof value !== "number" || !Number.isFinite(value)) console.warn("[Vue warn] Invalid value used for CSS binding. Expected a string or a finite number but received:", value);
return String(value);
}
//#endregion
//#region packages/shared/src/vaporFlags.ts
/**
* Flags to optimize vapor `createFor` runtime behavior, shared between the
* compiler and the runtime
*/
const VaporVForFlags = {
"FAST_REMOVE": 1,
"1": "FAST_REMOVE",
"IS_COMPONENT": 2,
"2": "IS_COMPONENT",
"ONCE": 4,
"4": "ONCE",
"IS_SINGLE_NODE": 8,
"8": "IS_SINGLE_NODE",
"IS_FRAGMENT": 16,
"16": "IS_FRAGMENT",
"SLOT_ROOT": 32,
"32": "SLOT_ROOT",
"WRAPPED_ROWS": 64,
"64": "WRAPPED_ROWS"
};
const VaporBlockShape = {
"EMPTY": 0,
"0": "EMPTY",
"SINGLE_ROOT": 1,
"1": "SINGLE_ROOT",
"MULTI_ROOT": 2,
"2": "MULTI_ROOT",
"ELSE_IF": 3,
"3": "ELSE_IF"
};
/**
* Bit layout for vapor `createIf` flags.
*
* - bits 0-1: true branch VaporBlockShape
* - bits 2-3: false branch VaporBlockShape
* - bit 4: v-once
* - bit 5: true branch is static and can skip branch-owned EffectScope
* - bit 6: false branch is static and can skip branch-owned EffectScope
* - bit 7: v-if sits on a slot content/fallback root chain
* - bits 8+: branch index + 1 for keyed dynamic fragments
*
* Examples:
* - v-once, true single-root, no false branch: 1 | ONCE = 17
* - keyed index 0, true/false single-root: 1 | (1 << 2) | (1 << 8) = 261
*/
const VaporIfFlags = {
"BLOCK_SHAPE": 15,
"15": "BLOCK_SHAPE",
"ONCE": 16,
"16": "ONCE",
"TRUE_NO_SCOPE": 32,
"32": "TRUE_NO_SCOPE",
"FALSE_NO_SCOPE": 64,
"64": "FALSE_NO_SCOPE",
"SLOT_ROOT": 128,
"128": "SLOT_ROOT",
"INDEX_SHIFT": 8,
"8": "INDEX_SHIFT"
};
/**
* Flags used by vapor template factories, shared between the compiler and the
* runtime.
*/
const TemplateFlags = {
"ROOT": 1,
"1": "ROOT",
"STATIC": 2,
"2": "STATIC"
};
/**
* Flags used by vapor slot outlets, shared between the compiler and the
* runtime.
*/
const VaporSlotFlags = {
"NO_SLOTTED": 1,
"1": "NO_SLOTTED",
"ONCE": 2,
"2": "ONCE",
"FORWARDED": 4,
"4": "FORWARDED"
};
function isForwardedSlot(flags) {
return !!(flags & 4);
}
/**
* The data of the comment a vapor server render opens the branch of a `v-if`
* chain with, `<!--[1-->`: the digits are the branch's position in the chain,
* and `<!--]-->` closes it like a fragment.
*/
function isVaporBranchStart(data) {
if (data.length < 2 || data.charCodeAt(0) !== 91) return false;
for (let i = 1; i < data.length; i++) {
const c = data.charCodeAt(i);
if (c < 48 || c > 57) return false;
}
return true;
}
function slotNotifiesBoundary(flags) {
return isForwardedSlot(flags) && !(flags & 2);
}
/**
* Per-slot-function metadata attached by the compiler as `fn._`.
*/
const VaporSlotStability = {
"NON_STABLE": 1,
"1": "NON_STABLE"
};
const VaporDynamicComponentFlags = {
"SINGLE_ROOT": 1,
"1": "SINGLE_ROOT",
"ONCE": 2,
"2": "ONCE",
"SLOT_ROOT": 4,
"4": "SLOT_ROOT",
"DOM2_FLATTEN_TRUE": 65536,
"65536": "DOM2_FLATTEN_TRUE",
"DOM2_FLATTEN_FALSE": 131072,
"131072": "DOM2_FLATTEN_FALSE",
"NS_SVG": 8,
"8": "NS_SVG",
"NS_MATHML": 16,
"16": "NS_MATHML",
"SLOT_SINGLE_ROOT": 32,
"32": "SLOT_SINGLE_ROOT"
};
/**
* `isSingleRoot` of a component creation call for the single root of a slot
* body (`true` marks the single root of a component template). See
* resolveFallthroughOwner in runtime-vapor.
*/
const VaporSingleRoot = {
"SLOT": 2,
"2": "SLOT"
};
//#endregion
exports.EMPTY_ARR = EMPTY_ARR;
exports.EMPTY_OBJ = EMPTY_OBJ;
exports.NO = NO;
exports.NOOP = NOOP;
exports.Namespaces = Namespaces;
exports.PatchFlagNames = PatchFlagNames;
exports.PatchFlags = PatchFlags;
exports.ShapeFlags = ShapeFlags;
exports.SlotFlags = SlotFlags;
exports.TemplateFlags = TemplateFlags;
exports.VaporBlockShape = VaporBlockShape;
exports.VaporDynamicComponentFlags = VaporDynamicComponentFlags;
exports.VaporIfFlags = VaporIfFlags;
exports.VaporSingleRoot = VaporSingleRoot;
exports.VaporSlotFlags = VaporSlotFlags;
exports.VaporSlotStability = VaporSlotStability;
exports.VaporVForFlags = VaporVForFlags;
exports.YES = YES;
exports.camelize = camelize;
exports.canSetValueDirectly = canSetValueDirectly;
exports.capitalize = capitalize;
exports.cssVarNameEscapeSymbolsRE = cssVarNameEscapeSymbolsRE;
exports.def = def;
exports.escapeHtml = escapeHtml;
exports.escapeHtmlComment = escapeHtmlComment;
exports.extend = extend;
exports.genCacheKey = genCacheKey;
exports.genPropsAccessExp = genPropsAccessExp;
exports.generateCodeFrame = generateCodeFrame;
exports.getEscapedCssVarName = getEscapedCssVarName;
exports.getGlobalThis = getGlobalThis;
exports.getModifierPropName = getModifierPropName;
exports.getSequence = getSequence;
exports.hasChanged = hasChanged;
exports.hasOwn = hasOwn;
exports.hyphenate = hyphenate;
exports.includeBooleanAttr = includeBooleanAttr;
exports.invokeArrayFns = invokeArrayFns;
exports.isAlwaysCloseTag = isAlwaysCloseTag;
exports.isArray = isArray;
exports.isBooleanAttr = isBooleanAttr;
exports.isBuiltInDirective = isBuiltInDirective;
exports.isBuiltInTag = isBuiltInTag;
exports.isDate = isDate;
exports.isFormattingTag = isFormattingTag;
exports.isForwardedSlot = isForwardedSlot;
exports.isFunction = isFunction;
exports.isGloballyAllowed = isGloballyAllowed;
exports.isGloballyWhitelisted = isGloballyWhitelisted;
exports.isHTMLTag = isHTMLTag;
exports.isIntegerKey = isIntegerKey;
exports.isKnownHtmlAttr = isKnownHtmlAttr;
exports.isKnownMathMLAttr = isKnownMathMLAttr;
exports.isKnownSvgAttr = isKnownSvgAttr;
exports.isMap = isMap;
exports.isMathMLTag = isMathMLTag;
exports.isModelListener = isModelListener;
exports.isNativeOn = isNativeOn;
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.isVaporBranchStart = isVaporBranchStart;
exports.isVoidTag = isVoidTag;
exports.looseEqual = looseEqual;
exports.looseIndexOf = looseIndexOf;
exports.looseToNumber = looseToNumber;
exports.makeMap = makeMap;
exports.normalizeClass = normalizeClass;
exports.normalizeCssVarValue = normalizeCssVarValue;
exports.normalizeProps = normalizeProps;
exports.normalizeStyle = normalizeStyle;
exports.objectToString = objectToString;
exports.parseStringStyle = parseStringStyle;
exports.propsToAttrMap = propsToAttrMap;
exports.remove = remove;
exports.shouldSetAsAttr = shouldSetAsAttr;
exports.slotFlagsText = slotFlagsText;
exports.slotNotifiesBoundary = slotNotifiesBoundary;
exports.stringifyStyle = stringifyStyle;
exports.toDisplayString = toDisplayString;
exports.toHandlerKey = toHandlerKey;
exports.toNumber = toNumber;
exports.toRawType = toRawType;
exports.toTypeString = toTypeString;
@@ -0,0 +1,917 @@
/**
* @vue/shared v3.6.0-rc.14
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT
**/
Object.defineProperties(exports, {
__esModule: { value: true },
[Symbol.toStringTag]: { value: "Module" }
});
//#region packages/shared/src/makeMap.ts
/**
* 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 they can be tree-shaken if necessary.
*/
/*@__NO_SIDE_EFFECTS__*/
function makeMap(str) {
const map = Object.create(null);
for (const key of str.split(",")) map[key] = 1;
return (val) => val in map;
}
//#endregion
//#region packages/shared/src/general.ts
const EMPTY_OBJ = {};
const EMPTY_ARR = [];
const NOOP = () => {};
/**
* Always return true.
*/
const YES = () => true;
/**
* Always return false.
*/
const NO = () => false;
const isOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && (key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97);
const isNativeOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && key.charCodeAt(2) > 96 && key.charCodeAt(2) < 123;
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 || typeof key === "number" && Number.isInteger(key) && key >= 0;
const isReservedProp = /*@__PURE__*/ makeMap(",key,ref,ref_for,ref_key,__cid,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted");
const isBuiltInTag = /*#__PURE__*/ makeMap("slot,component");
const isBuiltInDirective = /*@__PURE__*/ makeMap("bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo");
const cacheStringFunction = (fn) => {
const cache = Object.create(null);
return ((str) => {
return cache[str] || (cache[str] = fn(str));
});
};
const camelizeRE = /-(\w)/g;
const camelizeReplacer = (_, c) => c ? c.toUpperCase() : "";
/**
* @private
*/
const camelize = cacheStringFunction((str) => str.replace(camelizeRE, camelizeReplacer));
const hyphenateRE = /\B([A-Z])/g;
/**
* @private
*/
const hyphenate = cacheStringFunction((str) => str.replace(hyphenateRE, "-$1").toLowerCase());
/**
* @private
*/
const capitalize = cacheStringFunction((str) => {
return str.charAt(0).toUpperCase() + str.slice(1);
});
/**
* @private
*/
const toHandlerKey = cacheStringFunction((str) => {
return str ? `on${capitalize(str)}` : ``;
});
/**
* #13070 When v-model and v-model:model directives are used together,
* they will generate the same modelModifiers prop,
* so a `$` suffix is added to avoid conflicts.
* @private
*/
const getModifierPropName = (name) => {
return `${name === "modelValue" || name === "model-value" ? "model" : name}Modifiers${name === "model" ? "$" : ""}`;
};
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, writable = false) => {
Object.defineProperty(obj, key, {
configurable: true,
enumerable: false,
writable,
value
});
};
/**
* "123-foo" will be parsed to 123
* This is used for the .number modifier in v-model
*/
const looseToNumber = (val) => {
const n = parseFloat(val);
return isNaN(n) ? val : n;
};
/**
* Only concerns number-like strings
* "123-foo" will be returned as-is
*/
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)}]`;
}
function genCacheKey(source, options) {
return source + JSON.stringify(options, (_, val) => typeof val === "function" ? val.toString() : val);
}
function canSetValueDirectly(tagName) {
return tagName !== "PROGRESS" && !tagName.includes("-");
}
//#endregion
//#region packages/shared/src/patchFlags.ts
/**
* 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.
*/
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",
"CACHED": -1,
"-1": "CACHED",
"BAIL": -2,
"-2": "BAIL"
};
/**
* dev only flag -> name mapping
*/
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]: `CACHED`,
[-2]: `BAIL`
};
//#endregion
//#region packages/shared/src/shapeFlags.ts
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",
"SLOT_FALLBACK": 1024,
"1024": "SLOT_FALLBACK",
"COMPONENT": 6,
"6": "COMPONENT"
};
//#endregion
//#region packages/shared/src/slotFlags.ts
const SlotFlags = {
"STABLE": 1,
"1": "STABLE",
"DYNAMIC": 2,
"2": "DYNAMIC",
"FORWARDED": 3,
"3": "FORWARDED"
};
/**
* Dev only
*/
const slotFlagsText = {
[1]: "STABLE",
[2]: "DYNAMIC",
[3]: "FORWARDED"
};
const isGloballyAllowed = /*@__PURE__*/ makeMap("Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console,Error,Symbol");
/** @deprecated use `isGloballyAllowed` instead */
const isGloballyWhitelisted = isGloballyAllowed;
//#endregion
//#region packages/shared/src/codeframe.ts
const range = 2;
function generateCodeFrame(source, start = 0, end = source.length) {
start = Math.max(0, Math.min(start, source.length));
end = Math.max(0, Math.min(end, source.length));
if (start > end) return "";
let lines = source.split(/(\r?\n)/);
const newlineSequences = lines.filter((_, idx) => idx % 2 === 1);
lines = lines.filter((_, idx) => idx % 2 === 0);
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");
}
//#endregion
//#region packages/shared/src/normalizeProp.ts
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, (match) => match.startsWith("/*") ? "" : match).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) {
if (!styles) return "";
if (isString(styles)) return styles;
let ret = "";
for (const key in styles) {
const value = styles[key];
if (isString(value) || typeof value === "number") {
const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key);
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;
}
//#endregion
//#region packages/shared/src/domTagConfig.ts
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 FORMATTING_TAGS = "a,b,big,code,em,font,i,nobr,s,small,strike,strong,tt,u";
const ALWAYS_CLOSE_TAGS = "title,style,script,noscript,template,object,table,button,textarea,select,iframe,fieldset,form,foreignObject,desc,mi,mo,mn,ms,mtext,annotation-xml";
/**
* Compiler only.
* Do NOT use in runtime code paths unless behind `__DEV__` flag.
*/
const isHTMLTag = /*@__PURE__*/ makeMap(HTML_TAGS);
/**
* Compiler only.
* Do NOT use in runtime code paths unless behind `__DEV__` flag.
*/
const isSVGTag = /*@__PURE__*/ makeMap(SVG_TAGS);
/**
* Compiler only.
* Do NOT use in runtime code paths unless behind `__DEV__` flag.
*/
const isMathMLTag = /*@__PURE__*/ makeMap(MATH_TAGS);
/**
* Compiler only.
* Do NOT use in runtime code paths unless behind `__DEV__` flag.
*/
const isVoidTag = /*@__PURE__*/ makeMap(VOID_TAGS);
/**
* Compiler only.
* Do NOT use in runtime code paths unless behind `__DEV__` flag.
*/
const isFormattingTag = /*@__PURE__*/ makeMap(FORMATTING_TAGS);
/**
* Compiler only.
* Do NOT use in runtime code paths unless behind `__DEV__` flag.
*/
const isAlwaysCloseTag = /*@__PURE__*/ makeMap(ALWAYS_CLOSE_TAGS);
//#endregion
//#region packages/shared/src/domAttrConfig.ts
/**
* On the client we only need to offer special cases for boolean attributes that
* have different names from their corresponding dom properties:
* - itemscope -> N/A
* - allowfullscreen -> allowFullscreen
* - formnovalidate -> formNoValidate
* - ismap -> isMap
* - nomodule -> noModule
* - novalidate -> noValidate
* - playsinline -> playsInline
* - readonly -> readOnly
*/
const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,playsinline,readonly`;
const isSpecialBooleanAttr = /*@__PURE__*/ makeMap(specialBooleanAttrs);
/**
* The full list is needed during SSR to produce the correct initial markup.
*/
const isBooleanAttr = /*@__PURE__*/ makeMap(specialBooleanAttrs + ",async,autofocus,autoplay,controls,default,defer,disabled,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected");
/**
* Boolean attributes should be included if the value is truthy or ''.
* e.g. `<select multiple>` compiles to `{ multiple: '' }`
*/
function includeBooleanAttr(value) {
return !!value || value === "";
}
const unsafeAttrCharRE = /[>/="'\u0009\u000a\u000c\u000d\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"
};
/**
* Known attributes, this is used for stringification of runtime static nodes
* so that we don't stringify bindings that cannot be set from HTML.
* Don't also forget to allow `data-*` and `aria-*`!
* Generated from https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes
*/
const isKnownHtmlAttr = /*@__PURE__*/ makeMap("accept,accept-charset,accesskey,action,align,allow,alt,async,autocapitalize,autocomplete,autofocus,autoplay,background,bgcolor,border,buffered,capture,challenge,charset,checked,cite,class,code,codebase,color,cols,colspan,content,contenteditable,contextmenu,controls,coords,crossorigin,csp,data,datetime,decoding,default,defer,dir,dirname,disabled,download,draggable,dropzone,enctype,enterkeyhint,for,form,formaction,formenctype,formmethod,formnovalidate,formtarget,headers,height,hidden,high,href,hreflang,http-equiv,icon,id,importance,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");
/**
* Generated from https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute
*/
const isKnownSvgAttr = /*@__PURE__*/ makeMap("xmlns,accent-height,accumulate,additive,alignment-baseline,alphabetic,amplitude,arabic-form,ascent,attributeName,attributeType,azimuth,baseFrequency,baseline-shift,baseProfile,bbox,begin,bias,by,calcMode,cap-height,class,clip,clipPathUnits,clip-path,clip-rule,color,color-interpolation,color-interpolation-filters,color-profile,color-rendering,contentScriptType,contentStyleType,crossorigin,cursor,cx,cy,d,decelerate,descent,diffuseConstant,direction,display,divisor,dominant-baseline,dur,dx,dy,edgeMode,elevation,enable-background,end,exponent,fill,fill-opacity,fill-rule,filter,filterRes,filterUnits,flood-color,flood-opacity,font-family,font-size,font-size-adjust,font-stretch,font-style,font-variant,font-weight,format,from,fr,fx,fy,g1,g2,glyph-name,glyph-orientation-horizontal,glyph-orientation-vertical,glyphRef,gradientTransform,gradientUnits,hanging,height,href,hreflang,horiz-adv-x,horiz-origin-x,id,ideographic,image-rendering,in,in2,intercept,k,k1,k2,k3,k4,kernelMatrix,kernelUnitLength,kerning,keyPoints,keySplines,keyTimes,lang,lengthAdjust,letter-spacing,lighting-color,limitingConeAngle,local,marker-end,marker-mid,marker-start,markerHeight,markerUnits,markerWidth,mask,maskContentUnits,maskUnits,mathematical,max,media,method,min,mode,name,numOctaves,offset,opacity,operator,order,orient,orientation,origin,overflow,overline-position,overline-thickness,panose-1,paint-order,path,pathLength,patternContentUnits,patternTransform,patternUnits,ping,pointer-events,points,pointsAtX,pointsAtY,pointsAtZ,preserveAlpha,preserveAspectRatio,primitiveUnits,r,radius,referrerPolicy,refX,refY,rel,rendering-intent,repeatCount,repeatDur,requiredExtensions,requiredFeatures,restart,result,rotate,rx,ry,scale,seed,shape-rendering,slope,spacing,specularConstant,specularExponent,speed,spreadMethod,startOffset,stdDeviation,stemh,stemv,stitchTiles,stop-color,stop-opacity,strikethrough-position,strikethrough-thickness,string,stroke,stroke-dasharray,stroke-dashoffset,stroke-linecap,stroke-linejoin,stroke-miterlimit,stroke-opacity,stroke-width,style,surfaceScale,systemLanguage,tabindex,tableValues,target,targetX,targetY,text-anchor,text-decoration,text-rendering,textLength,to,transform,transform-origin,type,u1,u2,underline-position,underline-thickness,unicode,unicode-bidi,unicode-range,units-per-em,v-alphabetic,v-hanging,v-ideographic,v-mathematical,values,vector-effect,version,vert-adv-y,vert-origin-x,vert-origin-y,viewBox,viewTarget,visibility,width,widths,word-spacing,writing-mode,x,x-height,x1,x2,xChannelSelector,xlink:actuate,xlink:arcrole,xlink:href,xlink:role,xlink:show,xlink:title,xlink:type,xmlns:xlink,xml:base,xml:lang,xml:space,y,y1,y2,yChannelSelector,z,zoomAndPan");
/**
* Generated from https://developer.mozilla.org/en-US/docs/Web/MathML/Attribute
*/
const isKnownMathMLAttr = /*@__PURE__*/ makeMap("accent,accentunder,actiontype,align,alignmentscope,altimg,altimg-height,altimg-valign,altimg-width,alttext,bevelled,close,columnsalign,columnlines,columnspan,denomalign,depth,dir,display,displaystyle,encoding,equalcolumns,equalrows,fence,fontstyle,fontweight,form,frame,framespacing,groupalign,height,href,id,indentalign,indentalignfirst,indentalignlast,indentshift,indentshiftfirst,indentshiftlast,indextype,justify,largetop,largeop,lquote,lspace,mathbackground,mathcolor,mathsize,mathvariant,maxsize,minlabelspacing,mode,other,overflow,position,rowalign,rowlines,rowspan,rquote,rspace,scriptlevel,scriptminsize,scriptsizemultiplier,selection,separator,separators,shift,side,src,stackalign,stretchy,subscriptshift,superscriptshift,symmetric,voffset,width,widths,xlink:href,xlink:show,xlink:type,xmlns");
/**
* Shared between server-renderer and runtime-core hydration logic
*/
function isRenderableAttrValue(value) {
if (value == null) return false;
const type = typeof value;
return type === "string" || type === "number" || type === "boolean";
}
function shouldSetAsAttr(tagName, key) {
if (key === "spellcheck" || key === "draggable" || key === "translate" || key === "autocorrect") return true;
if (key === "form") return true;
if (key === "list" && tagName === "INPUT") return true;
if (key === "type" && tagName === "TEXTAREA") return true;
if ((key === "width" || key === "height") && (tagName === "IMG" || tagName === "VIDEO" || tagName === "CANVAS" || tagName === "SOURCE")) return true;
if (key === "sandbox" && tagName === "IFRAME") return true;
return false;
}
//#endregion
//#region packages/shared/src/domNamespace.ts
const Namespaces = {
"HTML": 0,
"0": "HTML",
"SVG": 1,
"1": "SVG",
"MATH_ML": 2,
"2": "MATH_ML"
};
//#endregion
//#region packages/shared/src/escapeHtml.ts
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 = "&quot;";
break;
case 38:
escaped = "&amp;";
break;
case 39:
escaped = "&#39;";
break;
case 60:
escaped = "&lt;";
break;
case 62:
escaped = "&gt;";
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) {
let prev;
do {
prev = src;
src = src.replace(commentStripRE, "");
} while (src !== prev);
return src;
}
const cssVarNameEscapeSymbolsRE = /[ !"#$%&'()*+,./:;<=>?@[\\\]^`{|}~]/g;
function getEscapedCssVarName(key, doubleEscape) {
return key.replace(cssVarNameEscapeSymbolsRE, (s) => doubleEscape ? s === "\"" ? "\\\\\\\"" : `\\\\${s}` : `\\${s}`);
}
//#endregion
//#region packages/shared/src/looseEqual.ts
function looseCompareArrays(a, b, seen) {
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], seen);
return equal;
}
function looseCompareCollections(a, b, seen) {
if (a.size !== b.size) return false;
const candidates = Array.from(b);
const matched = new Uint8Array(candidates.length);
for (const item of a) {
let index = -1;
for (let i = 0; i < candidates.length; i++) if (!matched[i] && looseEqual(item, candidates[i], seen)) {
index = i;
break;
}
if (index < 0) return false;
matched[index] = 1;
}
return true;
}
function looseCompareObjects(a, b, seen) {
let aValidType = isMap(a);
let bValidType = isMap(b);
if (aValidType || bValidType) return aValidType && bValidType ? looseCompareCollections(a, b, seen) : false;
aValidType = isSet(a);
bValidType = isSet(b);
if (aValidType || bValidType) return aValidType && bValidType ? looseCompareCollections(a, b, seen) : false;
if (Object.keys(a).length !== Object.keys(b).length) 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], seen)) return false;
}
return String(a) === String(b);
}
function looseCompareNested(a, b, seen, compare) {
if (!seen) seen = [/* @__PURE__ */ new Map(), /* @__PURE__ */ new Map()];
const [seenA, seenB] = seen;
if (seenA.has(a) || seenB.has(b)) return seenA.get(a) === b && seenB.get(b) === a;
seenA.set(a, b);
seenB.set(b, a);
const equal = compare(a, b, seen);
seenA.delete(a);
seenB.delete(b);
return equal;
}
function looseEqual(a, b, seen) {
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 ? looseCompareNested(a, b, seen, looseCompareArrays) : false;
aValidType = isObject(a);
bValidType = isObject(b);
if (aValidType || bValidType) {
if (!aValidType || !bValidType) return false;
return looseCompareNested(a, b, seen, looseCompareObjects);
}
return String(a) === String(b);
}
function looseIndexOf(arr, val) {
return arr.findIndex((item) => looseEqual(item, val));
}
//#endregion
//#region packages/shared/src/toDisplayString.ts
const isRef = (val) => {
return !!(val && val["__v_isRef"] === true);
};
/**
* For converting {{ interpolation }} values to displayed strings.
* @private
*/
const toDisplayString = (val) => {
switch (typeof val) {
case "string": return val;
case "object": if (val) {
if (isRef(val)) return toDisplayString(val.value);
else if (isArray(val) || val.toString === objectToString || !isFunction(val.toString)) return JSON.stringify(val, replacer, 2);
}
default: return val == null ? "" : String(val);
}
};
const replacer = (_key, val) => {
if (isRef(val)) return replacer(_key, val.value);
else if (isMap(val)) return { [`Map(${val.size})`]: [...val.entries()].reduce((entries, [key, val], i) => {
entries[stringifySymbol(key, i) + " =>"] = val;
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 _description;
return isSymbol(v) ? `Symbol(${(_description = v.description) !== null && _description !== void 0 ? _description : i})` : v;
};
//#endregion
//#region packages/shared/src/subSequence.ts
function getSequence(arr) {
const p = arr.slice();
const result = [0];
let i, j, u, v, c;
const len = arr.length;
for (i = 0; i < len; i++) {
const arrI = arr[i];
if (arrI !== 0) {
j = result[result.length - 1];
if (arr[j] < arrI) {
p[i] = j;
result.push(i);
continue;
}
u = 0;
v = result.length - 1;
while (u < v) {
c = u + v >> 1;
if (arr[result[c]] < arrI) u = c + 1;
else v = c;
}
if (arrI < arr[result[u]]) {
if (u > 0) p[i] = result[u - 1];
result[u] = i;
}
}
}
u = result.length;
v = result[u - 1];
while (u-- > 0) {
result[u] = v;
v = p[v];
}
return result;
}
//#endregion
//#region packages/shared/src/cssVars.ts
/**
* Normalize CSS var value created by `v-bind` in `<style>` block
* See https://github.com/vuejs/core/pull/12461#issuecomment-2495804664
*/
function normalizeCssVarValue(value) {
if (value == null) return "initial";
if (typeof value === "string") return value === "" ? " " : value;
if (typeof value !== "number" || !Number.isFinite(value)) {}
return String(value);
}
//#endregion
//#region packages/shared/src/vaporFlags.ts
/**
* Flags to optimize vapor `createFor` runtime behavior, shared between the
* compiler and the runtime
*/
const VaporVForFlags = {
"FAST_REMOVE": 1,
"1": "FAST_REMOVE",
"IS_COMPONENT": 2,
"2": "IS_COMPONENT",
"ONCE": 4,
"4": "ONCE",
"IS_SINGLE_NODE": 8,
"8": "IS_SINGLE_NODE",
"IS_FRAGMENT": 16,
"16": "IS_FRAGMENT",
"SLOT_ROOT": 32,
"32": "SLOT_ROOT",
"WRAPPED_ROWS": 64,
"64": "WRAPPED_ROWS"
};
const VaporBlockShape = {
"EMPTY": 0,
"0": "EMPTY",
"SINGLE_ROOT": 1,
"1": "SINGLE_ROOT",
"MULTI_ROOT": 2,
"2": "MULTI_ROOT",
"ELSE_IF": 3,
"3": "ELSE_IF"
};
/**
* Bit layout for vapor `createIf` flags.
*
* - bits 0-1: true branch VaporBlockShape
* - bits 2-3: false branch VaporBlockShape
* - bit 4: v-once
* - bit 5: true branch is static and can skip branch-owned EffectScope
* - bit 6: false branch is static and can skip branch-owned EffectScope
* - bit 7: v-if sits on a slot content/fallback root chain
* - bits 8+: branch index + 1 for keyed dynamic fragments
*
* Examples:
* - v-once, true single-root, no false branch: 1 | ONCE = 17
* - keyed index 0, true/false single-root: 1 | (1 << 2) | (1 << 8) = 261
*/
const VaporIfFlags = {
"BLOCK_SHAPE": 15,
"15": "BLOCK_SHAPE",
"ONCE": 16,
"16": "ONCE",
"TRUE_NO_SCOPE": 32,
"32": "TRUE_NO_SCOPE",
"FALSE_NO_SCOPE": 64,
"64": "FALSE_NO_SCOPE",
"SLOT_ROOT": 128,
"128": "SLOT_ROOT",
"INDEX_SHIFT": 8,
"8": "INDEX_SHIFT"
};
/**
* Flags used by vapor template factories, shared between the compiler and the
* runtime.
*/
const TemplateFlags = {
"ROOT": 1,
"1": "ROOT",
"STATIC": 2,
"2": "STATIC"
};
/**
* Flags used by vapor slot outlets, shared between the compiler and the
* runtime.
*/
const VaporSlotFlags = {
"NO_SLOTTED": 1,
"1": "NO_SLOTTED",
"ONCE": 2,
"2": "ONCE",
"FORWARDED": 4,
"4": "FORWARDED"
};
function isForwardedSlot(flags) {
return !!(flags & 4);
}
/**
* The data of the comment a vapor server render opens the branch of a `v-if`
* chain with, `<!--[1-->`: the digits are the branch's position in the chain,
* and `<!--]-->` closes it like a fragment.
*/
function isVaporBranchStart(data) {
if (data.length < 2 || data.charCodeAt(0) !== 91) return false;
for (let i = 1; i < data.length; i++) {
const c = data.charCodeAt(i);
if (c < 48 || c > 57) return false;
}
return true;
}
function slotNotifiesBoundary(flags) {
return isForwardedSlot(flags) && !(flags & 2);
}
/**
* Per-slot-function metadata attached by the compiler as `fn._`.
*/
const VaporSlotStability = {
"NON_STABLE": 1,
"1": "NON_STABLE"
};
const VaporDynamicComponentFlags = {
"SINGLE_ROOT": 1,
"1": "SINGLE_ROOT",
"ONCE": 2,
"2": "ONCE",
"SLOT_ROOT": 4,
"4": "SLOT_ROOT",
"DOM2_FLATTEN_TRUE": 65536,
"65536": "DOM2_FLATTEN_TRUE",
"DOM2_FLATTEN_FALSE": 131072,
"131072": "DOM2_FLATTEN_FALSE",
"NS_SVG": 8,
"8": "NS_SVG",
"NS_MATHML": 16,
"16": "NS_MATHML",
"SLOT_SINGLE_ROOT": 32,
"32": "SLOT_SINGLE_ROOT"
};
/**
* `isSingleRoot` of a component creation call for the single root of a slot
* body (`true` marks the single root of a component template). See
* resolveFallthroughOwner in runtime-vapor.
*/
const VaporSingleRoot = {
"SLOT": 2,
"2": "SLOT"
};
//#endregion
exports.EMPTY_ARR = EMPTY_ARR;
exports.EMPTY_OBJ = EMPTY_OBJ;
exports.NO = NO;
exports.NOOP = NOOP;
exports.Namespaces = Namespaces;
exports.PatchFlagNames = PatchFlagNames;
exports.PatchFlags = PatchFlags;
exports.ShapeFlags = ShapeFlags;
exports.SlotFlags = SlotFlags;
exports.TemplateFlags = TemplateFlags;
exports.VaporBlockShape = VaporBlockShape;
exports.VaporDynamicComponentFlags = VaporDynamicComponentFlags;
exports.VaporIfFlags = VaporIfFlags;
exports.VaporSingleRoot = VaporSingleRoot;
exports.VaporSlotFlags = VaporSlotFlags;
exports.VaporSlotStability = VaporSlotStability;
exports.VaporVForFlags = VaporVForFlags;
exports.YES = YES;
exports.camelize = camelize;
exports.canSetValueDirectly = canSetValueDirectly;
exports.capitalize = capitalize;
exports.cssVarNameEscapeSymbolsRE = cssVarNameEscapeSymbolsRE;
exports.def = def;
exports.escapeHtml = escapeHtml;
exports.escapeHtmlComment = escapeHtmlComment;
exports.extend = extend;
exports.genCacheKey = genCacheKey;
exports.genPropsAccessExp = genPropsAccessExp;
exports.generateCodeFrame = generateCodeFrame;
exports.getEscapedCssVarName = getEscapedCssVarName;
exports.getGlobalThis = getGlobalThis;
exports.getModifierPropName = getModifierPropName;
exports.getSequence = getSequence;
exports.hasChanged = hasChanged;
exports.hasOwn = hasOwn;
exports.hyphenate = hyphenate;
exports.includeBooleanAttr = includeBooleanAttr;
exports.invokeArrayFns = invokeArrayFns;
exports.isAlwaysCloseTag = isAlwaysCloseTag;
exports.isArray = isArray;
exports.isBooleanAttr = isBooleanAttr;
exports.isBuiltInDirective = isBuiltInDirective;
exports.isBuiltInTag = isBuiltInTag;
exports.isDate = isDate;
exports.isFormattingTag = isFormattingTag;
exports.isForwardedSlot = isForwardedSlot;
exports.isFunction = isFunction;
exports.isGloballyAllowed = isGloballyAllowed;
exports.isGloballyWhitelisted = isGloballyWhitelisted;
exports.isHTMLTag = isHTMLTag;
exports.isIntegerKey = isIntegerKey;
exports.isKnownHtmlAttr = isKnownHtmlAttr;
exports.isKnownMathMLAttr = isKnownMathMLAttr;
exports.isKnownSvgAttr = isKnownSvgAttr;
exports.isMap = isMap;
exports.isMathMLTag = isMathMLTag;
exports.isModelListener = isModelListener;
exports.isNativeOn = isNativeOn;
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.isVaporBranchStart = isVaporBranchStart;
exports.isVoidTag = isVoidTag;
exports.looseEqual = looseEqual;
exports.looseIndexOf = looseIndexOf;
exports.looseToNumber = looseToNumber;
exports.makeMap = makeMap;
exports.normalizeClass = normalizeClass;
exports.normalizeCssVarValue = normalizeCssVarValue;
exports.normalizeProps = normalizeProps;
exports.normalizeStyle = normalizeStyle;
exports.objectToString = objectToString;
exports.parseStringStyle = parseStringStyle;
exports.propsToAttrMap = propsToAttrMap;
exports.remove = remove;
exports.shouldSetAsAttr = shouldSetAsAttr;
exports.slotFlagsText = slotFlagsText;
exports.slotNotifiesBoundary = slotNotifiesBoundary;
exports.stringifyStyle = stringifyStyle;
exports.toDisplayString = toDisplayString;
exports.toHandlerKey = toHandlerKey;
exports.toNumber = toNumber;
exports.toRawType = toRawType;
exports.toTypeString = toTypeString;
@@ -0,0 +1,537 @@
//#region temp/packages/shared/src/makeMap.d.ts
/**
* 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 they can be tree-shaken if necessary.
*/
export declare function makeMap(str: string): (key: string) => boolean;
//#endregion
//#region temp/packages/shared/src/general.d.ts
export declare const EMPTY_OBJ: {
readonly [key: string]: any;
};
export declare const EMPTY_ARR: readonly never[];
export declare const NOOP: () => void;
/**
* Always return true.
*/
export declare const YES: () => boolean;
/**
* Always return false.
*/
export declare const NO: () => boolean;
export declare const isOn: (key: string) => boolean;
export declare const isNativeOn: (key: string) => boolean;
export declare const isModelListener: (key: string) => boolean;
export declare const extend: typeof Object.assign;
export declare const remove: <T>(arr: T[], el: T) => void;
export declare const hasOwn: (val: object, key: string | symbol) => key is keyof typeof val;
export declare const isArray: typeof Array.isArray;
export declare const isMap: (val: unknown) => val is Map<any, any>;
export declare const isSet: (val: unknown) => val is Set<any>;
export declare const isDate: (val: unknown) => val is Date;
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: typeof Object.prototype.toString;
export declare const toTypeString: (value: unknown) => string;
export declare const toRawType: (value: unknown) => string;
export declare const isPlainObject: (val: unknown) => val is object;
export declare const isIntegerKey: (key: unknown) => boolean;
export declare const isReservedProp: (key: string) => boolean;
export declare const isBuiltInTag: (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>}`;
/**
* #13070 When v-model and v-model:model directives are used together,
* they will generate the same modelModifiers prop,
* so a `$` suffix is added to avoid conflicts.
* @private
*/
export declare const getModifierPropName: (name: string) => string;
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, writable?: boolean) => 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;
export declare function genCacheKey(source: string, options: any): string;
export declare function canSetValueDirectly(tagName: string): boolean;
//#endregion
//#region temp/packages/shared/src/patchFlags.d.ts
/**
* 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 cached static vnode. This is also a hint for hydration to skip
* the entire sub tree since static content never needs to be updated.
*/
CACHED = -1,
/**
* A special flag that indicates that the diffing algorithm should bail out
* of optimized mode. For example, on block fragments created by renderSlot()
* 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>;
//#endregion
//#region temp/packages/shared/src/shapeFlags.d.ts
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,
SLOT_FALLBACK = 1024,
COMPONENT = 6
}
//#endregion
//#region temp/packages/shared/src/slotFlags.d.ts
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: Record<SlotFlags, string>;
//#endregion
//#region temp/packages/shared/src/globalsAllowList.d.ts
export declare const isGloballyAllowed: (key: string) => boolean;
/** @deprecated use `isGloballyAllowed` instead */
export declare const isGloballyWhitelisted: (key: string) => boolean;
//#endregion
//#region temp/packages/shared/src/codeframe.d.ts
export declare function generateCodeFrame(source: string, start?: number, end?: number): string;
//#endregion
//#region temp/packages/shared/src/normalizeProp.d.ts
export type NormalizedStyle = Record<string, unknown>;
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;
//#endregion
//#region temp/packages/shared/src/domTagConfig.d.ts
/**
* 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;
/**
* Compiler only.
* Do NOT use in runtime code paths unless behind `__DEV__` flag.
*/
export declare const isFormattingTag: (key: string) => boolean;
/**
* Compiler only.
* Do NOT use in runtime code paths unless behind `__DEV__` flag.
*/
export declare const isAlwaysCloseTag: (key: string) => boolean;
//#endregion
//#region temp/packages/shared/src/domAttrConfig.d.ts
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;
/**
* Generated from https://developer.mozilla.org/en-US/docs/Web/MathML/Attribute
*/
export declare const isKnownMathMLAttr: (key: string) => boolean;
/**
* Shared between server-renderer and runtime-core hydration logic
*/
export declare function isRenderableAttrValue(value: unknown): boolean;
export declare function shouldSetAsAttr(tagName: string, key: string): boolean;
//#endregion
//#region temp/packages/shared/src/domNamespace.d.ts
export type Namespace = number;
export declare enum Namespaces {
HTML = 0,
SVG = 1,
MATH_ML = 2
}
//#endregion
//#region temp/packages/shared/src/escapeHtml.d.ts
export declare function escapeHtml(string: unknown): string;
export declare function escapeHtmlComment(src: string): string;
export declare const cssVarNameEscapeSymbolsRE: RegExp;
export declare function getEscapedCssVarName(key: string, doubleEscape: boolean): string;
//#endregion
//#region temp/packages/shared/src/looseEqual.d.ts
type ComparisonState = [Map<any, any>, Map<any, any>];
export declare function looseEqual(a: any, b: any, seen?: ComparisonState): boolean;
export declare function looseIndexOf(arr: any[], val: any): number;
//#endregion
//#region temp/packages/shared/src/toDisplayString.d.ts
/**
* For converting {{ interpolation }} values to displayed strings.
* @private
*/
export declare const toDisplayString: (val: unknown) => string;
//#endregion
//#region temp/packages/shared/src/typeUtils.d.ts
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 IsKeyValues<T, K = string> = IfAny<T, false, T extends object ? (keyof T extends K ? true : false) : false>;
/**
* Utility for extracting the parameters from a function overload (for typed emits)
* https://github.com/microsoft/TypeScript/issues/32164#issuecomment-1146737709
*/
export type OverloadParameters<T extends (...args: any[]) => any> = Parameters<OverloadUnion<T>>;
type OverloadProps<TOverload> = Pick<TOverload, keyof TOverload>;
type OverloadUnionRecursive<TOverload, TPartialOverload = unknown> = TOverload extends ((...args: infer TArgs) => infer TReturn) ? TPartialOverload extends TOverload ? never : OverloadUnionRecursive<TPartialOverload & TOverload, TPartialOverload & ((...args: TArgs) => TReturn) & OverloadProps<TOverload>> | ((...args: TArgs) => TReturn) : never;
type OverloadUnion<TOverload extends (...args: any[]) => any> = Exclude<OverloadUnionRecursive<(() => never) & TOverload>, TOverload extends (() => never) ? never : () => never>;
//#endregion
//#region temp/packages/shared/src/subSequence.d.ts
export declare function getSequence(arr: number[]): number[];
//#endregion
//#region temp/packages/shared/src/cssVars.d.ts
/**
* Normalize CSS var value created by `v-bind` in `<style>` block
* See https://github.com/vuejs/core/pull/12461#issuecomment-2495804664
*/
export declare function normalizeCssVarValue(value: unknown): string;
//#endregion
//#region temp/packages/shared/src/vaporFlags.d.ts
/**
* Flags to optimize vapor `createFor` runtime behavior, shared between the
* compiler and the runtime
*/
export declare enum VaporVForFlags {
/**
* v-for is the only child of a parent container, so it can take the fast
* path with textContent = '' when the whole list is emptied
*/
FAST_REMOVE = 1,
/**
* v-for used on a component-shaped item. Component items require structural
* removal before item scope cleanup and cannot use the fast-clear path. This
* does not guarantee the item block is a VaporComponentInstance: component
* fallback paths may still return a DOM Node.
*/
IS_COMPONENT = 2,
/**
* v-for inside v-once
*/
ONCE = 4,
/**
* v-for item block is a single DOM Node.
*/
IS_SINGLE_NODE = 8,
/**
* v-for item block is known to be a VaporFragment, so runtime can use
* fragment-specific insert/remove helpers.
*/
IS_FRAGMENT = 16,
/**
* v-for sits on a slot content/fallback root chain and can change slot
* validity.
*/
SLOT_ROOT = 32,
/**
* The server wraps every row in `<!--[-->...<!--]-->`: the row template is
* not a single element and the list is not a direct child of a Transition
* or TransitionGroup (compiler-ssr `needFragmentWrapper`). Hydration then
* treats a leading `<!--[-->` as the row wrapper rather than as the row
* content's own marker.
*/
WRAPPED_ROWS = 64
}
export declare enum VaporBlockShape {
EMPTY = 0,
SINGLE_ROOT = 1,
MULTI_ROOT = 2,
/**
* A `createIf` false branch that is the `v-else-if` rest of the chain: a
* nested `createIf` that renders the chain's later branches.
*/
ELSE_IF = 3
}
/**
* Bit layout for vapor `createIf` flags.
*
* - bits 0-1: true branch VaporBlockShape
* - bits 2-3: false branch VaporBlockShape
* - bit 4: v-once
* - bit 5: true branch is static and can skip branch-owned EffectScope
* - bit 6: false branch is static and can skip branch-owned EffectScope
* - bit 7: v-if sits on a slot content/fallback root chain
* - bits 8+: branch index + 1 for keyed dynamic fragments
*
* Examples:
* - v-once, true single-root, no false branch: 1 | ONCE = 17
* - keyed index 0, true/false single-root: 1 | (1 << 2) | (1 << 8) = 261
*/
export declare enum VaporIfFlags {
/**
* Documents the packed true/false branch shape bits. Runtime decode shifts
* to the selected branch first, then masks with 0b11 for one VaporBlockShape.
*
* `createIfChain` splits the same bits across two arguments: each branch
* flags entry holds that branch's shape with `TRUE_NO_SCOPE`, the chain
* flags hold `ONCE`, `SLOT_ROOT` and the keyed index.
*/
BLOCK_SHAPE = 15,
/**
* Marks a branch that is created once and never updated.
*/
ONCE = 16,
/**
* The compiler proved that the true branch only returns static template nodes,
* so runtime can skip creating a branch-owned EffectScope.
*/
TRUE_NO_SCOPE = 32,
/**
* The compiler proved that the false branch only returns static template
* nodes, so runtime can skip creating a branch-owned EffectScope.
*/
FALSE_NO_SCOPE = 64,
/**
* v-if sits on a slot content/fallback root chain and can change slot
* validity.
*/
SLOT_ROOT = 128,
/**
* Shift for keyed branch index. The encoded value is index + 1, so decoded
* zero means "not keyed" and source index 0 still round-trips.
*/
INDEX_SHIFT = 8
}
/**
* Flags used by vapor template factories, shared between the compiler and the
* runtime.
*/
export declare enum TemplateFlags {
ROOT = 1,
STATIC = 2
}
/**
* Flags used by vapor slot outlets, shared between the compiler and the
* runtime.
*/
export declare enum VaporSlotFlags {
NO_SLOTTED = 1,
ONCE = 2,
FORWARDED = 4
}
export declare function isForwardedSlot(flags: number): boolean;
/**
* The data of the comment a vapor server render opens the branch of a `v-if`
* chain with, `<!--[1-->`: the digits are the branch's position in the chain,
* and `<!--]-->` closes it like a fragment.
*/
export declare function isVaporBranchStart(data: string): boolean;
export declare function slotNotifiesBoundary(flags: number): boolean;
/**
* Per-slot-function metadata attached by the compiler as `fn._`.
*/
export declare enum VaporSlotStability {
NON_STABLE = 1
}
export declare enum VaporDynamicComponentFlags {
SINGLE_ROOT = 1,
ONCE = 2,
SLOT_ROOT = 4,
DOM2_FLATTEN_TRUE = 65536,
DOM2_FLATTEN_FALSE = 131072,
NS_SVG = 8,
NS_MATHML = 16,
SLOT_SINGLE_ROOT = 32
}
/**
* `isSingleRoot` of a component creation call for the single root of a slot
* body (`true` marks the single root of a component template). See
* resolveFallthroughOwner in runtime-vapor.
*/
export declare enum VaporSingleRoot {
SLOT = 2
}
//#endregion
@@ -0,0 +1,822 @@
/**
* @vue/shared v3.6.0-rc.14
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT
**/
//#region packages/shared/src/makeMap.ts
/**
* 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 they can be tree-shaken if necessary.
*/
/*@__NO_SIDE_EFFECTS__*/
function makeMap(str) {
const map = Object.create(null);
for (const key of str.split(",")) map[key] = 1;
return (val) => val in map;
}
//#endregion
//#region packages/shared/src/general.ts
const EMPTY_OBJ = !!(process.env.NODE_ENV !== "production") ? Object.freeze({}) : {};
const EMPTY_ARR = !!(process.env.NODE_ENV !== "production") ? Object.freeze([]) : [];
const NOOP = () => {};
/**
* Always return true.
*/
const YES = () => true;
/**
* Always return false.
*/
const NO = () => false;
const isOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && (key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97);
const isNativeOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && key.charCodeAt(2) > 96 && key.charCodeAt(2) < 123;
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 || typeof key === "number" && Number.isInteger(key) && key >= 0;
const isReservedProp = /*@__PURE__*/ makeMap(",key,ref,ref_for,ref_key,__cid,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted");
const isBuiltInTag = /*#__PURE__*/ makeMap("slot,component");
const isBuiltInDirective = /*@__PURE__*/ makeMap("bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo");
const cacheStringFunction = (fn) => {
const cache = Object.create(null);
return ((str) => {
return cache[str] || (cache[str] = fn(str));
});
};
const camelizeRE = /-(\w)/g;
const camelizeReplacer = (_, c) => c ? c.toUpperCase() : "";
/**
* @private
*/
const camelize = cacheStringFunction((str) => str.replace(camelizeRE, camelizeReplacer));
const hyphenateRE = /\B([A-Z])/g;
/**
* @private
*/
const hyphenate = cacheStringFunction((str) => str.replace(hyphenateRE, "-$1").toLowerCase());
/**
* @private
*/
const capitalize = cacheStringFunction((str) => {
return str.charAt(0).toUpperCase() + str.slice(1);
});
/**
* @private
*/
const toHandlerKey = cacheStringFunction((str) => {
return str ? `on${capitalize(str)}` : ``;
});
/**
* #13070 When v-model and v-model:model directives are used together,
* they will generate the same modelModifiers prop,
* so a `$` suffix is added to avoid conflicts.
* @private
*/
const getModifierPropName = (name) => {
return `${name === "modelValue" || name === "model-value" ? "model" : name}Modifiers${name === "model" ? "$" : ""}`;
};
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, writable = false) => {
Object.defineProperty(obj, key, {
configurable: true,
enumerable: false,
writable,
value
});
};
/**
* "123-foo" will be parsed to 123
* This is used for the .number modifier in v-model
*/
const looseToNumber = (val) => {
const n = parseFloat(val);
return isNaN(n) ? val : n;
};
/**
* Only concerns number-like strings
* "123-foo" will be returned as-is
*/
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)}]`;
}
function genCacheKey(source, options) {
return source + JSON.stringify(options, (_, val) => typeof val === "function" ? val.toString() : val);
}
function canSetValueDirectly(tagName) {
return tagName !== "PROGRESS" && !tagName.includes("-");
}
//#endregion
//#region packages/shared/src/patchFlags.ts
/**
* 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.
*/
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",
"CACHED": -1,
"-1": "CACHED",
"BAIL": -2,
"-2": "BAIL"
};
/**
* dev only flag -> name mapping
*/
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]: `CACHED`,
[-2]: `BAIL`
};
//#endregion
//#region packages/shared/src/shapeFlags.ts
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",
"SLOT_FALLBACK": 1024,
"1024": "SLOT_FALLBACK",
"COMPONENT": 6,
"6": "COMPONENT"
};
//#endregion
//#region packages/shared/src/slotFlags.ts
const SlotFlags = {
"STABLE": 1,
"1": "STABLE",
"DYNAMIC": 2,
"2": "DYNAMIC",
"FORWARDED": 3,
"3": "FORWARDED"
};
/**
* Dev only
*/
const slotFlagsText = {
[1]: "STABLE",
[2]: "DYNAMIC",
[3]: "FORWARDED"
};
const isGloballyAllowed = /*@__PURE__*/ makeMap("Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console,Error,Symbol");
/** @deprecated use `isGloballyAllowed` instead */
const isGloballyWhitelisted = isGloballyAllowed;
//#endregion
//#region packages/shared/src/codeframe.ts
const range = 2;
function generateCodeFrame(source, start = 0, end = source.length) {
start = Math.max(0, Math.min(start, source.length));
end = Math.max(0, Math.min(end, source.length));
if (start > end) return "";
let lines = source.split(/(\r?\n)/);
const newlineSequences = lines.filter((_, idx) => idx % 2 === 1);
lines = lines.filter((_, idx) => idx % 2 === 0);
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");
}
//#endregion
//#region packages/shared/src/normalizeProp.ts
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, (match) => match.startsWith("/*") ? "" : match).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) {
if (!styles) return "";
if (isString(styles)) return styles;
let ret = "";
for (const key in styles) {
const value = styles[key];
if (isString(value) || typeof value === "number") {
const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key);
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;
}
//#endregion
//#region packages/shared/src/domTagConfig.ts
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 FORMATTING_TAGS = "a,b,big,code,em,font,i,nobr,s,small,strike,strong,tt,u";
const ALWAYS_CLOSE_TAGS = "title,style,script,noscript,template,object,table,button,textarea,select,iframe,fieldset,form,foreignObject,desc,mi,mo,mn,ms,mtext,annotation-xml";
/**
* Compiler only.
* Do NOT use in runtime code paths unless behind `!!(process.env.NODE_ENV !== 'production')` flag.
*/
const isHTMLTag = /*@__PURE__*/ makeMap(HTML_TAGS);
/**
* Compiler only.
* Do NOT use in runtime code paths unless behind `!!(process.env.NODE_ENV !== 'production')` flag.
*/
const isSVGTag = /*@__PURE__*/ makeMap(SVG_TAGS);
/**
* Compiler only.
* Do NOT use in runtime code paths unless behind `!!(process.env.NODE_ENV !== 'production')` flag.
*/
const isMathMLTag = /*@__PURE__*/ makeMap(MATH_TAGS);
/**
* Compiler only.
* Do NOT use in runtime code paths unless behind `!!(process.env.NODE_ENV !== 'production')` flag.
*/
const isVoidTag = /*@__PURE__*/ makeMap(VOID_TAGS);
/**
* Compiler only.
* Do NOT use in runtime code paths unless behind `!!(process.env.NODE_ENV !== 'production')` flag.
*/
const isFormattingTag = /*@__PURE__*/ makeMap(FORMATTING_TAGS);
/**
* Compiler only.
* Do NOT use in runtime code paths unless behind `!!(process.env.NODE_ENV !== 'production')` flag.
*/
const isAlwaysCloseTag = /*@__PURE__*/ makeMap(ALWAYS_CLOSE_TAGS);
//#endregion
//#region packages/shared/src/domAttrConfig.ts
/**
* On the client we only need to offer special cases for boolean attributes that
* have different names from their corresponding dom properties:
* - itemscope -> N/A
* - allowfullscreen -> allowFullscreen
* - formnovalidate -> formNoValidate
* - ismap -> isMap
* - nomodule -> noModule
* - novalidate -> noValidate
* - playsinline -> playsInline
* - readonly -> readOnly
*/
const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,playsinline,readonly`;
const isSpecialBooleanAttr = /*@__PURE__*/ makeMap(specialBooleanAttrs);
/**
* The full list is needed during SSR to produce the correct initial markup.
*/
const isBooleanAttr = /*@__PURE__*/ makeMap(specialBooleanAttrs + ",async,autofocus,autoplay,controls,default,defer,disabled,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected");
/**
* Boolean attributes should be included if the value is truthy or ''.
* e.g. `<select multiple>` compiles to `{ multiple: '' }`
*/
function includeBooleanAttr(value) {
return !!value || value === "";
}
const unsafeAttrCharRE = /[>/="'\u0009\u000a\u000c\u000d\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"
};
/**
* Known attributes, this is used for stringification of runtime static nodes
* so that we don't stringify bindings that cannot be set from HTML.
* Don't also forget to allow `data-*` and `aria-*`!
* Generated from https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes
*/
const isKnownHtmlAttr = /*@__PURE__*/ makeMap("accept,accept-charset,accesskey,action,align,allow,alt,async,autocapitalize,autocomplete,autofocus,autoplay,background,bgcolor,border,buffered,capture,challenge,charset,checked,cite,class,code,codebase,color,cols,colspan,content,contenteditable,contextmenu,controls,coords,crossorigin,csp,data,datetime,decoding,default,defer,dir,dirname,disabled,download,draggable,dropzone,enctype,enterkeyhint,for,form,formaction,formenctype,formmethod,formnovalidate,formtarget,headers,height,hidden,high,href,hreflang,http-equiv,icon,id,importance,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");
/**
* Generated from https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute
*/
const isKnownSvgAttr = /*@__PURE__*/ makeMap("xmlns,accent-height,accumulate,additive,alignment-baseline,alphabetic,amplitude,arabic-form,ascent,attributeName,attributeType,azimuth,baseFrequency,baseline-shift,baseProfile,bbox,begin,bias,by,calcMode,cap-height,class,clip,clipPathUnits,clip-path,clip-rule,color,color-interpolation,color-interpolation-filters,color-profile,color-rendering,contentScriptType,contentStyleType,crossorigin,cursor,cx,cy,d,decelerate,descent,diffuseConstant,direction,display,divisor,dominant-baseline,dur,dx,dy,edgeMode,elevation,enable-background,end,exponent,fill,fill-opacity,fill-rule,filter,filterRes,filterUnits,flood-color,flood-opacity,font-family,font-size,font-size-adjust,font-stretch,font-style,font-variant,font-weight,format,from,fr,fx,fy,g1,g2,glyph-name,glyph-orientation-horizontal,glyph-orientation-vertical,glyphRef,gradientTransform,gradientUnits,hanging,height,href,hreflang,horiz-adv-x,horiz-origin-x,id,ideographic,image-rendering,in,in2,intercept,k,k1,k2,k3,k4,kernelMatrix,kernelUnitLength,kerning,keyPoints,keySplines,keyTimes,lang,lengthAdjust,letter-spacing,lighting-color,limitingConeAngle,local,marker-end,marker-mid,marker-start,markerHeight,markerUnits,markerWidth,mask,maskContentUnits,maskUnits,mathematical,max,media,method,min,mode,name,numOctaves,offset,opacity,operator,order,orient,orientation,origin,overflow,overline-position,overline-thickness,panose-1,paint-order,path,pathLength,patternContentUnits,patternTransform,patternUnits,ping,pointer-events,points,pointsAtX,pointsAtY,pointsAtZ,preserveAlpha,preserveAspectRatio,primitiveUnits,r,radius,referrerPolicy,refX,refY,rel,rendering-intent,repeatCount,repeatDur,requiredExtensions,requiredFeatures,restart,result,rotate,rx,ry,scale,seed,shape-rendering,slope,spacing,specularConstant,specularExponent,speed,spreadMethod,startOffset,stdDeviation,stemh,stemv,stitchTiles,stop-color,stop-opacity,strikethrough-position,strikethrough-thickness,string,stroke,stroke-dasharray,stroke-dashoffset,stroke-linecap,stroke-linejoin,stroke-miterlimit,stroke-opacity,stroke-width,style,surfaceScale,systemLanguage,tabindex,tableValues,target,targetX,targetY,text-anchor,text-decoration,text-rendering,textLength,to,transform,transform-origin,type,u1,u2,underline-position,underline-thickness,unicode,unicode-bidi,unicode-range,units-per-em,v-alphabetic,v-hanging,v-ideographic,v-mathematical,values,vector-effect,version,vert-adv-y,vert-origin-x,vert-origin-y,viewBox,viewTarget,visibility,width,widths,word-spacing,writing-mode,x,x-height,x1,x2,xChannelSelector,xlink:actuate,xlink:arcrole,xlink:href,xlink:role,xlink:show,xlink:title,xlink:type,xmlns:xlink,xml:base,xml:lang,xml:space,y,y1,y2,yChannelSelector,z,zoomAndPan");
/**
* Generated from https://developer.mozilla.org/en-US/docs/Web/MathML/Attribute
*/
const isKnownMathMLAttr = /*@__PURE__*/ makeMap("accent,accentunder,actiontype,align,alignmentscope,altimg,altimg-height,altimg-valign,altimg-width,alttext,bevelled,close,columnsalign,columnlines,columnspan,denomalign,depth,dir,display,displaystyle,encoding,equalcolumns,equalrows,fence,fontstyle,fontweight,form,frame,framespacing,groupalign,height,href,id,indentalign,indentalignfirst,indentalignlast,indentshift,indentshiftfirst,indentshiftlast,indextype,justify,largetop,largeop,lquote,lspace,mathbackground,mathcolor,mathsize,mathvariant,maxsize,minlabelspacing,mode,other,overflow,position,rowalign,rowlines,rowspan,rquote,rspace,scriptlevel,scriptminsize,scriptsizemultiplier,selection,separator,separators,shift,side,src,stackalign,stretchy,subscriptshift,superscriptshift,symmetric,voffset,width,widths,xlink:href,xlink:show,xlink:type,xmlns");
/**
* Shared between server-renderer and runtime-core hydration logic
*/
function isRenderableAttrValue(value) {
if (value == null) return false;
const type = typeof value;
return type === "string" || type === "number" || type === "boolean";
}
function shouldSetAsAttr(tagName, key) {
if (key === "spellcheck" || key === "draggable" || key === "translate" || key === "autocorrect") return true;
if (key === "form") return true;
if (key === "list" && tagName === "INPUT") return true;
if (key === "type" && tagName === "TEXTAREA") return true;
if ((key === "width" || key === "height") && (tagName === "IMG" || tagName === "VIDEO" || tagName === "CANVAS" || tagName === "SOURCE")) return true;
if (key === "sandbox" && tagName === "IFRAME") return true;
return false;
}
//#endregion
//#region packages/shared/src/domNamespace.ts
const Namespaces = {
"HTML": 0,
"0": "HTML",
"SVG": 1,
"1": "SVG",
"MATH_ML": 2,
"2": "MATH_ML"
};
//#endregion
//#region packages/shared/src/escapeHtml.ts
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 = "&quot;";
break;
case 38:
escaped = "&amp;";
break;
case 39:
escaped = "&#39;";
break;
case 60:
escaped = "&lt;";
break;
case 62:
escaped = "&gt;";
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) {
let prev;
do {
prev = src;
src = src.replace(commentStripRE, "");
} while (src !== prev);
return src;
}
const cssVarNameEscapeSymbolsRE = /[ !"#$%&'()*+,./:;<=>?@[\\\]^`{|}~]/g;
function getEscapedCssVarName(key, doubleEscape) {
return key.replace(cssVarNameEscapeSymbolsRE, (s) => doubleEscape ? s === "\"" ? "\\\\\\\"" : `\\\\${s}` : `\\${s}`);
}
//#endregion
//#region packages/shared/src/looseEqual.ts
function looseCompareArrays(a, b, seen) {
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], seen);
return equal;
}
function looseCompareCollections(a, b, seen) {
if (a.size !== b.size) return false;
const candidates = Array.from(b);
const matched = new Uint8Array(candidates.length);
for (const item of a) {
let index = -1;
for (let i = 0; i < candidates.length; i++) if (!matched[i] && looseEqual(item, candidates[i], seen)) {
index = i;
break;
}
if (index < 0) return false;
matched[index] = 1;
}
return true;
}
function looseCompareObjects(a, b, seen) {
let aValidType = isMap(a);
let bValidType = isMap(b);
if (aValidType || bValidType) return aValidType && bValidType ? looseCompareCollections(a, b, seen) : false;
aValidType = isSet(a);
bValidType = isSet(b);
if (aValidType || bValidType) return aValidType && bValidType ? looseCompareCollections(a, b, seen) : false;
if (Object.keys(a).length !== Object.keys(b).length) 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], seen)) return false;
}
return String(a) === String(b);
}
function looseCompareNested(a, b, seen, compare) {
if (!seen) seen = [/* @__PURE__ */ new Map(), /* @__PURE__ */ new Map()];
const [seenA, seenB] = seen;
if (seenA.has(a) || seenB.has(b)) return seenA.get(a) === b && seenB.get(b) === a;
seenA.set(a, b);
seenB.set(b, a);
const equal = compare(a, b, seen);
seenA.delete(a);
seenB.delete(b);
return equal;
}
function looseEqual(a, b, seen) {
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 ? looseCompareNested(a, b, seen, looseCompareArrays) : false;
aValidType = isObject(a);
bValidType = isObject(b);
if (aValidType || bValidType) {
if (!aValidType || !bValidType) return false;
return looseCompareNested(a, b, seen, looseCompareObjects);
}
return String(a) === String(b);
}
function looseIndexOf(arr, val) {
return arr.findIndex((item) => looseEqual(item, val));
}
//#endregion
//#region packages/shared/src/toDisplayString.ts
const isRef = (val) => {
return !!(val && val["__v_isRef"] === true);
};
/**
* For converting {{ interpolation }} values to displayed strings.
* @private
*/
const toDisplayString = (val) => {
switch (typeof val) {
case "string": return val;
case "object": if (val) {
if (isRef(val)) return toDisplayString(val.value);
else if (isArray(val) || val.toString === objectToString || !isFunction(val.toString)) return JSON.stringify(val, replacer, 2);
}
default: return val == null ? "" : String(val);
}
};
const replacer = (_key, val) => {
if (isRef(val)) return replacer(_key, val.value);
else if (isMap(val)) return { [`Map(${val.size})`]: [...val.entries()].reduce((entries, [key, val], i) => {
entries[stringifySymbol(key, i) + " =>"] = val;
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 _description;
return isSymbol(v) ? `Symbol(${(_description = v.description) !== null && _description !== void 0 ? _description : i})` : v;
};
//#endregion
//#region packages/shared/src/subSequence.ts
function getSequence(arr) {
const p = arr.slice();
const result = [0];
let i, j, u, v, c;
const len = arr.length;
for (i = 0; i < len; i++) {
const arrI = arr[i];
if (arrI !== 0) {
j = result[result.length - 1];
if (arr[j] < arrI) {
p[i] = j;
result.push(i);
continue;
}
u = 0;
v = result.length - 1;
while (u < v) {
c = u + v >> 1;
if (arr[result[c]] < arrI) u = c + 1;
else v = c;
}
if (arrI < arr[result[u]]) {
if (u > 0) p[i] = result[u - 1];
result[u] = i;
}
}
}
u = result.length;
v = result[u - 1];
while (u-- > 0) {
result[u] = v;
v = p[v];
}
return result;
}
//#endregion
//#region packages/shared/src/cssVars.ts
/**
* Normalize CSS var value created by `v-bind` in `<style>` block
* See https://github.com/vuejs/core/pull/12461#issuecomment-2495804664
*/
function normalizeCssVarValue(value) {
if (value == null) return "initial";
if (typeof value === "string") return value === "" ? " " : value;
if (typeof value !== "number" || !Number.isFinite(value)) {
if (!!(process.env.NODE_ENV !== "production")) console.warn("[Vue warn] Invalid value used for CSS binding. Expected a string or a finite number but received:", value);
}
return String(value);
}
//#endregion
//#region packages/shared/src/vaporFlags.ts
/**
* Flags to optimize vapor `createFor` runtime behavior, shared between the
* compiler and the runtime
*/
const VaporVForFlags = {
"FAST_REMOVE": 1,
"1": "FAST_REMOVE",
"IS_COMPONENT": 2,
"2": "IS_COMPONENT",
"ONCE": 4,
"4": "ONCE",
"IS_SINGLE_NODE": 8,
"8": "IS_SINGLE_NODE",
"IS_FRAGMENT": 16,
"16": "IS_FRAGMENT",
"SLOT_ROOT": 32,
"32": "SLOT_ROOT",
"WRAPPED_ROWS": 64,
"64": "WRAPPED_ROWS"
};
const VaporBlockShape = {
"EMPTY": 0,
"0": "EMPTY",
"SINGLE_ROOT": 1,
"1": "SINGLE_ROOT",
"MULTI_ROOT": 2,
"2": "MULTI_ROOT",
"ELSE_IF": 3,
"3": "ELSE_IF"
};
/**
* Bit layout for vapor `createIf` flags.
*
* - bits 0-1: true branch VaporBlockShape
* - bits 2-3: false branch VaporBlockShape
* - bit 4: v-once
* - bit 5: true branch is static and can skip branch-owned EffectScope
* - bit 6: false branch is static and can skip branch-owned EffectScope
* - bit 7: v-if sits on a slot content/fallback root chain
* - bits 8+: branch index + 1 for keyed dynamic fragments
*
* Examples:
* - v-once, true single-root, no false branch: 1 | ONCE = 17
* - keyed index 0, true/false single-root: 1 | (1 << 2) | (1 << 8) = 261
*/
const VaporIfFlags = {
"BLOCK_SHAPE": 15,
"15": "BLOCK_SHAPE",
"ONCE": 16,
"16": "ONCE",
"TRUE_NO_SCOPE": 32,
"32": "TRUE_NO_SCOPE",
"FALSE_NO_SCOPE": 64,
"64": "FALSE_NO_SCOPE",
"SLOT_ROOT": 128,
"128": "SLOT_ROOT",
"INDEX_SHIFT": 8,
"8": "INDEX_SHIFT"
};
/**
* Flags used by vapor template factories, shared between the compiler and the
* runtime.
*/
const TemplateFlags = {
"ROOT": 1,
"1": "ROOT",
"STATIC": 2,
"2": "STATIC"
};
/**
* Flags used by vapor slot outlets, shared between the compiler and the
* runtime.
*/
const VaporSlotFlags = {
"NO_SLOTTED": 1,
"1": "NO_SLOTTED",
"ONCE": 2,
"2": "ONCE",
"FORWARDED": 4,
"4": "FORWARDED"
};
function isForwardedSlot(flags) {
return !!(flags & 4);
}
/**
* The data of the comment a vapor server render opens the branch of a `v-if`
* chain with, `<!--[1-->`: the digits are the branch's position in the chain,
* and `<!--]-->` closes it like a fragment.
*/
function isVaporBranchStart(data) {
if (data.length < 2 || data.charCodeAt(0) !== 91) return false;
for (let i = 1; i < data.length; i++) {
const c = data.charCodeAt(i);
if (c < 48 || c > 57) return false;
}
return true;
}
function slotNotifiesBoundary(flags) {
return isForwardedSlot(flags) && !(flags & 2);
}
/**
* Per-slot-function metadata attached by the compiler as `fn._`.
*/
const VaporSlotStability = {
"NON_STABLE": 1,
"1": "NON_STABLE"
};
const VaporDynamicComponentFlags = {
"SINGLE_ROOT": 1,
"1": "SINGLE_ROOT",
"ONCE": 2,
"2": "ONCE",
"SLOT_ROOT": 4,
"4": "SLOT_ROOT",
"DOM2_FLATTEN_TRUE": 65536,
"65536": "DOM2_FLATTEN_TRUE",
"DOM2_FLATTEN_FALSE": 131072,
"131072": "DOM2_FLATTEN_FALSE",
"NS_SVG": 8,
"8": "NS_SVG",
"NS_MATHML": 16,
"16": "NS_MATHML",
"SLOT_SINGLE_ROOT": 32,
"32": "SLOT_SINGLE_ROOT"
};
/**
* `isSingleRoot` of a component creation call for the single root of a slot
* body (`true` marks the single root of a component template). See
* resolveFallthroughOwner in runtime-vapor.
*/
const VaporSingleRoot = {
"SLOT": 2,
"2": "SLOT"
};
//#endregion
export { EMPTY_ARR, EMPTY_OBJ, NO, NOOP, Namespaces, PatchFlagNames, PatchFlags, ShapeFlags, SlotFlags, TemplateFlags, VaporBlockShape, VaporDynamicComponentFlags, VaporIfFlags, VaporSingleRoot, VaporSlotFlags, VaporSlotStability, VaporVForFlags, YES, camelize, canSetValueDirectly, capitalize, cssVarNameEscapeSymbolsRE, def, escapeHtml, escapeHtmlComment, extend, genCacheKey, genPropsAccessExp, generateCodeFrame, getEscapedCssVarName, getGlobalThis, getModifierPropName, getSequence, hasChanged, hasOwn, hyphenate, includeBooleanAttr, invokeArrayFns, isAlwaysCloseTag, isArray, isBooleanAttr, isBuiltInDirective, isBuiltInTag, isDate, isFormattingTag, isForwardedSlot, isFunction, isGloballyAllowed, isGloballyWhitelisted, isHTMLTag, isIntegerKey, isKnownHtmlAttr, isKnownMathMLAttr, isKnownSvgAttr, isMap, isMathMLTag, isModelListener, isNativeOn, isObject, isOn, isPlainObject, isPromise, isRegExp, isRenderableAttrValue, isReservedProp, isSSRSafeAttrName, isSVGTag, isSet, isSpecialBooleanAttr, isString, isSymbol, isVaporBranchStart, isVoidTag, looseEqual, looseIndexOf, looseToNumber, makeMap, normalizeClass, normalizeCssVarValue, normalizeProps, normalizeStyle, objectToString, parseStringStyle, propsToAttrMap, remove, shouldSetAsAttr, slotFlagsText, slotNotifiesBoundary, stringifyStyle, toDisplayString, toHandlerKey, toNumber, toRawType, toTypeString };
@@ -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')
}
@@ -0,0 +1,47 @@
{
"name": "@vue/shared",
"version": "3.6.0-alpha.2",
"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"
}
@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2019-present Eduardo San Martin Morote
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.
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,11 @@
{
"name": "pinia",
"version": "3.0.4",
"license": "MIT",
"module": "dist/pinia.mjs",
"exports": {
".": "./dist/pinia.mjs",
"./package.json": "./package.json"
},
"sideEffects": false
}
@@ -0,0 +1,20 @@
The MIT License (MIT)
Copyright (c) 2020 kazuya kawaguchi
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.
@@ -0,0 +1 @@
export * from '../dist/vue-i18n.mjs'
File diff suppressed because it is too large Load Diff
@@ -0,0 +1 @@
export * from '../dist/vue-i18n.runtime.mjs'
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,12 @@
{
"name": "vue-i18n",
"version": "11.4.6",
"license": "MIT",
"module": "dist/vue-i18n.mjs",
"exports": {
".": "./dist/vue-i18n.mjs",
"./runtime": "./dist/vue-i18n.runtime.mjs",
"./package.json": "./package.json"
},
"sideEffects": false
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,127 @@
import { Plugin, ViteDevServer } from "vite";
import * as _compiler from "vue/compiler-sfc";
import { SFCScriptCompileOptions, SFCStyleCompileOptions, SFCTemplateCompileOptions } from "vue/compiler-sfc";
//#region src/utils/query.d.ts
interface VueQuery {
vue?: boolean;
src?: string;
type?: 'script' | 'template' | 'style' | 'custom';
index?: number;
lang?: string;
raw?: boolean;
url?: boolean;
scoped?: boolean;
id?: string;
}
declare function parseVueRequest(id: string): {
filename: string;
query: VueQuery;
};
//#endregion
//#region src/index.d.ts
interface Options {
include?: string | RegExp | (string | RegExp)[];
exclude?: string | RegExp | (string | RegExp)[];
/**
* In Vite, this option follows Vite's config.
*/
isProduction?: boolean;
script?: Partial<Omit<SFCScriptCompileOptions, 'id' | 'isProd' | 'inlineTemplate' | 'templateOptions' | 'sourceMap' | 'genDefaultAs' | 'customElement' | 'defineModel' | 'propsDestructure'>> & {
/**
* @deprecated defineModel is now a stable feature and always enabled if
* using Vue 3.4 or above.
*/
defineModel?: boolean;
/**
* @deprecated moved to `features.propsDestructure`.
*/
propsDestructure?: boolean;
};
template?: Partial<Omit<SFCTemplateCompileOptions, 'id' | 'source' | 'ast' | 'filename' | 'scoped' | 'slotted' | 'isProd' | 'inMap' | 'ssr' | 'ssrCssVars' | 'preprocessLang'>>;
style?: Partial<Omit<SFCStyleCompileOptions, 'filename' | 'id' | 'isProd' | 'source' | 'scoped' | 'cssDevSourcemap' | 'postcssOptions' | 'map' | 'postcssPlugins' | 'preprocessCustomRequire' | 'preprocessLang' | 'preprocessOptions'>>;
/**
* Use custom compiler-sfc instance. Can be used to force a specific version.
*/
compiler?: typeof _compiler;
/**
* Requires @vitejs/plugin-vue@^5.1.0
*/
features?: {
/**
* Enable reactive destructure for `defineProps`.
* - Available in Vue 3.4 and later.
* - **default:** `false` in Vue 3.4 (**experimental**), `true` in Vue 3.5+
*/
propsDestructure?: boolean;
/**
* Transform Vue SFCs into custom elements.
* - `true`: all `*.vue` imports are converted into custom elements
* - `string | RegExp`: matched files are converted into custom elements
* - **default:** /\.ce\.vue$/
*/
customElement?: boolean | string | RegExp | (string | RegExp)[];
/**
* Force all <script setup> Vue SFC (`.vue`) files to compile in Vapor mode.
* When enabled, this acts as a plugin-level fallback for SFCs without the
* per-file `vapor` marker.
* - Available in Vue 3.6 and later.
* - **default:** `false`
*/
vapor?: boolean;
/**
* Set to `false` to disable Options API support and allow related code in
* Vue core to be dropped via dead-code elimination in production builds,
* resulting in smaller bundles.
* - **default:** `true`
*/
optionsAPI?: boolean;
/**
* Set to `true` to enable devtools support in production builds.
* Results in slightly larger bundles.
* - **default:** `false`
*/
prodDevtools?: boolean;
/**
* Set to `true` to enable detailed information for hydration mismatch
* errors in production builds. Results in slightly larger bundles.
* - **default:** `false`
*/
prodHydrationMismatchDetails?: boolean;
/**
* Customize the component ID generation strategy.
* - `'filepath'`: hash the file path (relative to the project root)
* - `'filepath-source'`: hash the file path and the source code
* - `function`: custom function that takes the file path, source code,
* whether in production mode, and the default hash function as arguments
* - **default:** `'filepath'` in development, `'filepath-source'` in production
*/
componentIdGenerator?: 'filepath' | 'filepath-source' | ((filepath: string, source: string, isProduction: boolean | undefined, getHash: (text: string) => string) => string);
};
/**
* @deprecated moved to `features.customElement`.
*/
customElement?: boolean | string | RegExp | (string | RegExp)[];
}
interface ResolvedOptions extends Omit<Options, 'include' | 'exclude'> {
compiler: typeof _compiler;
root: string;
sourceMap: boolean;
cssDevSourcemap: boolean;
devServer?: ViteDevServer;
devToolsEnabled?: boolean;
}
interface Api {
get options(): ResolvedOptions;
set options(value: ResolvedOptions);
get include(): string | RegExp | (string | RegExp)[] | undefined;
/** include cannot be updated after `options` hook is called */
set include(value: string | RegExp | (string | RegExp)[] | undefined);
get exclude(): string | RegExp | (string | RegExp)[] | undefined;
/** exclude cannot be updated after `options` hook is called */
set exclude(value: string | RegExp | (string | RegExp)[] | undefined);
version: string;
}
declare function vuePlugin(rawOptions?: Options): Plugin<Api>;
declare function vuePluginCjs(this: unknown, options: Options): Plugin<Api>;
//#endregion
export { Api, Options, ResolvedOptions, type VueQuery, vuePlugin as default, vuePluginCjs as "module.exports", parseVueRequest };
@@ -0,0 +1,127 @@
import { Plugin, ViteDevServer } from "vite";
import * as _compiler from "vue/compiler-sfc";
import { SFCScriptCompileOptions, SFCStyleCompileOptions, SFCTemplateCompileOptions } from "vue/compiler-sfc";
//#region src/utils/query.d.ts
interface VueQuery {
vue?: boolean;
src?: string;
type?: 'script' | 'template' | 'style' | 'custom';
index?: number;
lang?: string;
raw?: boolean;
url?: boolean;
scoped?: boolean;
id?: string;
}
declare function parseVueRequest(id: string): {
filename: string;
query: VueQuery;
};
//#endregion
//#region src/index.d.ts
interface Options {
include?: string | RegExp | (string | RegExp)[];
exclude?: string | RegExp | (string | RegExp)[];
/**
* In Vite, this option follows Vite's config.
*/
isProduction?: boolean;
script?: Partial<Omit<SFCScriptCompileOptions, 'id' | 'isProd' | 'inlineTemplate' | 'templateOptions' | 'sourceMap' | 'genDefaultAs' | 'customElement' | 'defineModel' | 'propsDestructure'>> & {
/**
* @deprecated defineModel is now a stable feature and always enabled if
* using Vue 3.4 or above.
*/
defineModel?: boolean;
/**
* @deprecated moved to `features.propsDestructure`.
*/
propsDestructure?: boolean;
};
template?: Partial<Omit<SFCTemplateCompileOptions, 'id' | 'source' | 'ast' | 'filename' | 'scoped' | 'slotted' | 'isProd' | 'inMap' | 'ssr' | 'ssrCssVars' | 'preprocessLang'>>;
style?: Partial<Omit<SFCStyleCompileOptions, 'filename' | 'id' | 'isProd' | 'source' | 'scoped' | 'cssDevSourcemap' | 'postcssOptions' | 'map' | 'postcssPlugins' | 'preprocessCustomRequire' | 'preprocessLang' | 'preprocessOptions'>>;
/**
* Use custom compiler-sfc instance. Can be used to force a specific version.
*/
compiler?: typeof _compiler;
/**
* Requires @vitejs/plugin-vue@^5.1.0
*/
features?: {
/**
* Enable reactive destructure for `defineProps`.
* - Available in Vue 3.4 and later.
* - **default:** `false` in Vue 3.4 (**experimental**), `true` in Vue 3.5+
*/
propsDestructure?: boolean;
/**
* Transform Vue SFCs into custom elements.
* - `true`: all `*.vue` imports are converted into custom elements
* - `string | RegExp`: matched files are converted into custom elements
* - **default:** /\.ce\.vue$/
*/
customElement?: boolean | string | RegExp | (string | RegExp)[];
/**
* Force all <script setup> Vue SFC (`.vue`) files to compile in Vapor mode.
* When enabled, this acts as a plugin-level fallback for SFCs without the
* per-file `vapor` marker.
* - Available in Vue 3.6 and later.
* - **default:** `false`
*/
vapor?: boolean;
/**
* Set to `false` to disable Options API support and allow related code in
* Vue core to be dropped via dead-code elimination in production builds,
* resulting in smaller bundles.
* - **default:** `true`
*/
optionsAPI?: boolean;
/**
* Set to `true` to enable devtools support in production builds.
* Results in slightly larger bundles.
* - **default:** `false`
*/
prodDevtools?: boolean;
/**
* Set to `true` to enable detailed information for hydration mismatch
* errors in production builds. Results in slightly larger bundles.
* - **default:** `false`
*/
prodHydrationMismatchDetails?: boolean;
/**
* Customize the component ID generation strategy.
* - `'filepath'`: hash the file path (relative to the project root)
* - `'filepath-source'`: hash the file path and the source code
* - `function`: custom function that takes the file path, source code,
* whether in production mode, and the default hash function as arguments
* - **default:** `'filepath'` in development, `'filepath-source'` in production
*/
componentIdGenerator?: 'filepath' | 'filepath-source' | ((filepath: string, source: string, isProduction: boolean | undefined, getHash: (text: string) => string) => string);
};
/**
* @deprecated moved to `features.customElement`.
*/
customElement?: boolean | string | RegExp | (string | RegExp)[];
}
interface ResolvedOptions extends Omit<Options, 'include' | 'exclude'> {
compiler: typeof _compiler;
root: string;
sourceMap: boolean;
cssDevSourcemap: boolean;
devServer?: ViteDevServer;
devToolsEnabled?: boolean;
}
interface Api {
get options(): ResolvedOptions;
set options(value: ResolvedOptions);
get include(): string | RegExp | (string | RegExp)[] | undefined;
/** include cannot be updated after `options` hook is called */
set include(value: string | RegExp | (string | RegExp)[] | undefined);
get exclude(): string | RegExp | (string | RegExp)[] | undefined;
/** exclude cannot be updated after `options` hook is called */
set exclude(value: string | RegExp | (string | RegExp)[] | undefined);
version: string;
}
declare function vuePlugin(rawOptions?: Options): Plugin<Api>;
declare function vuePluginCjs(this: unknown, options: Options): Plugin<Api>;
//#endregion
export { Api, Options, ResolvedOptions, type VueQuery, vuePlugin as default, vuePluginCjs as "module.exports", parseVueRequest };
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,67 @@
{
"name": "@vitejs/plugin-vue",
"version": "6.0.9",
"type": "module",
"license": "MIT",
"author": "Evan You",
"description": "The official plugin for Vue SFC support in Vite.",
"keywords": [
"vite",
"vite-plugin",
"vue"
],
"files": [
"dist"
],
"exports": {
".": "./dist/index.mjs",
"./package.json": "./package.json"
},
"scripts": {
"dev": "tsdown --watch",
"build": "tsdown",
"prepublishOnly": "npm run build"
},
"engines": {
"node": "^20.19.0 || >=22.12.0"
},
"repository": {
"type": "git",
"url": "git+https://github.com/vitejs/vite-plugin-vue.git",
"directory": "packages/plugin-vue"
},
"bugs": {
"url": "https://github.com/vitejs/vite-plugin-vue/issues"
},
"homepage": "https://github.com/vitejs/vite-plugin-vue/tree/main/packages/plugin-vue#readme",
"peerDependencies": {
"vite": "^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0",
"vue": "^3.2.25"
},
"devDependencies": {
"@babel/types": "^7.29.7",
"@jridgewell/gen-mapping": "^0.3.13",
"@jridgewell/trace-mapping": "^0.3.31",
"obug": "^3.0.0",
"slash": "^5.1.0",
"source-map-js": "^1.2.1",
"tsdown": "^0.22.13",
"unrun": "^0.3.1",
"vite": "catalog:",
"vue": "catalog:"
},
"dependencies": {
"@rolldown/pluginutils": "^1.0.1"
},
"compatiblePackages": {
"schemaVersion": 1,
"rolldown": {
"type": "incompatible",
"reason": "Uses Vite-specific APIs"
},
"rollup": {
"type": "incompatible",
"reason": "Uses Vite-specific APIs"
}
}
}
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large Load Diff
@@ -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')
}
@@ -0,0 +1,58 @@
{
"name": "@vue/compiler-core",
"version": "3.6.0-rc.14",
"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": "catalog:",
"@vue/shared": "workspace:*",
"entities": "catalog:",
"estree-walker": "catalog:",
"source-map-js": "catalog:"
},
"devDependencies": {
"@babel/types": "catalog:"
}
}
@@ -0,0 +1,766 @@
/**
* @vue/compiler-dom v3.6.0-rc.14
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT
**/
Object.defineProperties(exports, {
__esModule: { value: true },
[Symbol.toStringTag]: { value: "Module" }
});
let _vue_compiler_core = require("@vue/compiler-core");
let _vue_shared = require("@vue/shared");
//#region packages/compiler-dom/src/runtimeHelpers.ts
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`);
(0, _vue_compiler_core.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`
});
//#endregion
//#region packages/compiler-dom/src/parserOptions.ts
const parserOptions = {
parseMode: "html",
isVoidTag: _vue_shared.isVoidTag,
isNativeTag: (tag) => (0, _vue_shared.isHTMLTag)(tag) || (0, _vue_shared.isSVGTag)(tag) || (0, _vue_shared.isMathMLTag)(tag),
isPreTag: (tag) => tag === "pre",
isIgnoreNewlineTag: (tag) => tag === "pre" || tag === "textarea",
decodeEntities: void 0,
isBuiltInComponent: (tag) => {
if (tag === "Transition" || tag === "transition") return TRANSITION;
else if (tag === "TransitionGroup" || tag === "transition-group") return TRANSITION_GROUP;
},
getNamespace(tag, parent, rootNamespace) {
let ns = parent ? parent.ns : rootNamespace;
if (parent && ns === 2) {
if (parent.tag === "annotation-xml") {
if ((0, _vue_shared.isSVGTag)(tag)) 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 ((0, _vue_shared.isSVGTag)(tag)) return 1;
if ((0, _vue_shared.isMathMLTag)(tag)) return 2;
}
return ns;
}
};
//#endregion
//#region packages/compiler-dom/src/transforms/transformStyle.ts
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: (0, _vue_compiler_core.createSimpleExpression)(`style`, true, p.loc),
exp: parseInlineCSS(p.value.content, p.loc),
modifiers: [],
loc: p.loc
};
});
};
const parseInlineCSS = (cssText, loc) => {
const normalized = (0, _vue_shared.parseStringStyle)(cssText);
return (0, _vue_compiler_core.createSimpleExpression)(JSON.stringify(normalized), false, loc, 3);
};
//#endregion
//#region packages/compiler-dom/src/errors.ts
function createDOMCompilerError(code, loc) {
return (0, _vue_compiler_core.createCompilerError)(code, loc, DOMErrorMessages);
}
const DOMErrorCodes = {
"X_V_HTML_NO_EXPRESSION": 54,
"54": "X_V_HTML_NO_EXPRESSION",
"X_V_HTML_WITH_CHILDREN": 55,
"55": "X_V_HTML_WITH_CHILDREN",
"X_V_TEXT_NO_EXPRESSION": 56,
"56": "X_V_TEXT_NO_EXPRESSION",
"X_V_TEXT_WITH_CHILDREN": 57,
"57": "X_V_TEXT_WITH_CHILDREN",
"X_V_MODEL_ON_INVALID_ELEMENT": 58,
"58": "X_V_MODEL_ON_INVALID_ELEMENT",
"X_V_MODEL_ARG_ON_ELEMENT": 59,
"59": "X_V_MODEL_ARG_ON_ELEMENT",
"X_V_MODEL_ON_FILE_INPUT_ELEMENT": 60,
"60": "X_V_MODEL_ON_FILE_INPUT_ELEMENT",
"X_V_MODEL_UNNECESSARY_VALUE": 61,
"61": "X_V_MODEL_UNNECESSARY_VALUE",
"X_V_SHOW_NO_EXPRESSION": 62,
"62": "X_V_SHOW_NO_EXPRESSION",
"X_TRANSITION_INVALID_CHILDREN": 63,
"63": "X_TRANSITION_INVALID_CHILDREN",
"X_IGNORED_SIDE_EFFECT_TAG": 64,
"64": "X_IGNORED_SIDE_EFFECT_TAG",
"__EXTEND_POINT__": 65,
"65": "__EXTEND_POINT__"
};
const DOMErrorMessages = {
[54]: `v-html is missing expression.`,
[55]: `v-html will override element children.`,
[56]: `v-text is missing expression.`,
[57]: `v-text will override element children.`,
[58]: `v-model can only be used on <input>, <textarea> and <select> elements.`,
[59]: `v-model argument is not supported on plain elements.`,
[60]: `v-model cannot be used on file inputs since they are read-only. Use a v-on:change listener instead.`,
[61]: `Unnecessary value binding used alongside v-model. It will interfere with v-model's behavior.`,
[62]: `v-show is missing expression.`,
[63]: `<Transition> expects exactly one child element or component.`,
[64]: `Tags with side effect (<script> and <style>) are ignored in client component templates.`,
[65]: ``
};
//#endregion
//#region packages/compiler-dom/src/transforms/vHtml.ts
const transformVHtml = (dir, node, context) => {
const { exp, loc } = dir;
if (!exp) context.onError(createDOMCompilerError(54, loc));
if (node.children.length) {
context.onError(createDOMCompilerError(55, loc));
node.children.length = 0;
}
return { props: [(0, _vue_compiler_core.createObjectProperty)((0, _vue_compiler_core.createSimpleExpression)(`innerHTML`, true, loc), exp || (0, _vue_compiler_core.createSimpleExpression)("", true))] };
};
//#endregion
//#region packages/compiler-dom/src/transforms/vText.ts
const transformVText = (dir, node, context) => {
const { exp, loc } = dir;
if (!exp) context.onError(createDOMCompilerError(56, loc));
if (node.children.length) {
context.onError(createDOMCompilerError(57, loc));
node.children.length = 0;
}
return { props: [(0, _vue_compiler_core.createObjectProperty)((0, _vue_compiler_core.createSimpleExpression)(`textContent`, true), exp ? (0, _vue_compiler_core.getConstantType)(exp, context) > 0 ? exp : (0, _vue_compiler_core.createCallExpression)(context.helperString(_vue_compiler_core.TO_DISPLAY_STRING), [exp], loc) : (0, _vue_compiler_core.createSimpleExpression)("", true))] };
};
//#endregion
//#region packages/compiler-dom/src/transforms/vModel.ts
const transformModel = (dir, node, context) => {
const baseResult = (0, _vue_compiler_core.transformModel)(dir, node, context);
if (!baseResult.props.length || node.tagType === 1) return baseResult;
if (dir.arg) context.onError(createDOMCompilerError(59, dir.arg.loc));
function checkDuplicatedValue() {
const value = (0, _vue_compiler_core.findDir)(node, "bind");
if (value && (0, _vue_compiler_core.isStaticArgOf)(value.arg, "value")) context.onError(createDOMCompilerError(61, 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 = (0, _vue_compiler_core.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(60, dir.loc));
break;
default: checkDuplicatedValue();
}
} else if ((0, _vue_compiler_core.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(58, dir.loc));
baseResult.props = baseResult.props.filter((p) => !(p.key.type === 4 && p.key.content === "modelValue"));
return baseResult;
};
//#endregion
//#region packages/compiler-dom/src/transforms/vOn.ts
const isEventOptionModifier = /*@__PURE__*/ (0, _vue_shared.makeMap)(`passive,once,capture`);
const isNonKeyModifier = /*@__PURE__*/ (0, _vue_shared.makeMap)("stop,prevent,self,ctrl,shift,alt,meta,exact,middle");
const maybeKeyModifier = /*@__PURE__*/ (0, _vue_shared.makeMap)("left,right");
const isKeyboardEvent = /*@__PURE__*/ (0, _vue_shared.makeMap)(`onkeyup,onkeydown,onkeypress`);
const resolveModifiers = (key, modifiers, context, loc) => {
const keyModifiers = [];
const nonKeyModifiers = [];
const eventOptionModifiers = [];
for (let i = 0; i < modifiers.length; i++) {
const modifier = modifiers[i].content;
if (modifier === "delegate") {
if (context) {
const error = /* @__PURE__ */ new SyntaxError(`.delegate modifier is only supported in Vapor components.`);
error.loc = modifiers[i].loc;
context.onWarn(error);
}
continue;
}
if (modifier === "native" && context && (0, _vue_compiler_core.checkCompatEnabled)("COMPILER_V_ON_NATIVE", context, loc)) eventOptionModifiers.push(modifier);
else if (isEventOptionModifier(modifier)) eventOptionModifiers.push(modifier);
else {
const keyString = (0, _vue_shared.isString)(key) ? key : (0, _vue_compiler_core.isStaticExp)(key) ? key.content : null;
if (maybeKeyModifier(modifier)) {
if (keyString) {
if (isKeyboardEvent(keyString.toLowerCase())) 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) => {
return (0, _vue_compiler_core.isStaticExp)(key) && key.content.toLowerCase() === "onclick" ? (0, _vue_compiler_core.createSimpleExpression)(event, true) : key.type !== 4 ? (0, _vue_compiler_core.createCompoundExpression)([
`(`,
key,
`) === "onClick" ? "${event}" : (`,
key,
`)`
]) : key;
};
const transformOn = (dir, node, context) => {
return (0, _vue_compiler_core.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 = (0, _vue_compiler_core.createCallExpression)(context.helper(V_ON_WITH_MODIFIERS), [handlerExp, JSON.stringify(nonKeyModifiers)]);
if (keyModifiers.length && (!(0, _vue_compiler_core.isStaticExp)(key) || isKeyboardEvent(key.content.toLowerCase()))) handlerExp = (0, _vue_compiler_core.createCallExpression)(context.helper(V_ON_WITH_KEYS), [handlerExp, JSON.stringify(keyModifiers)]);
if (eventOptionModifiers.length) {
const modifierPostfix = eventOptionModifiers.map(_vue_shared.capitalize).join("");
key = (0, _vue_compiler_core.isStaticExp)(key) ? (0, _vue_compiler_core.createSimpleExpression)(`${key.content}${modifierPostfix}`, true) : (0, _vue_compiler_core.createCompoundExpression)([
`(`,
key,
`) + "${modifierPostfix}"`
]);
}
return { props: [(0, _vue_compiler_core.createObjectProperty)(key, handlerExp)] };
});
};
//#endregion
//#region packages/compiler-dom/src/transforms/vShow.ts
const transformShow = (dir, node, context) => {
const { exp, loc } = dir;
if (!exp) context.onError(createDOMCompilerError(62, loc));
return {
props: [],
needRuntime: context.helper(V_SHOW)
};
};
//#endregion
//#region packages/compiler-dom/src/transforms/Transition.ts
const transformTransition = (node, context) => {
if (node.type === 1 && node.tagType === 1) {
if (context.isBuiltInComponent(node.tag) === TRANSITION) return postTransformTransition(node, context.onError);
}
};
function postTransformTransition(node, onError, hasMultipleChildren = defaultHasMultipleChildren) {
return () => {
if (!node.children.length) return;
if (hasMultipleChildren(node)) onError(createDOMCompilerError(63, {
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 && !(0, _vue_compiler_core.findDir)(child, "if")) {
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 defaultHasMultipleChildren(node) {
const children = node.children = node.children.filter((c) => !(0, _vue_compiler_core.isCommentOrWhitespace)(c));
const child = children[0];
return children.length !== 1 || child.type === 11 || child.type === 9 && child.branches.some(defaultHasMultipleChildren);
}
//#endregion
//#region packages/compiler-dom/src/transforms/stringifyStatic.ts
/**
* This module is Node-only.
*/
/**
* Regex for replacing placeholders for embedded constant variables
* (e.g. import URL string constants generated by compiler-sfc)
*/
const expReplaceRE = /__VUE_EXP_START__(.*?)__VUE_EXP_END__/g;
/**
* Turn eligible hoisted static trees into stringified static nodes, e.g.
*
* ```js
* const _hoisted_1 = createStaticVNode(`<div class="foo">bar</div>`)
* ```
*
* A single static vnode can contain stringified content for **multiple**
* consecutive nodes (element and plain text), called a "chunk".
* `@vue/runtime-dom` will create the content via innerHTML in a hidden
* container element and insert all the nodes in place. The call must also
* provide the number of nodes contained in the chunk so that during hydration
* we can know how many nodes the static vnode should adopt.
*
* The optimization scans a children list that contains hoisted nodes, and
* tries to find the largest chunk of consecutive hoisted nodes before running
* into a non-hoisted node or the end of the list. A chunk is then converted
* into a single static vnode and replaces the hoisted expression of the first
* node in the chunk. Other nodes in the chunk are considered "merged" and
* therefore removed from both the hoist list and the children array.
*
* This optimization is only performed in Node.js.
*/
const stringifyStatic = (children, context, parent) => {
if (context.scopes.vSlot > 0) return;
const isParentCached = parent.type === 1 && parent.codegenNode && parent.codegenNode.type === 13 && parent.codegenNode.children && !(0, _vue_shared.isArray)(parent.codegenNode.children) && parent.codegenNode.children.type === 20;
let nc = 0;
let ec = 0;
const currentChunk = [];
const stringifyCurrentChunk = (currentIndex) => {
if (nc >= 20 || ec >= 5) {
const staticCall = (0, _vue_compiler_core.createCallExpression)(context.helper(_vue_compiler_core.CREATE_STATIC), [JSON.stringify(currentChunk.map((node) => stringifyNode(node, context)).join("")).replace(expReplaceRE, `" + $1 + "`), String(currentChunk.length)]);
const deleteCount = currentChunk.length - 1;
if (isParentCached) children.splice(currentIndex - currentChunk.length, currentChunk.length, staticCall);
else {
currentChunk[0].codegenNode.value = staticCall;
if (currentChunk.length > 1) {
children.splice(currentIndex - currentChunk.length + 1, deleteCount);
const cacheIndex = context.cached.indexOf(currentChunk[currentChunk.length - 1].codegenNode);
if (cacheIndex > -1) {
for (let i = cacheIndex; i < context.cached.length; i++) {
const c = context.cached[i];
if (c) c.index -= deleteCount;
}
context.cached.splice(cacheIndex - deleteCount + 1, deleteCount);
}
}
}
return deleteCount;
}
return 0;
};
let i = 0;
for (; i < children.length; i++) {
const child = children[i];
if (isParentCached || getCachedNode(child)) {
const result = analyzeNode(child);
if (result) {
nc += result[0];
ec += result[1];
currentChunk.push(child);
continue;
}
}
i -= stringifyCurrentChunk(i);
nc = 0;
ec = 0;
currentChunk.length = 0;
}
stringifyCurrentChunk(i);
};
const getCachedNode = (node) => {
if ((node.type === 1 && node.tagType === 0 || node.type === 12) && node.codegenNode && node.codegenNode.type === 20) return node.codegenNode;
};
const dataAriaRE = /^(?:data|aria)-/;
const isStringifiableAttr = (name, ns) => {
return (ns === 0 ? (0, _vue_shared.isKnownHtmlAttr)(name) : ns === 1 ? (0, _vue_shared.isKnownSvgAttr)(name) : ns === 2 ? (0, _vue_shared.isKnownMathMLAttr)(name) : false) || dataAriaRE.test(name);
};
const isNonStringifiable = /*@__PURE__*/ (0, _vue_shared.makeMap)(`caption,thead,tr,th,tbody,td,tfoot,colgroup,col`);
/**
* for a cached node, analyze it and return:
* - false: bailed (contains non-stringifiable props or runtime constant)
* - [nc, ec] where
* - nc is the number of nodes inside
* - ec is the number of element with bindings inside
*/
function analyzeNode(node) {
if (node.type === 1 && isNonStringifiable(node.tag)) return false;
if (node.type === 1 && (0, _vue_compiler_core.findDir)(node, "once", true)) 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(node) {
const isOptionTag = node.tag === "option" && node.ns === 0;
for (let i = 0; i < node.props.length; i++) {
const p = node.props[i];
if (p.type === 6 && !isStringifiableAttr(p.name, node.ns)) return bail();
if (p.type === 7 && p.name === "bind") {
if (p.arg && (p.arg.type === 8 || p.arg.isStatic && !isStringifiableAttr(p.arg.content, node.ns))) return bail();
if (p.exp && (p.exp.type === 8 || p.exp.constType < 3)) return bail();
if (isOptionTag && (0, _vue_compiler_core.isStaticArgOf)(p.arg, "value") && p.exp && !p.exp.isStatic) return bail();
}
}
for (let i = 0; i < node.children.length; i++) {
nc++;
const child = node.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 ((0, _vue_shared.isString)(node)) return node;
if ((0, _vue_shared.isSymbol)(node)) return ``;
switch (node.type) {
case 1: return stringifyElement(node, context);
case 2: return (0, _vue_shared.escapeHtml)(node.content);
case 3: return `<!--${(0, _vue_shared.escapeHtml)(node.content)}-->`;
case 5: return (0, _vue_shared.escapeHtml)((0, _vue_shared.toDisplayString)(evaluateConstant(node.content)));
case 8: return (0, _vue_shared.escapeHtml)(evaluateConstant(node));
case 12: return stringifyNode(node.content, context);
default: return "";
}
}
function stringifyElement(node, context) {
let res = `<${node.tag}`;
let innerHTML = void 0;
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 += `="${(0, _vue_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 (((0, _vue_shared.isBooleanAttr)(p.arg.content) || p.arg.content === "hidden") && exp.content === "false") continue;
let evaluated = evaluateConstant(exp);
if (evaluated != null) {
const arg = p.arg && p.arg.content;
if (arg === "hidden" && typeof evaluated === "number" && !(0, _vue_shared.includeBooleanAttr)(evaluated)) continue;
if (arg === "class") evaluated = (0, _vue_shared.normalizeClass)(evaluated);
else if (arg === "style") evaluated = (0, _vue_shared.stringifyStyle)((0, _vue_shared.normalizeStyle)(evaluated));
res += ` ${p.arg.content}="${(0, _vue_shared.escapeHtml)(evaluated)}"`;
}
} else if (p.name === "html") {
var _evaluateConstant;
innerHTML = (_evaluateConstant = evaluateConstant(p.exp)) !== null && _evaluateConstant !== void 0 ? _evaluateConstant : "";
} else if (p.name === "text") innerHTML = (0, _vue_shared.escapeHtml)((0, _vue_shared.toDisplayString)(evaluateConstant(p.exp)));
}
}
if (context.scopeId) res += ` ${context.scopeId}`;
res += `>`;
if (innerHTML !== void 0) res += innerHTML;
else for (let i = 0; i < node.children.length; i++) res += stringifyNode(node.children[i], context);
if (!(0, _vue_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 ((0, _vue_shared.isString)(c) || (0, _vue_shared.isSymbol)(c)) return;
if (c.type === 2) res += c.content;
else if (c.type === 5) res += (0, _vue_shared.toDisplayString)(evaluateConstant(c.content));
else res += evaluateConstant(c);
});
return res;
}
}
//#endregion
//#region packages/compiler-dom/src/transforms/ignoreSideEffectTags.ts
const ignoreSideEffectTags = (node, context) => {
if (node.type === 1 && node.tagType === 0 && (node.tag === "script" || node.tag === "style")) {
context.onError(createDOMCompilerError(64, node.loc));
context.removeNode();
}
};
//#endregion
//#region packages/compiler-dom/src/htmlNesting.ts
/**
* Copied from https://github.com/MananTank/validate-html-nesting
* with ISC license
*
* To avoid runtime dependency on validate-html-nesting
* This file should not change very often in the original repo
* but we may need to keep it up-to-date from time to time.
*/
/**
* returns true if given parent-child nesting is valid HTML
*/
function isValidHTMLNesting(parent, child) {
if (parent === "template") return true;
if (parent in onlyValidChildren) return onlyValidChildren[parent].has(child);
if (child in onlyValidParents) return onlyValidParents[child].has(parent);
if (parent in knownInvalidChildren) {
if (knownInvalidChildren[parent].has(child)) return false;
}
if (child in knownInvalidParents) {
if (knownInvalidParents[child].has(parent)) return false;
}
return true;
}
const headings = /* @__PURE__ */ new Set([
"h1",
"h2",
"h3",
"h4",
"h5",
"h6"
]);
const emptySet = /* @__PURE__ */ new Set([]);
/**
* maps element to set of elements that can be it's children, no other */
const onlyValidChildren = {
head: /* @__PURE__ */ new Set([
"base",
"basefront",
"bgsound",
"link",
"meta",
"title",
"noscript",
"noframes",
"style",
"script",
"template"
]),
optgroup: /* @__PURE__ */ new Set(["option"]),
select: /* @__PURE__ */ new Set([
"optgroup",
"option",
"hr"
]),
table: /* @__PURE__ */ new Set([
"caption",
"colgroup",
"tbody",
"tfoot",
"thead"
]),
tr: /* @__PURE__ */ new Set(["td", "th"]),
colgroup: /* @__PURE__ */ new Set(["col"]),
tbody: /* @__PURE__ */ new Set(["tr"]),
thead: /* @__PURE__ */ new Set(["tr"]),
tfoot: /* @__PURE__ */ new Set(["tr"]),
script: emptySet,
iframe: emptySet,
option: emptySet,
textarea: emptySet,
style: emptySet,
title: emptySet
};
/** maps elements to set of elements which can be it's parent, no other */
const onlyValidParents = {
html: emptySet,
body: /* @__PURE__ */ new Set(["html"]),
head: /* @__PURE__ */ new Set(["html"]),
td: /* @__PURE__ */ new Set(["tr"]),
colgroup: /* @__PURE__ */ new Set(["table"]),
caption: /* @__PURE__ */ new Set(["table"]),
tbody: /* @__PURE__ */ new Set(["table"]),
tfoot: /* @__PURE__ */ new Set(["table"]),
col: /* @__PURE__ */ new Set(["colgroup"]),
th: /* @__PURE__ */ new Set(["tr"]),
thead: /* @__PURE__ */ new Set(["table"]),
tr: /* @__PURE__ */ new Set([
"tbody",
"thead",
"tfoot"
]),
dd: /* @__PURE__ */ new Set(["dl", "div"]),
dt: /* @__PURE__ */ new Set(["dl", "div"]),
figcaption: /* @__PURE__ */ new Set(["figure"]),
summary: /* @__PURE__ */ new Set(["details"]),
area: /* @__PURE__ */ new Set(["map"])
};
/** maps element to set of elements that can not be it's children, others can */
const knownInvalidChildren = {
p: /* @__PURE__ */ new Set([
"address",
"article",
"aside",
"blockquote",
"center",
"details",
"dialog",
"dir",
"div",
"dl",
"fieldset",
"figure",
"footer",
"form",
"h1",
"h2",
"h3",
"h4",
"h5",
"h6",
"header",
"hgroup",
"hr",
"li",
"main",
"nav",
"menu",
"ol",
"p",
"pre",
"section",
"table",
"ul"
]),
svg: /* @__PURE__ */ new Set([
"b",
"blockquote",
"br",
"code",
"dd",
"div",
"dl",
"dt",
"em",
"embed",
"h1",
"h2",
"h3",
"h4",
"h5",
"h6",
"hr",
"i",
"img",
"li",
"menu",
"meta",
"ol",
"p",
"pre",
"ruby",
"s",
"small",
"span",
"strong",
"sub",
"sup",
"table",
"u",
"ul",
"var"
])
};
/** maps element to set of elements that can not be it's parent, others can */
const knownInvalidParents = {
a: /* @__PURE__ */ new Set(["a"]),
button: /* @__PURE__ */ new Set(["button"]),
dd: /* @__PURE__ */ new Set(["dd", "dt"]),
dt: /* @__PURE__ */ new Set(["dd", "dt"]),
form: /* @__PURE__ */ new Set(["form"]),
li: /* @__PURE__ */ new Set(["li"]),
h1: headings,
h2: headings,
h3: headings,
h4: headings,
h5: headings,
h6: headings
};
//#endregion
//#region packages/compiler-dom/src/transforms/validateHtmlNesting.ts
const validateHtmlNesting = (node, context) => {
if (node.type === 1 && node.tagType === 0 && context.parent && context.parent.type === 1 && context.parent.tagType === 0 && !isValidHTMLNesting(context.parent.tag, node.tag)) {
const error = /* @__PURE__ */ new SyntaxError(`<${node.tag}> cannot be child of <${context.parent.tag}>, according to HTML specifications. This can cause hydration errors or potentially disrupt future functionality.`);
error.loc = node.loc;
context.onWarn(error);
}
};
//#endregion
//#region packages/compiler-dom/src/index.ts
const DOMNodeTransforms = [
transformStyle,
transformTransition,
...[validateHtmlNesting]
];
const DOMDirectiveTransforms = {
cloak: _vue_compiler_core.noopDirectiveTransform,
html: transformVHtml,
text: transformVText,
model: transformModel,
on: transformOn,
show: transformShow
};
function compile(src, options = {}) {
return (0, _vue_compiler_core.baseCompile)(src, (0, _vue_shared.extend)({}, parserOptions, options, {
nodeTransforms: [
ignoreSideEffectTags,
...DOMNodeTransforms,
...options.nodeTransforms || []
],
directiveTransforms: (0, _vue_shared.extend)({}, DOMDirectiveTransforms, options.directiveTransforms || {}),
transformHoist: stringifyStatic
}));
}
function parse(template, options = {}) {
return (0, _vue_compiler_core.baseParse)(template, (0, _vue_shared.extend)({}, parserOptions, options));
}
//#endregion
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.isKeyboardEvent = isKeyboardEvent;
exports.isValidHTMLNesting = isValidHTMLNesting;
exports.parse = parse;
exports.parserOptions = parserOptions;
exports.postTransformTransition = postTransformTransition;
exports.resolveModifiers = resolveModifiers;
exports.transformStyle = transformStyle;
Object.keys(_vue_compiler_core).forEach(function(k) {
if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
enumerable: true,
get: function() {
return _vue_compiler_core[k];
}
});
});
@@ -0,0 +1,742 @@
/**
* @vue/compiler-dom v3.6.0-rc.14
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT
**/
Object.defineProperties(exports, {
__esModule: { value: true },
[Symbol.toStringTag]: { value: "Module" }
});
let _vue_compiler_core = require("@vue/compiler-core");
let _vue_shared = require("@vue/shared");
//#region packages/compiler-dom/src/runtimeHelpers.ts
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(``);
(0, _vue_compiler_core.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`
});
//#endregion
//#region packages/compiler-dom/src/parserOptions.ts
const parserOptions = {
parseMode: "html",
isVoidTag: _vue_shared.isVoidTag,
isNativeTag: (tag) => (0, _vue_shared.isHTMLTag)(tag) || (0, _vue_shared.isSVGTag)(tag) || (0, _vue_shared.isMathMLTag)(tag),
isPreTag: (tag) => tag === "pre",
isIgnoreNewlineTag: (tag) => tag === "pre" || tag === "textarea",
decodeEntities: void 0,
isBuiltInComponent: (tag) => {
if (tag === "Transition" || tag === "transition") return TRANSITION;
else if (tag === "TransitionGroup" || tag === "transition-group") return TRANSITION_GROUP;
},
getNamespace(tag, parent, rootNamespace) {
let ns = parent ? parent.ns : rootNamespace;
if (parent && ns === 2) {
if (parent.tag === "annotation-xml") {
if ((0, _vue_shared.isSVGTag)(tag)) 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 ((0, _vue_shared.isSVGTag)(tag)) return 1;
if ((0, _vue_shared.isMathMLTag)(tag)) return 2;
}
return ns;
}
};
//#endregion
//#region packages/compiler-dom/src/transforms/transformStyle.ts
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: (0, _vue_compiler_core.createSimpleExpression)(`style`, true, p.loc),
exp: parseInlineCSS(p.value.content, p.loc),
modifiers: [],
loc: p.loc
};
});
};
const parseInlineCSS = (cssText, loc) => {
const normalized = (0, _vue_shared.parseStringStyle)(cssText);
return (0, _vue_compiler_core.createSimpleExpression)(JSON.stringify(normalized), false, loc, 3);
};
//#endregion
//#region packages/compiler-dom/src/errors.ts
function createDOMCompilerError(code, loc) {
return (0, _vue_compiler_core.createCompilerError)(code, loc, DOMErrorMessages);
}
const DOMErrorCodes = {
"X_V_HTML_NO_EXPRESSION": 54,
"54": "X_V_HTML_NO_EXPRESSION",
"X_V_HTML_WITH_CHILDREN": 55,
"55": "X_V_HTML_WITH_CHILDREN",
"X_V_TEXT_NO_EXPRESSION": 56,
"56": "X_V_TEXT_NO_EXPRESSION",
"X_V_TEXT_WITH_CHILDREN": 57,
"57": "X_V_TEXT_WITH_CHILDREN",
"X_V_MODEL_ON_INVALID_ELEMENT": 58,
"58": "X_V_MODEL_ON_INVALID_ELEMENT",
"X_V_MODEL_ARG_ON_ELEMENT": 59,
"59": "X_V_MODEL_ARG_ON_ELEMENT",
"X_V_MODEL_ON_FILE_INPUT_ELEMENT": 60,
"60": "X_V_MODEL_ON_FILE_INPUT_ELEMENT",
"X_V_MODEL_UNNECESSARY_VALUE": 61,
"61": "X_V_MODEL_UNNECESSARY_VALUE",
"X_V_SHOW_NO_EXPRESSION": 62,
"62": "X_V_SHOW_NO_EXPRESSION",
"X_TRANSITION_INVALID_CHILDREN": 63,
"63": "X_TRANSITION_INVALID_CHILDREN",
"X_IGNORED_SIDE_EFFECT_TAG": 64,
"64": "X_IGNORED_SIDE_EFFECT_TAG",
"__EXTEND_POINT__": 65,
"65": "__EXTEND_POINT__"
};
const DOMErrorMessages = {
[54]: `v-html is missing expression.`,
[55]: `v-html will override element children.`,
[56]: `v-text is missing expression.`,
[57]: `v-text will override element children.`,
[58]: `v-model can only be used on <input>, <textarea> and <select> elements.`,
[59]: `v-model argument is not supported on plain elements.`,
[60]: `v-model cannot be used on file inputs since they are read-only. Use a v-on:change listener instead.`,
[61]: `Unnecessary value binding used alongside v-model. It will interfere with v-model's behavior.`,
[62]: `v-show is missing expression.`,
[63]: `<Transition> expects exactly one child element or component.`,
[64]: `Tags with side effect (<script> and <style>) are ignored in client component templates.`,
[65]: ``
};
//#endregion
//#region packages/compiler-dom/src/transforms/vHtml.ts
const transformVHtml = (dir, node, context) => {
const { exp, loc } = dir;
if (!exp) context.onError(createDOMCompilerError(54, loc));
if (node.children.length) {
context.onError(createDOMCompilerError(55, loc));
node.children.length = 0;
}
return { props: [(0, _vue_compiler_core.createObjectProperty)((0, _vue_compiler_core.createSimpleExpression)(`innerHTML`, true, loc), exp || (0, _vue_compiler_core.createSimpleExpression)("", true))] };
};
//#endregion
//#region packages/compiler-dom/src/transforms/vText.ts
const transformVText = (dir, node, context) => {
const { exp, loc } = dir;
if (!exp) context.onError(createDOMCompilerError(56, loc));
if (node.children.length) {
context.onError(createDOMCompilerError(57, loc));
node.children.length = 0;
}
return { props: [(0, _vue_compiler_core.createObjectProperty)((0, _vue_compiler_core.createSimpleExpression)(`textContent`, true), exp ? (0, _vue_compiler_core.getConstantType)(exp, context) > 0 ? exp : (0, _vue_compiler_core.createCallExpression)(context.helperString(_vue_compiler_core.TO_DISPLAY_STRING), [exp], loc) : (0, _vue_compiler_core.createSimpleExpression)("", true))] };
};
//#endregion
//#region packages/compiler-dom/src/transforms/vModel.ts
const transformModel = (dir, node, context) => {
const baseResult = (0, _vue_compiler_core.transformModel)(dir, node, context);
if (!baseResult.props.length || node.tagType === 1) return baseResult;
if (dir.arg) context.onError(createDOMCompilerError(59, 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 = (0, _vue_compiler_core.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(60, dir.loc));
}
} else if ((0, _vue_compiler_core.hasDynamicKeyVBind)(node)) directiveToUse = V_MODEL_DYNAMIC;
} else if (tag === "select") directiveToUse = V_MODEL_SELECT;
if (!isInvalidType) baseResult.needRuntime = context.helper(directiveToUse);
} else context.onError(createDOMCompilerError(58, dir.loc));
baseResult.props = baseResult.props.filter((p) => !(p.key.type === 4 && p.key.content === "modelValue"));
return baseResult;
};
//#endregion
//#region packages/compiler-dom/src/transforms/vOn.ts
const isEventOptionModifier = /*@__PURE__*/ (0, _vue_shared.makeMap)(`passive,once,capture`);
const isNonKeyModifier = /*@__PURE__*/ (0, _vue_shared.makeMap)("stop,prevent,self,ctrl,shift,alt,meta,exact,middle");
const maybeKeyModifier = /*@__PURE__*/ (0, _vue_shared.makeMap)("left,right");
const isKeyboardEvent = /*@__PURE__*/ (0, _vue_shared.makeMap)(`onkeyup,onkeydown,onkeypress`);
const resolveModifiers = (key, modifiers, context, loc) => {
const keyModifiers = [];
const nonKeyModifiers = [];
const eventOptionModifiers = [];
for (let i = 0; i < modifiers.length; i++) {
const modifier = modifiers[i].content;
if (modifier === "delegate") {
if (context) {
const error = /* @__PURE__ */ new SyntaxError(`.delegate modifier is only supported in Vapor components.`);
error.loc = modifiers[i].loc;
context.onWarn(error);
}
continue;
}
if (modifier === "native" && context && (0, _vue_compiler_core.checkCompatEnabled)("COMPILER_V_ON_NATIVE", context, loc)) eventOptionModifiers.push(modifier);
else if (isEventOptionModifier(modifier)) eventOptionModifiers.push(modifier);
else {
const keyString = (0, _vue_shared.isString)(key) ? key : (0, _vue_compiler_core.isStaticExp)(key) ? key.content : null;
if (maybeKeyModifier(modifier)) {
if (keyString) {
if (isKeyboardEvent(keyString.toLowerCase())) 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) => {
return (0, _vue_compiler_core.isStaticExp)(key) && key.content.toLowerCase() === "onclick" ? (0, _vue_compiler_core.createSimpleExpression)(event, true) : key.type !== 4 ? (0, _vue_compiler_core.createCompoundExpression)([
`(`,
key,
`) === "onClick" ? "${event}" : (`,
key,
`)`
]) : key;
};
const transformOn = (dir, node, context) => {
return (0, _vue_compiler_core.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 = (0, _vue_compiler_core.createCallExpression)(context.helper(V_ON_WITH_MODIFIERS), [handlerExp, JSON.stringify(nonKeyModifiers)]);
if (keyModifiers.length && (!(0, _vue_compiler_core.isStaticExp)(key) || isKeyboardEvent(key.content.toLowerCase()))) handlerExp = (0, _vue_compiler_core.createCallExpression)(context.helper(V_ON_WITH_KEYS), [handlerExp, JSON.stringify(keyModifiers)]);
if (eventOptionModifiers.length) {
const modifierPostfix = eventOptionModifiers.map(_vue_shared.capitalize).join("");
key = (0, _vue_compiler_core.isStaticExp)(key) ? (0, _vue_compiler_core.createSimpleExpression)(`${key.content}${modifierPostfix}`, true) : (0, _vue_compiler_core.createCompoundExpression)([
`(`,
key,
`) + "${modifierPostfix}"`
]);
}
return { props: [(0, _vue_compiler_core.createObjectProperty)(key, handlerExp)] };
});
};
//#endregion
//#region packages/compiler-dom/src/transforms/vShow.ts
const transformShow = (dir, node, context) => {
const { exp, loc } = dir;
if (!exp) context.onError(createDOMCompilerError(62, loc));
return {
props: [],
needRuntime: context.helper(V_SHOW)
};
};
//#endregion
//#region packages/compiler-dom/src/transforms/Transition.ts
const transformTransition = (node, context) => {
if (node.type === 1 && node.tagType === 1) {
if (context.isBuiltInComponent(node.tag) === TRANSITION) return postTransformTransition(node, context.onError);
}
};
function postTransformTransition(node, onError, hasMultipleChildren = defaultHasMultipleChildren) {
return () => {
if (!node.children.length) return;
hasMultipleChildren(node);
const child = node.children[0];
if (child.type === 1 && !(0, _vue_compiler_core.findDir)(child, "if")) {
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 defaultHasMultipleChildren(node) {
const children = node.children = node.children.filter((c) => !(0, _vue_compiler_core.isCommentOrWhitespace)(c));
const child = children[0];
return children.length !== 1 || child.type === 11 || child.type === 9 && child.branches.some(defaultHasMultipleChildren);
}
//#endregion
//#region packages/compiler-dom/src/transforms/stringifyStatic.ts
/**
* This module is Node-only.
*/
/**
* Regex for replacing placeholders for embedded constant variables
* (e.g. import URL string constants generated by compiler-sfc)
*/
const expReplaceRE = /__VUE_EXP_START__(.*?)__VUE_EXP_END__/g;
/**
* Turn eligible hoisted static trees into stringified static nodes, e.g.
*
* ```js
* const _hoisted_1 = createStaticVNode(`<div class="foo">bar</div>`)
* ```
*
* A single static vnode can contain stringified content for **multiple**
* consecutive nodes (element and plain text), called a "chunk".
* `@vue/runtime-dom` will create the content via innerHTML in a hidden
* container element and insert all the nodes in place. The call must also
* provide the number of nodes contained in the chunk so that during hydration
* we can know how many nodes the static vnode should adopt.
*
* The optimization scans a children list that contains hoisted nodes, and
* tries to find the largest chunk of consecutive hoisted nodes before running
* into a non-hoisted node or the end of the list. A chunk is then converted
* into a single static vnode and replaces the hoisted expression of the first
* node in the chunk. Other nodes in the chunk are considered "merged" and
* therefore removed from both the hoist list and the children array.
*
* This optimization is only performed in Node.js.
*/
const stringifyStatic = (children, context, parent) => {
if (context.scopes.vSlot > 0) return;
const isParentCached = parent.type === 1 && parent.codegenNode && parent.codegenNode.type === 13 && parent.codegenNode.children && !(0, _vue_shared.isArray)(parent.codegenNode.children) && parent.codegenNode.children.type === 20;
let nc = 0;
let ec = 0;
const currentChunk = [];
const stringifyCurrentChunk = (currentIndex) => {
if (nc >= 20 || ec >= 5) {
const staticCall = (0, _vue_compiler_core.createCallExpression)(context.helper(_vue_compiler_core.CREATE_STATIC), [JSON.stringify(currentChunk.map((node) => stringifyNode(node, context)).join("")).replace(expReplaceRE, `" + $1 + "`), String(currentChunk.length)]);
const deleteCount = currentChunk.length - 1;
if (isParentCached) children.splice(currentIndex - currentChunk.length, currentChunk.length, staticCall);
else {
currentChunk[0].codegenNode.value = staticCall;
if (currentChunk.length > 1) {
children.splice(currentIndex - currentChunk.length + 1, deleteCount);
const cacheIndex = context.cached.indexOf(currentChunk[currentChunk.length - 1].codegenNode);
if (cacheIndex > -1) {
for (let i = cacheIndex; i < context.cached.length; i++) {
const c = context.cached[i];
if (c) c.index -= deleteCount;
}
context.cached.splice(cacheIndex - deleteCount + 1, deleteCount);
}
}
}
return deleteCount;
}
return 0;
};
let i = 0;
for (; i < children.length; i++) {
const child = children[i];
if (isParentCached || getCachedNode(child)) {
const result = analyzeNode(child);
if (result) {
nc += result[0];
ec += result[1];
currentChunk.push(child);
continue;
}
}
i -= stringifyCurrentChunk(i);
nc = 0;
ec = 0;
currentChunk.length = 0;
}
stringifyCurrentChunk(i);
};
const getCachedNode = (node) => {
if ((node.type === 1 && node.tagType === 0 || node.type === 12) && node.codegenNode && node.codegenNode.type === 20) return node.codegenNode;
};
const dataAriaRE = /^(?:data|aria)-/;
const isStringifiableAttr = (name, ns) => {
return (ns === 0 ? (0, _vue_shared.isKnownHtmlAttr)(name) : ns === 1 ? (0, _vue_shared.isKnownSvgAttr)(name) : ns === 2 ? (0, _vue_shared.isKnownMathMLAttr)(name) : false) || dataAriaRE.test(name);
};
const isNonStringifiable = /*@__PURE__*/ (0, _vue_shared.makeMap)(`caption,thead,tr,th,tbody,td,tfoot,colgroup,col`);
/**
* for a cached node, analyze it and return:
* - false: bailed (contains non-stringifiable props or runtime constant)
* - [nc, ec] where
* - nc is the number of nodes inside
* - ec is the number of element with bindings inside
*/
function analyzeNode(node) {
if (node.type === 1 && isNonStringifiable(node.tag)) return false;
if (node.type === 1 && (0, _vue_compiler_core.findDir)(node, "once", true)) 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(node) {
const isOptionTag = node.tag === "option" && node.ns === 0;
for (let i = 0; i < node.props.length; i++) {
const p = node.props[i];
if (p.type === 6 && !isStringifiableAttr(p.name, node.ns)) return bail();
if (p.type === 7 && p.name === "bind") {
if (p.arg && (p.arg.type === 8 || p.arg.isStatic && !isStringifiableAttr(p.arg.content, node.ns))) return bail();
if (p.exp && (p.exp.type === 8 || p.exp.constType < 3)) return bail();
if (isOptionTag && (0, _vue_compiler_core.isStaticArgOf)(p.arg, "value") && p.exp && !p.exp.isStatic) return bail();
}
}
for (let i = 0; i < node.children.length; i++) {
nc++;
const child = node.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 ((0, _vue_shared.isString)(node)) return node;
if ((0, _vue_shared.isSymbol)(node)) return ``;
switch (node.type) {
case 1: return stringifyElement(node, context);
case 2: return (0, _vue_shared.escapeHtml)(node.content);
case 3: return `<!--${(0, _vue_shared.escapeHtml)(node.content)}-->`;
case 5: return (0, _vue_shared.escapeHtml)((0, _vue_shared.toDisplayString)(evaluateConstant(node.content)));
case 8: return (0, _vue_shared.escapeHtml)(evaluateConstant(node));
case 12: return stringifyNode(node.content, context);
default: return "";
}
}
function stringifyElement(node, context) {
let res = `<${node.tag}`;
let innerHTML = void 0;
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 += `="${(0, _vue_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 (((0, _vue_shared.isBooleanAttr)(p.arg.content) || p.arg.content === "hidden") && exp.content === "false") continue;
let evaluated = evaluateConstant(exp);
if (evaluated != null) {
const arg = p.arg && p.arg.content;
if (arg === "hidden" && typeof evaluated === "number" && !(0, _vue_shared.includeBooleanAttr)(evaluated)) continue;
if (arg === "class") evaluated = (0, _vue_shared.normalizeClass)(evaluated);
else if (arg === "style") evaluated = (0, _vue_shared.stringifyStyle)((0, _vue_shared.normalizeStyle)(evaluated));
res += ` ${p.arg.content}="${(0, _vue_shared.escapeHtml)(evaluated)}"`;
}
} else if (p.name === "html") {
var _evaluateConstant;
innerHTML = (_evaluateConstant = evaluateConstant(p.exp)) !== null && _evaluateConstant !== void 0 ? _evaluateConstant : "";
} else if (p.name === "text") innerHTML = (0, _vue_shared.escapeHtml)((0, _vue_shared.toDisplayString)(evaluateConstant(p.exp)));
}
}
if (context.scopeId) res += ` ${context.scopeId}`;
res += `>`;
if (innerHTML !== void 0) res += innerHTML;
else for (let i = 0; i < node.children.length; i++) res += stringifyNode(node.children[i], context);
if (!(0, _vue_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 ((0, _vue_shared.isString)(c) || (0, _vue_shared.isSymbol)(c)) return;
if (c.type === 2) res += c.content;
else if (c.type === 5) res += (0, _vue_shared.toDisplayString)(evaluateConstant(c.content));
else res += evaluateConstant(c);
});
return res;
}
}
//#endregion
//#region packages/compiler-dom/src/transforms/ignoreSideEffectTags.ts
const ignoreSideEffectTags = (node, context) => {
if (node.type === 1 && node.tagType === 0 && (node.tag === "script" || node.tag === "style")) context.removeNode();
};
//#endregion
//#region packages/compiler-dom/src/htmlNesting.ts
/**
* Copied from https://github.com/MananTank/validate-html-nesting
* with ISC license
*
* To avoid runtime dependency on validate-html-nesting
* This file should not change very often in the original repo
* but we may need to keep it up-to-date from time to time.
*/
/**
* returns true if given parent-child nesting is valid HTML
*/
function isValidHTMLNesting(parent, child) {
if (parent === "template") return true;
if (parent in onlyValidChildren) return onlyValidChildren[parent].has(child);
if (child in onlyValidParents) return onlyValidParents[child].has(parent);
if (parent in knownInvalidChildren) {
if (knownInvalidChildren[parent].has(child)) return false;
}
if (child in knownInvalidParents) {
if (knownInvalidParents[child].has(parent)) return false;
}
return true;
}
const headings = /* @__PURE__ */ new Set([
"h1",
"h2",
"h3",
"h4",
"h5",
"h6"
]);
const emptySet = /* @__PURE__ */ new Set([]);
/**
* maps element to set of elements that can be it's children, no other */
const onlyValidChildren = {
head: /* @__PURE__ */ new Set([
"base",
"basefront",
"bgsound",
"link",
"meta",
"title",
"noscript",
"noframes",
"style",
"script",
"template"
]),
optgroup: /* @__PURE__ */ new Set(["option"]),
select: /* @__PURE__ */ new Set([
"optgroup",
"option",
"hr"
]),
table: /* @__PURE__ */ new Set([
"caption",
"colgroup",
"tbody",
"tfoot",
"thead"
]),
tr: /* @__PURE__ */ new Set(["td", "th"]),
colgroup: /* @__PURE__ */ new Set(["col"]),
tbody: /* @__PURE__ */ new Set(["tr"]),
thead: /* @__PURE__ */ new Set(["tr"]),
tfoot: /* @__PURE__ */ new Set(["tr"]),
script: emptySet,
iframe: emptySet,
option: emptySet,
textarea: emptySet,
style: emptySet,
title: emptySet
};
/** maps elements to set of elements which can be it's parent, no other */
const onlyValidParents = {
html: emptySet,
body: /* @__PURE__ */ new Set(["html"]),
head: /* @__PURE__ */ new Set(["html"]),
td: /* @__PURE__ */ new Set(["tr"]),
colgroup: /* @__PURE__ */ new Set(["table"]),
caption: /* @__PURE__ */ new Set(["table"]),
tbody: /* @__PURE__ */ new Set(["table"]),
tfoot: /* @__PURE__ */ new Set(["table"]),
col: /* @__PURE__ */ new Set(["colgroup"]),
th: /* @__PURE__ */ new Set(["tr"]),
thead: /* @__PURE__ */ new Set(["table"]),
tr: /* @__PURE__ */ new Set([
"tbody",
"thead",
"tfoot"
]),
dd: /* @__PURE__ */ new Set(["dl", "div"]),
dt: /* @__PURE__ */ new Set(["dl", "div"]),
figcaption: /* @__PURE__ */ new Set(["figure"]),
summary: /* @__PURE__ */ new Set(["details"]),
area: /* @__PURE__ */ new Set(["map"])
};
/** maps element to set of elements that can not be it's children, others can */
const knownInvalidChildren = {
p: /* @__PURE__ */ new Set([
"address",
"article",
"aside",
"blockquote",
"center",
"details",
"dialog",
"dir",
"div",
"dl",
"fieldset",
"figure",
"footer",
"form",
"h1",
"h2",
"h3",
"h4",
"h5",
"h6",
"header",
"hgroup",
"hr",
"li",
"main",
"nav",
"menu",
"ol",
"p",
"pre",
"section",
"table",
"ul"
]),
svg: /* @__PURE__ */ new Set([
"b",
"blockquote",
"br",
"code",
"dd",
"div",
"dl",
"dt",
"em",
"embed",
"h1",
"h2",
"h3",
"h4",
"h5",
"h6",
"hr",
"i",
"img",
"li",
"menu",
"meta",
"ol",
"p",
"pre",
"ruby",
"s",
"small",
"span",
"strong",
"sub",
"sup",
"table",
"u",
"ul",
"var"
])
};
/** maps element to set of elements that can not be it's parent, others can */
const knownInvalidParents = {
a: /* @__PURE__ */ new Set(["a"]),
button: /* @__PURE__ */ new Set(["button"]),
dd: /* @__PURE__ */ new Set(["dd", "dt"]),
dt: /* @__PURE__ */ new Set(["dd", "dt"]),
form: /* @__PURE__ */ new Set(["form"]),
li: /* @__PURE__ */ new Set(["li"]),
h1: headings,
h2: headings,
h3: headings,
h4: headings,
h5: headings,
h6: headings
};
//#endregion
//#region packages/compiler-dom/src/index.ts
const DOMNodeTransforms = [
transformStyle,
transformTransition,
...[]
];
const DOMDirectiveTransforms = {
cloak: _vue_compiler_core.noopDirectiveTransform,
html: transformVHtml,
text: transformVText,
model: transformModel,
on: transformOn,
show: transformShow
};
function compile(src, options = {}) {
return (0, _vue_compiler_core.baseCompile)(src, (0, _vue_shared.extend)({}, parserOptions, options, {
nodeTransforms: [
ignoreSideEffectTags,
...DOMNodeTransforms,
...options.nodeTransforms || []
],
directiveTransforms: (0, _vue_shared.extend)({}, DOMDirectiveTransforms, options.directiveTransforms || {}),
transformHoist: stringifyStatic
}));
}
function parse(template, options = {}) {
return (0, _vue_compiler_core.baseParse)(template, (0, _vue_shared.extend)({}, parserOptions, options));
}
//#endregion
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.isKeyboardEvent = isKeyboardEvent;
exports.isValidHTMLNesting = isValidHTMLNesting;
exports.parse = parse;
exports.parserOptions = parserOptions;
exports.postTransformTransition = postTransformTransition;
exports.resolveModifiers = resolveModifiers;
exports.transformStyle = transformStyle;
Object.keys(_vue_compiler_core).forEach(function(k) {
if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
enumerable: true,
get: function() {
return _vue_compiler_core[k];
}
});
});
@@ -0,0 +1,72 @@
import { CodegenResult, CompilerError, CompilerOptions, ComponentNode, DirectiveTransform, ExpressionNode, NodeTransform, ParserOptions, RootNode, SimpleExpressionNode, SourceLocation, TransformContext } from "@vue/compiler-core";
export * from "@vue/compiler-core";
//#region temp/packages/compiler-dom/src/parserOptions.d.ts
export declare const parserOptions: ParserOptions;
//#endregion
//#region temp/packages/compiler-dom/src/runtimeHelpers.d.ts
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;
//#endregion
//#region temp/packages/compiler-dom/src/transforms/transformStyle.d.ts
export declare const transformStyle: NodeTransform;
//#endregion
//#region temp/packages/compiler-dom/src/errors.d.ts
interface DOMCompilerError extends CompilerError {
code: DOMErrorCodes;
}
export declare function createDOMCompilerError(code: DOMErrorCodes, loc?: SourceLocation): DOMCompilerError;
export declare enum DOMErrorCodes {
X_V_HTML_NO_EXPRESSION = 54,
X_V_HTML_WITH_CHILDREN = 55,
X_V_TEXT_NO_EXPRESSION = 56,
X_V_TEXT_WITH_CHILDREN = 57,
X_V_MODEL_ON_INVALID_ELEMENT = 58,
X_V_MODEL_ARG_ON_ELEMENT = 59,
X_V_MODEL_ON_FILE_INPUT_ELEMENT = 60,
X_V_MODEL_UNNECESSARY_VALUE = 61,
X_V_SHOW_NO_EXPRESSION = 62,
X_TRANSITION_INVALID_CHILDREN = 63,
X_IGNORED_SIDE_EFFECT_TAG = 64,
__EXTEND_POINT__ = 65
}
export declare const DOMErrorMessages: Record<DOMErrorCodes, string>;
//#endregion
//#region temp/packages/compiler-dom/src/transforms/vOn.d.ts
export declare const isKeyboardEvent: (key: string) => boolean;
export declare const resolveModifiers: (key: ExpressionNode | string, modifiers: SimpleExpressionNode[], context: TransformContext | null, loc: SourceLocation) => {
keyModifiers: string[];
nonKeyModifiers: string[];
eventOptionModifiers: string[];
};
//#endregion
//#region temp/packages/compiler-dom/src/htmlNesting.d.ts
/**
* Copied from https://github.com/MananTank/validate-html-nesting
* with ISC license
*
* To avoid runtime dependency on validate-html-nesting
* This file should not change very often in the original repo
* but we may need to keep it up-to-date from time to time.
*/
/**
* returns true if given parent-child nesting is valid HTML
*/
export declare function isValidHTMLNesting(parent: string, child: string): boolean;
//#endregion
//#region temp/packages/compiler-dom/src/transforms/Transition.d.ts
export declare function postTransformTransition(node: ComponentNode, onError: (error: CompilerError) => void, hasMultipleChildren?: (node: ComponentNode) => boolean): () => void;
//#endregion
//#region temp/packages/compiler-dom/src/index.d.ts
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;
//#endregion
File diff suppressed because one or more lines are too long
@@ -0,0 +1,553 @@
/**
* @vue/compiler-dom v3.6.0-rc.14
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT
**/
import { TO_DISPLAY_STRING, baseCompile, baseParse, checkCompatEnabled, createCallExpression, createCompilerError, createCompoundExpression, createObjectProperty, createSimpleExpression, findDir, findProp, getConstantType, hasDynamicKeyVBind, isCommentOrWhitespace, isStaticArgOf, isStaticExp, noopDirectiveTransform, registerRuntimeHelpers, transformModel, transformOn } from "@vue/compiler-core";
import { capitalize, extend, isHTMLTag, isMathMLTag, isSVGTag, isString, isVoidTag, makeMap, parseStringStyle } from "@vue/shared";
export * from "@vue/compiler-core";
//#region packages/compiler-dom/src/runtimeHelpers.ts
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`
});
//#endregion
//#region packages/compiler-dom/src/decodeHtmlBrowser.ts
let decoder;
function decodeHtmlBrowser(raw, asAttr = false) {
if (!decoder) decoder = document.createElement("div");
if (asAttr) {
decoder.innerHTML = `<div foo="${raw.replace(/"/g, "&quot;")}">`;
return decoder.children[0].getAttribute("foo");
} else {
decoder.innerHTML = raw;
return decoder.textContent;
}
}
//#endregion
//#region packages/compiler-dom/src/parserOptions.ts
const parserOptions = {
parseMode: "html",
isVoidTag,
isNativeTag: (tag) => isHTMLTag(tag) || isSVGTag(tag) || isMathMLTag(tag),
isPreTag: (tag) => tag === "pre",
isIgnoreNewlineTag: (tag) => tag === "pre" || tag === "textarea",
decodeEntities: decodeHtmlBrowser,
isBuiltInComponent: (tag) => {
if (tag === "Transition" || tag === "transition") return TRANSITION;
else if (tag === "TransitionGroup" || tag === "transition-group") return TRANSITION_GROUP;
},
getNamespace(tag, parent, rootNamespace) {
let ns = parent ? parent.ns : rootNamespace;
if (parent && ns === 2) {
if (parent.tag === "annotation-xml") {
if (isSVGTag(tag)) 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 (isSVGTag(tag)) return 1;
if (isMathMLTag(tag)) return 2;
}
return ns;
}
};
//#endregion
//#region packages/compiler-dom/src/transforms/transformStyle.ts
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);
};
//#endregion
//#region packages/compiler-dom/src/errors.ts
function createDOMCompilerError(code, loc) {
return createCompilerError(code, loc, !!(process.env.NODE_ENV !== "production") || false ? DOMErrorMessages : void 0);
}
const DOMErrorCodes = {
"X_V_HTML_NO_EXPRESSION": 54,
"54": "X_V_HTML_NO_EXPRESSION",
"X_V_HTML_WITH_CHILDREN": 55,
"55": "X_V_HTML_WITH_CHILDREN",
"X_V_TEXT_NO_EXPRESSION": 56,
"56": "X_V_TEXT_NO_EXPRESSION",
"X_V_TEXT_WITH_CHILDREN": 57,
"57": "X_V_TEXT_WITH_CHILDREN",
"X_V_MODEL_ON_INVALID_ELEMENT": 58,
"58": "X_V_MODEL_ON_INVALID_ELEMENT",
"X_V_MODEL_ARG_ON_ELEMENT": 59,
"59": "X_V_MODEL_ARG_ON_ELEMENT",
"X_V_MODEL_ON_FILE_INPUT_ELEMENT": 60,
"60": "X_V_MODEL_ON_FILE_INPUT_ELEMENT",
"X_V_MODEL_UNNECESSARY_VALUE": 61,
"61": "X_V_MODEL_UNNECESSARY_VALUE",
"X_V_SHOW_NO_EXPRESSION": 62,
"62": "X_V_SHOW_NO_EXPRESSION",
"X_TRANSITION_INVALID_CHILDREN": 63,
"63": "X_TRANSITION_INVALID_CHILDREN",
"X_IGNORED_SIDE_EFFECT_TAG": 64,
"64": "X_IGNORED_SIDE_EFFECT_TAG",
"__EXTEND_POINT__": 65,
"65": "__EXTEND_POINT__"
};
const DOMErrorMessages = {
[54]: `v-html is missing expression.`,
[55]: `v-html will override element children.`,
[56]: `v-text is missing expression.`,
[57]: `v-text will override element children.`,
[58]: `v-model can only be used on <input>, <textarea> and <select> elements.`,
[59]: `v-model argument is not supported on plain elements.`,
[60]: `v-model cannot be used on file inputs since they are read-only. Use a v-on:change listener instead.`,
[61]: `Unnecessary value binding used alongside v-model. It will interfere with v-model's behavior.`,
[62]: `v-show is missing expression.`,
[63]: `<Transition> expects exactly one child element or component.`,
[64]: `Tags with side effect (<script> and <style>) are ignored in client component templates.`,
[65]: ``
};
//#endregion
//#region packages/compiler-dom/src/transforms/vHtml.ts
const transformVHtml = (dir, node, context) => {
const { exp, loc } = dir;
if (!exp) context.onError(createDOMCompilerError(54, loc));
if (node.children.length) {
context.onError(createDOMCompilerError(55, loc));
node.children.length = 0;
}
return { props: [createObjectProperty(createSimpleExpression(`innerHTML`, true, loc), exp || createSimpleExpression("", true))] };
};
//#endregion
//#region packages/compiler-dom/src/transforms/vText.ts
const transformVText = (dir, node, context) => {
const { exp, loc } = dir;
if (!exp) context.onError(createDOMCompilerError(56, loc));
if (node.children.length) {
context.onError(createDOMCompilerError(57, 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))] };
};
//#endregion
//#region packages/compiler-dom/src/transforms/vModel.ts
const transformModel$1 = (dir, node, context) => {
const baseResult = transformModel(dir, node, context);
if (!baseResult.props.length || node.tagType === 1) return baseResult;
if (dir.arg) context.onError(createDOMCompilerError(59, dir.arg.loc));
function checkDuplicatedValue() {
const value = findDir(node, "bind");
if (value && isStaticArgOf(value.arg, "value")) context.onError(createDOMCompilerError(61, 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(60, dir.loc));
break;
default: process.env.NODE_ENV !== "production" && checkDuplicatedValue();
}
} 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(58, dir.loc));
baseResult.props = baseResult.props.filter((p) => !(p.key.type === 4 && p.key.content === "modelValue"));
return baseResult;
};
//#endregion
//#region packages/compiler-dom/src/transforms/vOn.ts
const isEventOptionModifier = /*@__PURE__*/ makeMap(`passive,once,capture`);
const isNonKeyModifier = /*@__PURE__*/ makeMap("stop,prevent,self,ctrl,shift,alt,meta,exact,middle");
const maybeKeyModifier = /*@__PURE__*/ makeMap("left,right");
const isKeyboardEvent = /*@__PURE__*/ makeMap(`onkeyup,onkeydown,onkeypress`);
const resolveModifiers = (key, modifiers, context, loc) => {
const keyModifiers = [];
const nonKeyModifiers = [];
const eventOptionModifiers = [];
for (let i = 0; i < modifiers.length; i++) {
const modifier = modifiers[i].content;
if (modifier === "delegate") {
if (context) {
const error = /* @__PURE__ */ new SyntaxError(`.delegate modifier is only supported in Vapor components.`);
error.loc = modifiers[i].loc;
context.onWarn(error);
}
continue;
}
if (modifier === "native" && context && checkCompatEnabled("COMPILER_V_ON_NATIVE", context, loc)) eventOptionModifiers.push(modifier);
else if (isEventOptionModifier(modifier)) eventOptionModifiers.push(modifier);
else {
const keyString = isString(key) ? key : isStaticExp(key) ? key.content : null;
if (maybeKeyModifier(modifier)) {
if (keyString) {
if (isKeyboardEvent(keyString.toLowerCase())) 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) => {
return isStaticExp(key) && key.content.toLowerCase() === "onclick" ? createSimpleExpression(event, true) : key.type !== 4 ? createCompoundExpression([
`(`,
key,
`) === "onClick" ? "${event}" : (`,
key,
`)`
]) : key;
};
const transformOn$1 = (dir, node, context) => {
return 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 = createCallExpression(context.helper(V_ON_WITH_MODIFIERS), [handlerExp, JSON.stringify(nonKeyModifiers)]);
if (keyModifiers.length && (!isStaticExp(key) || isKeyboardEvent(key.content.toLowerCase()))) 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)] };
});
};
//#endregion
//#region packages/compiler-dom/src/transforms/vShow.ts
const transformShow = (dir, node, context) => {
const { exp, loc } = dir;
if (!exp) context.onError(createDOMCompilerError(62, loc));
return {
props: [],
needRuntime: context.helper(V_SHOW)
};
};
//#endregion
//#region packages/compiler-dom/src/transforms/Transition.ts
const transformTransition = (node, context) => {
if (node.type === 1 && node.tagType === 1) {
if (context.isBuiltInComponent(node.tag) === TRANSITION) return postTransformTransition(node, context.onError);
}
};
function postTransformTransition(node, onError, hasMultipleChildren = defaultHasMultipleChildren) {
return () => {
if (!node.children.length) return;
const multipleChildren = hasMultipleChildren(node);
if (!!(process.env.NODE_ENV !== "production") && multipleChildren) onError(createDOMCompilerError(63, {
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 && !findDir(child, "if")) {
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 defaultHasMultipleChildren(node) {
const children = node.children = node.children.filter((c) => !isCommentOrWhitespace(c));
const child = children[0];
return children.length !== 1 || child.type === 11 || child.type === 9 && child.branches.some(defaultHasMultipleChildren);
}
//#endregion
//#region packages/compiler-dom/src/transforms/ignoreSideEffectTags.ts
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(64, node.loc));
context.removeNode();
}
};
//#endregion
//#region packages/compiler-dom/src/htmlNesting.ts
/**
* Copied from https://github.com/MananTank/validate-html-nesting
* with ISC license
*
* To avoid runtime dependency on validate-html-nesting
* This file should not change very often in the original repo
* but we may need to keep it up-to-date from time to time.
*/
/**
* returns true if given parent-child nesting is valid HTML
*/
function isValidHTMLNesting(parent, child) {
if (parent === "template") return true;
if (parent in onlyValidChildren) return onlyValidChildren[parent].has(child);
if (child in onlyValidParents) return onlyValidParents[child].has(parent);
if (parent in knownInvalidChildren) {
if (knownInvalidChildren[parent].has(child)) return false;
}
if (child in knownInvalidParents) {
if (knownInvalidParents[child].has(parent)) return false;
}
return true;
}
const headings = /* @__PURE__ */ new Set([
"h1",
"h2",
"h3",
"h4",
"h5",
"h6"
]);
const emptySet = /* @__PURE__ */ new Set([]);
/**
* maps element to set of elements that can be it's children, no other */
const onlyValidChildren = {
head: /* @__PURE__ */ new Set([
"base",
"basefront",
"bgsound",
"link",
"meta",
"title",
"noscript",
"noframes",
"style",
"script",
"template"
]),
optgroup: /* @__PURE__ */ new Set(["option"]),
select: /* @__PURE__ */ new Set([
"optgroup",
"option",
"hr"
]),
table: /* @__PURE__ */ new Set([
"caption",
"colgroup",
"tbody",
"tfoot",
"thead"
]),
tr: /* @__PURE__ */ new Set(["td", "th"]),
colgroup: /* @__PURE__ */ new Set(["col"]),
tbody: /* @__PURE__ */ new Set(["tr"]),
thead: /* @__PURE__ */ new Set(["tr"]),
tfoot: /* @__PURE__ */ new Set(["tr"]),
script: emptySet,
iframe: emptySet,
option: emptySet,
textarea: emptySet,
style: emptySet,
title: emptySet
};
/** maps elements to set of elements which can be it's parent, no other */
const onlyValidParents = {
html: emptySet,
body: /* @__PURE__ */ new Set(["html"]),
head: /* @__PURE__ */ new Set(["html"]),
td: /* @__PURE__ */ new Set(["tr"]),
colgroup: /* @__PURE__ */ new Set(["table"]),
caption: /* @__PURE__ */ new Set(["table"]),
tbody: /* @__PURE__ */ new Set(["table"]),
tfoot: /* @__PURE__ */ new Set(["table"]),
col: /* @__PURE__ */ new Set(["colgroup"]),
th: /* @__PURE__ */ new Set(["tr"]),
thead: /* @__PURE__ */ new Set(["table"]),
tr: /* @__PURE__ */ new Set([
"tbody",
"thead",
"tfoot"
]),
dd: /* @__PURE__ */ new Set(["dl", "div"]),
dt: /* @__PURE__ */ new Set(["dl", "div"]),
figcaption: /* @__PURE__ */ new Set(["figure"]),
summary: /* @__PURE__ */ new Set(["details"]),
area: /* @__PURE__ */ new Set(["map"])
};
/** maps element to set of elements that can not be it's children, others can */
const knownInvalidChildren = {
p: /* @__PURE__ */ new Set([
"address",
"article",
"aside",
"blockquote",
"center",
"details",
"dialog",
"dir",
"div",
"dl",
"fieldset",
"figure",
"footer",
"form",
"h1",
"h2",
"h3",
"h4",
"h5",
"h6",
"header",
"hgroup",
"hr",
"li",
"main",
"nav",
"menu",
"ol",
"p",
"pre",
"section",
"table",
"ul"
]),
svg: /* @__PURE__ */ new Set([
"b",
"blockquote",
"br",
"code",
"dd",
"div",
"dl",
"dt",
"em",
"embed",
"h1",
"h2",
"h3",
"h4",
"h5",
"h6",
"hr",
"i",
"img",
"li",
"menu",
"meta",
"ol",
"p",
"pre",
"ruby",
"s",
"small",
"span",
"strong",
"sub",
"sup",
"table",
"u",
"ul",
"var"
])
};
/** maps element to set of elements that can not be it's parent, others can */
const knownInvalidParents = {
a: /* @__PURE__ */ new Set(["a"]),
button: /* @__PURE__ */ new Set(["button"]),
dd: /* @__PURE__ */ new Set(["dd", "dt"]),
dt: /* @__PURE__ */ new Set(["dd", "dt"]),
form: /* @__PURE__ */ new Set(["form"]),
li: /* @__PURE__ */ new Set(["li"]),
h1: headings,
h2: headings,
h3: headings,
h4: headings,
h5: headings,
h6: headings
};
//#endregion
//#region packages/compiler-dom/src/transforms/validateHtmlNesting.ts
const validateHtmlNesting = (node, context) => {
if (node.type === 1 && node.tagType === 0 && context.parent && context.parent.type === 1 && context.parent.tagType === 0 && !isValidHTMLNesting(context.parent.tag, node.tag)) {
const error = /* @__PURE__ */ new SyntaxError(`<${node.tag}> cannot be child of <${context.parent.tag}>, according to HTML specifications. This can cause hydration errors or potentially disrupt future functionality.`);
error.loc = node.loc;
context.onWarn(error);
}
};
//#endregion
//#region packages/compiler-dom/src/index.ts
const DOMNodeTransforms = [
transformStyle,
transformTransition,
...!!(process.env.NODE_ENV !== "production") ? [validateHtmlNesting] : []
];
const DOMDirectiveTransforms = {
cloak: noopDirectiveTransform,
html: transformVHtml,
text: transformVText,
model: transformModel$1,
on: transformOn$1,
show: transformShow
};
function compile(src, options = {}) {
return baseCompile(src, extend({}, parserOptions, options, {
nodeTransforms: [
ignoreSideEffectTags,
...DOMNodeTransforms,
...options.nodeTransforms || []
],
directiveTransforms: extend({}, DOMDirectiveTransforms, options.directiveTransforms || {}),
transformHoist: null
}));
}
function parse(template, options = {}) {
return baseParse(template, extend({}, parserOptions, options));
}
//#endregion
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, isKeyboardEvent, isValidHTMLNesting, parse, parserOptions, postTransformTransition, resolveModifiers, transformStyle };
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
@@ -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')
}
@@ -0,0 +1,57 @@
{
"name": "@vue/compiler-dom",
"version": "3.6.0-rc.14",
"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": "workspace:*",
"@vue/compiler-core": "workspace:*"
}
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
@@ -0,0 +1,68 @@
{
"name": "@vue/compiler-sfc",
"version": "3.6.0-rc.14",
"description": "@vue/compiler-sfc",
"main": "dist/compiler-sfc.cjs.js",
"module": "dist/compiler-sfc.esm-browser.js",
"types": "dist/compiler-sfc.d.ts",
"files": [
"dist"
],
"exports": {
".": {
"types": "./dist/compiler-sfc.d.ts",
"node": "./dist/compiler-sfc.cjs.js",
"module": "./dist/compiler-sfc.esm-browser.js",
"import": "./dist/compiler-sfc.esm-browser.js",
"require": "./dist/compiler-sfc.cjs.js"
},
"./*": "./*"
},
"buildOptions": {
"name": "VueCompilerSFC",
"formats": [
"cjs",
"esm-browser"
],
"prod": false,
"enableNonBrowserBranches": true
},
"repository": {
"type": "git",
"url": "git+https://github.com/vuejs/core.git",
"directory": "packages/compiler-sfc"
},
"keywords": [
"vue"
],
"author": "Evan You",
"license": "MIT",
"bugs": {
"url": "https://github.com/vuejs/core/issues"
},
"homepage": "https://github.com/vuejs/core/tree/main/packages/compiler-sfc#readme",
"dependencies": {
"@babel/parser": "catalog:",
"@dcloudio/compiler-vapor-web": "workspace:*",
"@vue/compiler-core": "workspace:*",
"@vue/compiler-dom": "workspace:*",
"@vue/compiler-ssr": "workspace:*",
"@vue/shared": "workspace:*",
"estree-walker": "catalog:",
"magic-string": "catalog:",
"postcss": "^8.5.29",
"source-map-js": "catalog:"
},
"devDependencies": {
"@babel/types": "catalog:",
"@vue/consolidate": "^1.0.0",
"hash-sum": "^2.0.0",
"lru-cache": "10.1.0",
"merge-source-map": "^1.1.0",
"minimatch": "~10.2.6",
"postcss-modules": "^6.0.1",
"postcss-selector-parser": "^7.1.6",
"pug": "^3.0.4",
"sass": "^1.105.1"
}
}
@@ -0,0 +1,915 @@
/**
* @vue/compiler-ssr v3.6.0-rc.14
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT
**/
Object.defineProperties(exports, {
__esModule: { value: true },
[Symbol.toStringTag]: { value: "Module" }
});
let _vue_compiler_dom = require("@vue/compiler-dom");
let _vue_shared = require("@vue/shared");
//#region packages/compiler-ssr/src/runtimeHelpers.ts
const SSR_INTERPOLATE = Symbol(`ssrInterpolate`);
const SSR_RENDER_VNODE = Symbol(`ssrRenderVNode`);
const SSR_RENDER_DYNAMIC_COMPONENT = Symbol(`ssrRenderDynamicComponent`);
const SSR_RENDER_COMPONENT = Symbol(`ssrRenderComponent`);
const SSR_RENDER_SLOT = Symbol(`ssrRenderSlot`);
const SSR_RENDER_SLOT_INNER = Symbol(`ssrRenderSlotInner`);
const SSR_RENDER_CLASS = Symbol(`ssrRenderClass`);
const SSR_RENDER_STYLE = Symbol(`ssrRenderStyle`);
const SSR_RENDER_ATTRS = Symbol(`ssrRenderAttrs`);
const SSR_RENDER_ATTR = Symbol(`ssrRenderAttr`);
const SSR_RENDER_DYNAMIC_ATTR = Symbol(`ssrRenderDynamicAttr`);
const SSR_RENDER_LIST = Symbol(`ssrRenderList`);
const SSR_INCLUDE_BOOLEAN_ATTR = Symbol(`ssrIncludeBooleanAttr`);
const SSR_LOOSE_EQUAL = Symbol(`ssrLooseEqual`);
const SSR_LOOSE_CONTAIN = Symbol(`ssrLooseContain`);
const SSR_RENDER_DYNAMIC_MODEL = Symbol(`ssrRenderDynamicModel`);
const SSR_GET_DYNAMIC_MODEL_PROPS = Symbol(`ssrGetDynamicModelProps`);
const SSR_RENDER_TELEPORT = Symbol(`ssrRenderTeleport`);
const SSR_RENDER_SUSPENSE = Symbol(`ssrRenderSuspense`);
const SSR_GET_DIRECTIVE_PROPS = Symbol(`ssrGetDirectiveProps`);
const ssrHelpers = {
[SSR_INTERPOLATE]: `ssrInterpolate`,
[SSR_RENDER_VNODE]: `ssrRenderVNode`,
[SSR_RENDER_DYNAMIC_COMPONENT]: `ssrRenderDynamicComponent`,
[SSR_RENDER_COMPONENT]: `ssrRenderComponent`,
[SSR_RENDER_SLOT]: `ssrRenderSlot`,
[SSR_RENDER_SLOT_INNER]: `ssrRenderSlotInner`,
[SSR_RENDER_CLASS]: `ssrRenderClass`,
[SSR_RENDER_STYLE]: `ssrRenderStyle`,
[SSR_RENDER_ATTRS]: `ssrRenderAttrs`,
[SSR_RENDER_ATTR]: `ssrRenderAttr`,
[SSR_RENDER_DYNAMIC_ATTR]: `ssrRenderDynamicAttr`,
[SSR_RENDER_LIST]: `ssrRenderList`,
[SSR_INCLUDE_BOOLEAN_ATTR]: `ssrIncludeBooleanAttr`,
[SSR_LOOSE_EQUAL]: `ssrLooseEqual`,
[SSR_LOOSE_CONTAIN]: `ssrLooseContain`,
[SSR_RENDER_DYNAMIC_MODEL]: `ssrRenderDynamicModel`,
[SSR_GET_DYNAMIC_MODEL_PROPS]: `ssrGetDynamicModelProps`,
[SSR_RENDER_TELEPORT]: `ssrRenderTeleport`,
[SSR_RENDER_SUSPENSE]: `ssrRenderSuspense`,
[SSR_GET_DIRECTIVE_PROPS]: `ssrGetDirectiveProps`
};
(0, _vue_compiler_dom.registerRuntimeHelpers)(ssrHelpers);
//#endregion
//#region packages/compiler-ssr/src/transforms/ssrVIf.ts
const ssrTransformIf = (0, _vue_compiler_dom.createStructuralDirectiveTransform)(/^(?:if|else|else-if)$/, _vue_compiler_dom.processIf);
function ssrProcessIf(node, context, disableNestedFragments = false, disableComment = false) {
const { branches } = node;
const ranged = !!context.options.vapor && hasLookalikeBranches(branches);
const [rootBranch] = branches;
const ifStatement = (0, _vue_compiler_dom.createIfStatement)(rootBranch.condition, processIfBranch(rootBranch, context, disableNestedFragments, ranged && 0));
context.pushStatement(ifStatement);
let currentIf = ifStatement;
for (let i = 1; i < branches.length; i++) {
const branch = branches[i];
const branchBlockStatement = processIfBranch(branch, context, disableNestedFragments, ranged && i);
if (branch.condition) currentIf = currentIf.alternate = (0, _vue_compiler_dom.createIfStatement)(branch.condition, branchBlockStatement);
else currentIf.alternate = branchBlockStatement;
}
if (!currentIf.alternate && (!disableComment || context.options.vapor)) currentIf.alternate = (0, _vue_compiler_dom.createBlockStatement)([(0, _vue_compiler_dom.createCallExpression)(`_push`, ["`<!---->`"])]);
}
function processIfBranch(branch, context, disableNestedFragments = false, index = false) {
if (index !== false) {
const childContext = createChildContext(context);
childContext.pushStringPart(`<!--[${index}-->`);
processChildren(branch, childContext);
childContext.pushStringPart(`<!--]-->`);
return (0, _vue_compiler_dom.createBlockStatement)(childContext.body);
}
const { children } = branch;
return processChildrenAsStatement(branch, context, !disableNestedFragments && (children.length !== 1 || children[0].type !== 1) && !(children.length === 1 && children[0].type === 11));
}
/**
* Whether two branches of a chain could start with the same node. Branches
* that each render one plain element, all of different tags, are told apart
* by the tag.
*/
function hasLookalikeBranches(branches) {
if (branches.length < 2) return false;
const tags = /* @__PURE__ */ new Set();
for (const { children } of branches) {
const nodes = children.filter((child) => child.type !== 3);
const root = nodes.length === 1 ? nodes[0] : void 0;
if (!root || root.type !== 1 || root.tagType !== 0 || tags.has(root.tag)) return true;
tags.add(root.tag);
}
return false;
}
//#endregion
//#region packages/compiler-ssr/src/transforms/ssrVFor.ts
const ssrTransformFor = (0, _vue_compiler_dom.createStructuralDirectiveTransform)("for", _vue_compiler_dom.processFor);
function ssrProcessFor(node, context, disableNestedFragments = false) {
const needFragmentWrapper = !disableNestedFragments && (node.children.length !== 1 || node.children[0].type !== 1);
const renderLoop = (0, _vue_compiler_dom.createFunctionExpression)((0, _vue_compiler_dom.createForLoopParams)(node.parseResult));
renderLoop.body = processChildrenAsStatement(node, context, needFragmentWrapper);
if (!disableNestedFragments) context.pushStringPart(`<!--[-->`);
context.pushStatement((0, _vue_compiler_dom.createCallExpression)(context.helper(SSR_RENDER_LIST), [node.source, renderLoop]));
if (!disableNestedFragments) context.pushStringPart(`<!--]-->`);
}
//#endregion
//#region packages/compiler-ssr/src/errors.ts
function createSSRCompilerError(code, loc) {
return (0, _vue_compiler_dom.createCompilerError)(code, loc, SSRErrorMessages);
}
const SSRErrorMessages = {
[65]: `Unsafe attribute name for SSR.`,
[66]: `Missing the 'to' prop on teleport element.`,
[67]: `Invalid AST node during SSR transform.`
};
//#endregion
//#region packages/compiler-ssr/src/transforms/ssrTransformTeleport.ts
function ssrProcessTeleport(node, context) {
const targetProp = (0, _vue_compiler_dom.findProp)(node, "to");
if (!targetProp) {
context.onError(createSSRCompilerError(66, node.loc));
return;
}
let target;
if (targetProp.type === 6) target = targetProp.value && (0, _vue_compiler_dom.createSimpleExpression)(targetProp.value.content, true);
else target = targetProp.exp;
if (!target) {
context.onError(createSSRCompilerError(66, targetProp.loc));
return;
}
const disabledProp = (0, _vue_compiler_dom.findProp)(node, "disabled", false, true);
const disabled = disabledProp ? disabledProp.type === 6 ? `true` : disabledProp.exp || `false` : `false`;
const contentRenderFn = (0, _vue_compiler_dom.createFunctionExpression)([`_push`], void 0, true, false, node.loc);
contentRenderFn.body = processChildrenAsStatement(node, context);
context.pushStatement((0, _vue_compiler_dom.createCallExpression)(context.helper(SSR_RENDER_TELEPORT), [
`_push`,
contentRenderFn,
target,
disabled,
`_parent`
]));
}
//#endregion
//#region packages/compiler-ssr/src/transforms/ssrTransformSuspense.ts
const wipMap$3 = /* @__PURE__ */ new WeakMap();
function ssrTransformSuspense(node, context) {
return () => {
if (node.children.length) {
const wipEntry = {
slotsExp: null,
wipSlots: []
};
wipMap$3.set(node, wipEntry);
wipEntry.slotsExp = (0, _vue_compiler_dom.buildSlots)(node, context, (_props, _vForExp, children, loc) => {
const fn = (0, _vue_compiler_dom.createFunctionExpression)([], void 0, true, false, loc);
wipEntry.wipSlots.push({
fn,
children
});
return fn;
}).slots;
}
};
}
function ssrProcessSuspense(node, context) {
const wipEntry = wipMap$3.get(node);
if (!wipEntry) return;
const { slotsExp, wipSlots } = wipEntry;
for (let i = 0; i < wipSlots.length; i++) {
const slot = wipSlots[i];
slot.fn.body = processChildrenAsStatement(slot, context, !!context.options.vapor);
}
context.pushStatement((0, _vue_compiler_dom.createCallExpression)(context.helper(SSR_RENDER_SUSPENSE), [`_push`, slotsExp]));
}
//#endregion
//#region packages/compiler-ssr/src/transforms/ssrTransformElement.ts
const rawChildrenMap = /* @__PURE__ */ new WeakMap();
const ssrTransformElement = (node, context) => {
if (node.type !== 1 || node.tagType !== 0) return;
return function ssrPostTransformElement() {
const openTag = [`<${node.tag}`];
const needTagForRuntime = node.tag === "textarea" || node.tag.indexOf("-") > 0;
const hasDynamicVBind = (0, _vue_compiler_dom.hasDynamicKeyVBind)(node);
const hasCustomDir = node.props.some((p) => p.type === 7 && !(0, _vue_shared.isBuiltInDirective)(p.name));
const vShowPropIndex = node.props.findIndex((i) => i.type === 7 && i.name === "show");
if (vShowPropIndex !== -1) {
const vShowProp = node.props[vShowPropIndex];
node.props.splice(vShowPropIndex, 1);
node.props.push(vShowProp);
}
const needMergeProps = hasDynamicVBind || hasCustomDir;
if (needMergeProps) {
const { props, directives } = (0, _vue_compiler_dom.buildProps)(node, context, node.props, false, false, true);
if (props || directives.length) {
const mergedProps = buildSSRProps(props, directives, context);
const propsExp = (0, _vue_compiler_dom.createCallExpression)(context.helper(SSR_RENDER_ATTRS), [mergedProps]);
if (node.tag === "textarea") {
const existingText = node.children[0];
if (!hasContentOverrideDirective(node) && (!existingText || existingText.type !== 5)) {
const tempId = `_temp${context.temps++}`;
propsExp.arguments = [(0, _vue_compiler_dom.createAssignmentExpression)((0, _vue_compiler_dom.createSimpleExpression)(tempId, false), mergedProps)];
rawChildrenMap.set(node, (0, _vue_compiler_dom.createCallExpression)(context.helper(SSR_INTERPOLATE), [(0, _vue_compiler_dom.createConditionalExpression)((0, _vue_compiler_dom.createSimpleExpression)(`"value" in ${tempId}`, false), (0, _vue_compiler_dom.createSimpleExpression)(`${tempId}.value`, false), (0, _vue_compiler_dom.createSimpleExpression)(existingText ? existingText.content : ``, true), false)]));
}
} else if (node.tag === "input") {
const vModel = findVModel(node);
if (vModel) {
const tempId = `_temp${context.temps++}`;
const tempExp = (0, _vue_compiler_dom.createSimpleExpression)(tempId, false);
propsExp.arguments = [(0, _vue_compiler_dom.createSequenceExpression)([(0, _vue_compiler_dom.createAssignmentExpression)(tempExp, mergedProps), (0, _vue_compiler_dom.createCallExpression)(context.helper(_vue_compiler_dom.MERGE_PROPS), [tempExp, (0, _vue_compiler_dom.createCallExpression)(context.helper(SSR_GET_DYNAMIC_MODEL_PROPS), [tempExp, vModel.exp])])])];
}
} else if (directives.length && !node.children.length) {
if (!hasContentOverrideDirective(node)) {
const tempId = `_temp${context.temps++}`;
propsExp.arguments = [(0, _vue_compiler_dom.createAssignmentExpression)((0, _vue_compiler_dom.createSimpleExpression)(tempId, false), mergedProps)];
rawChildrenMap.set(node, (0, _vue_compiler_dom.createConditionalExpression)((0, _vue_compiler_dom.createSimpleExpression)(`"textContent" in ${tempId}`, false), (0, _vue_compiler_dom.createCallExpression)(context.helper(SSR_INTERPOLATE), [(0, _vue_compiler_dom.createSimpleExpression)(`${tempId}.textContent`, false)]), (0, _vue_compiler_dom.createSimpleExpression)(`${tempId}.innerHTML ?? ''`, false), false));
}
}
if (needTagForRuntime) propsExp.arguments.push(`"${node.tag}"`);
openTag.push(propsExp);
}
}
let dynamicClassBinding = void 0;
let staticClassBinding = void 0;
let dynamicStyleBinding = void 0;
for (let i = 0; i < node.props.length; i++) {
const prop = node.props[i];
if (node.tag === "input" && isTrueFalseValue(prop)) continue;
if (prop.type === 7) {
if (prop.name === "html" && prop.exp) rawChildrenMap.set(node, (0, _vue_compiler_dom.createCompoundExpression)([
`(`,
prop.exp,
`) ?? ''`
]));
else if (prop.name === "text" && prop.exp) node.children = [(0, _vue_compiler_dom.createInterpolation)(prop.exp, prop.loc)];
else if (prop.name === "slot") context.onError((0, _vue_compiler_dom.createCompilerError)(40, prop.loc));
else if (isTextareaWithValue(node, prop) && prop.exp) {
if (!needMergeProps) node.children = [(0, _vue_compiler_dom.createInterpolation)(prop.exp, prop.loc)];
} else if (!needMergeProps && prop.name !== "on") {
const directiveTransform = context.directiveTransforms[prop.name];
if (directiveTransform) {
const { props, ssrTagParts } = directiveTransform(prop, node, context);
if (ssrTagParts) openTag.push(...ssrTagParts);
for (let j = 0; j < props.length; j++) {
const { key, value } = props[j];
if ((0, _vue_compiler_dom.isStaticExp)(key)) {
let attrName = key.content;
if (attrName === "key" || attrName === "ref") continue;
if (attrName === "class") openTag.push(` class="`, dynamicClassBinding = (0, _vue_compiler_dom.createCallExpression)(context.helper(SSR_RENDER_CLASS), [value]), `"`);
else if (attrName === "style") {
if (dynamicStyleBinding) mergeCall(dynamicStyleBinding, value);
else openTag.push(` style="`, dynamicStyleBinding = (0, _vue_compiler_dom.createCallExpression)(context.helper(SSR_RENDER_STYLE), [value]), `"`);
} else {
attrName = node.tag.indexOf("-") > 0 ? attrName : _vue_shared.propsToAttrMap[attrName] || attrName.toLowerCase();
if ((0, _vue_shared.isBooleanAttr)(attrName)) openTag.push((0, _vue_compiler_dom.createConditionalExpression)((0, _vue_compiler_dom.createCallExpression)(context.helper(SSR_INCLUDE_BOOLEAN_ATTR), [value]), (0, _vue_compiler_dom.createSimpleExpression)(" " + attrName, true), (0, _vue_compiler_dom.createSimpleExpression)("", true), false));
else if (attrName === "hidden") openTag.push((0, _vue_compiler_dom.createCallExpression)(context.helper(SSR_RENDER_DYNAMIC_ATTR), [key, value]));
else if ((0, _vue_shared.isSSRSafeAttrName)(attrName)) openTag.push((0, _vue_compiler_dom.createCallExpression)(context.helper(SSR_RENDER_ATTR), [key, value]));
else context.onError(createSSRCompilerError(65, key.loc));
}
} else {
const args = [key, value];
if (needTagForRuntime) args.push(`"${node.tag}"`);
openTag.push((0, _vue_compiler_dom.createCallExpression)(context.helper(SSR_RENDER_DYNAMIC_ATTR), args));
}
}
}
}
} else {
const name = prop.name;
if (node.tag === "textarea" && name === "value" && prop.value) rawChildrenMap.set(node, (0, _vue_shared.escapeHtml)(prop.value.content));
else if (!needMergeProps) {
if (name === "key" || name === "ref") continue;
if (name === "class" && prop.value) staticClassBinding = JSON.stringify(prop.value.content);
openTag.push(` ${prop.name}` + (prop.value ? `="${(0, _vue_shared.escapeHtml)(prop.value.content)}"` : ``));
}
}
}
if (dynamicClassBinding && staticClassBinding) {
mergeCall(dynamicClassBinding, staticClassBinding);
removeStaticBinding(openTag, "class");
}
if (context.scopeId) openTag.push(` ${context.scopeId}`);
node.ssrCodegenNode = (0, _vue_compiler_dom.createTemplateLiteral)(openTag);
};
};
function buildSSRProps(props, directives, context) {
let mergePropsArgs = [];
if (props) {
if (props.type === 14) mergePropsArgs = props.arguments;
else mergePropsArgs.push(props);
}
if (directives.length) for (const dir of directives) mergePropsArgs.push((0, _vue_compiler_dom.createCallExpression)(context.helper(SSR_GET_DIRECTIVE_PROPS), [`_ctx`, ...(0, _vue_compiler_dom.buildDirectiveArgs)(dir, context).elements]));
return mergePropsArgs.length > 1 ? (0, _vue_compiler_dom.createCallExpression)(context.helper(_vue_compiler_dom.MERGE_PROPS), mergePropsArgs) : mergePropsArgs[0];
}
function isTrueFalseValue(prop) {
if (prop.type === 7) return prop.name === "bind" && prop.arg && (0, _vue_compiler_dom.isStaticExp)(prop.arg) && (prop.arg.content === "true-value" || prop.arg.content === "false-value");
else return prop.name === "true-value" || prop.name === "false-value";
}
function isTextareaWithValue(node, prop) {
return !!(node.tag === "textarea" && prop.name === "bind" && (0, _vue_compiler_dom.isStaticArgOf)(prop.arg, "value"));
}
function mergeCall(call, arg) {
const existing = call.arguments[0];
if (existing.type === 17) existing.elements.push(arg);
else call.arguments[0] = (0, _vue_compiler_dom.createArrayExpression)([existing, arg]);
}
function removeStaticBinding(tag, binding) {
const regExp = new RegExp(`^ ${binding}=".+"$`);
const i = tag.findIndex((e) => typeof e === "string" && regExp.test(e));
if (i > -1) tag.splice(i, 1);
}
function findVModel(node) {
return node.props.find((p) => p.type === 7 && p.name === "model" && p.exp);
}
function hasContentOverrideDirective(node) {
return !!(0, _vue_compiler_dom.findDir)(node, "text") || !!(0, _vue_compiler_dom.findDir)(node, "html");
}
function ssrProcessElement(node, context) {
const isVoidTag = context.options.isVoidTag || _vue_shared.NO;
const elementsToAdd = node.ssrCodegenNode.elements;
for (let j = 0; j < elementsToAdd.length; j++) context.pushStringPart(elementsToAdd[j]);
if (context.withSlotScopeId) context.pushStringPart((0, _vue_compiler_dom.createSimpleExpression)(`_scopeId`, false));
context.pushStringPart(`>`);
const rawChildren = rawChildrenMap.get(node);
if (rawChildren) context.pushStringPart(rawChildren);
else if (node.children.length) processChildren(node, context);
if (!isVoidTag(node.tag)) context.pushStringPart(`</${node.tag}>`);
}
//#endregion
//#region packages/compiler-ssr/src/transforms/ssrTransformTransitionGroup.ts
const wipMap$2 = /* @__PURE__ */ new WeakMap();
function ssrTransformTransitionGroup(node, context) {
return () => {
const tag = (0, _vue_compiler_dom.findProp)(node, "tag");
if (tag) {
const otherProps = node.props.filter((p) => p !== tag);
const { props, directives } = (0, _vue_compiler_dom.buildProps)(node, context, otherProps, true, false, true);
let propsExp = null;
if (props || directives.length) propsExp = (0, _vue_compiler_dom.createCallExpression)(context.helper(SSR_RENDER_ATTRS), [buildSSRProps(props, directives, context)]);
wipMap$2.set(node, {
tag,
propsExp,
scopeId: context.scopeId || null
});
}
};
}
function ssrProcessTransitionGroup(node, context) {
const entry = wipMap$2.get(node);
const disableNestedFragments = !context.options.vapor;
if (entry) {
const { tag, propsExp, scopeId } = entry;
if (tag.type === 7) {
context.pushStringPart(`<`);
context.pushStringPart(tag.exp);
if (propsExp) context.pushStringPart(propsExp);
if (scopeId) context.pushStringPart(` ${scopeId}`);
context.pushStringPart(`>`);
processChildren(
node,
context,
false,
/**
* TransitionGroup has the special runtime behavior of flattening and
* concatenating all children into a single fragment (in order for them to
* be patched using the same key map) so we need to account for that here
* by disabling nested fragment wrappers from being generated.
*/
disableNestedFragments,
/**
* TransitionGroup filters out comment children at runtime and thus
* doesn't expect comments to be present during hydration. We need to
* account for that by disabling the empty comment that is otherwise
* rendered for a falsy v-if that has no v-else specified. (#6715)
*/
true
);
context.pushStringPart(`</`);
context.pushStringPart(tag.exp);
context.pushStringPart(`>`);
} else {
context.pushStringPart(`<${tag.value.content}`);
if (propsExp) context.pushStringPart(propsExp);
if (scopeId) context.pushStringPart(` ${scopeId}`);
context.pushStringPart(`>`);
processChildren(node, context, false, disableNestedFragments, true);
context.pushStringPart(`</${tag.value.content}>`);
}
} else processChildren(node, context, true, disableNestedFragments, true);
}
//#endregion
//#region packages/compiler-ssr/src/transforms/ssrTransformTransition.ts
const wipMap$1 = /* @__PURE__ */ new WeakMap();
function ssrTransformTransition(node, context) {
return () => {
const appear = (0, _vue_compiler_dom.findProp)(node, "appear", false, true);
wipMap$1.set(node, !!appear);
};
}
function ssrProcessTransition(node, context) {
node.children = node.children.filter((c) => c.type !== 3);
if (wipMap$1.get(node)) {
context.pushStringPart(`<template>`);
processChildren(node, context, false, true);
context.pushStringPart(`</template>`);
} else processChildren(node, context, false, true);
}
//#endregion
//#region packages/compiler-ssr/src/transforms/ssrTransformComponent.ts
const wipMap = /* @__PURE__ */ new WeakMap();
const WIP_SLOT = Symbol();
const componentTypeMap = /* @__PURE__ */ new WeakMap();
const ssrTransformComponent = (node, context) => {
if (node.type !== 1 || node.tagType !== 1) return;
const component = (0, _vue_compiler_dom.resolveComponentType)(node, context, true);
const isDynamicComponent = (0, _vue_shared.isObject)(component) && component.callee === _vue_compiler_dom.RESOLVE_DYNAMIC_COMPONENT;
componentTypeMap.set(node, component);
if ((0, _vue_shared.isSymbol)(component)) {
if (component === _vue_compiler_dom.SUSPENSE) return ssrTransformSuspense(node, context);
else if (component === _vue_compiler_dom.TRANSITION_GROUP) return ssrTransformTransitionGroup(node, context);
else if (component === _vue_compiler_dom.TRANSITION) return ssrTransformTransition(node, context);
return;
}
const vnodeBranches = [];
const clonedNode = clone(node);
return function ssrPostTransformComponent() {
if (clonedNode.children.length) (0, _vue_compiler_dom.buildSlots)(clonedNode, context, (props, vFor, children) => {
vnodeBranches.push(createVNodeSlotBranch(props, vFor, children, context));
return (0, _vue_compiler_dom.createFunctionExpression)(void 0);
});
let propsExp = `null`;
if (node.props.length) {
const { props, directives } = (0, _vue_compiler_dom.buildProps)(node, context, void 0, true, isDynamicComponent);
if (props || directives.length) propsExp = buildSSRProps(props, directives, context);
}
const wipEntries = [];
wipMap.set(node, wipEntries);
const buildSSRSlotFn = (props, _vForExp, children, loc) => {
const param0 = props && (0, _vue_compiler_dom.stringifyExpression)(props) || `_`;
const fn = (0, _vue_compiler_dom.createFunctionExpression)([
param0,
`_push`,
`_parent`,
`_scopeId`
], void 0, true, true, loc);
wipEntries.push({
type: WIP_SLOT,
fn,
children,
vnodeBranch: vnodeBranches[wipEntries.length]
});
return fn;
};
const slots = node.children.length ? (0, _vue_compiler_dom.buildSlots)(node, context, buildSSRSlotFn).slots : `null`;
if (typeof component !== "string" && rawOptionsMap.get(context.root).vapor) node.ssrCodegenNode = (0, _vue_compiler_dom.createCallExpression)(context.helper(SSR_RENDER_DYNAMIC_COMPONENT), [
`_push`,
component,
propsExp,
slots,
`_parent`
]);
else if (typeof component !== "string") node.ssrCodegenNode = (0, _vue_compiler_dom.createCallExpression)(context.helper(SSR_RENDER_VNODE), [
`_push`,
(0, _vue_compiler_dom.createCallExpression)(context.helper(_vue_compiler_dom.CREATE_VNODE), [
component,
propsExp,
slots
]),
`_parent`
]);
else node.ssrCodegenNode = (0, _vue_compiler_dom.createCallExpression)(context.helper(SSR_RENDER_COMPONENT), [
component,
propsExp,
slots,
`_parent`
]);
};
};
function ssrProcessComponent(node, context, parent) {
const component = componentTypeMap.get(node);
if (!node.ssrCodegenNode) {
if (component === _vue_compiler_dom.TELEPORT) return ssrProcessTeleport(node, context);
else if (component === _vue_compiler_dom.SUSPENSE) return ssrProcessSuspense(node, context);
else if (component === _vue_compiler_dom.TRANSITION_GROUP) return ssrProcessTransitionGroup(node, context);
else {
if (parent.type === WIP_SLOT) context.pushStringPart(``);
if (component === _vue_compiler_dom.TRANSITION) return ssrProcessTransition(node, context);
processChildren(node, context);
}
} else {
const wipEntries = wipMap.get(node) || [];
for (let i = 0; i < wipEntries.length; i++) {
const { fn, vnodeBranch } = wipEntries[i];
fn.body = (0, _vue_compiler_dom.createIfStatement)((0, _vue_compiler_dom.createSimpleExpression)(`_push`, false), processChildrenAsStatement(wipEntries[i], context, false, true), vnodeBranch);
}
if (context.withSlotScopeId) node.ssrCodegenNode.arguments.push(`_scopeId`);
if (typeof component === "string") context.pushStatement((0, _vue_compiler_dom.createCallExpression)(`_push`, [node.ssrCodegenNode]));
else context.pushStatement(node.ssrCodegenNode);
}
}
const rawOptionsMap = /* @__PURE__ */ new WeakMap();
const [baseNodeTransforms, baseDirectiveTransforms] = (0, _vue_compiler_dom.getBaseTransformPreset)(true);
const vnodeNodeTransforms = [...baseNodeTransforms, ..._vue_compiler_dom.DOMNodeTransforms];
const vnodeDirectiveTransforms = {
...baseDirectiveTransforms,
..._vue_compiler_dom.DOMDirectiveTransforms
};
function createVNodeSlotBranch(slotProps, vFor, children, parentContext) {
const rawOptions = rawOptionsMap.get(parentContext.root);
const subOptions = {
...rawOptions,
nodeTransforms: [
...rawOptions.preNodeTransforms || [],
...vnodeNodeTransforms,
...rawOptions.nodeTransforms || []
],
directiveTransforms: {
...vnodeDirectiveTransforms,
...rawOptions.directiveTransforms || {}
}
};
const wrapperProps = [];
if (slotProps) wrapperProps.push({
type: 7,
name: "slot",
exp: slotProps,
arg: void 0,
modifiers: [],
loc: _vue_compiler_dom.locStub
});
if (vFor) wrapperProps.push((0, _vue_shared.extend)({}, vFor));
subTransform({
type: 1,
ns: 0,
tag: "template",
tagType: 3,
props: wrapperProps,
children,
loc: _vue_compiler_dom.locStub,
codegenNode: void 0
}, subOptions, parentContext);
return (0, _vue_compiler_dom.createReturnStatement)(children);
}
function subTransform(node, options, parentContext) {
const childRoot = (0, _vue_compiler_dom.createRoot)([node]);
const childContext = (0, _vue_compiler_dom.createTransformContext)(childRoot, options);
childContext.ssr = false;
childContext.scopes = { ...parentContext.scopes };
childContext.identifiers = { ...parentContext.identifiers };
childContext.identifierScopes = Object.create(null);
for (const name in parentContext.identifierScopes) childContext.identifierScopes[name] = parentContext.identifierScopes[name].slice();
childContext.imports = parentContext.imports;
(0, _vue_compiler_dom.traverseNode)(childRoot, childContext);
[
"helpers",
"components",
"directives"
].forEach((key) => {
childContext[key].forEach((value, helperKey) => {
if (key === "helpers") {
const parentCount = parentContext.helpers.get(helperKey);
if (parentCount === void 0) parentContext.helpers.set(helperKey, value);
else parentContext.helpers.set(helperKey, value + parentCount);
} else parentContext[key].add(value);
});
});
}
function clone(v) {
if ((0, _vue_shared.isArray)(v)) return v.map(clone);
else if ((0, _vue_shared.isPlainObject)(v)) {
const res = {};
for (const key in v) res[key] = clone(v[key]);
return res;
} else return v;
}
//#endregion
//#region packages/compiler-ssr/src/transforms/ssrTransformSlotOutlet.ts
const ssrTransformSlotOutlet = (node, context) => {
if ((0, _vue_compiler_dom.isSlotOutlet)(node)) {
const { slotName, slotProps } = (0, _vue_compiler_dom.processSlotOutlet)(node, context);
const args = [
`_ctx.$slots`,
slotName,
slotProps || `{}`,
`null`,
`_push`,
`_parent`
];
if (context.scopeId && context.slotted !== false) args.push(`"${context.scopeId}-s"`);
let method = SSR_RENDER_SLOT;
let parent = context.parent;
if (parent && !rawOptionsMap.get(context.root).vapor) {
const children = parent.children;
if (parent.type === 10) parent = context.grandParent;
let componentType;
if (parent.type === 1 && parent.tagType === 1 && ((componentType = (0, _vue_compiler_dom.resolveComponentType)(parent, context, true)) === _vue_compiler_dom.TRANSITION || componentType === _vue_compiler_dom.TRANSITION_GROUP) && children.filter((c) => c.type === 1).length === 1) {
method = SSR_RENDER_SLOT_INNER;
if (!(context.scopeId && context.slotted !== false)) args.push("null");
args.push("true");
}
}
if (node.__uniTextSlot) {
if (args.length === 6) args.push("null");
args.push("true");
}
node.ssrCodegenNode = (0, _vue_compiler_dom.createCallExpression)(context.helper(method), args);
}
};
function ssrProcessSlotOutlet(node, context) {
const renderCall = node.ssrCodegenNode;
if (node.children.length) {
const fallbackRenderFn = (0, _vue_compiler_dom.createFunctionExpression)([]);
fallbackRenderFn.body = processChildrenAsStatement(node, context);
renderCall.arguments[3] = fallbackRenderFn;
}
if (context.withSlotScopeId) {
const slotScopeId = renderCall.arguments[6];
renderCall.arguments[6] = slotScopeId ? `${slotScopeId} + _scopeId` : `_scopeId`;
}
context.pushStatement(node.ssrCodegenNode);
}
//#endregion
//#region packages/compiler-ssr/src/ssrCodegenTransform.ts
function ssrCodegenTransform(ast, options) {
const context = createSSRTransformContext(ast, options);
if (options.ssrCssVars) {
const cssContext = (0, _vue_compiler_dom.createTransformContext)((0, _vue_compiler_dom.createRoot)([]), options);
const varsExp = (0, _vue_compiler_dom.processExpression)((0, _vue_compiler_dom.createSimpleExpression)(options.ssrCssVars, false), cssContext);
context.body.push((0, _vue_compiler_dom.createCompoundExpression)([
`const _cssVars = { style: `,
varsExp,
`}`
]));
Array.from(cssContext.helpers.keys()).forEach((helper) => {
ast.helpers.add(helper);
});
}
processChildren(ast, context, ast.children.length > 1 && ast.children.some((c) => !(0, _vue_compiler_dom.isText)(c)));
ast.codegenNode = (0, _vue_compiler_dom.createBlockStatement)(context.body);
ast.ssrHelpers = Array.from(/* @__PURE__ */ new Set([...Array.from(ast.helpers).filter((h) => h in ssrHelpers), ...context.helpers]));
ast.helpers = new Set(Array.from(ast.helpers).filter((h) => !(h in ssrHelpers)));
}
function createSSRTransformContext(root, options, helpers = /* @__PURE__ */ new Set(), withSlotScopeId = false) {
const body = [];
let currentString = null;
return {
root,
options,
body,
helpers,
withSlotScopeId,
onError: options.onError || ((e) => {
throw e;
}),
helper(name) {
helpers.add(name);
return name;
},
pushStringPart(part) {
if (!currentString) {
const currentCall = (0, _vue_compiler_dom.createCallExpression)(`_push`);
body.push(currentCall);
currentString = (0, _vue_compiler_dom.createTemplateLiteral)([]);
currentCall.arguments.push(currentString);
}
const bufferedElements = currentString.elements;
const lastItem = bufferedElements[bufferedElements.length - 1];
if ((0, _vue_shared.isString)(part) && (0, _vue_shared.isString)(lastItem)) bufferedElements[bufferedElements.length - 1] += part;
else bufferedElements.push(part);
},
pushStatement(statement) {
currentString = null;
body.push(statement);
}
};
}
function createChildContext(parent, withSlotScopeId = parent.withSlotScopeId) {
return createSSRTransformContext(parent.root, parent.options, parent.helpers, withSlotScopeId);
}
function processChildren(parent, context, asFragment = false, disableNestedFragments = false, disableComment = false) {
if (asFragment) context.pushStringPart(`<!--[-->`);
const { children } = parent;
for (let i = 0; i < children.length; i++) {
const child = children[i];
switch (child.type) {
case 1:
switch (child.tagType) {
case 0:
ssrProcessElement(child, context);
break;
case 1:
ssrProcessComponent(child, context, parent);
break;
case 2:
ssrProcessSlotOutlet(child, context);
break;
case 3: break;
default:
context.onError(createSSRCompilerError(67, child.loc));
return child;
}
break;
case 2:
context.pushStringPart((0, _vue_shared.escapeHtml)(child.content));
break;
case 3:
if (!disableComment) context.pushStringPart(`<!--${child.content}-->`);
break;
case 5:
const interpolationArgs = [child.content];
if (parent.__uniText) interpolationArgs.push((0, _vue_compiler_dom.createSimpleExpression)("true", false));
context.pushStringPart((0, _vue_compiler_dom.createCallExpression)(context.helper(SSR_INTERPOLATE), [...interpolationArgs]));
break;
case 9:
ssrProcessIf(child, context, disableNestedFragments, disableComment);
break;
case 11:
ssrProcessFor(child, context, disableNestedFragments);
break;
case 10: break;
case 12:
case 8: break;
default:
context.onError(createSSRCompilerError(67, child.loc));
return child;
}
}
if (asFragment) context.pushStringPart(`<!--]-->`);
}
function processChildrenAsStatement(parent, parentContext, asFragment = false, withSlotScopeId = parentContext.withSlotScopeId) {
const childContext = createChildContext(parentContext, withSlotScopeId);
processChildren(parent, childContext, asFragment);
return (0, _vue_compiler_dom.createBlockStatement)(childContext.body);
}
//#endregion
//#region packages/compiler-ssr/src/transforms/ssrVModel.ts
const ssrTransformModel = (dir, node, context) => {
const model = dir.exp;
function checkDuplicatedValue() {
const value = (0, _vue_compiler_dom.findProp)(node, "value");
if (value) context.onError((0, _vue_compiler_dom.createDOMCompilerError)(61, value.loc));
}
const processSelectChildren = (children) => {
children.forEach((child) => {
if (child.type === 1) processOption(child);
else if (child.type === 11) processSelectChildren(child.children);
else if (child.type === 9) child.branches.forEach((b) => processSelectChildren(b.children));
});
};
function processOption(plainNode) {
if (plainNode.tag === "option") {
if (plainNode.props.findIndex((p) => p.name === "selected") === -1) {
const value = findValueBinding(plainNode);
plainNode.ssrCodegenNode.elements.push((0, _vue_compiler_dom.createConditionalExpression)((0, _vue_compiler_dom.createCallExpression)(context.helper(SSR_INCLUDE_BOOLEAN_ATTR), [(0, _vue_compiler_dom.createConditionalExpression)((0, _vue_compiler_dom.createCallExpression)(`Array.isArray`, [model]), (0, _vue_compiler_dom.createCallExpression)(context.helper(SSR_LOOSE_CONTAIN), [model, value]), (0, _vue_compiler_dom.createCallExpression)(context.helper(SSR_LOOSE_EQUAL), [model, value]))]), (0, _vue_compiler_dom.createSimpleExpression)(" selected", true), (0, _vue_compiler_dom.createSimpleExpression)("", true), false));
}
} else if (plainNode.tag === "optgroup") processSelectChildren(plainNode.children);
}
if (node.tagType === 0) {
const res = { props: [] };
if (node.tag === "input") {
const defaultProps = [(0, _vue_compiler_dom.createObjectProperty)(`value`, model)];
const type = (0, _vue_compiler_dom.findProp)(node, "type");
if (type) {
const value = findValueBinding(node);
if (type.type === 7) res.ssrTagParts = [(0, _vue_compiler_dom.createCallExpression)(context.helper(SSR_RENDER_DYNAMIC_MODEL), [
type.exp,
model,
value
])];
else if (type.value) switch (type.value.content) {
case "radio":
res.props = [(0, _vue_compiler_dom.createObjectProperty)(`checked`, (0, _vue_compiler_dom.createCallExpression)(context.helper(SSR_LOOSE_EQUAL), [model, value]))];
break;
case "checkbox":
const trueValueBinding = (0, _vue_compiler_dom.findProp)(node, "true-value");
if (trueValueBinding) {
const trueValue = trueValueBinding.type === 6 ? JSON.stringify(trueValueBinding.value.content) : trueValueBinding.exp;
res.props = [(0, _vue_compiler_dom.createObjectProperty)(`checked`, (0, _vue_compiler_dom.createCallExpression)(context.helper(SSR_LOOSE_EQUAL), [model, trueValue]))];
} else res.props = [(0, _vue_compiler_dom.createObjectProperty)(`checked`, (0, _vue_compiler_dom.createConditionalExpression)((0, _vue_compiler_dom.createCallExpression)(`Array.isArray`, [model]), (0, _vue_compiler_dom.createCallExpression)(context.helper(SSR_LOOSE_CONTAIN), [model, value]), model))];
break;
case "file":
context.onError((0, _vue_compiler_dom.createDOMCompilerError)(60, dir.loc));
break;
default:
checkDuplicatedValue();
res.props = defaultProps;
}
} else if ((0, _vue_compiler_dom.hasDynamicKeyVBind)(node)) {} else {
checkDuplicatedValue();
res.props = defaultProps;
}
} else if (node.tag === "textarea") {
checkDuplicatedValue();
node.children = [(0, _vue_compiler_dom.createInterpolation)(model, model.loc)];
} else if (node.tag === "select") processSelectChildren(node.children);
else context.onError((0, _vue_compiler_dom.createDOMCompilerError)(58, dir.loc));
return res;
} else return (0, _vue_compiler_dom.transformModel)(dir, node, context);
};
function findValueBinding(node) {
const valueBinding = (0, _vue_compiler_dom.findProp)(node, "value");
return valueBinding ? valueBinding.type === 7 ? valueBinding.exp : (0, _vue_compiler_dom.createSimpleExpression)(valueBinding.value.content, true) : (0, _vue_compiler_dom.createSimpleExpression)(`null`, false);
}
//#endregion
//#region packages/compiler-ssr/src/transforms/ssrVShow.ts
const ssrTransformShow = (dir, node, context) => {
if (!dir.exp) context.onError((0, _vue_compiler_dom.createDOMCompilerError)(62));
return { props: [(0, _vue_compiler_dom.createObjectProperty)(`style`, (0, _vue_compiler_dom.createConditionalExpression)(dir.exp, (0, _vue_compiler_dom.createSimpleExpression)(`null`, false), (0, _vue_compiler_dom.createObjectExpression)([(0, _vue_compiler_dom.createObjectProperty)(`display`, (0, _vue_compiler_dom.createSimpleExpression)(`none`, true))]), false))] };
};
//#endregion
//#region packages/compiler-ssr/src/transforms/ssrInjectFallthroughAttrs.ts
const ssrInjectFallthroughAttrs = (node, context) => {
if (node.type === 0) context.identifiers._attrs = 1;
if (node.type === 1 && node.tagType === 1 && (node.tag === "transition" || node.tag === "Transition" || node.tag === "KeepAlive" || node.tag === "keep-alive")) {
const rootChildren = (0, _vue_compiler_dom.filterNonCommentChildren)(context.root);
if (rootChildren.length === 1 && rootChildren[0] === node) {
if ((0, _vue_compiler_dom.hasSingleChild)(node)) injectFallthroughAttrs(node.children[0]);
return;
}
}
const parent = context.parent;
if (!parent || parent.type !== 0) return;
if (node.type === 10 && (0, _vue_compiler_dom.hasSingleChild)(node)) {
if ((0, _vue_compiler_dom.isSingleIfBlock)(parent)) injectFallthroughAttrs(node.children[0]);
} else if ((0, _vue_compiler_dom.hasSingleChild)(parent)) injectFallthroughAttrs(node);
};
function injectFallthroughAttrs(node) {
if (node.type === 1 && (node.tagType === 0 || node.tagType === 1) && !(0, _vue_compiler_dom.findDir)(node, "for")) node.props.push({
type: 7,
name: "bind",
arg: void 0,
exp: (0, _vue_compiler_dom.createSimpleExpression)(`_attrs`, false),
modifiers: [],
loc: _vue_compiler_dom.locStub
});
}
//#endregion
//#region packages/compiler-ssr/src/transforms/ssrInjectCssVars.ts
const ssrInjectCssVars = (node, context) => {
if (!context.ssrCssVars) return;
if (node.type === 0) context.identifiers._cssVars = 1;
const parent = context.parent;
if (!parent || parent.type !== 0) return;
if (node.type === 10) for (const child of node.children) injectCssVars(child);
else injectCssVars(node);
};
function injectCssVars(node) {
if (node.type === 1 && (node.tagType === 0 || node.tagType === 1) && !(0, _vue_compiler_dom.findDir)(node, "for")) {
if (node.tag === "suspense" || node.tag === "Suspense") for (const child of node.children) if (child.type === 1 && child.tagType === 3) child.children.forEach(injectCssVars);
else injectCssVars(child);
else node.props.push({
type: 7,
name: "bind",
arg: void 0,
exp: (0, _vue_compiler_dom.createSimpleExpression)(`_cssVars`, false),
modifiers: [],
loc: _vue_compiler_dom.locStub
});
}
}
//#endregion
//#region packages/compiler-ssr/src/index.ts
function compile(source, options = {}) {
options = {
...options,
..._vue_compiler_dom.parserOptions,
ssr: true,
inSSR: true,
scopeId: options.mode === "function" ? null : options.scopeId,
prefixIdentifiers: true,
cacheHandlers: false,
hoistStatic: false
};
const ast = typeof source === "string" ? (0, _vue_compiler_dom.baseParse)(source, options) : source;
rawOptionsMap.set(ast, options);
(0, _vue_compiler_dom.transform)(ast, {
...options,
hoistStatic: false,
nodeTransforms: [
...options.preNodeTransforms || [],
_vue_compiler_dom.transformVBindShorthand,
ssrTransformIf,
ssrTransformFor,
_vue_compiler_dom.trackVForSlotScopes,
_vue_compiler_dom.transformExpression,
ssrTransformSlotOutlet,
ssrInjectFallthroughAttrs,
ssrInjectCssVars,
ssrTransformElement,
ssrTransformComponent,
_vue_compiler_dom.trackSlotScopes,
_vue_compiler_dom.transformStyle,
...options.nodeTransforms || []
],
directiveTransforms: {
bind: _vue_compiler_dom.transformBind,
on: _vue_compiler_dom.transformOn,
model: ssrTransformModel,
show: ssrTransformShow,
cloak: _vue_compiler_dom.noopDirectiveTransform,
once: _vue_compiler_dom.noopDirectiveTransform,
memo: _vue_compiler_dom.noopDirectiveTransform,
...options.directiveTransforms || {}
}
});
ssrCodegenTransform(ast, options);
return (0, _vue_compiler_dom.generate)(ast, options);
}
//#endregion
exports.compile = compile;
@@ -0,0 +1,9 @@
import { CodegenResult, CompilerOptions, NodeTransform, RootNode } from "@vue/compiler-dom";
//#region temp/packages/compiler-ssr/src/options.d.ts
export interface SSRCompilerOptions extends CompilerOptions {
preNodeTransforms?: NodeTransform[];
}
//#endregion
//#region temp/packages/compiler-ssr/src/index.d.ts
export declare function compile(source: string | RootNode, options?: SSRCompilerOptions): CodegenResult;
//#endregion
@@ -0,0 +1,34 @@
{
"name": "@vue/compiler-ssr",
"version": "3.6.0-rc.14",
"description": "@vue/compiler-ssr",
"main": "dist/compiler-ssr.cjs.js",
"types": "dist/compiler-ssr.d.ts",
"files": [
"dist"
],
"buildOptions": {
"prod": false,
"formats": [
"cjs"
]
},
"repository": {
"type": "git",
"url": "git+https://github.com/vuejs/core.git",
"directory": "packages/compiler-ssr"
},
"keywords": [
"vue"
],
"author": "Evan You",
"license": "MIT",
"bugs": {
"url": "https://github.com/vuejs/core/issues"
},
"homepage": "https://github.com/vuejs/core/tree/main/packages/compiler-ssr#readme",
"dependencies": {
"@vue/shared": "workspace:*",
"@vue/compiler-dom": "workspace:*"
}
}
@@ -0,0 +1,798 @@
/**
* @dcloudio/compiler-vapor-web v3.6.0-rc.14
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT
**/
Object.defineProperties(exports, {
__esModule: { value: true },
[Symbol.toStringTag]: { value: "Module" }
});
//#region \0rolldown/runtime.js
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
key = keys[i];
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
get: ((k) => from[k]).bind(null, key),
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
});
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
value: mod,
enumerable: true
}) : target, mod));
//#endregion
let _vue_compiler_dom = require("@vue/compiler-dom");
let _vue_compiler_vapor = require("@vue/compiler-vapor");
let _vue_compiler_ssr = require("@vue/compiler-ssr");
let _vue_shared = require("@vue/shared");
let _dcloudio_uni_shared = require("@dcloudio/uni-shared");
let hash_sum = require("hash-sum");
hash_sum = __toESM(hash_sum);
//#region packages/compiler-vapor-web/src/parse.ts
const uniNativeTags = /* @__PURE__ */ new Set([
"view",
"text",
"image",
"cover-view",
"cover-image"
]);
function resolveParserOptions(options) {
const getNamespace = options.getNamespace || _vue_compiler_dom.parserOptions.getNamespace;
const isNativeTag = options.isNativeTag || _vue_compiler_dom.parserOptions.isNativeTag;
const isCustomElement = options.isCustomElement;
return {
prefixIdentifiers: true,
...options,
isNativeTag: (tag) => uniNativeTags.has(tag) || isNativeTag(tag),
isCustomElement: (tag) => !uniNativeTags.has(tag) && !!(isCustomElement === null || isCustomElement === void 0 ? void 0 : isCustomElement(tag)),
getNamespace: (tag, parent, rootNamespace) => getNamespace(tag === "view" || tag === "cover-view" ? "div" : tag === "text" ? "span" : tag === "image" || tag === "cover-image" ? "img" : tag, parent, rootNamespace)
};
}
function parse(source, options = {}) {
return (0, _vue_compiler_dom.parse)(source, resolveParserOptions(options));
}
//#endregion
//#region packages/compiler-vapor-web/src/transforms/transformView.ts
function transformView(node) {
if (node.type !== 1 || node.tag !== "view" && node.tag !== "cover-view" || node.ns !== 0) return;
node.tag = "div";
node.tagType = 0;
node.props = node.props.filter((prop) => {
var _prop$arg;
if (prop.type === 6) return prop.name !== "flatten";
return !(prop.name === "bind" && ((_prop$arg = prop.arg) === null || _prop$arg === void 0 ? void 0 : _prop$arg.type) === 4 && prop.arg.isStatic && prop.arg.content === "flatten");
});
if (!node.props.some((prop) => prop.type === 6 && prop.name === "uni-view")) node.props.unshift({
__uniTemplate: true,
type: 6,
name: "uni-view",
nameLoc: node.loc,
value: void 0,
loc: node.loc
});
}
//#endregion
//#region packages/compiler-vapor-web/src/transforms/transformText.ts
const unsupportedProps = /* @__PURE__ */ new Set([
"space",
"decode",
"max-lines"
]);
function transformText(node) {
if (node.type !== 1 || node.tag !== "text" || node.ns !== 0) return;
node.tag = "span";
node.tagType = 0;
node.__uniText = true;
for (const child of node.children) if (child.type === 2) child.content = (0, _vue_shared.normalizeUniText)(child.content);
node.props = node.props.filter((prop) => {
var _prop$arg;
if (prop.type === 6) return !unsupportedProps.has(prop.name);
return !(prop.name === "bind" && ((_prop$arg = prop.arg) === null || _prop$arg === void 0 ? void 0 : _prop$arg.type) === 4 && prop.arg.isStatic && unsupportedProps.has(prop.arg.content));
});
if (!node.props.some((prop) => prop.type === 6 && prop.name === "uni-text")) node.props.unshift({
__uniTemplate: true,
type: 6,
name: "uni-text",
nameLoc: node.loc,
value: void 0,
loc: node.loc
});
for (const child of node.children) if (child.type === 1 && child.tag === "slot") child.__uniTextSlot = true;
}
const isUniTextElement = (node) => node.type === 1 && node.tag === "span" && node.props.some((prop) => prop.type === 6 && prop.name === "uni-text");
function createTextTransform() {
const textElements = /* @__PURE__ */ new Set();
return {
transformElementProps(props, node, context) {
if (node.type === 1 && isUniTextElement(node)) textElements.add(context.reference());
},
genOperation(operation, context) {
if (operation.type !== 6 || !textElements.has(operation.element)) return;
const value = operation.values.flatMap((expression, index) => {
let result = (0, _vue_compiler_vapor.genExpression)(expression, context);
if (!expression.isStatic) result = (0, _vue_compiler_vapor.genCall)(context.helper("toDisplayString"), result);
if (index > 0) result.unshift(" + ");
return result;
});
const normalizedValue = (0, _vue_compiler_vapor.genCall)(context.helper("normalizeUniText"), value);
return [_vue_compiler_vapor.NEWLINE, ...(0, _vue_compiler_vapor.genCall)(context.helper("setText"), `${operation.generated ? "x" : "n"}${operation.element}`, normalizedValue)];
}
};
}
//#endregion
//#region packages/compiler-vapor-web/src/transforms/transformImage.ts
function genImageExpression(expression, context) {
if (!expression.isStatic && expression.ast === void 0) return [[
expression.content,
-3,
expression.loc
]];
return (0, _vue_compiler_vapor.genExpression)(expression, context);
}
function transformImage(node) {
if (node.type !== 1 || node.tag !== "image" && node.tag !== "cover-image" || node.ns !== 0) return;
node.tag = "img";
node.tagType = 0;
node.children = [];
if (!node.props.some((prop) => prop.type === 6 && prop.name === "uni-image")) node.props.unshift({
__uniTemplate: true,
type: 6,
name: "uni-image",
nameLoc: node.loc,
value: void 0,
loc: node.loc
});
if (!node.props.some((prop) => prop.type === 6 && prop.name === "draggable")) node.props.push({
type: 6,
name: "draggable",
nameLoc: node.loc,
value: {
type: 2,
content: "false",
loc: node.loc
},
loc: node.loc
});
}
const transformSSRImage = (node) => {
transformImage(node);
};
function createImageTransform() {
const operations = /* @__PURE__ */ new WeakMap();
const imageElements = /* @__PURE__ */ new Set();
return {
transformElementProps(props, node, context) {
var _props$;
if (node.type !== 1 || node.tag !== "img" || !node.props.some((p) => p.type === 6 && p.name === "uni-image")) return;
const element = context.reference();
imageElements.add(element);
if (props[0]) return;
const imageProps = (_props$ = props[1]) === null || _props$ === void 0 ? void 0 : _props$.filter((prop) => prop.key.content === "src" || prop.key.content === "mode" && (!prop.values[0].isStatic || prop.values[0].content === "widthFix" || prop.values[0].content === "heightFix"));
if (!(imageProps === null || imageProps === void 0 ? void 0 : imageProps.length)) return;
props[1] = props[1].filter((prop) => !imageProps.includes(prop));
for (const prop of imageProps) {
const key = prop.key.content;
const operation = {
type: 3,
element,
tag: "img",
isSVG: false,
prop
};
operations.set(operation, key);
context.registerEffect(prop.values, operation);
}
},
genOperation(operation, context) {
if (operation.type === 4 && imageElements.has(operation.element)) return (0, _vue_compiler_vapor.genDynamicProps)(operation, context, "setImageDynamicProps");
if (operation.type === 8 && imageElements.has(operation.element)) return (0, _vue_compiler_vapor.genCall)(context.helper("setImageDynamicEvents"), `n${operation.element}`, (0, _vue_compiler_vapor.genExpression)(operation.event, context));
if (operation.type !== 3) return;
const key = operations.get(operation);
if (!key) return;
return [_vue_compiler_vapor.NEWLINE, ...(0, _vue_compiler_vapor.genCall)(context.helper(key === "src" ? "setImageSrc" : "setImageMode"), `n${operation.element}`, genImageExpression(operation.prop.values[0], context))];
},
genEventHandler(operation, context, handler) {
if (!imageElements.has(operation.element) || !operation.key.isStatic) return;
const event = operation.key.content.toLowerCase();
if (event !== "load" && event !== "error") return;
return (0, _vue_compiler_vapor.genCall)(context.helper("withImageEventDetail"), [
"(",
...handler,
")"
], JSON.stringify(event));
}
};
}
//#endregion
//#region packages/compiler-vapor-web/src/transforms/transformHover.ts
const hoverProps = [
"hoverClass",
"hoverStopPropagation",
"hoverStartTime",
"hoverStayTime"
];
const transformSSRHover = (node) => {
if (node.type !== 1 || !isHoverElement(node)) return;
node.props = node.props.filter((prop) => {
var _prop$arg;
const name = prop.type === 6 ? prop.name : prop.name === "bind" && ((_prop$arg = prop.arg) === null || _prop$arg === void 0 ? void 0 : _prop$arg.type) === 4 && prop.arg.isStatic ? prop.arg.content : "";
return !hoverProps.includes((0, _vue_shared.camelize)(name));
});
};
function createHoverTransform() {
const operations = /* @__PURE__ */ new WeakMap();
const hoverElements = /* @__PURE__ */ new Set();
return {
transformElementProps(props, node, context, getEffectIndex) {
if (node.type !== 1 || !isHoverElement(node)) return;
if (props[0]) {
hoverElements.add(context.reference());
return;
}
const values = [
"none",
"false",
"50",
"400"
].map((value, index) => (0, _vue_compiler_dom.createSimpleExpression)(value, index === 0, node.loc));
values[1].ast = null;
for (let i = 2; i < values.length; i++) values[i].ast = {
type: "NumericLiteral",
value: Number(values[i].content)
};
props[1] = props[1].filter((prop) => {
if (prop.key.content === "flatten") return false;
const index = hoverProps.indexOf((0, _vue_shared.camelize)(prop.key.content));
if (index < 0) return true;
values[index] = prop.values[0];
return false;
});
if (values[0].isStatic && (!values[0].content || values[0].content === "none")) return;
const classes = [];
for (const prop of props[1]) if (prop.key.content === "class") classes.push(...prop.values);
const operation = {
type: 3,
element: context.reference(),
tag: node.tag,
isSVG: false,
prop: {
key: (0, _vue_compiler_dom.createSimpleExpression)("hover", true),
values
}
};
operations.set(operation, (0, _vue_compiler_vapor.foldClassValues)(classes) || "");
context.registerEffect(values, operation, getEffectIndex);
},
genOperation(operation, context) {
if (operation.type === 4 && hoverElements.has(operation.element)) return (0, _vue_compiler_vapor.genDynamicProps)(operation, context, "setViewDynamicProps");
if (operation.type !== 3 || !operations.has(operation)) return;
return [_vue_compiler_vapor.NEWLINE, ...(0, _vue_compiler_vapor.genCall)(context.helper("setHover"), `n${operation.element}`, ...operation.prop.values.map((value) => (0, _vue_compiler_vapor.genExpression)(value, context)), JSON.stringify(operations.get(operation)))];
}
};
}
function isHoverElement(node) {
return node.tag === "div" && node.props.some((p) => p.type === 6 && p.name === "uni-view") || node.tag === "span" && isUniTextElement(node);
}
//#endregion
//#region packages/compiler-vapor-web/src/transforms/transformRecycleFor.ts
function markRecycleFor(node) {
const key = (0, _vue_compiler_dom.findProp)(node, "key");
if (!key) return false;
node.__recycleFor = true;
if (node.tag === "template") return true;
node.props.push({
type: 7,
name: "bind",
arg: (0, _vue_compiler_dom.createSimpleExpression)("itemKey", true),
exp: toExpression(key),
modifiers: [],
loc: node.loc
});
return true;
}
function toViewElement(node) {
node.tag = "view";
node.tagType = 0;
node.props = node.props.filter((prop) => {
var _prop$arg;
if (prop.type === 6) return prop.name !== "type";
return !(prop.name === "bind" && ((_prop$arg = prop.arg) === null || _prop$arg === void 0 ? void 0 : _prop$arg.type) === 4 && prop.arg.isStatic && prop.arg.content === "type");
});
}
function createRecycleForTransform() {
const types = /* @__PURE__ */ new WeakMap();
const ids = /* @__PURE__ */ new WeakMap();
const operations = /* @__PURE__ */ new WeakSet();
const transform = (node, context) => {
if (node.type !== 1) return;
if (!node.__recycleFor) return;
const type = (0, _vue_compiler_dom.findProp)(node, "type");
const id = (0, _vue_compiler_dom.findProp)(node, "id");
return () => {
const operation = context.dynamic.operation;
if (operation && operation.type === 16) {
operations.add(operation);
if (type) types.set(operation, toExpression(type));
if (id) ids.set(operation, toExpression(id));
}
};
};
return {
transform,
isRecycleFor: (operation) => operation.type === 16 && operations.has(operation),
genOperation(operation, context) {
if (operation.type !== 16 || !operations.has(operation)) return;
const { value, key, index, render, keyProp } = operation;
const valueIds = (0, _vue_compiler_vapor.parseValueDestructure)(value, context);
const keyIds = (0, _vue_compiler_vapor.parseValueDestructure)(key, context);
const indexIds = (0, _vue_compiler_vapor.parseValueDestructure)(index, context);
const [depth, exitScope] = context.enterScope();
const args = [
`_for_item${depth}`,
`_for_key${depth}`,
`_for_index${depth}`
];
const plugins = context.options.expressionPlugins;
const idMap = {
...(0, _vue_compiler_vapor.buildDestructureIdMap)(valueIds, `${args[0]}.value`, plugins),
...(0, _vue_compiler_vapor.buildDestructureIdMap)(keyIds, `${args[1]}.value`, plugins),
...(0, _vue_compiler_vapor.buildDestructureIdMap)(indexIds, `${args[2]}.value`, plugins)
};
const source = [
"() => (",
...(0, _vue_compiler_vapor.genExpression)(operation.source, context),
")"
];
const callback = (expression) => {
if (!expression) return false;
const locals = {};
for (const map of [
valueIds,
keyIds,
indexIds
]) map.forEach((_, name) => locals[name] = null);
return context.withId(() => [
...(0, _vue_compiler_vapor.genAliasParams)(value, key, index, context),
" => (",
...(0, _vue_compiler_vapor.genExpression)(expression, context),
")"
], locals);
};
const getKey = callback(keyProp);
const getType = callback(types.get(operation));
const getId = callback(ids.get(operation));
const block = context.withId(() => (0, _vue_compiler_vapor.genBlock)(render, context, [args.join(", ")]), idMap);
exitScope();
const helper = (name) => context.helper(name);
const flags = (operation.slotRoot ? 32 : 0) | (operation.wrappedRows ? 64 : 0);
return [
_vue_compiler_vapor.NEWLINE,
`const n${operation.id} = `,
...(0, _vue_compiler_vapor.genCall)(helper("createRecycleFor"), (0, _vue_compiler_vapor.genCall)(helper("createRecycleContext")), (0, _vue_compiler_vapor.genCall)(helper("preCreateRecycleFor"), source, getKey, getId), block, getKey, getType, flags ? String(flags) : void 0)
];
}
};
}
function toExpression(prop) {
return prop.type === 6 ? (0, _vue_compiler_dom.createSimpleExpression)(prop.value ? prop.value.content : "", true, prop.loc) : prop.exp;
}
function wrapTemplate(name, children) {
return {
type: 1,
tag: "template",
tagType: 3,
ns: 0,
props: [{
type: 7,
name: "slot",
arg: (0, _vue_compiler_dom.createSimpleExpression)(name, true),
exp: void 0,
modifiers: [],
loc: children[0].loc
}],
children,
loc: children[0].loc,
codegenNode: void 0
};
}
//#endregion
//#region packages/compiler-vapor-web/src/transforms/transformComponentId.ts
function createComponentIdTransform(recycle) {
const positions = /* @__PURE__ */ new WeakMap();
let forKey;
return {
transform(node, context) {
if (node.type !== 1) return;
return () => {
const operation = context.dynamic.operation;
if (operation && operation.type === 12) positions.set(operation, node.loc.start.offset);
};
},
genOperation(operation, context) {
if (operation.type === 16) {
const prev = forKey;
forKey = recycle.isRecycleFor(operation) ? void 0 : operation.keyProp;
try {
return recycle.genOperation(operation, context) || (0, _vue_compiler_vapor.genFor)(operation, context);
} finally {
forKey = prev;
}
}
if (operation.type !== 12 || operation.useCreateElement) return;
const baseId = JSON.stringify((0, hash_sum.default)(`${context.options.filename}:${positions.get(operation)}`));
const cid = forKey ? [
baseId,
" + \"-\" + (",
...(0, _vue_compiler_vapor.genExpression)(forKey, context),
")"
] : [baseId];
const fragments = (0, _vue_compiler_vapor.genCreateComponent)(operation, context);
const callStart = fragments.indexOf(`const n${operation.id} = `) + 1;
return [...fragments.slice(0, callStart), ...(0, _vue_compiler_vapor.genCall)(context.helper("withComponentId"), cid, ["() => ", ...fragments.slice(callStart)], operation.tag === "list-item" || operation.tag === "flow-item" ? "true" : void 0)];
}
};
}
//#endregion
//#region packages/compiler-vapor-web/src/transforms/transformListView.ts
function transformListView(node) {
if (node.type === 1 && node.tag === "list-item") {
if (!node.__recycleFor) toViewElement(node);
return;
}
if (node.type !== 1 || node.tag !== "list-view" && node.tag !== "sticky-section") return;
const container = node;
if (container.__recycleForProcessed) return;
container.__recycleForProcessed = true;
if (node.tag === "sticky-section") {
const rowIndex = node.children.findIndex((child) => isListRow(child) && (0, _vue_compiler_dom.findDir)(child, "for") && !(0, _vue_compiler_dom.findDir)(child, "if"));
if (rowIndex >= 0) markRecycleFor(node.children[rowIndex]);
return;
}
const defaultChildren = [];
const refresher = [];
const namedSlots = [];
for (let i = 0; i < node.children.length; i++) {
const child = node.children[i];
if (child.type === 1) {
if (child.tag === "template" && (0, _vue_compiler_dom.findDir)(child, "slot", true)) {
namedSlots.push(child);
continue;
}
const slot = (0, _vue_compiler_dom.findProp)(child, "slot", false, true);
if (slot && slot.type === 6 && slot.value && slot.value.content === "refresher") {
child.props.splice(child.props.indexOf(slot), 1);
refresher.push(child);
continue;
}
}
defaultChildren.push(child);
}
const rowIndex = defaultChildren.findIndex((child) => isListRow(child) && (0, _vue_compiler_dom.findDir)(child, "for") && !(0, _vue_compiler_dom.findDir)(child, "if"));
const sections = defaultChildren.filter((child) => child.type === 1 && child.tag === "sticky-section");
let start = rowIndex < 0 ? defaultChildren.length : rowIndex;
let end = start;
if (sections.length) {
start = defaultChildren.indexOf(sections[0]);
end = defaultChildren.indexOf(sections[sections.length - 1]);
} else if (rowIndex >= 0) markRecycleFor(defaultChildren[rowIndex]);
const header = defaultChildren.slice(0, start);
const footer = defaultChildren.slice(end + 1);
node.children = [
...header.length ? [wrapTemplate("header", header)] : [],
...defaultChildren.slice(start, end + 1),
...footer.length ? [wrapTemplate("footer", footer)] : [],
...refresher.length ? [wrapTemplate("refresher", refresher)] : [],
...namedSlots
];
}
function isListRow(node) {
return node.type === 1 && (node.tag === "list-item" || node.tag === "template" && node.children.length === 1 && node.children[0].type === 1 && node.children[0].tag === "list-item" && !(0, _vue_compiler_dom.findDir)(node.children[0], "for"));
}
//#endregion
//#region packages/compiler-vapor-web/src/transforms/transformWaterflow.ts
function transformWaterflow(node) {
if (node.type === 1 && node.tag === "flow-item") {
if (!node.__recycleFor) toViewElement(node);
return;
}
if (node.type !== 1 || node.tag !== "waterflow") return;
const container = node;
if (container.__recycleForProcessed) return;
container.__recycleForProcessed = true;
const row = node.children.find((child) => isFlowRow(child) && (0, _vue_compiler_dom.findDir)(child, "for") && !(0, _vue_compiler_dom.findDir)(child, "if") && !(0, _vue_compiler_dom.findDir)(child, "slot", true) && !child.props.some((prop) => prop.type === 6 && prop.name === "slot" && prop.value && (prop.value.content === "refresher" || prop.value.content === "load-more")));
if (!row) return;
markRecycleFor(row);
const defaultChildren = [];
const refresher = [];
const loadMore = [];
const namedSlots = [];
for (const child of node.children) {
if (child.type === 1) {
if (child.tag === "template" && (0, _vue_compiler_dom.findDir)(child, "slot", true)) {
namedSlots.push(child);
continue;
}
const slot = (0, _vue_compiler_dom.findProp)(child, "slot", false, true);
if (slot && slot.type === 6 && slot.value) {
const name = slot.value.content;
if (name === "refresher" || name === "load-more") {
child.props.splice(child.props.indexOf(slot), 1);
(name === "refresher" ? refresher : loadMore).push(child);
continue;
}
}
}
defaultChildren.push(child);
}
node.children = [
...defaultChildren,
...refresher.length ? [wrapTemplate("refresher", refresher)] : [],
...loadMore.length ? [wrapTemplate("load-more", loadMore)] : [],
...namedSlots
];
}
function isFlowRow(node) {
return node.type === 1 && (node.tag === "flow-item" || node.tag === "template" && node.children.length === 1 && node.children[0].type === 1 && node.children[0].tag === "flow-item" && !(0, _vue_compiler_dom.findDir)(node.children[0], "for"));
}
//#endregion
//#region packages/compiler-vapor-web/src/transforms/transformDataset.ts
function createDatasetTransform() {
const operations = /* @__PURE__ */ new WeakMap();
const hoists = /* @__PURE__ */ new Map();
return {
transformElementProps(props, node, context) {
if (props[0] || !(0, _vue_compiler_vapor.isUniBasicElement)(node)) return;
const data = Object.create(null);
for (const prop of props[1]) if (prop.key.isStatic && prop.key.content.toLowerCase().startsWith("data-") && prop.modifier !== "." && prop.values[0].isStatic) data[prop.key.content] = prop.values[0].content;
if (!Object.keys(data).length) return;
const operation = {
type: 3,
element: context.reference(),
tag: node.tag,
isSVG: false,
prop: {
key: (0, _vue_compiler_dom.createSimpleExpression)("dataset", true),
values: []
}
};
operations.set(operation, JSON.stringify(data));
context.registerOperation(operation);
},
genOperation(operation, context) {
if (operation.type !== 3) return;
const json = operations.get(operation);
if (!json) return;
let name = hoists.get(json);
if (!name) {
name = context.getUniqueLocalName("_dataset");
hoists.set(json, name);
context.hoists.push(`const ${name} = ${json}\n`);
}
return [_vue_compiler_vapor.NEWLINE, ...(0, _vue_compiler_vapor.genCall)(context.helper("initUniDataset"), `n${operation.element}`, name)];
}
};
}
//#endregion
//#region packages/compiler-vapor-web/src/uniElement.ts
const names = /* @__PURE__ */ new Set([..._dcloudio_uni_shared.BUILT_IN_TAGS, ..._dcloudio_uni_shared.UVUE_WEB_BUILT_IN_TAGS]);
function resolveUniElementRoots(ast, name) {
if (!ast || !(names.has(`uni-${name}`) || (0, _dcloudio_uni_shared.isDom2WebVueComponentTag)(name))) return;
const roots = ast.children.filter((node) => node.type !== 3 && !(node.type === 2 && !node.content.trim()));
if (!roots.length) return;
const elements = roots.filter((node) => node.type === 1);
if (elements.length !== roots.length) return;
if ((name === "list-view" || name === "waterflow") && elements.length === 1 && elements[0].tag === "scroll-view" && elements[0].tagType === 1 && !(0, _vue_compiler_dom.findProp)(elements[0], "key", true, true) && !elements[0].props.some((prop) => prop.type === 7 && [
"if",
"else-if",
"else",
"for"
].includes(prop.name))) return elements;
if (elements.length > 1) {
if (!elements[0].props.some((prop) => prop.type === 7 && prop.name === "if") || elements.slice(1).some((node) => !node.props.some((prop) => prop.type === 7 && (prop.name === "else-if" || prop.name === "else")))) return;
}
if (elements.some((root) => ![
"view",
"text",
"image",
"cover-view",
"cover-image"
].includes(root.tag) || root.props.some((prop) => prop.type === 7 && prop.name === "for" || prop.type === 6 && prop.name === `uni-${name}`))) return;
return elements;
}
//#endregion
//#region packages/compiler-vapor-web/src/transforms/transformUniElement.ts
function createUniElementTransform() {
let roots;
let name;
let descriptor;
const elementOperations = /* @__PURE__ */ new Set();
return {
transform(node, context) {
if (node.type === 0) {
name = context.options.bindingMetadata.__uniElement;
if (name) roots = resolveUniElementRoots(node, name);
if ((roots === null || roots === void 0 ? void 0 : roots[0].tag) === "scroll-view") {
const root = roots[0];
return () => {
var _context$dynamic$chil;
const element = (_context$dynamic$chil = context.dynamic.children[node.children.indexOf(root)]) === null || _context$dynamic$chil === void 0 ? void 0 : _context$dynamic$chil.id;
if (element === void 0) return;
const operation = {
type: 3,
element,
tag: root.tag,
isSVG: false,
prop: {
key: (0, _vue_compiler_dom.createSimpleExpression)("uniTagName", true),
values: []
}
};
elementOperations.add(operation);
context.registerOperation(operation);
};
}
} else if (roots && node.type === 1 && roots.some((root) => node.loc === root.loc) && (0, _vue_compiler_vapor.isUniBasicElement)(node)) {
if (!node.props.some((prop) => prop.type === 6 && prop.name === `uni-${name}`)) node.props.unshift({
__uniTemplate: true,
type: 6,
name: `uni-${name}`,
nameLoc: node.loc,
value: void 0,
loc: node.loc
});
const operation = {
type: 3,
element: context.reference(),
tag: node.tag,
isSVG: false,
prop: {
key: (0, _vue_compiler_dom.createSimpleExpression)("uniTagName", true),
values: []
}
};
elementOperations.add(operation);
context.registerOperation(operation);
}
},
genOperation(operation, context) {
if (operation.type !== 3 || !elementOperations.has(operation)) return;
if (!descriptor) {
descriptor = context.getUniqueLocalName(`_uni${(0, _vue_shared.capitalize)((0, _vue_shared.camelize)(name))}Element`);
context.hoists.push(`const ${descriptor} = { value: ${JSON.stringify(name.toUpperCase())} }\n`);
}
if (operation.tag === "scroll-view") {
const element = context.getUniqueLocalName(`_uni${(0, _vue_shared.capitalize)((0, _vue_shared.camelize)(name))}Root`);
return [
_vue_compiler_vapor.NEWLINE,
`const ${element} = `,
...(0, _vue_compiler_vapor.genCall)(context.helper("getBlockFirstNode"), `n${operation.element}`),
_vue_compiler_vapor.NEWLINE,
`if (${element} && ${element}.nodeType === 1) {`,
_vue_compiler_vapor.NEWLINE,
` ${element}.setAttribute(${JSON.stringify(`uni-${name}`)}, "")`,
_vue_compiler_vapor.NEWLINE,
" ",
...(0, _vue_compiler_vapor.genCall)(context.helper("initUniElement"), element, descriptor),
_vue_compiler_vapor.NEWLINE,
"}"
];
}
return [_vue_compiler_vapor.NEWLINE, ...(0, _vue_compiler_vapor.genCall)(context.helper("initUniElement"), `n${operation.element}`, descriptor)];
}
};
}
//#endregion
//#region packages/compiler-vapor-web/src/transforms/transformUniAppXWeb.ts
function createUniAppXWebTransform(options = {}) {
if (options.ssr) {
const transform = (node, context) => {
transformListView(node);
transformWaterflow(node);
transformView(node);
transformText(node);
transformSSRImage(node, context);
transformStaticStyle(node);
return transformSSRHover(node, context);
};
return { transform };
}
const hover = createHoverTransform();
const image = createImageTransform();
const text = createTextTransform();
const recycle = createRecycleForTransform();
const componentId = createComponentIdTransform(recycle);
const dataset = createDatasetTransform();
const element = createUniElementTransform();
return {
transform: (node, context) => {
transformListView(node);
transformWaterflow(node);
const exitRecycle = recycle.transform(node, context);
const exitComponentId = componentId.transform(node, context);
transformView(node);
transformText(node);
transformImage(node);
transformStaticStyle(node);
return [exitRecycle, exitComponentId].flat().filter((exit) => !!exit);
},
transformUniElement: element.transform,
transformElementProps: (props, node, context, getEffectIndex) => {
dataset.transformElementProps(props, node, context, getEffectIndex);
hover.transformElementProps(props, node, context, getEffectIndex);
image.transformElementProps(props, node, context, getEffectIndex);
text.transformElementProps(props, node, context, getEffectIndex);
},
genOperation: (operation, context) => {
var _hover$genOperation, _componentId$genOpera, _element$genOperation, _dataset$genOperation, _image$genOperation, _text$genOperation;
const hoverOperation = (_hover$genOperation = hover.genOperation) === null || _hover$genOperation === void 0 ? void 0 : _hover$genOperation.call(hover, operation, context);
return ((_componentId$genOpera = componentId.genOperation) === null || _componentId$genOpera === void 0 ? void 0 : _componentId$genOpera.call(componentId, operation, context)) || ((_element$genOperation = element.genOperation) === null || _element$genOperation === void 0 ? void 0 : _element$genOperation.call(element, operation, context)) || ((_dataset$genOperation = dataset.genOperation) === null || _dataset$genOperation === void 0 ? void 0 : _dataset$genOperation.call(dataset, operation, context)) || hoverOperation || ((_image$genOperation = image.genOperation) === null || _image$genOperation === void 0 ? void 0 : _image$genOperation.call(image, operation, context)) || ((_text$genOperation = text.genOperation) === null || _text$genOperation === void 0 ? void 0 : _text$genOperation.call(text, operation, context));
},
genEventHandler: image.genEventHandler
};
}
function transformStaticStyle(node) {
if (node.type !== 1 || node.tagType !== 0 && node.tagType !== 1) return;
for (const prop of node.props) if (prop.type === 6 && prop.name === "style" && prop.value) prop.value.content = (0, _dcloudio_uni_shared.normalizeRpx)(prop.value.content);
}
//#endregion
//#region packages/compiler-vapor-web/src/compile.ts
function compile(source, options = {}) {
var _options$bindingMetad, _options$isUniPage, _options$expressionPl;
const resolvedOptions = {
...options,
...resolveParserOptions(options)
};
const isolation = (_options$bindingMetad = options.bindingMetadata) === null || _options$bindingMetad === void 0 ? void 0 : _options$bindingMetad.__uniStyleIsolation;
if (isolation === null) throw new SyntaxError("Web Vapor 的 styleIsolation 必须在编译期确定,请使用字符串字面量,例如 styleIsolation: 'isolated'。");
const isPage = (_options$isUniPage = options.isUniPage) === null || _options$isUniPage === void 0 ? void 0 : _options$isUniPage.call(options, options.filename || "");
if (isPage ? isolation !== "isolated" : isolation === "app" || isolation === "app-shared" || isolation === "app-and-page") resolvedOptions.extraScopeId = _vue_shared.UNI_APP_SCOPE_ID;
resolvedOptions.templateFlags = !isPage && isolation === "app-and-page" ? 256 : 0;
if (options.isTS && !((_options$expressionPl = options.expressionPlugins) === null || _options$expressionPl === void 0 ? void 0 : _options$expressionPl.includes("typescript"))) resolvedOptions.expressionPlugins = [...options.expressionPlugins || [], "typescript"];
const ast = typeof source === "string" ? (0, _vue_compiler_dom.parse)(source, resolvedOptions) : source;
const [nodeTransforms, directiveTransforms] = (0, _vue_compiler_vapor.getBaseTransformPreset)();
const web = createUniAppXWebTransform();
nodeTransforms.splice(nodeTransforms.indexOf(_vue_compiler_vapor.transformChildren), 0, web.transformUniElement);
const ir = (0, _vue_compiler_vapor.transform)(ast, {
...resolvedOptions,
transformElementProps: web.transformElementProps,
nodeTransforms: [
web.transform,
...nodeTransforms,
...[_vue_compiler_vapor.transformTransition],
...options.nodeTransforms || []
],
directiveTransforms: {
...directiveTransforms,
...options.directiveTransforms
}
});
return (0, _vue_compiler_vapor.generate)(ir, {
...resolvedOptions,
genOperation: web.genOperation,
genEventHandler: web.genEventHandler
});
}
function compileSSR(source, options = {}) {
const ast = typeof source === "string" ? parse(source, options) : source;
const web = createUniAppXWebTransform({ ssr: true });
const { ssrPreTagTransforms = [], nodeTransforms = [], ...compilerOptions } = options;
return (0, _vue_compiler_ssr.compile)(ast, {
...compilerOptions,
nodeTransforms: nodeTransforms.filter((transform) => !ssrPreTagTransforms.includes(transform)),
preNodeTransforms: [web.transform, ...ssrPreTagTransforms]
});
}
//#endregion
exports.UNI_APP_SCOPE_ID = _vue_shared.UNI_APP_SCOPE_ID;
exports.compile = compile;
exports.compileSSR = compileSSR;
exports.parse = parse;
exports.resolveUniElementRoots = resolveUniElementRoots;

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