From d9040348746e799f73666451b617180d27cce1a8 Mon Sep 17 00:00:00 2001 From: fxy060608 Date: Mon, 5 Jul 2021 15:30:16 +0800 Subject: [PATCH] wip(app): uni-app-vite --- package.json | 2 +- packages/playground/ssr/package.json | 2 +- packages/playground/ssr/yarn.lock | 2 +- .../uni-app-plus/dist/uni-app-view.umd.js | 12 +- packages/uni-app-vite/dist/index.js | 8 + packages/uni-app-vite/dist/plugin.js | 8 +- packages/uni-app-vite/dist/plugins/copy.js | 4 - .../lib/template/__uniappview.html | 2 +- packages/uni-app-vite/src/index.ts | 8 + packages/uni-app-vite/src/plugin.ts | 7 +- packages/uni-app-vite/src/plugins/copy.ts | 4 - .../uni-app-vue/dist/service.runtime.esm.js | 878 +- packages/uni-app-vue/dist/view.runtime.esm.js | 20878 +++++++++------- .../uni-cli-shared/src/vite/plugins/css.ts | 113 + .../uni-cli-shared/src/vite/plugins/index.ts | 1 + yarn.lock | 2 +- 16 files changed, 11796 insertions(+), 10135 deletions(-) create mode 100644 packages/uni-cli-shared/src/vite/plugins/css.ts diff --git a/package.json b/package.json index 0c3546cc6..ef05b93eb 100644 --- a/package.json +++ b/package.json @@ -86,7 +86,7 @@ "semver": "^7.3.4", "ts-jest": "^27.0.3", "typescript": "~4.1.3", - "vite": "^2.4.0-beta.2", + "vite": "^2.4.0-beta.3", "vue": "^3.1.2", "yorkie": "^2.0.0" }, diff --git a/packages/playground/ssr/package.json b/packages/playground/ssr/package.json index b8108bffe..9ff25f9c7 100644 --- a/packages/playground/ssr/package.json +++ b/packages/playground/ssr/package.json @@ -31,6 +31,6 @@ "compression": "^1.7.4", "cypress": "^7.3.0", "serve-static": "^1.14.1", - "vite": "^2.4.0-beta.2" + "vite": "^2.4.0-beta.3" } } diff --git a/packages/playground/ssr/yarn.lock b/packages/playground/ssr/yarn.lock index 1eb6f0b78..e657eef1a 100644 --- a/packages/playground/ssr/yarn.lock +++ b/packages/playground/ssr/yarn.lock @@ -2243,7 +2243,7 @@ verror@1.10.0: core-util-is "1.0.2" extsprintf "^1.2.0" -vite@^2.4.0-beta.2: +vite@^2.4.0-beta.3: version "2.4.0-beta.3" resolved "https://registry.yarnpkg.com/vite/-/vite-2.4.0-beta.3.tgz#81da5e6cbfb4cb710610e5757567cbe58b667c44" integrity sha512-sSUbH0mPMbqqOVZ1/LD/Wiu347yvn4BXjS/94mn5Q7E/zd50hxEnKU1NC4x59TBKq5OeboPhyXwibyCEpyAQKQ== diff --git a/packages/uni-app-plus/dist/uni-app-view.umd.js b/packages/uni-app-plus/dist/uni-app-view.umd.js index ef272b584..1e902f909 100644 --- a/packages/uni-app-plus/dist/uni-app-view.umd.js +++ b/packages/uni-app-plus/dist/uni-app-view.umd.js @@ -1235,7 +1235,11 @@ } const appErrorHandler = instance.appContext.config.errorHandler; if (appErrorHandler) { - callWithErrorHandling(appErrorHandler, null, 10, [err, exposedInstance, errorInfo]); + callWithErrorHandling(appErrorHandler, null, 10, [ + err, + exposedInstance, + errorInfo + ]); return; } } @@ -1551,7 +1555,11 @@ function resolveMergedOptions(instance) { const base = instance.type; const { mixins, extends: extendsOptions } = base; - const { mixins: globalMixins, optionsCache: cache, config: { optionMergeStrategies } } = instance.appContext; + const { + mixins: globalMixins, + optionsCache: cache, + config: { optionMergeStrategies } + } = instance.appContext; const cached = cache.get(base); let resolved; if (cached) { diff --git a/packages/uni-app-vite/dist/index.js b/packages/uni-app-vite/dist/index.js index d065f5f64..18411ab37 100644 --- a/packages/uni-app-vite/dist/index.js +++ b/packages/uni-app-vite/dist/index.js @@ -1,5 +1,10 @@ "use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; Object.defineProperty(exports, "__esModule", { value: true }); +const fs_1 = __importDefault(require("fs")); +const uni_cli_shared_1 = require("@dcloudio/uni-cli-shared"); const plugin_1 = require("./plugin"); const copy_1 = require("./plugins/copy"); const mainJs_1 = require("./plugins/mainJs"); @@ -13,4 +18,7 @@ exports.default = [ manifestJson_1.uniManifestJsonPlugin(), pagesJson_1.uniPagesJsonPlugin(), plugin_1.UniAppPlugin, + uni_cli_shared_1.uniCssPlugin({ + app: fs_1.default.readFileSync(require.resolve('@dcloudio/uni-app-plus/dist/style.css'), 'utf8'), + }), ]; diff --git a/packages/uni-app-vite/dist/plugin.js b/packages/uni-app-vite/dist/plugin.js index 684c40790..4acccb9ac 100644 --- a/packages/uni-app-vite/dist/plugin.js +++ b/packages/uni-app-vite/dist/plugin.js @@ -34,7 +34,7 @@ exports.UniAppPlugin = { }, }; }, - configResolved() { + configResolved(config) { const manifestJson = uni_cli_shared_1.parseManifestJsonOnce(process.env.UNI_INPUT_DIR); if (uni_cli_shared_1.getNVueCompiler(manifestJson) === 'uni-app') { process.env.UNI_USING_NVUE_COMPILER = 'uni-app'; @@ -42,6 +42,12 @@ exports.UniAppPlugin = { if (uni_cli_shared_1.getNVueStyleCompiler(manifestJson) === 'uni-app') { process.env.UNI_USING_NVUE_STYLE_COMPILER = 'uni-app'; } + // 移除 vite 内置的 css post 处理 + const index = config.plugins.findIndex((p) => p.name === 'vite:css-post'); + if (index > -1) { + ; + config.plugins.splice(index, 1); + } }, resolveId(id) { if (id === 'vue') { diff --git a/packages/uni-app-vite/dist/plugins/copy.js b/packages/uni-app-vite/dist/plugins/copy.js index 4c8bf98c2..2d8a11854 100644 --- a/packages/uni-app-vite/dist/plugins/copy.js +++ b/packages/uni-app-vite/dist/plugins/copy.js @@ -14,10 +14,6 @@ function uniCopyPlugin() { src: slash_1.default(path_1.default.resolve(__dirname, '../../lib/template/*')), dest: process.env.UNI_OUTPUT_DIR, }, - { - src: slash_1.default(require.resolve('@dcloudio/uni-app-plus/dist/style.css')), - dest: process.env.UNI_OUTPUT_DIR, - }, { src: slash_1.default(require.resolve('@dcloudio/uni-app-plus/dist/uni-app-view.umd.js')), dest: process.env.UNI_OUTPUT_DIR, diff --git a/packages/uni-app-vite/lib/template/__uniappview.html b/packages/uni-app-vite/lib/template/__uniappview.html index 042511c83..77221d6c4 100644 --- a/packages/uni-app-vite/lib/template/__uniappview.html +++ b/packages/uni-app-vite/lib/template/__uniappview.html @@ -4,7 +4,7 @@ View - +
diff --git a/packages/uni-app-vite/src/index.ts b/packages/uni-app-vite/src/index.ts index 597d20105..49c591f0a 100644 --- a/packages/uni-app-vite/src/index.ts +++ b/packages/uni-app-vite/src/index.ts @@ -1,3 +1,5 @@ +import fs from 'fs' +import { uniCssPlugin } from '@dcloudio/uni-cli-shared' import { UniAppPlugin } from './plugin' import { uniCopyPlugin } from './plugins/copy' import { uniMainJsPlugin } from './plugins/mainJs' @@ -12,4 +14,10 @@ export default [ uniManifestJsonPlugin(), uniPagesJsonPlugin(), UniAppPlugin, + uniCssPlugin({ + app: fs.readFileSync( + require.resolve('@dcloudio/uni-app-plus/dist/style.css'), + 'utf8' + ), + }), ] diff --git a/packages/uni-app-vite/src/plugin.ts b/packages/uni-app-vite/src/plugin.ts index 14c952660..2f6adfb7f 100644 --- a/packages/uni-app-vite/src/plugin.ts +++ b/packages/uni-app-vite/src/plugin.ts @@ -42,7 +42,7 @@ export const UniAppPlugin: UniVitePlugin = { }, } }, - configResolved() { + configResolved(config) { const manifestJson = parseManifestJsonOnce(process.env.UNI_INPUT_DIR) if (getNVueCompiler(manifestJson) === 'uni-app') { process.env.UNI_USING_NVUE_COMPILER = 'uni-app' @@ -50,6 +50,11 @@ export const UniAppPlugin: UniVitePlugin = { if (getNVueStyleCompiler(manifestJson) === 'uni-app') { process.env.UNI_USING_NVUE_STYLE_COMPILER = 'uni-app' } + // 移除 vite 内置的 css post 处理 + const index = config.plugins.findIndex((p) => p.name === 'vite:css-post') + if (index > -1) { + ;(config.plugins as Plugin[]).splice(index, 1) + } }, resolveId(id) { if (id === 'vue') { diff --git a/packages/uni-app-vite/src/plugins/copy.ts b/packages/uni-app-vite/src/plugins/copy.ts index fc1a11029..e6e5f1fd4 100644 --- a/packages/uni-app-vite/src/plugins/copy.ts +++ b/packages/uni-app-vite/src/plugins/copy.ts @@ -10,10 +10,6 @@ export function uniCopyPlugin() { src: slash(path.resolve(__dirname, '../../lib/template/*')), dest: process.env.UNI_OUTPUT_DIR, }, - { - src: slash(require.resolve('@dcloudio/uni-app-plus/dist/style.css')), - dest: process.env.UNI_OUTPUT_DIR, - }, { src: slash( require.resolve('@dcloudio/uni-app-plus/dist/uni-app-view.umd.js') diff --git a/packages/uni-app-vue/dist/service.runtime.esm.js b/packages/uni-app-vue/dist/service.runtime.esm.js index e7375933e..085b0c2e8 100644 --- a/packages/uni-app-vue/dist/service.runtime.esm.js +++ b/packages/uni-app-vue/dist/service.runtime.esm.js @@ -710,12 +710,12 @@ export default function vueFactory(exports) { return UniTextNode; }(UniBaseNode); - /** - * Make a map and return a function for checking if a key - * is in that map. - * IMPORTANT: all calls of this function must be prefixed with - * \/\*#\_\_PURE\_\_\*\/ - * So that rollup can tree-shake them if necessary. + /** + * Make a map and return a function for checking if a key + * is in that map. + * IMPORTANT: all calls of this function must be prefixed with + * \/\*#\_\_PURE\_\_\*\/ + * So that rollup can tree-shake them if necessary. */ @@ -803,9 +803,9 @@ export default function vueFactory(exports) { var SVG_TAGS = 'svg,animate,animateMotion,animateTransform,circle,clipPath,color-profile,' + 'defs,desc,discard,ellipse,feBlend,feColorMatrix,feComponentTransfer,' + 'feComposite,feConvolveMatrix,feDiffuseLighting,feDisplacementMap,' + 'feDistanceLight,feDropShadow,feFlood,feFuncA,feFuncB,feFuncG,feFuncR,' + 'feGaussianBlur,feImage,feMerge,feMergeNode,feMorphology,feOffset,' + 'fePointLight,feSpecularLighting,feSpotLight,feTile,feTurbulence,filter,' + 'foreignObject,g,hatch,hatchpath,image,line,linearGradient,marker,mask,' + 'mesh,meshgradient,meshpatch,meshrow,metadata,mpath,path,pattern,' + 'polygon,polyline,radialGradient,rect,set,solidcolor,stop,switch,symbol,' + 'text,textPath,title,tspan,unknown,use,view'; var isHTMLTag = /*#__PURE__*/makeMap(HTML_TAGS); var isSVGTag = /*#__PURE__*/makeMap(SVG_TAGS); - /** - * For converting {{ interpolation }} values to displayed strings. - * @private + /** + * For converting {{ interpolation }} values to displayed strings. + * @private */ var toDisplayString = function toDisplayString(val) { @@ -839,8 +839,8 @@ export default function vueFactory(exports) { var EMPTY_ARR = process.env.NODE_ENV !== 'production' ? Object.freeze([]) : []; var NOOP = function NOOP() {}; - /** - * Always return false. + /** + * Always return false. */ @@ -935,8 +935,8 @@ export default function vueFactory(exports) { }; var camelizeRE = /-(\w)/g; - /** - * @private + /** + * @private */ var camelize = cacheStringFunction(function (str) { @@ -945,22 +945,22 @@ export default function vueFactory(exports) { }); }); var hyphenateRE = /\B([A-Z])/g; - /** - * @private + /** + * @private */ var hyphenate = cacheStringFunction(function (str) { return str.replace(hyphenateRE, '-$1').toLowerCase(); }); - /** - * @private + /** + * @private */ var capitalize = cacheStringFunction(function (str) { return str.charAt(0).toUpperCase() + str.slice(1); }); - /** - * @private + /** + * @private */ var toHandlerKey = cacheStringFunction(function (str) { @@ -1150,7 +1150,7 @@ export default function vueFactory(exports) { } }; - if (type === "clear" + if (type === 'clear' /* CLEAR */ ) { // collection being cleared @@ -1170,7 +1170,7 @@ export default function vueFactory(exports) { switch (type) { - case "add" + case 'add' /* ADD */ : if (!isArray(target)) { @@ -1186,7 +1186,7 @@ export default function vueFactory(exports) { break; - case "delete" + case 'delete' /* DELETE */ : if (!isArray(target)) { @@ -1199,7 +1199,7 @@ export default function vueFactory(exports) { break; - case "set" + case 'set' /* SET */ : if (isMap(target)) { @@ -1252,7 +1252,7 @@ export default function vueFactory(exports) { var arr = toRaw(this); for (var i = 0, l = this.length; i < l; i++) { - track(arr, "get" + track(arr, 'get' /* GET */ , i + ''); } // we run the method using the original args first (which may be reactive) @@ -1294,15 +1294,15 @@ export default function vueFactory(exports) { var isReadonly = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; var shallow = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; return function get(target, key, receiver) { - if (key === "__v_isReactive" + if (key === '__v_isReactive' /* IS_REACTIVE */ ) { return !isReadonly; - } else if (key === "__v_isReadonly" + } else if (key === '__v_isReadonly' /* IS_READONLY */ ) { return isReadonly; - } else if (key === "__v_raw" + } else if (key === '__v_raw' /* RAW */ && receiver === (isReadonly ? shallow ? shallowReadonlyMap : readonlyMap : shallow ? shallowReactiveMap : reactiveMap).get(target)) { return target; @@ -1321,7 +1321,7 @@ export default function vueFactory(exports) { } if (!isReadonly) { - track(target, "get" + track(target, 'get' /* GET */ , key); } @@ -1370,11 +1370,11 @@ export default function vueFactory(exports) { if (target === toRaw(receiver)) { if (!hadKey) { - trigger(target, "add" + trigger(target, 'add' /* ADD */ , key, value); } else if (hasChanged(value, oldValue)) { - trigger(target, "set" + trigger(target, 'set' /* SET */ , key, value, oldValue); } @@ -1390,7 +1390,7 @@ export default function vueFactory(exports) { var result = Reflect.deleteProperty(target, key); if (result && hadKey) { - trigger(target, "delete" + trigger(target, 'delete' /* DELETE */ , key, undefined, oldValue); } @@ -1402,7 +1402,7 @@ export default function vueFactory(exports) { var result = Reflect.has(target, key); if (!isSymbol(key) || !builtInSymbols.has(key)) { - track(target, "has" + track(target, 'has' /* HAS */ , key); } @@ -1411,7 +1411,7 @@ export default function vueFactory(exports) { } function ownKeys(target) { - track(target, "iterate" + track(target, 'iterate' /* ITERATE */ , isArray(target) ? 'length' : ITERATE_KEY); return Reflect.ownKeys(target); @@ -1476,19 +1476,19 @@ export default function vueFactory(exports) { var isShallow = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; // #1772: readonly(reactive(Map)) should return readonly + reactive version // of the value - target = target["__v_raw" + target = target['__v_raw' /* RAW */ ]; var rawTarget = toRaw(target); var rawKey = toRaw(key); if (key !== rawKey) { - !isReadonly && track(rawTarget, "get" + !isReadonly && track(rawTarget, 'get' /* GET */ , key); } - !isReadonly && track(rawTarget, "get" + !isReadonly && track(rawTarget, 'get' /* GET */ , rawKey); @@ -1510,19 +1510,19 @@ export default function vueFactory(exports) { function has$1(key) { var isReadonly = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; - var target = this["__v_raw" + var target = this['__v_raw' /* RAW */ ]; var rawTarget = toRaw(target); var rawKey = toRaw(key); if (key !== rawKey) { - !isReadonly && track(rawTarget, "has" + !isReadonly && track(rawTarget, 'has' /* HAS */ , key); } - !isReadonly && track(rawTarget, "has" + !isReadonly && track(rawTarget, 'has' /* HAS */ , rawKey); return key === rawKey ? target.has(key) : target.has(key) || target.has(rawKey); @@ -1530,10 +1530,10 @@ export default function vueFactory(exports) { function size(target) { var isReadonly = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; - target = target["__v_raw" + target = target['__v_raw' /* RAW */ ]; - !isReadonly && track(toRaw(target), "iterate" + !isReadonly && track(toRaw(target), 'iterate' /* ITERATE */ , ITERATE_KEY); return Reflect.get(target, 'size', target); @@ -1547,7 +1547,7 @@ export default function vueFactory(exports) { if (!hadKey) { target.add(value); - trigger(target, "add" + trigger(target, 'add' /* ADD */ , value, value); } @@ -1576,11 +1576,11 @@ export default function vueFactory(exports) { target.set(key, value); if (!hadKey) { - trigger(target, "add" + trigger(target, 'add' /* ADD */ , key, value); } else if (hasChanged(value, oldValue)) { - trigger(target, "set" + trigger(target, 'set' /* SET */ , key, value, oldValue); } @@ -1609,7 +1609,7 @@ export default function vueFactory(exports) { var result = target.delete(key); if (hadKey) { - trigger(target, "delete" + trigger(target, 'delete' /* DELETE */ , key, undefined, oldValue); } @@ -1625,7 +1625,7 @@ export default function vueFactory(exports) { var result = target.clear(); if (hadItems) { - trigger(target, "clear" + trigger(target, 'clear' /* CLEAR */ , undefined, undefined, oldTarget); } @@ -1636,12 +1636,12 @@ export default function vueFactory(exports) { function createForEach(isReadonly, isShallow) { return function forEach(callback, thisArg) { var observed = this; - var target = observed["__v_raw" + var target = observed['__v_raw' /* RAW */ ]; var rawTarget = toRaw(target); var wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive; - !isReadonly && track(rawTarget, "iterate" + !isReadonly && track(rawTarget, 'iterate' /* ITERATE */ , ITERATE_KEY); return target.forEach(function (value, key) { @@ -1655,7 +1655,7 @@ export default function vueFactory(exports) { function createIterableMethod(method, isReadonly, isShallow) { return function () { - var target = this["__v_raw" + var target = this['__v_raw' /* RAW */ ]; var rawTarget = toRaw(target); @@ -1664,7 +1664,7 @@ export default function vueFactory(exports) { var isKeyOnly = method === 'keys' && targetIsMap; var innerIterator = target[method].apply(target, arguments); var wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive; - !isReadonly && track(rawTarget, "iterate" + !isReadonly && track(rawTarget, 'iterate' /* ITERATE */ , isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY); // return a wrapped iterator which returns observed versions of the // values emitted from the real iterator @@ -1701,7 +1701,7 @@ export default function vueFactory(exports) { console.warn("".concat(capitalize(type), " operation ").concat(key, "failed: target is readonly."), toRaw(this)); } - return type === "delete" + return type === 'delete' /* DELETE */ ? false : this; }; @@ -1753,16 +1753,16 @@ export default function vueFactory(exports) { return has$1.call(this, key, true); }, - add: createReadonlyMethod("add" + add: createReadonlyMethod('add' /* ADD */ ), - set: createReadonlyMethod("set" + set: createReadonlyMethod('set' /* SET */ ), - delete: createReadonlyMethod("delete" + delete: createReadonlyMethod('delete' /* DELETE */ ), - clear: createReadonlyMethod("clear" + clear: createReadonlyMethod('clear' /* CLEAR */ ), forEach: createForEach(true, false) @@ -1780,16 +1780,16 @@ export default function vueFactory(exports) { return has$1.call(this, key, true); }, - add: createReadonlyMethod("add" + add: createReadonlyMethod('add' /* ADD */ ), - set: createReadonlyMethod("set" + set: createReadonlyMethod('set' /* SET */ ), - delete: createReadonlyMethod("delete" + delete: createReadonlyMethod('delete' /* DELETE */ ), - clear: createReadonlyMethod("clear" + clear: createReadonlyMethod('clear' /* CLEAR */ ), forEach: createForEach(true, true) @@ -1814,15 +1814,15 @@ export default function vueFactory(exports) { function createInstrumentationGetter(isReadonly, shallow) { var instrumentations = shallow ? isReadonly ? shallowReadonlyInstrumentations : shallowInstrumentations : isReadonly ? readonlyInstrumentations : mutableInstrumentations; return function (target, key, receiver) { - if (key === "__v_isReactive" + if (key === '__v_isReactive' /* IS_REACTIVE */ ) { return !isReadonly; - } else if (key === "__v_isReadonly" + } else if (key === '__v_isReadonly' /* IS_READONLY */ ) { return isReadonly; - } else if (key === "__v_raw" + } else if (key === '__v_raw' /* RAW */ ) { return target; @@ -1863,27 +1863,27 @@ export default function vueFactory(exports) { switch (rawType) { case 'Object': case 'Array': - return 1 - /* COMMON */ - ; + return 1; + + /* COMMON */ case 'Map': case 'Set': case 'WeakMap': case 'WeakSet': - return 2 - /* COLLECTION */ - ; + return 2; + + /* COLLECTION */ default: - return 0 - /* INVALID */ - ; + return 0; + + /* INVALID */ } } function getTargetType(value) { - return value["__v_skip" + return value['__v_skip' /* SKIP */ ] || !Object.isExtensible(value) ? 0 /* INVALID */ @@ -1892,7 +1892,7 @@ export default function vueFactory(exports) { function reactive(target) { // if trying to observe a readonly proxy, return the readonly version. - if (target && target["__v_isReadonly" + if (target && target['__v_isReadonly' /* IS_READONLY */ ]) { return target; @@ -1900,30 +1900,30 @@ export default function vueFactory(exports) { return createReactiveObject(target, false, mutableHandlers, mutableCollectionHandlers, reactiveMap); } - /** - * Return a shallowly-reactive copy of the original object, where only the root - * level properties are reactive. It also does not auto-unwrap refs (even at the - * root level). + /** + * Return a shallowly-reactive copy of the original object, where only the root + * level properties are reactive. It also does not auto-unwrap refs (even at the + * root level). */ function shallowReactive(target) { return createReactiveObject(target, false, shallowReactiveHandlers, shallowCollectionHandlers, shallowReactiveMap); } - /** - * Creates a readonly copy of the original object. Note the returned copy is not - * made reactive, but `readonly` can be called on an already reactive object. + /** + * Creates a readonly copy of the original object. Note the returned copy is not + * made reactive, but `readonly` can be called on an already reactive object. */ function readonly(target) { return createReactiveObject(target, true, readonlyHandlers, readonlyCollectionHandlers, readonlyMap); } - /** - * Returns a reactive-copy of the original object, where only the root level - * properties are readonly, and does NOT unwrap refs nor recursively convert - * returned properties. - * This is used for creating the props proxy object for stateful components. + /** + * Returns a reactive-copy of the original object, where only the root level + * properties are readonly, and does NOT unwrap refs nor recursively convert + * returned properties. + * This is used for creating the props proxy object for stateful components. */ @@ -1942,9 +1942,9 @@ export default function vueFactory(exports) { // exception: calling readonly() on a reactive object - if (target["__v_raw" + if (target['__v_raw' /* RAW */ - ] && !(isReadonly && target["__v_isReactive" + ] && !(isReadonly && target['__v_isReactive' /* IS_REACTIVE */ ])) { return target; @@ -1975,18 +1975,18 @@ export default function vueFactory(exports) { function isReactive(value) { if (isReadonly(value)) { - return isReactive(value["__v_raw" + return isReactive(value['__v_raw' /* RAW */ ]); } - return !!(value && value["__v_isReactive" + return !!(value && value['__v_isReactive' /* IS_REACTIVE */ ]); } function isReadonly(value) { - return !!(value && value["__v_isReadonly" + return !!(value && value['__v_isReadonly' /* IS_READONLY */ ]); } @@ -1996,13 +1996,13 @@ export default function vueFactory(exports) { } function toRaw(observed) { - return observed && toRaw(observed["__v_raw" + return observed && toRaw(observed['__v_raw' /* RAW */ ]) || observed; } function markRaw(value) { - def(value, "__v_skip" + def(value, '__v_skip' /* SKIP */ , true); return value; @@ -2037,7 +2037,7 @@ export default function vueFactory(exports) { _createClass(RefImpl, [{ key: "value", get: function get() { - track(toRaw(this), "get" + track(toRaw(this), 'get' /* GET */ , 'value'); return this._value; @@ -2046,7 +2046,7 @@ export default function vueFactory(exports) { if (hasChanged(toRaw(newVal), this._rawValue)) { this._rawValue = newVal; this._value = this._shallow ? newVal : convert(newVal); - trigger(toRaw(this), "set" + trigger(toRaw(this), 'set' /* SET */ , 'value', newVal); } @@ -2067,7 +2067,7 @@ export default function vueFactory(exports) { } function triggerRef(ref) { - trigger(toRaw(ref), "set" + trigger(toRaw(ref), 'set' /* SET */ , 'value', process.env.NODE_ENV !== 'production' ? ref.value : void 0); } @@ -2105,13 +2105,13 @@ export default function vueFactory(exports) { this.__v_isRef = true; var _factory = factory(function () { - return track(_this7, "get" + return track(_this7, 'get' /* GET */ , /* GET */ 'value'); }, function () { - return trigger(_this7, "set" + return trigger(_this7, 'set' /* SET */ , /* SET */ @@ -2195,13 +2195,13 @@ export default function vueFactory(exports) { scheduler: function scheduler() { if (!_this8._dirty) { _this8._dirty = true; - trigger(toRaw(_this8), "set" + trigger(toRaw(_this8), 'set' /* SET */ , 'value'); } } }); - this["__v_isReadonly" + this['__v_isReadonly' /* IS_READONLY */ ] = isReadonly; } @@ -2217,7 +2217,7 @@ export default function vueFactory(exports) { self._dirty = false; } - track(self, "get" + track(self, 'get' /* GET */ , 'value'); return self._value; @@ -2380,46 +2380,46 @@ export default function vueFactory(exports) { } var ErrorTypeStrings = { - ["sp" + ['sp' /* SERVER_PREFETCH */ ]: 'serverPrefetch hook', - ["bc" + ['bc' /* BEFORE_CREATE */ ]: 'beforeCreate hook', - ["c" + ['c' /* CREATED */ ]: 'created hook', - ["bm" + ['bm' /* BEFORE_MOUNT */ ]: 'beforeMount hook', - ["m" + ['m' /* MOUNTED */ ]: 'mounted hook', - ["bu" + ['bu' /* BEFORE_UPDATE */ ]: 'beforeUpdate hook', - ["u" + ['u' /* UPDATED */ ]: 'updated', - ["bum" + ['bum' /* BEFORE_UNMOUNT */ ]: 'beforeUnmount hook', - ["um" + ['um' /* UNMOUNTED */ ]: 'unmounted hook', - ["a" + ['a' /* ACTIVATED */ ]: 'activated hook', - ["da" + ['da' /* DEACTIVATED */ ]: 'deactivated hook', - ["ec" + ['ec' /* ERROR_CAPTURED */ ]: 'errorCaptured hook', - ["rtc" + ['rtc' /* RENDER_TRACKED */ ]: 'renderTracked hook', - ["rtg" + ['rtg' /* RENDER_TRIGGERED */ ]: 'renderTriggered hook', [0 @@ -2939,7 +2939,7 @@ export default function vueFactory(exports) { function devtoolsInitApp(app, version) { // TODO queue if devtools is undefined if (!devtools) return; - devtools.emit("app:init" + devtools.emit('app:init' /* APP_INIT */ , app, version, { Fragment, @@ -2951,18 +2951,18 @@ export default function vueFactory(exports) { function devtoolsUnmountApp(app) { if (!devtools) return; - devtools.emit("app:unmount" + devtools.emit('app:unmount' /* APP_UNMOUNT */ , app); } - var devtoolsComponentAdded = /*#__PURE__*/createDevtoolsComponentHook("component:added" + var devtoolsComponentAdded = /*#__PURE__*/createDevtoolsComponentHook('component:added' /* COMPONENT_ADDED */ ); - var devtoolsComponentUpdated = /*#__PURE__*/createDevtoolsComponentHook("component:updated" + var devtoolsComponentUpdated = /*#__PURE__*/createDevtoolsComponentHook('component:updated' /* COMPONENT_UPDATED */ ); - var devtoolsComponentRemoved = /*#__PURE__*/createDevtoolsComponentHook("component:removed" + var devtoolsComponentRemoved = /*#__PURE__*/createDevtoolsComponentHook('component:removed' /* COMPONENT_REMOVED */ ); @@ -2973,10 +2973,10 @@ export default function vueFactory(exports) { }; } - var devtoolsPerfStart = /*#__PURE__*/createDevtoolsPerformanceHook("perf:start" + var devtoolsPerfStart = /*#__PURE__*/createDevtoolsPerformanceHook('perf:start' /* PERFORMANCE_START */ ); - var devtoolsPerfEnd = /*#__PURE__*/createDevtoolsPerformanceHook("perf:end" + var devtoolsPerfEnd = /*#__PURE__*/createDevtoolsPerformanceHook('perf:end' /* PERFORMANCE_END */ ); @@ -2989,7 +2989,7 @@ export default function vueFactory(exports) { function devtoolsComponentEmit(component, event, params) { if (!devtools) return; - devtools.emit("component:emit" + devtools.emit('component:emit' /* COMPONENT_EMIT */ , component.appContext.app, component, event, params); } @@ -3187,23 +3187,23 @@ export default function vueFactory(exports) { key = key.slice(2).replace(/Once$/, ''); return hasOwn(options, key[0].toLowerCase() + key.slice(1)) || hasOwn(options, hyphenate(key)) || hasOwn(options, key); } - /** - * mark the current rendering instance for asset resolution (e.g. - * resolveComponent, resolveDirective) during render + /** + * mark the current rendering instance for asset resolution (e.g. + * resolveComponent, resolveDirective) during render */ var currentRenderingInstance = null; var currentScopeId = null; - /** - * Note: rendering calls maybe nested. The function returns the parent rendering - * instance if present, which should be restored after the render is done: - * - * ```js - * const prev = setCurrentRenderingInstance(i) - * // ...render - * setCurrentRenderingInstance(prev) - * ``` + /** + * Note: rendering calls maybe nested. The function returns the parent rendering + * instance if present, which should be restored after the render is done: + * + * ```js + * const prev = setCurrentRenderingInstance(i) + * // ...render + * setCurrentRenderingInstance(prev) + * ``` */ function setCurrentRenderingInstance(instance) { @@ -3212,37 +3212,37 @@ export default function vueFactory(exports) { currentScopeId = instance && instance.type.__scopeId || null; return prev; } - /** - * Set scope id when creating hoisted vnodes. - * @private compiler helper + /** + * Set scope id when creating hoisted vnodes. + * @private compiler helper */ function pushScopeId(id) { currentScopeId = id; } - /** - * Technically we no longer need this after 3.0.8 but we need to keep the same - * API for backwards compat w/ code generated by compilers. - * @private + /** + * Technically we no longer need this after 3.0.8 but we need to keep the same + * API for backwards compat w/ code generated by compilers. + * @private */ function popScopeId() { currentScopeId = null; } - /** - * Only for backwards compat - * @private + /** + * Only for backwards compat + * @private */ var withScopeId = function withScopeId(_id) { return withCtx; }; - /** - * Wrap a slot function to memoize current rendering instance - * @private compiler helper + /** + * Wrap a slot function to memoize current rendering instance + * @private compiler helper */ @@ -3291,10 +3291,10 @@ export default function vueFactory(exports) { renderFnWithContext._d = true; return renderFnWithContext; } - /** - * dev only flag to track whether $attrs was used during render. - * If $attrs was used during render then the warning for failed attrs - * fallthrough can be suppressed. + /** + * dev only flag to track whether $attrs was used during render. + * If $attrs was used during render then the warning for failed attrs + * fallthrough can be suppressed. */ @@ -3436,15 +3436,15 @@ export default function vueFactory(exports) { } } - if (false && isCompatEnabled("INSTANCE_ATTRS_CLASS_STYLE" + if (false && isCompatEnabled('INSTANCE_ATTRS_CLASS_STYLE' /* INSTANCE_ATTRS_CLASS_STYLE */ , instance) && vnode.shapeFlag & 4 /* STATEFUL_COMPONENT */ && (root.shapeFlag & 1 /* ELEMENT */ - || root.shapeFlag & 6 + || root.shapeFlag & 6) /* COMPONENT */ - )) ; // inherit directives + ) ; // inherit directives if (vnode.dirs) { if (process.env.NODE_ENV !== 'production' && !isElementRoot(root)) { @@ -3479,11 +3479,11 @@ export default function vueFactory(exports) { setCurrentRenderingInstance(prev); return result; } - /** - * dev only - * In dev mode, template root level comments are rendered, which turns the - * template into a fragment root, but we need to locate the single element - * root for attrs and scope id processing. + /** + * dev only + * In dev mode, template root level comments are rendered, which turns the + * template into a fragment root, but we need to locate the single element + * root for attrs and scope id processing. */ @@ -4127,9 +4127,9 @@ export default function vueFactory(exports) { function normalizeSuspenseChildren(vnode) { var shapeFlag = vnode.shapeFlag, children = vnode.children; - var isSlotChildren = shapeFlag & 32 + var isSlotChildren = shapeFlag & 32; /* SLOTS_CHILDREN */ - ; + vnode.ssContent = normalizeSuspenseSlot(isSlotChildren ? children.default : children); vnode.ssFallback = isSlotChildren ? normalizeSuspenseSlot(children.fallback) : createVNode(Comment); } @@ -4493,7 +4493,7 @@ export default function vueFactory(exports) { function traverse(value) { var seen = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new Set(); - if (!isObject(value) || seen.has(value) || value["__v_skip" + if (!isObject(value) || seen.has(value) || value['__v_skip' /* SKIP */ ]) { return value; @@ -4888,9 +4888,8 @@ export default function vueFactory(exports) { if (keyedFragmentCount > 1) { for (var _i2 = 0; _i2 < ret.length; _i2++) { - ret[_i2].patchFlag = -2 + ret[_i2].patchFlag = -2; /* BAIL */ - ; } } @@ -5277,11 +5276,7 @@ export default function vueFactory(exports) { current = null; return children; - } else if (!isVNode(rawVNode) || !(rawVNode.shapeFlag & 4 - /* STATEFUL_COMPONENT */ - ) && !(rawVNode.shapeFlag & 128 - /* SUSPENSE */ - )) { + } else if (!isVNode(rawVNode) || !(rawVNode.shapeFlag & 4) && !(rawVNode.shapeFlag & 128)) { current = null; return rawVNode; } @@ -5331,9 +5326,9 @@ export default function vueFactory(exports) { } // avoid vnode being mounted as fresh - vnode.shapeFlag |= 512 + vnode.shapeFlag |= 512; /* COMPONENT_KEPT_ALIVE */ - ; // make this key the freshest + // make this key the freshest keys.delete(key); keys.add(key); @@ -5346,9 +5341,9 @@ export default function vueFactory(exports) { } // avoid vnode being unmounted - vnode.shapeFlag |= 256 + vnode.shapeFlag |= 256; /* COMPONENT_SHOULD_KEEP_ALIVE */ - ; + current = vnode; return rawVNode; }; @@ -5376,13 +5371,13 @@ export default function vueFactory(exports) { } function onActivated(hook, target) { - registerKeepAliveHook(hook, "a" + registerKeepAliveHook(hook, 'a' /* ACTIVATED */ , target); } function onDeactivated(hook, target) { - registerKeepAliveHook(hook, "da" + registerKeepAliveHook(hook, 'da' /* DEACTIVATED */ , target); } @@ -5444,17 +5439,15 @@ export default function vueFactory(exports) { if (shapeFlag & 256 /* COMPONENT_SHOULD_KEEP_ALIVE */ ) { - shapeFlag -= 256 + shapeFlag -= 256; /* COMPONENT_SHOULD_KEEP_ALIVE */ - ; } if (shapeFlag & 512 /* COMPONENT_KEPT_ALIVE */ ) { - shapeFlag -= 512 + shapeFlag -= 512; /* COMPONENT_KEPT_ALIVE */ - ; } vnode.shapeFlag = shapeFlag; @@ -5515,44 +5508,44 @@ export default function vueFactory(exports) { return function (hook) { var target = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : currentInstance; return (// post-create lifecycle registrations are noops during SSR (except for serverPrefetch) - (!isInSSRComponentSetup || lifecycle === "sp" + (!isInSSRComponentSetup || lifecycle === 'sp') && /* SERVER_PREFETCH */ - ) && injectHook(lifecycle, hook, target) + injectHook(lifecycle, hook, target) ); }; }; - var onBeforeMount = createHook("bm" + var onBeforeMount = createHook('bm' /* BEFORE_MOUNT */ ); - var onMounted = createHook("m" + var onMounted = createHook('m' /* MOUNTED */ ); - var onBeforeUpdate = createHook("bu" + var onBeforeUpdate = createHook('bu' /* BEFORE_UPDATE */ ); - var onUpdated = createHook("u" + var onUpdated = createHook('u' /* UPDATED */ ); - var onBeforeUnmount = createHook("bum" + var onBeforeUnmount = createHook('bum' /* BEFORE_UNMOUNT */ ); - var onUnmounted = createHook("um" + var onUnmounted = createHook('um' /* UNMOUNTED */ ); - var onServerPrefetch = createHook("sp" + var onServerPrefetch = createHook('sp' /* SERVER_PREFETCH */ ); - var onRenderTriggered = createHook("rtg" + var onRenderTriggered = createHook('rtg' /* RENDER_TRIGGERED */ ); - var onRenderTracked = createHook("rtc" + var onRenderTracked = createHook('rtc' /* RENDER_TRACKED */ ); function onErrorCaptured(hook) { var target = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : currentInstance; - injectHook("ec" + injectHook('ec' /* ERROR_CAPTURED */ , hook, target); } @@ -5586,7 +5579,7 @@ export default function vueFactory(exports) { // the hook may mutate resolved options (#2791) if (options.beforeCreate) { - callHook(options.beforeCreate, instance, "bc" + callHook(options.beforeCreate, instance, 'bc' /* BEFORE_CREATE */ ); } @@ -5626,7 +5619,7 @@ export default function vueFactory(exports) { if (propsOptions) { for (var key in propsOptions) { - checkDuplicateProperties("Props" + checkDuplicateProperties('Props' /* PROPS */ , key); } @@ -5663,7 +5656,7 @@ export default function vueFactory(exports) { } if (process.env.NODE_ENV !== 'production') { - checkDuplicateProperties("Methods" + checkDuplicateProperties('Methods' /* METHODS */ , _key7); } @@ -5692,7 +5685,7 @@ export default function vueFactory(exports) { if (process.env.NODE_ENV !== 'production') { var _loop = function _loop(_key8) { - checkDuplicateProperties("Data" + checkDuplicateProperties('Data' /* DATA */ , _key8); // expose data on ctx during dev @@ -5747,7 +5740,7 @@ export default function vueFactory(exports) { }); if (process.env.NODE_ENV !== 'production') { - checkDuplicateProperties("Computed" + checkDuplicateProperties('Computed' /* COMPUTED */ , _key9); } @@ -5772,7 +5765,7 @@ export default function vueFactory(exports) { } if (created) { - callHook(created, instance, "c" + callHook(created, instance, 'c' /* CREATED */ ); } @@ -5856,7 +5849,7 @@ export default function vueFactory(exports) { } if (process.env.NODE_ENV !== 'production') { - checkDuplicateProperties("Inject" + checkDuplicateProperties('Inject' /* INJECT */ , key); } @@ -5902,10 +5895,10 @@ export default function vueFactory(exports) { warn("Invalid watch option: \"".concat(key, "\""), raw); } } - /** - * Resolve merged options and cache it on the component. - * This is done only once per-component since the merging does not involve - * instances. + /** + * Resolve merged options and cache it on the component. + * This is done only once per-component since the merging does not involve + * instances. */ @@ -6100,9 +6093,7 @@ export default function vueFactory(exports) { if ( // always force full diff in dev // - #1942 if hmr is enabled with sfc component // - vite#872 non-sfc component used by sfc component - !(process.env.NODE_ENV !== 'production' && (instance.type.__hmrId || instance.parent && instance.parent.type.__hmrId)) && (optimized || patchFlag > 0) && !(patchFlag & 16 - /* FULL_PROPS */ - )) { + !(process.env.NODE_ENV !== 'production' && (instance.type.__hmrId || instance.parent && instance.parent.type.__hmrId)) && (optimized || patchFlag > 0) && !(patchFlag & 16)) { if (patchFlag & 8 /* PROPS */ ) { @@ -6180,7 +6171,7 @@ export default function vueFactory(exports) { if (hasAttrsChanged) { - trigger(instance, "set" + trigger(instance, 'set' /* SET */ , '$attrs'); } @@ -6406,8 +6397,8 @@ export default function vueFactory(exports) { return -1; } - /** - * dev only + /** + * dev only */ @@ -6421,8 +6412,8 @@ export default function vueFactory(exports) { validateProp(key, resolvedValues[key], opt, !hasOwn(rawProps, key) && !hasOwn(rawProps, hyphenate(key))); } } - /** - * dev only + /** + * dev only */ @@ -6469,8 +6460,8 @@ export default function vueFactory(exports) { } var isSimpleType = /*#__PURE__*/makeMap('String,Number,Boolean,Function,Symbol,BigInt'); - /** - * dev only + /** + * dev only */ function assertType(value, type) { @@ -6497,8 +6488,8 @@ export default function vueFactory(exports) { expectedType }; } - /** - * dev only + /** + * dev only */ @@ -6521,8 +6512,8 @@ export default function vueFactory(exports) { return message; } - /** - * dev only + /** + * dev only */ @@ -6535,8 +6526,8 @@ export default function vueFactory(exports) { return "".concat(value); } } - /** - * dev only + /** + * dev only */ @@ -6546,8 +6537,8 @@ export default function vueFactory(exports) { return type.toLowerCase() === elem; }); } - /** - * dev only + /** + * dev only */ @@ -6704,17 +6695,17 @@ export default function vueFactory(exports) { } } }; - /** - Runtime helper for applying directives to a vnode. Example usage: + /** + Runtime helper for applying directives to a vnode. Example usage: - const comp = resolveComponent('comp') - const foo = resolveDirective('foo') - const bar = resolveDirective('bar') + const comp = resolveComponent('comp') + const foo = resolveDirective('foo') + const bar = resolveDirective('bar') - return withDirectives(h(comp), [ - [foo, this.x], - [bar, this.y] - ]) + return withDirectives(h(comp), [ + [foo, this.x], + [bar, this.y] + ]) */ @@ -6725,8 +6716,8 @@ export default function vueFactory(exports) { warn('Do not use built-in directive ids as custom directive id: ' + name); } } - /** - * Adds directives to a VNode. + /** + * Adds directives to a VNode. */ @@ -6987,9 +6978,9 @@ export default function vueFactory(exports) { var isComment = function isComment(node) { return node.nodeType === 8; - } + }; /* COMMENT */ - ; // Note: hydration is DOM-specific + // Note: hydration is DOM-specific // But we have to place it in core due to tight coupling with core - splitting // it out creates a ton of unnecessary complexity. // Hydration also depends on some renderer internal logic which needs to be @@ -7198,12 +7189,12 @@ export default function vueFactory(exports) { || patchFlag & 32 /* HYDRATE_EVENTS */ ) { - for (var key in props) { - if (forcePatchValue && key.endsWith('value') || isOn(key) && !isReservedProp(key)) { - patchProp(el, key, null, props[key]); + for (var key in props) { + if (forcePatchValue && key.endsWith('value') || isOn(key) && !isReservedProp(key)) { + patchProp(el, key, null, props[key]); + } } - } - } else if (props.onClick) { + } else if (props.onClick) { // Fast path for click listeners (which is most often) to avoid // iterating through props. patchProp(el, 'onClick', null, props.onClick); @@ -7415,12 +7406,12 @@ export default function vueFactory(exports) { return supported; } - /** - * This is only called in esm-bundler builds. - * It is called when a renderer is created, in `baseCreateRenderer` so that - * importing runtime-core is side-effects free. - * - * istanbul-ignore-next + /** + * This is only called in esm-bundler builds. + * It is called when a renderer is created, in `baseCreateRenderer` so that + * importing runtime-core is side-effects free. + * + * istanbul-ignore-next */ @@ -7536,20 +7527,20 @@ export default function vueFactory(exports) { warn('Invalid template ref type:', value, "(".concat(typeof value, ")")); } }; - /** - * The createRenderer function accepts two generic arguments: - * HostNode and HostElement, corresponding to Node and Element types in the - * host environment. For example, for runtime-dom, HostNode would be the DOM - * `Node` interface and HostElement would be the DOM `Element` interface. - * - * Custom renderers can pass in the platform specific types like this: - * - * ``` js - * const { render, createApp } = createRenderer({ - * patchProp, - * ...nodeOps - * }) - * ``` + /** + * The createRenderer function accepts two generic arguments: + * HostNode and HostElement, corresponding to Node and Element types in the + * host environment. For example, for runtime-dom, HostNode would be the DOM + * `Node` interface and HostElement would be the DOM `Element` interface. + * + * Custom renderers can pass in the platform specific types like this: + * + * ``` js + * const { render, createApp } = createRenderer({ + * patchProp, + * ...nodeOps + * }) + * ``` */ @@ -7709,8 +7700,8 @@ export default function vueFactory(exports) { n2.el = nodes[0]; n2.anchor = nodes[nodes.length - 1]; }; - /** - * Dev / HMR only + /** + * Dev / HMR only */ @@ -7902,9 +7893,9 @@ export default function vueFactory(exports) { dirs = n2.dirs; // #1426 take the old vnode's patch flag into account since user may clone a // compiler-generated vnode, which de-opts to FULL_PROPS - patchFlag |= n1.patchFlag & 16 + patchFlag |= n1.patchFlag & 16; /* FULL_PROPS */ - ; + var oldProps = n1.props || EMPTY_OBJ; var newProps = n2.props || EMPTY_OBJ; var vnodeHook; @@ -8027,9 +8018,9 @@ export default function vueFactory(exports) { !isSameVNodeType(oldVNode, newVNode) || // - In the case of a component, it could contain anything. oldVNode.shapeFlag & 6 /* COMPONENT */ - || oldVNode.shapeFlag & 64 + || oldVNode.shapeFlag & 64) /* TELEPORT */ - ) ? hostParentNode(oldVNode.el) : // In other cases, the parent container is not actually used so we + ? hostParentNode(oldVNode.el) : // In other cases, the parent container is not actually used so we // just pass the block element here to avoid a DOM parentNode call. fallbackContainer; patch(oldVNode, newVNode, container, null, parentComponent, parentSuspense, isSVG, slotScopeIds, true); @@ -8871,13 +8862,13 @@ export default function vueFactory(exports) { unmountChildren(dynamicChildren, parentComponent, parentSuspense, false, true); } else if (type === Fragment && (patchFlag & 128 /* KEYED_FRAGMENT */ - || patchFlag & 256 + || patchFlag & 256) /* UNKEYED_FRAGMENT */ - ) || !optimized && shapeFlag & 16 + || !optimized && shapeFlag & 16 /* ARRAY_CHILDREN */ ) { - unmountChildren(children, parentComponent, parentSuspense); - } + unmountChildren(children, parentComponent, parentSuspense); + } if (doRemove) { remove(vnode); @@ -9078,16 +9069,16 @@ export default function vueFactory(exports) { /* VNODE_HOOK */ , [vnode, prevVNode]); } - /** - * #1156 - * When a component is HMR-enabled, we need to make sure that all static nodes - * inside a block also inherit the DOM element from the previous tree so that - * HMR updates (which are full updates) can retrieve the element for patching. - * - * #2080 - * Inside keyed `template` fragment static children, if a fragment is moved, - * the children will always moved so that need inherit el form previous nodes - * to ensure correct moved position. + /** + * #1156 + * When a component is HMR-enabled, we need to make sure that all static nodes + * inside a block also inherit the DOM element from the previous tree so that + * HMR updates (which are full updates) can retrieve the element for patching. + * + * #2080 + * Inside keyed `template` fragment static children, if a fragment is moved, + * the children will always moved so that need inherit el form previous nodes + * to ensure correct moved position. */ @@ -9383,9 +9374,9 @@ export default function vueFactory(exports) { shapeFlag = vnode.shapeFlag, children = vnode.children, props = vnode.props; - var isReorder = moveType === 2 + var isReorder = moveType === 2; /* REORDER */ - ; // move main view anchor if this is a re-order. + // move main view anchor if this is a re-order. if (isReorder) { insert(el, container, parentAnchor); @@ -9447,8 +9438,8 @@ export default function vueFactory(exports) { var Teleport = TeleportImpl; var COMPONENTS = 'components'; var DIRECTIVES = 'directives'; - /** - * @private + /** + * @private */ function resolveComponent(name, maybeSelfReference) { @@ -9456,8 +9447,8 @@ export default function vueFactory(exports) { } var NULL_DYNAMIC_COMPONENT = Symbol(); - /** - * @private + /** + * @private */ function resolveDynamicComponent(component) { @@ -9468,8 +9459,8 @@ export default function vueFactory(exports) { return component || NULL_DYNAMIC_COMPONENT; } } - /** - * @private + /** + * @private */ @@ -9529,21 +9520,21 @@ export default function vueFactory(exports) { var blockStack = []; var currentBlock = null; - /** - * Open a block. - * This must be called before `createBlock`. It cannot be part of `createBlock` - * because the children of the block are evaluated before `createBlock` itself - * is called. The generated code typically looks like this: - * - * ```js - * function render() { - * return (openBlock(),createBlock('div', null, [...])) - * } - * ``` - * disableTracking is true when creating a v-for fragment block, since a v-for - * fragment always diffs its children. - * - * @private + /** + * Open a block. + * This must be called before `createBlock`. It cannot be part of `createBlock` + * because the children of the block are evaluated before `createBlock` itself + * is called. The generated code typically looks like this: + * + * ```js + * function render() { + * return (openBlock(),createBlock('div', null, [...])) + * } + * ``` + * disableTracking is true when creating a v-for fragment block, since a v-for + * fragment always diffs its children. + * + * @private */ function openBlock() { @@ -9561,32 +9552,32 @@ export default function vueFactory(exports) { var isBlockTreeEnabled = 1; - /** - * Block tracking sometimes needs to be disabled, for example during the - * creation of a tree that needs to be cached by v-once. The compiler generates - * code like this: - * - * ``` js - * _cache[1] || ( - * setBlockTracking(-1), - * _cache[1] = createVNode(...), - * setBlockTracking(1), - * _cache[1] - * ) - * ``` - * - * @private + /** + * Block tracking sometimes needs to be disabled, for example during the + * creation of a tree that needs to be cached by v-once. The compiler generates + * code like this: + * + * ``` js + * _cache[1] || ( + * setBlockTracking(-1), + * _cache[1] = createVNode(...), + * setBlockTracking(1), + * _cache[1] + * ) + * ``` + * + * @private */ function setBlockTracking(value) { isBlockTreeEnabled += value; } - /** - * Create a block root vnode. Takes the same exact arguments as `createVNode`. - * A block root keeps track of dynamic nodes within the block in the - * `dynamicChildren` array. - * - * @private + /** + * Create a block root vnode. Takes the same exact arguments as `createVNode`. + * A block root keeps track of dynamic nodes within the block in the + * `dynamicChildren` array. + * + * @private */ @@ -9623,11 +9614,11 @@ export default function vueFactory(exports) { } var vnodeArgsTransformer; - /** - * Internal API for registering an arguments transform for createVNode - * used for creating stubs in the test-utils - * It is *internal* but needs to be exposed for test-utils to pick up proper - * typings + /** + * Internal API for registering an arguments transform for createVNode + * used for creating stubs in the test-utils + * It is *internal* but needs to be exposed for test-utils to pick up proper + * typings */ function transformVNodeArgs(transformer) { @@ -9785,9 +9776,9 @@ export default function vueFactory(exports) { // component nodes also should always be patched, because even if the // component doesn't need to update, it needs to persist the instance on to // the next vnode so that it can be properly unmounted later. - patchFlag > 0 || shapeFlag & 6 + patchFlag > 0 || shapeFlag & 6) /* COMPONENT */ - ) && // the EVENTS flag is only for hydration and if it is the only flag, the + && // the EVENTS flag is only for hydration and if it is the only flag, the // vnode should not be considered dynamic due to handler caching. patchFlag !== 32 /* HYDRATE_EVENTS */ @@ -9855,9 +9846,9 @@ export default function vueFactory(exports) { }; return cloned; } - /** - * Dev only, for HMR of hoisted vnodes reused in v-for - * https://github.com/vitejs/vite/issues/2022 + /** + * Dev only, for HMR of hoisted vnodes reused in v-for + * https://github.com/vitejs/vite/issues/2022 */ @@ -9870,8 +9861,8 @@ export default function vueFactory(exports) { return cloned; } - /** - * @private + /** + * @private */ @@ -9880,8 +9871,8 @@ export default function vueFactory(exports) { var flag = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; return createVNode(Text, null, text, flag); } - /** - * @private + /** + * @private */ @@ -9892,8 +9883,8 @@ export default function vueFactory(exports) { vnode.staticCount = numberOfNodes; return vnode; } - /** - * @private + /** + * @private */ @@ -9933,9 +9924,8 @@ export default function vueFactory(exports) { if (children == null) { children = null; } else if (isArray(children)) { - type = 16 + type = 16; /* ARRAY_CHILDREN */ - ; } else if (typeof children === 'object') { if (shapeFlag & 1 /* ELEMENT */ @@ -9954,9 +9944,9 @@ export default function vueFactory(exports) { return; } else { - type = 32 + type = 32; /* SLOTS_CHILDREN */ - ; + var slotFlag = children._; if (!slotFlag && !(InternalObjectKey in children)) { @@ -9969,16 +9959,14 @@ export default function vueFactory(exports) { if (currentRenderingInstance.slots._ === 1 /* STABLE */ ) { - children._ = 1 + children._ = 1; /* STABLE */ - ; } else { - children._ = 2 + children._ = 2; /* DYNAMIC */ - ; - vnode.patchFlag |= 1024 + + vnode.patchFlag |= 1024; /* DYNAMIC_SLOTS */ - ; } } } @@ -9987,23 +9975,21 @@ export default function vueFactory(exports) { default: children, _ctx: currentRenderingInstance }; - type = 32 + type = 32; /* SLOTS_CHILDREN */ - ; } else { children = String(children); // force teleport children to array so it can be moved around if (shapeFlag & 64 /* TELEPORT */ ) { - type = 16 + type = 16; /* ARRAY_CHILDREN */ - ; + children = [createTextVNode(children)]; } else { - type = 8 + type = 8; /* TEXT_CHILDREN */ - ; } } @@ -10039,8 +10025,8 @@ export default function vueFactory(exports) { return ret; } - /** - * Actual implementation + /** + * Actual implementation */ @@ -10082,9 +10068,9 @@ export default function vueFactory(exports) { return ret; } - /** - * Compiler runtime helper for creating dynamic slots object - * @private + /** + * Compiler runtime helper for creating dynamic slots object + * @private */ @@ -10104,9 +10090,9 @@ export default function vueFactory(exports) { return slots; } - /** - * Compiler runtime helper for rendering `` - * @private + /** + * Compiler runtime helper for rendering `` + * @private */ @@ -10165,9 +10151,9 @@ export default function vueFactory(exports) { return true; }) ? vnodes : null; } - /** - * For prefixing keys in v-on="obj" with "on" - * @private + /** + * For prefixing keys in v-on="obj" with "on" + * @private */ @@ -10185,10 +10171,10 @@ export default function vueFactory(exports) { return ret; } - /** - * #2437 In Vue 3, functional components do not have a public instance proxy but - * they exist in the internal parent chain. For code that relies on traversing - * public $parent chains, skip functional ones and go to the parent instead. + /** + * #2437 In Vue 3, functional components do not have a public instance proxy but + * they exist in the internal parent chain. For code that relies on traversing + * public $parent chains, skip functional ones and go to the parent instead. */ @@ -10302,31 +10288,30 @@ export default function vueFactory(exports) { // default: just fallthrough } } else if (setupState !== EMPTY_OBJ && hasOwn(setupState, key)) { - accessCache[key] = 0 + accessCache[key] = 0; /* SETUP */ - ; + return setupState[key]; } else if (data !== EMPTY_OBJ && hasOwn(data, key)) { - accessCache[key] = 1 + accessCache[key] = 1; /* DATA */ - ; + return data[key]; } else if ( // only cache other properties when instance has declared (thus stable) // props (normalizedProps = instance.propsOptions[0]) && hasOwn(normalizedProps, key)) { - accessCache[key] = 2 + accessCache[key] = 2; /* PROPS */ - ; + return props[key]; } else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) { - accessCache[key] = 3 + accessCache[key] = 3; /* CONTEXT */ - ; + return ctx[key]; } else if (shouldCacheAccess) { - accessCache[key] = 4 + accessCache[key] = 4; /* OTHER */ - ; } } @@ -10335,7 +10320,7 @@ export default function vueFactory(exports) { if (publicGetter) { if (key === '$attrs') { - track(instance, "get" + track(instance, 'get' /* GET */ , key); process.env.NODE_ENV !== 'production' && markAttrsAccessed(); @@ -10347,9 +10332,9 @@ export default function vueFactory(exports) { return cssModule; } else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) { // user may set custom properties to `this` that start with `$` - accessCache[key] = 3 + accessCache[key] = 3; /* CONTEXT */ - ; + return ctx[key]; } else if ( // window properties globalProperties = appContext.config.globalProperties, hasOwn(globalProperties, key)) { @@ -10620,9 +10605,8 @@ export default function vueFactory(exports) { } function isStatefulComponent(instance) { - return instance.vnode.shapeFlag & 4 + return instance.vnode.shapeFlag & 4; /* STATEFUL_COMPONENT */ - ; } var isInSSRComponentSetup = false; @@ -10756,9 +10740,9 @@ export default function vueFactory(exports) { var isRuntimeOnly = function isRuntimeOnly() { return !compile; }; - /** - * For runtime-dom to register the compiler. - * Note the exported method uses any to avoid d.ts relying on the compiler types. + /** + * For runtime-dom to register the compiler. + * Note the exported method uses any to avoid d.ts relying on the compiler types. */ @@ -10985,23 +10969,23 @@ export default function vueFactory(exports) { return null; } - /** - * @deprecated use `defineEmits` instead. + /** + * @deprecated use `defineEmits` instead. */ var defineEmit = defineEmits; - /** - * Vue `