提交 4a5fc2d6 编写于 作者: fxy060608's avatar fxy060608

fix: alias

上级 c92355dd
......@@ -44,7 +44,7 @@ export const moduleAliasFormatter: Formatter = {
}
if (lang) {
return `预编译器错误:代码使用了${lang}语言,但未安装相应的编译器插件,请前往插件市场安装该插件:
https://ext.dcloud.net.cn/plugin?name=${preprocessor}`
https://ext.dcloud.net.cn/plugin?name=${preprocessor}`
}
return msg
},
......
"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 path_1 = __importDefault(require("path"));
const uni_cli_shared_1 = require("@dcloudio/uni-cli-shared");
const css_1 = require("./plugins/css");
const cssScoped_1 = require("./plugins/cssScoped");
const inject_1 = require("./plugins/inject");
......@@ -33,6 +39,12 @@ const UniH5Plugin = {
},
},
config(config, env) {
if (uni_cli_shared_1.isInHBuilderX()) {
if (!fs_1.default.existsSync(path_1.default.resolve(process.env.UNI_INPUT_DIR, 'index.html'))) {
console.error(`请确认您的项目模板是否支持vue3:根目录缺少 index.html`);
process.exit();
}
}
return {
optimizeDeps: {
exclude: ['@dcloudio/uni-h5', '@dcloudio/uni-h5-vue'],
......
import fs from 'fs'
import path from 'path'
import { ResolvedConfig } from 'vite'
import { UniVitePlugin } from '@dcloudio/uni-cli-shared'
import { isInHBuilderX, UniVitePlugin } from '@dcloudio/uni-cli-shared'
import { uniCssPlugin } from './plugins/css'
import { uniCssScopedPlugin } from './plugins/cssScoped'
import { uniInjectPlugin } from './plugins/inject'
......@@ -36,6 +38,14 @@ const UniH5Plugin: UniVitePlugin = {
},
},
config(config, env) {
if (isInHBuilderX()) {
if (
!fs.existsSync(path.resolve(process.env.UNI_INPUT_DIR, 'index.html'))
) {
console.error(`请确认您的项目模板是否支持vue3:根目录缺少 index.html`)
process.exit()
}
}
return {
optimizeDeps: {
exclude: ['@dcloudio/uni-h5', '@dcloudio/uni-h5-vue'],
......
......@@ -10,6 +10,7 @@
}
]
},
"external": ["@vue/shared"],
"replacements": {
"__PLATFORM__": "\"mp-weixin\""
}
......
import { isFunction, isSymbol, extend, isMap, isObject, toRawType, def, isArray, isString, isPromise, toHandlerKey, remove, EMPTY_OBJ, camelize, capitalize, normalizeClass, normalizeStyle, isOn, NOOP, isGloballyWhitelisted, isIntegerKey, hasOwn, hasChanged, invokeArrayFns as invokeArrayFns$1, makeMap, isSet, NO, toNumber, hyphenate, isReservedProp, EMPTY_ARR, toTypeString } from '@vue/shared';
import { isSymbol, extend, isMap, isObject, toRawType, def, isArray, isString, isFunction, isPromise, toHandlerKey, remove, EMPTY_OBJ, camelize, capitalize, normalizeClass, normalizeStyle, isOn, NOOP, isGloballyWhitelisted, isIntegerKey, hasOwn, hasChanged, invokeArrayFns as invokeArrayFns$1, makeMap, isSet, NO, toNumber, hyphenate, isReservedProp, EMPTY_ARR, toTypeString } from '@vue/shared';
export { camelize } from '@vue/shared';
import { injectHook as injectHook$1 } from 'vue';
const invokeArrayFns = (fns, arg) => {
let ret;
......@@ -11,136 +10,6 @@ const invokeArrayFns = (fns, arg) => {
};
const ON_ERROR = 'onError';
function applyOptions$1(options, instance, publicThis) {
if (!publicThis.$mpType) {
// 仅 App,Page 类型支持 on 生命周期
return;
}
Object.keys(options).forEach((name) => {
if (name.indexOf('on') === 0) {
const hook = options[name];
if (isFunction(hook)) {
injectHook$1(name, hook.bind(publicThis), instance);
}
}
});
}
function set$2(target, key, val) {
return (target[key] = val);
}
function hasHook(name) {
const hooks = this.$[name];
if (hooks && hooks.length) {
return true;
}
return false;
}
function callHook(name, args) {
const hooks = this.$[name];
return hooks && invokeArrayFns(hooks, args);
}
function errorHandler(err, instance, info) {
if (!instance) {
throw err;
}
const app = getApp();
if (!app || !app.$vm) {
throw err;
}
{
app.$vm.$callHook(ON_ERROR, err, info);
}
}
function b64DecodeUnicode(str) {
return decodeURIComponent(atob(str)
.split('')
.map(function (c) {
return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);
})
.join(''));
}
function getCurrentUserInfo() {
const token = uni.getStorageSync('uni_id_token') || '';
const tokenArr = token.split('.');
if (!token || tokenArr.length !== 3) {
return {
uid: null,
role: [],
permission: [],
tokenExpired: 0,
};
}
let userInfo;
try {
userInfo = JSON.parse(b64DecodeUnicode(tokenArr[1]));
}
catch (error) {
throw new Error('获取当前用户信息出错,详细错误信息为:' + error.message);
}
userInfo.tokenExpired = userInfo.exp * 1000;
delete userInfo.exp;
delete userInfo.iat;
return userInfo;
}
function uniIdMixin(globalProperties) {
globalProperties.uniIDHasRole = function (roleId) {
const { role } = getCurrentUserInfo();
return role.indexOf(roleId) > -1;
};
globalProperties.uniIDHasPermission = function (permissionId) {
const { permission } = getCurrentUserInfo();
return this.uniIDHasRole('admin') || permission.indexOf(permissionId) > -1;
};
globalProperties.uniIDTokenValid = function () {
const { tokenExpired } = getCurrentUserInfo();
return tokenExpired > Date.now();
};
}
function initApp(app) {
const appConfig = app._context.config;
if (isFunction(app._component.onError)) {
appConfig.errorHandler = errorHandler;
}
const globalProperties = appConfig.globalProperties;
uniIdMixin(globalProperties);
{
// 小程序,待重构,不再挂靠全局
globalProperties.$hasHook = hasHook;
globalProperties.$callHook = callHook;
}
if (__VUE_OPTIONS_API__) {
globalProperties.$set = set$2;
globalProperties.$applyOptions = applyOptions$1;
}
}
var plugin = {
install(app) {
initApp(app);
const globalProperties = app._context.config.globalProperties;
const oldCallHook = globalProperties.$callHook;
globalProperties.$callHook = function callHook(name, args) {
if (name === 'mounted') {
oldCallHook.call(this, 'bm'); // beforeMount
this.$.isMounted = true;
name = 'm';
}
return oldCallHook.call(this, name, args);
};
const oldMount = app.mount;
app.mount = function mount(rootContainer) {
const instance = oldMount.call(app, rootContainer);
// @ts-ignore
createMiniProgramApp(instance);
return instance;
};
},
};
const targetMap = new WeakMap();
const effectStack = [];
let activeEffect;
......@@ -415,7 +284,7 @@ function createGetter(isReadonly = false, shallow = false) {
return res;
};
}
const set = /*#__PURE__*/ createSetter();
const set$1 = /*#__PURE__*/ createSetter();
const shallowSet = /*#__PURE__*/ createSetter(true);
function createSetter(shallow = false) {
return function set(target, key, value, receiver) {
......@@ -465,7 +334,7 @@ function ownKeys(target) {
}
const mutableHandlers = {
get,
set,
set: set$1,
deleteProperty,
has,
ownKeys
......@@ -547,7 +416,7 @@ function add(value) {
}
return this;
}
function set$1(key, value) {
function set$1$1(key, value) {
value = toRaw(value);
const target = toRaw(this);
const { has, get } = getProto(target);
......@@ -667,7 +536,7 @@ const mutableInstrumentations = {
},
has: has$1,
add,
set: set$1,
set: set$1$1,
delete: deleteEntry,
clear,
forEach: createForEach(false, false)
......@@ -681,7 +550,7 @@ const shallowInstrumentations = {
},
has: has$1,
add,
set: set$1,
set: set$1$1,
delete: deleteEntry,
clear,
forEach: createForEach(false, true)
......@@ -2763,7 +2632,7 @@ function createDuplicateChecker() {
};
}
let shouldCacheAccess = true;
function applyOptions(instance, options, deferredData = [], deferredWatch = [], deferredProvide = [], asMixin = false) {
function applyOptions$1(instance, options, deferredData = [], deferredWatch = [], deferredProvide = [], asMixin = false) {
const {
// composition
mixins, extends: extendsOptions,
......@@ -2791,7 +2660,7 @@ function applyOptions(instance, options, deferredData = [], deferredWatch = [],
}
// extending a base component...
if (extendsOptions) {
applyOptions(instance, extendsOptions, deferredData, deferredWatch, deferredProvide, true);
applyOptions$1(instance, extendsOptions, deferredData, deferredWatch, deferredProvide, true);
}
// local mixins
if (mixins) {
......@@ -3058,7 +2927,7 @@ function callHookWithMixinAndExtends(name, type, options, instance) {
}
function applyMixins(instance, mixins, deferredData, deferredWatch, deferredProvide) {
for (let i = 0; i < mixins.length; i++) {
applyOptions(instance, mixins[i], deferredData, deferredWatch, deferredProvide, true);
applyOptions$1(instance, mixins[i], deferredData, deferredWatch, deferredProvide, true);
}
}
function resolveData(instance, dataFn, publicThis) {
......@@ -3633,7 +3502,7 @@ function finishComponentSetup(instance, isSSR) {
if (__VUE_OPTIONS_API__) {
currentInstance = instance;
pauseTracking();
applyOptions(instance, Component);
applyOptions$1(instance, Component);
resetTracking();
currentInstance = null;
}
......@@ -4179,9 +4048,144 @@ function createVueApp(rootComponent, rootProps = null) {
return app;
}
function withModifiers() { }
function createVNode$1() { }
function applyOptions(options, instance, publicThis) {
const mpType = options.mpType || publicThis.$mpType;
if (!mpType) {
// 仅 App,Page 类型支持 on 生命周期
return;
}
Object.keys(options).forEach((name) => {
if (name.indexOf('on') === 0) {
const hook = options[name];
if (isFunction(hook)) {
injectHook(name, hook.bind(publicThis), instance);
}
}
});
}
function set(target, key, val) {
return (target[key] = val);
}
function hasHook(name) {
const hooks = this.$[name];
if (hooks && hooks.length) {
return true;
}
return false;
}
function callHook(name, args) {
const hooks = this.$[name];
return hooks && invokeArrayFns(hooks, args);
}
function errorHandler(err, instance, info) {
if (!instance) {
throw err;
}
const app = getApp();
if (!app || !app.$vm) {
throw err;
}
{
app.$vm.$callHook(ON_ERROR, err, info);
}
}
function b64DecodeUnicode(str) {
return decodeURIComponent(atob(str)
.split('')
.map(function (c) {
return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);
})
.join(''));
}
function getCurrentUserInfo() {
const token = uni.getStorageSync('uni_id_token') || '';
const tokenArr = token.split('.');
if (!token || tokenArr.length !== 3) {
return {
uid: null,
role: [],
permission: [],
tokenExpired: 0,
};
}
let userInfo;
try {
userInfo = JSON.parse(b64DecodeUnicode(tokenArr[1]));
}
catch (error) {
throw new Error('获取当前用户信息出错,详细错误信息为:' + error.message);
}
userInfo.tokenExpired = userInfo.exp * 1000;
delete userInfo.exp;
delete userInfo.iat;
return userInfo;
}
function uniIdMixin(globalProperties) {
globalProperties.uniIDHasRole = function (roleId) {
const { role } = getCurrentUserInfo();
return role.indexOf(roleId) > -1;
};
globalProperties.uniIDHasPermission = function (permissionId) {
const { permission } = getCurrentUserInfo();
return this.uniIDHasRole('admin') || permission.indexOf(permissionId) > -1;
};
globalProperties.uniIDTokenValid = function () {
const { tokenExpired } = getCurrentUserInfo();
return tokenExpired > Date.now();
};
}
function initApp(app) {
const appConfig = app._context.config;
if (isFunction(app._component.onError)) {
appConfig.errorHandler = errorHandler;
}
const globalProperties = appConfig.globalProperties;
uniIdMixin(globalProperties);
{
// 小程序,待重构,不再挂靠全局
globalProperties.$hasHook = hasHook;
globalProperties.$callHook = callHook;
}
if (__VUE_OPTIONS_API__) {
globalProperties.$set = set;
globalProperties.$applyOptions = applyOptions;
}
}
var plugin = {
install(app) {
initApp(app);
const globalProperties = app._context.config.globalProperties;
const oldCallHook = globalProperties.$callHook;
globalProperties.$callHook = function callHook(name, args) {
if (name === 'mounted') {
oldCallHook.call(this, 'bm'); // beforeMount
this.$.isMounted = true;
name = 'm';
}
return oldCallHook.call(this, name, args);
};
const oldMount = app.mount;
app.mount = function mount(rootContainer) {
const instance = oldMount.call(app, rootContainer);
// @ts-ignore
createMiniProgramApp(instance);
return instance;
};
},
};
function createApp(rootComponent, rootProps = null) {
rootComponent && (rootComponent.mpType = 'app');
return createVueApp(rootComponent, rootProps).use(plugin);
}
}
const createSSRApp = createApp;
export { callWithAsyncErrorHandling, callWithErrorHandling, computed$1 as computed, createApp, createVueApp, customRef, defineComponent, defineEmit, defineProps, getCurrentInstance, inject, injectHook, isInSSRComponentSetup, isProxy, isReactive, isReadonly, isRef, logError, markRaw, nextTick, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onRenderTracked, onRenderTriggered, onUnmounted, onUpdated, provide, reactive, readonly, ref, resolveDirective, shallowReactive, shallowReadonly, shallowRef, toRaw, toRef, toRefs, triggerRef, unref, version, warn, watch, watchEffect, withDirectives };
export { callWithAsyncErrorHandling, callWithErrorHandling, computed$1 as computed, createApp, createSSRApp, createVNode$1 as createVNode, createVueApp, customRef, defineComponent, defineEmit, defineProps, getCurrentInstance, inject, injectHook, isInSSRComponentSetup, isProxy, isReactive, isReadonly, isRef, logError, markRaw, nextTick, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onRenderTracked, onRenderTriggered, onUnmounted, onUpdated, provide, reactive, readonly, ref, resolveDirective, shallowReactive, shallowReadonly, shallowRef, toRaw, toRef, toRefs, triggerRef, unref, version, warn, watch, watchEffect, withDirectives, withModifiers };
import { EMPTY_OBJ, isArray, isMap, isIntegerKey, isSymbol, extend, hasOwn, isObject, hasChanged, makeMap, capitalize, toRawType, def, isFunction, NOOP, isString, isPromise, toHandlerKey, toNumber, hyphenate, camelize, isOn, isReservedProp, EMPTY_ARR, remove, isSet, NO, normalizeClass, normalizeStyle, isGloballyWhitelisted, toTypeString, invokeArrayFns } from '@vue/shared';
export { camelize } from '@vue/shared';
import { EMPTY_OBJ, isArray, isMap, isIntegerKey, isSymbol, extend, hasOwn, isObject, hasChanged, makeMap, capitalize, toRawType, def, isFunction, NOOP, isString, isPromise, toHandlerKey, toNumber, hyphenate, camelize, isOn, isReservedProp, EMPTY_ARR, remove, isSet, NO, normalizeClass, normalizeStyle, isGloballyWhitelisted, toTypeString, invokeArrayFns } from '@vue/shared';
export { camelize } from '@vue/shared';
const targetMap = new WeakMap();
const effectStack = [];
let activeEffect;
......@@ -188,8 +188,8 @@ function trigger(target, type, key, newValue, oldValue, oldTarget) {
}
};
effects.forEach(run);
}
}
const isNonTrackableKeys = /*#__PURE__*/ makeMap(`__proto__,__v_isRef,__isVue`);
const builtInSymbols = new Set(Object.getOwnPropertyNames(Symbol)
.map(key => Symbol[key])
......@@ -354,8 +354,8 @@ const shallowReactiveHandlers = extend({}, mutableHandlers, {
// retain the reactivity of the normal readonly object.
const shallowReadonlyHandlers = extend({}, readonlyHandlers, {
get: shallowReadonlyGet
});
});
const toReactive = (value) => isObject(value) ? reactive(value) : value;
const toReadonly = (value) => isObject(value) ? readonly(value) : value;
const toShallow = (value) => value;
......@@ -630,8 +630,8 @@ function checkIdentityKeys(target, has, key) {
`Avoid differentiating between the raw and reactive versions ` +
`of an object and only use the reactive version if possible.`);
}
}
}
const reactiveMap = new WeakMap();
const shallowReactiveMap = new WeakMap();
const readonlyMap = new WeakMap();
......@@ -731,8 +731,8 @@ function toRaw(observed) {
function markRaw(value) {
def(value, "__v_skip" /* SKIP */, true);
return value;
}
}
const convert = (val) => isObject(val) ? reactive(val) : val;
function isRef(r) {
return Boolean(r && r.__v_isRef === true);
......@@ -836,8 +836,8 @@ function toRef(object, key) {
return isRef(object[key])
? object[key]
: new ObjectRefImpl(object, key);
}
}
class ComputedRefImpl {
constructor(getter, _setter, isReadonly) {
this._setter = _setter;
......@@ -884,8 +884,8 @@ function computed(getterOrOptions) {
setter = getterOrOptions.set;
}
return new ComputedRefImpl(getter, setter, isFunction(getterOrOptions) || !getterOrOptions.set);
}
}
const stack = [];
function pushWarningContext(vnode) {
stack.push(vnode);
......@@ -998,8 +998,8 @@ function formatProp(key, value, raw) {
value = toRaw(value);
return raw ? value : [`${key}=`, value];
}
}
}
const ErrorTypeStrings = {
["bc" /* BEFORE_CREATE */]: 'beforeCreate hook',
["c" /* CREATED */]: 'created hook',
......@@ -1108,8 +1108,8 @@ function logError(err, type, contextVNode, throwInDev = true) {
// recover in prod to reduce the impact on end-user
console.error(err);
}
}
}
let isFlushing = false;
let isFlushPending = false;
// fixed by xxxxxx
......@@ -1294,8 +1294,8 @@ function checkRecursiveUpdates(seen, fn) {
seen.set(fn, count + 1);
}
}
}
}
function emit(instance, event, ...rawArgs) {
const props = instance.vnode.props || EMPTY_OBJ;
if ((process.env.NODE_ENV !== 'production')) {
......@@ -1414,21 +1414,21 @@ function isEmitListener(options, key) {
return (hasOwn(options, key[0].toLowerCase() + key.slice(1)) ||
hasOwn(options, hyphenate(key)) ||
hasOwn(options, key));
}
}
let isRenderingCompiledSlot = 0;
const setCompiledSlotRendering = (n) => (isRenderingCompiledSlot += n);
const setCompiledSlotRendering = (n) => (isRenderingCompiledSlot += n);
/**
* mark the current rendering instance for asset resolution (e.g.
* resolveComponent, resolveDirective) during render
*/
let currentRenderingInstance = null;
let currentScopeId = null;
let currentScopeId = null;
function markAttrsAccessed() {
}
}
function initProps(instance, rawProps, isStateful, // result of bitwise flag comparison
isSSR = false) {
const props = {};
......@@ -1747,8 +1747,8 @@ function isExplicable(type) {
*/
function isBoolean(...args) {
return args.some(elem => elem.toLowerCase() === 'boolean');
}
}
function injectHook(type, hook, target = currentInstance, prepend = false) {
if (target) {
const hooks = target[type] || (target[type] = []);
......@@ -1801,8 +1801,8 @@ const onRenderTriggered = createHook("rtg" /* RENDER_TRIGGERED */);
const onRenderTracked = createHook("rtc" /* RENDER_TRACKED */);
const onErrorCaptured = (hook, target = currentInstance) => {
injectHook("ec" /* ERROR_CAPTURED */, hook, target);
};
};
// Simple effect.
function watchEffect(effect, options) {
return doWatch(effect, null, options);
......@@ -2006,8 +2006,8 @@ function traverse(value, seen = new Set()) {
}
}
return value;
}
}
const isKeepAlive = (vnode) => vnode.type.__isKeepAlive;
function onActivated(hook, target) {
registerKeepAliveHook(hook, "a" /* ACTIVATED */, target);
......@@ -2054,15 +2054,15 @@ function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) {
onUnmounted(() => {
remove(keepAliveRoot[type], injected);
}, target);
}
}
/**
Runtime helper for applying directives to a vnode. Example usage:
const comp = resolveComponent('comp')
const foo = resolveDirective('foo')
const bar = resolveDirective('bar')
return withDirectives(h(comp), [
[foo, this.x],
[bar, this.y]
......@@ -2082,8 +2082,8 @@ function withDirectives(vnode, directives) {
(process.env.NODE_ENV !== 'production') && warn(`withDirectives can only be used inside render functions.`);
return vnode;
}
}
}
function createAppContext() {
return {
app: null,
......@@ -2210,17 +2210,17 @@ function createAppAPI() {
});
return app;
};
}
}
// implementation, close to no-op
function defineComponent(options) {
return isFunction(options) ? { setup: options, name: options.name } : options;
}
const queuePostRenderEffect = queuePostFlushCb;
const isTeleport = (type) => type.__isTeleport;
}
const queuePostRenderEffect = queuePostFlushCb;
const isTeleport = (type) => type.__isTeleport;
const COMPONENTS = 'components';
const DIRECTIVES = 'directives';
const NULL_DYNAMIC_COMPONENT = Symbol();
......@@ -2270,8 +2270,8 @@ function resolve(registry, name) {
(registry[name] ||
registry[camelize(name)] ||
registry[capitalize(camelize(name))]));
}
}
const Fragment = Symbol((process.env.NODE_ENV !== 'production') ? 'Fragment' : undefined);
const Text = Symbol((process.env.NODE_ENV !== 'production') ? 'Text' : undefined);
const Comment = Symbol((process.env.NODE_ENV !== 'production') ? 'Comment' : undefined);
......@@ -2559,8 +2559,8 @@ function mergeProps(...args) {
}
}
return ret;
}
}
function provide(key, value) {
if (!currentInstance) {
if ((process.env.NODE_ENV !== 'production')) {
......@@ -2609,8 +2609,8 @@ function inject(key, defaultValue, treatDefaultAsFactory = false) {
else if ((process.env.NODE_ENV !== 'production')) {
warn(`inject() can only be used inside setup() or functional components.`);
}
}
}
function createDuplicateChecker() {
const cache = Object.create(null);
return (type, key) => {
......@@ -3018,8 +3018,8 @@ function mergeOptions(to, from, instance) {
to[key] = from[key];
}
}
}
}
/**
* #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
......@@ -3281,8 +3281,8 @@ function exposeSetupStateOnRenderContext(instance) {
set: NOOP
});
});
}
}
const emptyAppContext = createAppContext();
let uid$2 = 0;
function createComponentInstance(vnode, parent, suspense) {
......@@ -3598,14 +3598,14 @@ function formatComponentName(instance, Component, isRoot = false) {
}
function isClassComponent(value) {
return isFunction(value) && '__vccOpts' in value;
}
}
function computed$1(getterOrOptions) {
const c = computed(getterOrOptions);
recordInstanceBoundEffect(c.effect);
return c;
}
}
// implementation
function defineProps() {
if ((process.env.NODE_ENV !== 'production')) {
......@@ -3623,11 +3623,11 @@ function defineEmit() {
`compiled away and passing it at runtime has no effect.`);
}
return null;
}
}
// Core API ------------------------------------------------------------------
const version = "3.0.9";
const version = "3.0.9";
// import deepCopy from './deepCopy'
/**
* https://raw.githubusercontent.com/Tencent/westore/master/packages/westore/utils/diff.js
......@@ -3738,8 +3738,8 @@ function _diff(current, pre, path, result) {
}
function setResult(result, k, v) {
result[k] = v; //deepCopy(v)
}
}
function hasComponentEffect(instance) {
return queue.includes(instance.update);
}
......@@ -3806,8 +3806,8 @@ function nextTick$1(instance, fn) {
return new Promise(resolve => {
_resolve = resolve;
});
}
}
function getMPInstanceData(instance, keys) {
const data = instance.data;
const ret = Object.create(null);
......@@ -3884,14 +3884,14 @@ function patch(instance) {
flushCallbacks(instance);
}
}
}
}
function initAppConfig(appConfig) {
appConfig.globalProperties.$nextTick = function $nextTick(fn) {
return nextTick$1(this.$, fn);
};
}
}
function onApplyOptions(options, instance, publicThis) {
instance.appContext.config.globalProperties.$applyOptions(options, instance, publicThis);
const computedOptions = options.computed;
......@@ -3907,8 +3907,8 @@ function onApplyOptions(options, instance, publicThis) {
}
// remove
delete instance.ctx.$onApplyOptions;
}
}
var MPType;
(function (MPType) {
MPType["APP"] = "app";
......@@ -4037,6 +4037,9 @@ function createVueApp(rootComponent, rootProps = null) {
warn(`Cannot unmount an app.`);
};
return app;
}
export { callWithAsyncErrorHandling, callWithErrorHandling, computed$1 as computed, createVueApp, customRef, defineComponent, defineEmit, defineProps, getCurrentInstance, inject, injectHook, isInSSRComponentSetup, isProxy, isReactive, isReadonly, isRef, logError, markRaw, nextTick, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onRenderTracked, onRenderTriggered, onUnmounted, onUpdated, provide, reactive, readonly, ref, resolveDirective, shallowReactive, shallowReadonly, shallowRef, toRaw, toRef, toRefs, triggerRef, unref, version, warn, watch, watchEffect, withDirectives };
}
function withModifiers() { }
function createVNode$1() { }
export { callWithAsyncErrorHandling, callWithErrorHandling, computed$1 as computed, createVNode$1 as createVNode, createVueApp, customRef, defineComponent, defineEmit, defineProps, getCurrentInstance, inject, injectHook, isInSSRComponentSetup, isProxy, isReactive, isReadonly, isRef, logError, markRaw, nextTick, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onRenderTracked, onRenderTriggered, onUnmounted, onUpdated, provide, reactive, readonly, ref, resolveDirective, shallowReactive, shallowReadonly, shallowRef, toRaw, toRef, toRefs, triggerRef, unref, version, warn, watch, watchEffect, withDirectives, withModifiers };
......@@ -5,5 +5,6 @@ export function createApp(rootComponent: unknown, rootProps = null) {
rootComponent && ((rootComponent as any).mpType = 'app')
return createVueApp(rootComponent, rootProps).use(plugin)
}
export const createSSRApp = createApp
// @ts-ignore
export * from '../lib/vue.runtime.esm.js'
......@@ -15,7 +15,8 @@ export function applyOptions(
instance: ComponentInternalInstance,
publicThis: ComponentPublicInstance
) {
if (!publicThis.$mpType) {
const mpType = options.mpType || publicThis.$mpType
if (!mpType) {
// 仅 App,Page 类型支持 on 生命周期
return
}
......@@ -27,7 +28,7 @@ export function applyOptions(
}
}
})
if (__PLATFORM__ === 'app' && publicThis.$mpType === 'page') {
if (__PLATFORM__ === 'app' && mpType === 'page') {
invokeHook(publicThis, ON_LOAD, instance.attrs.__pageQuery)
invokeHook(publicThis, ON_SHOW)
}
......
......@@ -17,7 +17,7 @@ export function createConfigResolved(options: VitePluginUniResolvedOptions) {
if (isWindows) {
// TODO 等 https://github.com/vitejs/vite/issues/3331 修复后,可以移除下列代码
const item = config.resolve.alias.find((item) =>
typeof item.find !== 'string' ? item.find.test('@') : false
typeof item.find !== 'string' ? item.find.test('@/') : false
)
if (item) {
item.customResolver = customResolver
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册