提交 38e11c3f 编写于 作者: fxy060608's avatar fxy060608

chore: bump vite from 4.1.4 to 4.2.1

上级 96e07ef9
......@@ -19,160 +19,160 @@
const hasOwnProperty = Object.prototype.hasOwnProperty;
const hasOwn = (val, key) => hasOwnProperty.call(val, key);
const ACTION_TYPE_PAGE_CREATE = 1;
const ACTION_TYPE_PAGE_CREATED = 2;
const ACTION_TYPE_CREATE = 3;
const ACTION_TYPE_INSERT = 4;
const ACTION_TYPE_REMOVE = 5;
const ACTION_TYPE_SET_ATTRIBUTE = 6;
const ACTION_TYPE_REMOVE_ATTRIBUTE = 7;
const ACTION_TYPE_ADD_EVENT = 8;
const ACTION_TYPE_REMOVE_EVENT = 9;
const ACTION_TYPE_SET_TEXT = 10;
const ACTION_TYPE_PAGE_CREATE = 1;
const ACTION_TYPE_PAGE_CREATED = 2;
const ACTION_TYPE_CREATE = 3;
const ACTION_TYPE_INSERT = 4;
const ACTION_TYPE_REMOVE = 5;
const ACTION_TYPE_SET_ATTRIBUTE = 6;
const ACTION_TYPE_REMOVE_ATTRIBUTE = 7;
const ACTION_TYPE_ADD_EVENT = 8;
const ACTION_TYPE_REMOVE_EVENT = 9;
const ACTION_TYPE_SET_TEXT = 10;
const ACTION_TYPE_ADD_WXS_EVENT = 12;
const ACTION_TYPE_DICT = 0;
function createGetDict(dict) {
if (!dict.length) {
return (v) => v;
}
const getDict = (value, includeValue = true) => {
if (typeof value === 'number') {
return dict[value];
}
const res = {};
value.forEach(([n, v]) => {
if (includeValue) {
res[getDict(n)] = getDict(v);
}
else {
res[getDict(n)] = v;
}
});
return res;
};
return getDict;
}
function decodeActions(actions) {
const [type, dict] = actions[0];
if (type !== ACTION_TYPE_DICT) {
return actions;
}
const getDict = createGetDict(dict);
return actions.map((action) => {
switch (action[0]) {
case ACTION_TYPE_DICT:
return action;
case ACTION_TYPE_PAGE_CREATE:
return decodePageCreateAction(action);
case ACTION_TYPE_PAGE_CREATED:
return decodePageCreatedAction(action);
case ACTION_TYPE_CREATE:
return decodeCreateAction(action, getDict);
case ACTION_TYPE_INSERT:
return decodeInsertAction(action, getDict);
case ACTION_TYPE_REMOVE:
return decodeRemoveAction(action);
case ACTION_TYPE_SET_ATTRIBUTE:
return decodeSetAttributeAction(action, getDict);
case ACTION_TYPE_REMOVE_ATTRIBUTE:
return decodeRemoveAttributeAction(action, getDict);
case ACTION_TYPE_ADD_EVENT:
return decodeAddEventAction(action, getDict);
case ACTION_TYPE_ADD_WXS_EVENT:
return decodeAddWxsEventAction(action, getDict);
case ACTION_TYPE_REMOVE_EVENT:
return decodeRemoveEventAction(action, getDict);
case ACTION_TYPE_SET_TEXT:
return decodeSetTextAction(action, getDict);
}
});
}
function decodePageCreateAction([, pageCreateData]) {
return ['pageCreate', pageCreateData];
}
function decodePageCreatedAction([]) {
return ['pageCreated'];
}
function decodeNodeJson(getDict, nodeJson) {
if (!nodeJson) {
return;
}
if (hasOwn(nodeJson, 'a')) {
nodeJson.a = getDict(nodeJson.a);
}
if (hasOwn(nodeJson, 'e')) {
nodeJson.e = getDict(nodeJson.e, false);
}
if (hasOwn(nodeJson, 'w')) {
nodeJson.w = getWxsEventDict(nodeJson.w, getDict);
}
if (hasOwn(nodeJson, 's')) {
nodeJson.s = getDict(nodeJson.s);
}
if (hasOwn(nodeJson, 't')) {
nodeJson.t = getDict(nodeJson.t);
}
return nodeJson;
}
function getWxsEventDict(w, getDict) {
const res = {};
w.forEach(([name, [wxsEvent, flag]]) => {
res[getDict(name)] = [getDict(wxsEvent), flag];
});
return res;
}
function decodeCreateAction([, nodeId, nodeName, parentNodeId, refNodeId, nodeJson], getDict) {
return [
'create',
nodeId,
getDict(nodeName),
parentNodeId,
refNodeId,
decodeNodeJson(getDict, nodeJson),
];
}
function decodeInsertAction([, ...action], getDict) {
return [
'insert',
action[0],
action[1],
action[2],
action[3] ? decodeNodeJson(getDict, action[3]) : {},
];
}
function decodeRemoveAction([, ...action]) {
return ['remove', ...action];
}
function decodeAddEventAction([, ...action], getDict) {
return ['addEvent', action[0], getDict(action[1]), action[2]];
}
function decodeAddWxsEventAction([, ...action], getDict) {
return [
'addWxsEvent',
action[0],
getDict(action[1]),
getDict(action[2]),
action[3],
];
}
function decodeRemoveEventAction([, ...action], getDict) {
return ['removeEvent', action[0], getDict(action[1])];
}
function decodeSetAttributeAction([, ...action], getDict) {
return [
'setAttr',
action[0],
getDict(action[1]),
getDict(action[2]),
];
}
function decodeRemoveAttributeAction([, ...action], getDict) {
return ['removeAttr', action[0], getDict(action[1])];
}
function decodeSetTextAction([, ...action], getDict) {
return ['setText', action[0], getDict(action[1])];
function createGetDict(dict) {
if (!dict.length) {
return (v) => v;
}
const getDict = (value, includeValue = true) => {
if (typeof value === 'number') {
return dict[value];
}
const res = {};
value.forEach(([n, v]) => {
if (includeValue) {
res[getDict(n)] = getDict(v);
}
else {
res[getDict(n)] = v;
}
});
return res;
};
return getDict;
}
function decodeActions(actions) {
const [type, dict] = actions[0];
if (type !== ACTION_TYPE_DICT) {
return actions;
}
const getDict = createGetDict(dict);
return actions.map((action) => {
switch (action[0]) {
case ACTION_TYPE_DICT:
return action;
case ACTION_TYPE_PAGE_CREATE:
return decodePageCreateAction(action);
case ACTION_TYPE_PAGE_CREATED:
return decodePageCreatedAction(action);
case ACTION_TYPE_CREATE:
return decodeCreateAction(action, getDict);
case ACTION_TYPE_INSERT:
return decodeInsertAction(action, getDict);
case ACTION_TYPE_REMOVE:
return decodeRemoveAction(action);
case ACTION_TYPE_SET_ATTRIBUTE:
return decodeSetAttributeAction(action, getDict);
case ACTION_TYPE_REMOVE_ATTRIBUTE:
return decodeRemoveAttributeAction(action, getDict);
case ACTION_TYPE_ADD_EVENT:
return decodeAddEventAction(action, getDict);
case ACTION_TYPE_ADD_WXS_EVENT:
return decodeAddWxsEventAction(action, getDict);
case ACTION_TYPE_REMOVE_EVENT:
return decodeRemoveEventAction(action, getDict);
case ACTION_TYPE_SET_TEXT:
return decodeSetTextAction(action, getDict);
}
});
}
function decodePageCreateAction([, pageCreateData]) {
return ['pageCreate', pageCreateData];
}
function decodePageCreatedAction([]) {
return ['pageCreated'];
}
function decodeNodeJson(getDict, nodeJson) {
if (!nodeJson) {
return;
}
if (hasOwn(nodeJson, 'a')) {
nodeJson.a = getDict(nodeJson.a);
}
if (hasOwn(nodeJson, 'e')) {
nodeJson.e = getDict(nodeJson.e, false);
}
if (hasOwn(nodeJson, 'w')) {
nodeJson.w = getWxsEventDict(nodeJson.w, getDict);
}
if (hasOwn(nodeJson, 's')) {
nodeJson.s = getDict(nodeJson.s);
}
if (hasOwn(nodeJson, 't')) {
nodeJson.t = getDict(nodeJson.t);
}
return nodeJson;
}
function getWxsEventDict(w, getDict) {
const res = {};
w.forEach(([name, [wxsEvent, flag]]) => {
res[getDict(name)] = [getDict(wxsEvent), flag];
});
return res;
}
function decodeCreateAction([, nodeId, nodeName, parentNodeId, refNodeId, nodeJson], getDict) {
return [
'create',
nodeId,
getDict(nodeName),
parentNodeId,
refNodeId,
decodeNodeJson(getDict, nodeJson),
];
}
function decodeInsertAction([, ...action], getDict) {
return [
'insert',
action[0],
action[1],
action[2],
action[3] ? decodeNodeJson(getDict, action[3]) : {},
];
}
function decodeRemoveAction([, ...action]) {
return ['remove', ...action];
}
function decodeAddEventAction([, ...action], getDict) {
return ['addEvent', action[0], getDict(action[1]), action[2]];
}
function decodeAddWxsEventAction([, ...action], getDict) {
return [
'addWxsEvent',
action[0],
getDict(action[1]),
getDict(action[2]),
action[3],
];
}
function decodeRemoveEventAction([, ...action], getDict) {
return ['removeEvent', action[0], getDict(action[1])];
}
function decodeSetAttributeAction([, ...action], getDict) {
return [
'setAttr',
action[0],
getDict(action[1]),
getDict(action[2]),
];
}
function decodeRemoveAttributeAction([, ...action], getDict) {
return ['removeAttr', action[0], getDict(action[1])];
}
function decodeSetTextAction([, ...action], getDict) {
return ['setText', action[0], getDict(action[1])];
}
exports.createGetDict = createGetDict;
......
......@@ -2,275 +2,275 @@ import { invokeArrayFns, isUniLifecycleHook, ON_LOAD, ON_SHOW, LINEFEED, RENDERJ
import { isString, isArray, isFunction } from '@vue/shared';
import { injectHook } from 'vue';
function getCurrentPage() {
const pages = getCurrentPages();
const len = pages.length;
if (len) {
return pages[len - 1];
}
}
function getCurrentPageVm() {
const page = getCurrentPage();
if (page) {
return page.$vm;
}
function getCurrentPage() {
const pages = getCurrentPages();
const len = pages.length;
if (len) {
return pages[len - 1];
}
}
function getCurrentPageVm() {
const page = getCurrentPage();
if (page) {
return page.$vm;
}
}
function invokeHook(vm, name, args) {
if (isString(vm)) {
args = name;
name = vm;
vm = getCurrentPageVm();
}
else if (typeof vm === 'number') {
const page = getCurrentPages().find((page) => page.$page.id === vm);
if (page) {
vm = page.$vm;
}
else {
vm = getCurrentPageVm();
}
}
if (!vm) {
return;
}
// 兼容 nvue
{
if (vm.__call_hook) {
return vm.__call_hook(name, args);
}
}
const hooks = vm.$[name];
return hooks && invokeArrayFns(hooks, args);
function invokeHook(vm, name, args) {
if (isString(vm)) {
args = name;
name = vm;
vm = getCurrentPageVm();
}
else if (typeof vm === 'number') {
const page = getCurrentPages().find((page) => page.$page.id === vm);
if (page) {
vm = page.$vm;
}
else {
vm = getCurrentPageVm();
}
}
if (!vm) {
return;
}
// 兼容 nvue
{
if (vm.__call_hook) {
return vm.__call_hook(name, args);
}
}
const hooks = vm.$[name];
return hooks && invokeArrayFns(hooks, args);
}
function injectLifecycleHook(name, hook, publicThis, instance) {
if (isFunction(hook)) {
injectHook(name, hook.bind(publicThis), instance);
}
}
function initHooks(options, instance, publicThis) {
var _a;
const mpType = options.mpType || publicThis.$mpType;
if (!mpType || mpType === 'component') {
// 仅 App,Page 类型支持在 options 中配置 on 生命周期,组件可以使用组合式 API 定义页面生命周期
return;
}
Object.keys(options).forEach((name) => {
if (isUniLifecycleHook(name, options[name], false)) {
const hooks = options[name];
if (isArray(hooks)) {
hooks.forEach((hook) => injectLifecycleHook(name, hook, publicThis, instance));
}
else {
injectLifecycleHook(name, hooks, publicThis, instance);
}
}
});
if (mpType === 'page') {
instance.__isVisible = true;
// 直接触发页面 onLoad、onShow 组件内的 onLoad 和 onShow 在注册时,直接触发一次
try {
invokeHook(publicThis, ON_LOAD, instance.attrs.__pageQuery);
delete instance.attrs.__pageQuery;
if (((_a = publicThis.$page) === null || _a === void 0 ? void 0 : _a.openType) !== 'preloadPage') {
invokeHook(publicThis, ON_SHOW);
}
}
catch (e) {
console.error(e.message + LINEFEED + e.stack);
}
}
function injectLifecycleHook(name, hook, publicThis, instance) {
if (isFunction(hook)) {
injectHook(name, hook.bind(publicThis), instance);
}
}
function initHooks(options, instance, publicThis) {
var _a;
const mpType = options.mpType || publicThis.$mpType;
if (!mpType || mpType === 'component') {
// 仅 App,Page 类型支持在 options 中配置 on 生命周期,组件可以使用组合式 API 定义页面生命周期
return;
}
Object.keys(options).forEach((name) => {
if (isUniLifecycleHook(name, options[name], false)) {
const hooks = options[name];
if (isArray(hooks)) {
hooks.forEach((hook) => injectLifecycleHook(name, hook, publicThis, instance));
}
else {
injectLifecycleHook(name, hooks, publicThis, instance);
}
}
});
if (mpType === 'page') {
instance.__isVisible = true;
// 直接触发页面 onLoad、onShow 组件内的 onLoad 和 onShow 在注册时,直接触发一次
try {
invokeHook(publicThis, ON_LOAD, instance.attrs.__pageQuery);
delete instance.attrs.__pageQuery;
if (((_a = publicThis.$page) === null || _a === void 0 ? void 0 : _a.openType) !== 'preloadPage') {
invokeHook(publicThis, ON_SHOW);
}
}
catch (e) {
console.error(e.message + LINEFEED + e.stack);
}
}
}
function initRenderjs(options, instance) {
initModules(instance, options.$renderjs, options['$' + RENDERJS_MODULES]);
}
function initModules(instance, modules, moduleIds = {}) {
if (!isArray(modules)) {
return;
}
const ownerId = instance.uid;
// 在vue的定制内核中,通过$wxsModules来判断事件函数源码中是否包含该模块调用
// !$wxsModules.find(module => invokerSourceCode.indexOf('.' + module + '.') > -1)
const $wxsModules = (instance.$wxsModules ||
(instance.$wxsModules = []));
const ctx = instance.ctx;
modules.forEach((module) => {
if (moduleIds[module]) {
ctx[module] = proxyModule(ownerId, moduleIds[module], module);
$wxsModules.push(module);
}
else {
if ((process.env.NODE_ENV !== 'production')) {
console.error(formatLog('initModules', modules, moduleIds));
}
}
});
}
function proxyModule(ownerId, moduleId, module) {
const target = {};
return new Proxy(target, {
get(_, p) {
return (target[p] ||
(target[p] = createModuleFunction(ownerId, moduleId, module, p)));
},
});
}
function createModuleFunction(ownerId, moduleId, module, name) {
const target = () => { };
const toJSON = () => WXS_PROTOCOL + JSON.stringify([ownerId, moduleId, module + '.' + name]);
return new Proxy(target, {
get(_, p) {
if (p === 'toJSON') {
return toJSON;
}
return (target[p] ||
(target[p] = createModuleFunction(ownerId, moduleId, module + '.' + name, p)));
},
apply(_target, _thisArg, args) {
return (WXS_PROTOCOL +
JSON.stringify([ownerId, moduleId, module + '.' + name, [...args]]));
},
});
function initRenderjs(options, instance) {
initModules(instance, options.$renderjs, options['$' + RENDERJS_MODULES]);
}
function initModules(instance, modules, moduleIds = {}) {
if (!isArray(modules)) {
return;
}
const ownerId = instance.uid;
// 在vue的定制内核中,通过$wxsModules来判断事件函数源码中是否包含该模块调用
// !$wxsModules.find(module => invokerSourceCode.indexOf('.' + module + '.') > -1)
const $wxsModules = (instance.$wxsModules ||
(instance.$wxsModules = []));
const ctx = instance.ctx;
modules.forEach((module) => {
if (moduleIds[module]) {
ctx[module] = proxyModule(ownerId, moduleIds[module], module);
$wxsModules.push(module);
}
else {
if ((process.env.NODE_ENV !== 'production')) {
console.error(formatLog('initModules', modules, moduleIds));
}
}
});
}
function proxyModule(ownerId, moduleId, module) {
const target = {};
return new Proxy(target, {
get(_, p) {
return (target[p] ||
(target[p] = createModuleFunction(ownerId, moduleId, module, p)));
},
});
}
function createModuleFunction(ownerId, moduleId, module, name) {
const target = () => { };
const toJSON = () => WXS_PROTOCOL + JSON.stringify([ownerId, moduleId, module + '.' + name]);
return new Proxy(target, {
get(_, p) {
if (p === 'toJSON') {
return toJSON;
}
return (target[p] ||
(target[p] = createModuleFunction(ownerId, moduleId, module + '.' + name, p)));
},
apply(_target, _thisArg, args) {
return (WXS_PROTOCOL +
JSON.stringify([ownerId, moduleId, module + '.' + name, [...args]]));
},
});
}
function initWxs(options, instance) {
initModules(instance, options.$wxs, options['$' + WXS_MODULES]);
function initWxs(options, instance) {
initModules(instance, options.$wxs, options['$' + WXS_MODULES]);
}
function applyOptions(options, instance, publicThis) {
{
initWxs(options, instance);
initRenderjs(options, instance);
}
initHooks(options, instance, publicThis);
function applyOptions(options, instance, publicThis) {
{
initWxs(options, instance);
initRenderjs(options, instance);
}
initHooks(options, instance, publicThis);
}
function set(target, key, val) {
return (target[key] = val);
function set(target, key, val) {
return (target[key] = val);
}
function createErrorHandler(app) {
return function errorHandler(err, instance, _info) {
if (!instance) {
throw err;
}
const appInstance = app._instance;
if (!appInstance || !appInstance.proxy) {
throw err;
}
{
invokeHook(appInstance.proxy, ON_ERROR, err);
}
};
}
function mergeAsArray(to, from) {
return to ? [...new Set([].concat(to, from))] : from;
}
function initOptionMergeStrategies(optionMergeStrategies) {
UniLifecycleHooks.forEach((name) => {
optionMergeStrategies[name] = mergeAsArray;
});
function createErrorHandler(app) {
return function errorHandler(err, instance, _info) {
if (!instance) {
throw err;
}
const appInstance = app._instance;
if (!appInstance || !appInstance.proxy) {
throw err;
}
{
invokeHook(appInstance.proxy, ON_ERROR, err);
}
};
}
function mergeAsArray(to, from) {
return to ? [...new Set([].concat(to, from))] : from;
}
function initOptionMergeStrategies(optionMergeStrategies) {
UniLifecycleHooks.forEach((name) => {
optionMergeStrategies[name] = mergeAsArray;
});
}
let realAtob;
const b64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
const b64re = /^(?:[A-Za-z\d+/]{4})*?(?:[A-Za-z\d+/]{2}(?:==)?|[A-Za-z\d+/]{3}=?)?$/;
if (typeof atob !== 'function') {
realAtob = function (str) {
str = String(str).replace(/[\t\n\f\r ]+/g, '');
if (!b64re.test(str)) {
throw new Error("Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.");
}
// Adding the padding if missing, for semplicity
str += '=='.slice(2 - (str.length & 3));
var bitmap;
var result = '';
var r1;
var r2;
var i = 0;
for (; i < str.length;) {
bitmap =
(b64.indexOf(str.charAt(i++)) << 18) |
(b64.indexOf(str.charAt(i++)) << 12) |
((r1 = b64.indexOf(str.charAt(i++))) << 6) |
(r2 = b64.indexOf(str.charAt(i++)));
result +=
r1 === 64
? String.fromCharCode((bitmap >> 16) & 255)
: r2 === 64
? String.fromCharCode((bitmap >> 16) & 255, (bitmap >> 8) & 255)
: String.fromCharCode((bitmap >> 16) & 255, (bitmap >> 8) & 255, bitmap & 255);
}
return result;
};
}
else {
// 注意atob只能在全局对象上调用,例如:`const Base64 = {atob};Base64.atob('xxxx')`是错误的用法
realAtob = atob;
}
function b64DecodeUnicode(str) {
return decodeURIComponent(realAtob(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();
};
let realAtob;
const b64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
const b64re = /^(?:[A-Za-z\d+/]{4})*?(?:[A-Za-z\d+/]{2}(?:==)?|[A-Za-z\d+/]{3}=?)?$/;
if (typeof atob !== 'function') {
realAtob = function (str) {
str = String(str).replace(/[\t\n\f\r ]+/g, '');
if (!b64re.test(str)) {
throw new Error("Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.");
}
// Adding the padding if missing, for semplicity
str += '=='.slice(2 - (str.length & 3));
var bitmap;
var result = '';
var r1;
var r2;
var i = 0;
for (; i < str.length;) {
bitmap =
(b64.indexOf(str.charAt(i++)) << 18) |
(b64.indexOf(str.charAt(i++)) << 12) |
((r1 = b64.indexOf(str.charAt(i++))) << 6) |
(r2 = b64.indexOf(str.charAt(i++)));
result +=
r1 === 64
? String.fromCharCode((bitmap >> 16) & 255)
: r2 === 64
? String.fromCharCode((bitmap >> 16) & 255, (bitmap >> 8) & 255)
: String.fromCharCode((bitmap >> 16) & 255, (bitmap >> 8) & 255, bitmap & 255);
}
return result;
};
}
else {
// 注意atob只能在全局对象上调用,例如:`const Base64 = {atob};Base64.atob('xxxx')`是错误的用法
realAtob = atob;
}
function b64DecodeUnicode(str) {
return decodeURIComponent(realAtob(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;
appConfig.errorHandler = invokeCreateErrorHandler(app, createErrorHandler);
initOptionMergeStrategies(appConfig.optionMergeStrategies);
const globalProperties = appConfig.globalProperties;
{
uniIdMixin(globalProperties);
}
{
globalProperties.$set = set;
globalProperties.$applyOptions = applyOptions;
}
{
invokeCreateVueAppHook(app);
}
function initApp(app) {
const appConfig = app._context.config;
appConfig.errorHandler = invokeCreateErrorHandler(app, createErrorHandler);
initOptionMergeStrategies(appConfig.optionMergeStrategies);
const globalProperties = appConfig.globalProperties;
{
uniIdMixin(globalProperties);
}
{
globalProperties.$set = set;
globalProperties.$applyOptions = applyOptions;
}
{
invokeCreateVueAppHook(app);
}
}
export { initApp };
......@@ -43,7 +43,7 @@
"@dcloudio/uni-shared": "3.0.0-alpha-3070420230224002",
"@types/pako": "1.0.2",
"@vue/compiler-sfc": "3.2.47",
"autoprefixer": "^10.4.13",
"autoprefixer": "^10.4.14",
"pako": "^1.0.11",
"postcss": "^8.4.21",
"vue": "3.2.47"
......
......@@ -354,7 +354,7 @@ class InnerAudioContext implements UniApp.InnerAudioContext {
: getAudioState({
audioId: this.id,
})
const value = name in result ? result[name] : item.default
const value = name in result ? (result as any)[name] : item.default
return typeof value === 'number' && name !== 'volume'
? value / 1e3
: value
......
......@@ -403,7 +403,7 @@ class BackgroundAudioManager implements UniApp.BackgroundAudioManager {
Object.defineProperty(this, name, {
get: () => {
const result = item.cache ? this._options : getBackgroundAudioState()
return name in result ? result[name] : item.default
return name in result ? (result as any)[name] : item.default
},
set: item.readonly
? undefined
......
......@@ -25,7 +25,7 @@
"@dcloudio/uni-i18n": "3.0.0-alpha-3070420230224002",
"@dcloudio/uni-shared": "3.0.0-alpha-3070420230224002",
"@rollup/pluginutils": "^4.2.0",
"@vitejs/plugin-vue": "^4.0.0",
"@vitejs/plugin-vue": "^4.1.0",
"@vue/compiler-dom": "3.2.47",
"@vue/compiler-sfc": "3.2.47",
"debug": "^4.3.3",
......@@ -36,7 +36,7 @@
"@types/debug": "^4.1.7",
"@types/fs-extra": "^9.0.13",
"@vue/compiler-core": "3.2.47",
"esbuild": "^0.16.14",
"esbuild": "^0.17.5",
"postcss": "^8.4.21",
"rollup": "^3.7.0",
"vite": "^4.0.0",
......
......@@ -4,148 +4,148 @@ var vue = require('vue');
var shared = require('@vue/shared');
var uniShared = require('@dcloudio/uni-shared');
function assertKey(key, shallow = false) {
if (!key) {
throw new Error(`${shallow ? 'shallowSsrRef' : 'ssrRef'}: You must provide a key.`);
}
}
function proxy(target, track, trigger) {
return new Proxy(target, {
get(target, prop) {
track();
if (shared.isObject(target[prop])) {
return proxy(target[prop], track, trigger);
}
return Reflect.get(target, prop);
},
set(obj, prop, newVal) {
const result = Reflect.set(obj, prop, newVal);
trigger();
return result;
},
});
}
const globalData = {};
const ssrServerRef = (value, key, shallow = false) => {
assertKey(key, shallow);
const ctx = vue.getCurrentInstance() && vue.useSSRContext();
let state;
if (ctx) {
const __uniSSR = ctx[uniShared.UNI_SSR] || (ctx[uniShared.UNI_SSR] = {});
state = __uniSSR[uniShared.UNI_SSR_DATA] || (__uniSSR[uniShared.UNI_SSR_DATA] = {});
}
else {
state = globalData;
}
state[key] = uniShared.sanitise(value);
// SSR 模式下 watchEffect 不生效 https://github.com/vuejs/vue-next/blob/master/packages/runtime-core/src/apiWatch.ts#L283
// 故自定义ref
return vue.customRef((track, trigger) => {
const customTrigger = () => (trigger(), (state[key] = uniShared.sanitise(value)));
return {
get: () => {
track();
if (!shallow && shared.isObject(value)) {
return proxy(value, track, customTrigger);
}
return value;
},
set: (v) => {
value = v;
customTrigger();
},
};
});
};
const ssrRef = (value, key) => {
{
return ssrServerRef(value, key);
}
};
const shallowSsrRef = (value, key) => {
{
return ssrServerRef(value, key, true);
}
};
function getSsrGlobalData() {
return uniShared.sanitise(globalData);
function assertKey(key, shallow = false) {
if (!key) {
throw new Error(`${shallow ? 'shallowSsrRef' : 'ssrRef'}: You must provide a key.`);
}
}
function proxy(target, track, trigger) {
return new Proxy(target, {
get(target, prop) {
track();
if (shared.isObject(target[prop])) {
return proxy(target[prop], track, trigger);
}
return Reflect.get(target, prop);
},
set(obj, prop, newVal) {
const result = Reflect.set(obj, prop, newVal);
trigger();
return result;
},
});
}
const globalData = {};
const ssrServerRef = (value, key, shallow = false) => {
assertKey(key, shallow);
const ctx = vue.getCurrentInstance() && vue.useSSRContext();
let state;
if (ctx) {
const __uniSSR = ctx[uniShared.UNI_SSR] || (ctx[uniShared.UNI_SSR] = {});
state = __uniSSR[uniShared.UNI_SSR_DATA] || (__uniSSR[uniShared.UNI_SSR_DATA] = {});
}
else {
state = globalData;
}
state[key] = uniShared.sanitise(value);
// SSR 模式下 watchEffect 不生效 https://github.com/vuejs/vue-next/blob/master/packages/runtime-core/src/apiWatch.ts#L283
// 故自定义ref
return vue.customRef((track, trigger) => {
const customTrigger = () => (trigger(), (state[key] = uniShared.sanitise(value)));
return {
get: () => {
track();
if (!shallow && shared.isObject(value)) {
return proxy(value, track, customTrigger);
}
return value;
},
set: (v) => {
value = v;
customTrigger();
},
};
});
};
const ssrRef = (value, key) => {
{
return ssrServerRef(value, key);
}
};
const shallowSsrRef = (value, key) => {
{
return ssrServerRef(value, key, true);
}
};
function getSsrGlobalData() {
return uniShared.sanitise(globalData);
}
/**
* uni 对象是跨实例的,而此处列的 API 均是需要跟当前实例关联的,比如 requireNativePlugin 获取 dom 时,依赖当前 weex 实例
*/
function getCurrentSubNVue() {
// @ts-ignore
return uni.getSubNVueById(plus.webview.currentWebview().id);
}
function requireNativePlugin(name) {
return weex.requireModule(name);
/**
* uni 对象是跨实例的,而此处列的 API 均是需要跟当前实例关联的,比如 requireNativePlugin 获取 dom 时,依赖当前 weex 实例
*/
function getCurrentSubNVue() {
// @ts-ignore
return uni.getSubNVueById(plus.webview.currentWebview().id);
}
function requireNativePlugin(name) {
return weex.requireModule(name);
}
function formatAppLog(type, filename, ...args) {
// @ts-ignore
if (uni.__log__) {
// @ts-ignore
uni.__log__(type, filename, ...args);
}
else {
console[type].apply(console, [...args, filename]);
}
}
function formatH5Log(type, filename, ...args) {
console[type].apply(console, [...args, filename]);
function formatAppLog(type, filename, ...args) {
// @ts-ignore
if (uni.__log__) {
// @ts-ignore
uni.__log__(type, filename, ...args);
}
else {
console[type].apply(console, [...args, filename]);
}
}
function formatH5Log(type, filename, ...args) {
console[type].apply(console, [...args, filename]);
}
function resolveEasycom(component, easycom) {
return shared.isString(component) ? easycom : component;
function resolveEasycom(component, easycom) {
return shared.isString(component) ? easycom : component;
}
/// <reference types="@dcloudio/types" />
const createHook = (lifecycle) => (hook, target = vue.getCurrentInstance()) => {
// post-create lifecycle registrations are noops during SSR
!vue.isInSSRComponentSetup && vue.injectHook(lifecycle, hook, target);
};
const onShow = /*#__PURE__*/ createHook(uniShared.ON_SHOW);
const onHide = /*#__PURE__*/ createHook(uniShared.ON_HIDE);
const onLaunch =
/*#__PURE__*/ createHook(uniShared.ON_LAUNCH);
const onError =
/*#__PURE__*/ createHook(uniShared.ON_ERROR);
const onThemeChange =
/*#__PURE__*/ createHook(uniShared.ON_THEME_CHANGE);
const onPageNotFound =
/*#__PURE__*/ createHook(uniShared.ON_PAGE_NOT_FOUND);
const onUnhandledRejection = /*#__PURE__*/ createHook(uniShared.ON_UNHANDLE_REJECTION);
const onInit =
/*#__PURE__*/ createHook(uniShared.ON_INIT);
// 小程序如果想在 setup 的 props 传递页面参数,需要定义 props,故同时暴露 onLoad 吧
const onLoad =
/*#__PURE__*/ createHook(uniShared.ON_LOAD);
const onReady = /*#__PURE__*/ createHook(uniShared.ON_READY);
const onUnload = /*#__PURE__*/ createHook(uniShared.ON_UNLOAD);
const onResize =
/*#__PURE__*/ createHook(uniShared.ON_RESIZE);
const onBackPress =
/*#__PURE__*/ createHook(uniShared.ON_BACK_PRESS);
const onPageScroll =
/*#__PURE__*/ createHook(uniShared.ON_PAGE_SCROLL);
const onTabItemTap =
/*#__PURE__*/ createHook(uniShared.ON_TAB_ITEM_TAP);
const onReachBottom = /*#__PURE__*/ createHook(uniShared.ON_REACH_BOTTOM);
const onPullDownRefresh = /*#__PURE__*/ createHook(uniShared.ON_PULL_DOWN_REFRESH);
const onSaveExitState =
/*#__PURE__*/ createHook(uniShared.ON_SAVE_EXIT_STATE);
const onShareTimeline =
/*#__PURE__*/ createHook(uniShared.ON_SHARE_TIMELINE);
const onAddToFavorites =
/*#__PURE__*/ createHook(uniShared.ON_ADD_TO_FAVORITES);
const onShareAppMessage =
/*#__PURE__*/ createHook(uniShared.ON_SHARE_APP_MESSAGE);
const onNavigationBarButtonTap = /*#__PURE__*/ createHook(uniShared.ON_NAVIGATION_BAR_BUTTON_TAP);
const onNavigationBarSearchInputChanged = /*#__PURE__*/ createHook(uniShared.ON_NAVIGATION_BAR_SEARCH_INPUT_CHANGED);
const onNavigationBarSearchInputClicked = /*#__PURE__*/ createHook(uniShared.ON_NAVIGATION_BAR_SEARCH_INPUT_CLICKED);
const onNavigationBarSearchInputConfirmed = /*#__PURE__*/ createHook(uniShared.ON_NAVIGATION_BAR_SEARCH_INPUT_CONFIRMED);
const onNavigationBarSearchInputFocusChanged =
/// <reference types="@dcloudio/types" />
const createHook = (lifecycle) => (hook, target = vue.getCurrentInstance()) => {
// post-create lifecycle registrations are noops during SSR
!vue.isInSSRComponentSetup && vue.injectHook(lifecycle, hook, target);
};
const onShow = /*#__PURE__*/ createHook(uniShared.ON_SHOW);
const onHide = /*#__PURE__*/ createHook(uniShared.ON_HIDE);
const onLaunch =
/*#__PURE__*/ createHook(uniShared.ON_LAUNCH);
const onError =
/*#__PURE__*/ createHook(uniShared.ON_ERROR);
const onThemeChange =
/*#__PURE__*/ createHook(uniShared.ON_THEME_CHANGE);
const onPageNotFound =
/*#__PURE__*/ createHook(uniShared.ON_PAGE_NOT_FOUND);
const onUnhandledRejection = /*#__PURE__*/ createHook(uniShared.ON_UNHANDLE_REJECTION);
const onInit =
/*#__PURE__*/ createHook(uniShared.ON_INIT);
// 小程序如果想在 setup 的 props 传递页面参数,需要定义 props,故同时暴露 onLoad 吧
const onLoad =
/*#__PURE__*/ createHook(uniShared.ON_LOAD);
const onReady = /*#__PURE__*/ createHook(uniShared.ON_READY);
const onUnload = /*#__PURE__*/ createHook(uniShared.ON_UNLOAD);
const onResize =
/*#__PURE__*/ createHook(uniShared.ON_RESIZE);
const onBackPress =
/*#__PURE__*/ createHook(uniShared.ON_BACK_PRESS);
const onPageScroll =
/*#__PURE__*/ createHook(uniShared.ON_PAGE_SCROLL);
const onTabItemTap =
/*#__PURE__*/ createHook(uniShared.ON_TAB_ITEM_TAP);
const onReachBottom = /*#__PURE__*/ createHook(uniShared.ON_REACH_BOTTOM);
const onPullDownRefresh = /*#__PURE__*/ createHook(uniShared.ON_PULL_DOWN_REFRESH);
const onSaveExitState =
/*#__PURE__*/ createHook(uniShared.ON_SAVE_EXIT_STATE);
const onShareTimeline =
/*#__PURE__*/ createHook(uniShared.ON_SHARE_TIMELINE);
const onAddToFavorites =
/*#__PURE__*/ createHook(uniShared.ON_ADD_TO_FAVORITES);
const onShareAppMessage =
/*#__PURE__*/ createHook(uniShared.ON_SHARE_APP_MESSAGE);
const onNavigationBarButtonTap = /*#__PURE__*/ createHook(uniShared.ON_NAVIGATION_BAR_BUTTON_TAP);
const onNavigationBarSearchInputChanged = /*#__PURE__*/ createHook(uniShared.ON_NAVIGATION_BAR_SEARCH_INPUT_CHANGED);
const onNavigationBarSearchInputClicked = /*#__PURE__*/ createHook(uniShared.ON_NAVIGATION_BAR_SEARCH_INPUT_CLICKED);
const onNavigationBarSearchInputConfirmed = /*#__PURE__*/ createHook(uniShared.ON_NAVIGATION_BAR_SEARCH_INPUT_CONFIRMED);
const onNavigationBarSearchInputFocusChanged =
/*#__PURE__*/ createHook(uniShared.ON_NAVIGATION_BAR_SEARCH_INPUT_FOCUS_CHANGED);
Object.defineProperty(exports, 'capitalize', {
......
......@@ -3,120 +3,120 @@ import { hasOwn, isString } from '@vue/shared';
export { capitalize, extend, hasOwn, isPlainObject } from '@vue/shared';
import { sanitise, UNI_SSR_DATA, UNI_SSR_GLOBAL_DATA, UNI_SSR, ON_SHOW, ON_HIDE, ON_LAUNCH, ON_ERROR, ON_THEME_CHANGE, ON_PAGE_NOT_FOUND, ON_UNHANDLE_REJECTION, ON_INIT, ON_LOAD, ON_READY, ON_UNLOAD, ON_RESIZE, ON_BACK_PRESS, ON_PAGE_SCROLL, ON_TAB_ITEM_TAP, ON_REACH_BOTTOM, ON_PULL_DOWN_REFRESH, ON_SAVE_EXIT_STATE, ON_SHARE_TIMELINE, ON_ADD_TO_FAVORITES, ON_SHARE_APP_MESSAGE, ON_NAVIGATION_BAR_BUTTON_TAP, ON_NAVIGATION_BAR_SEARCH_INPUT_CHANGED, ON_NAVIGATION_BAR_SEARCH_INPUT_CLICKED, ON_NAVIGATION_BAR_SEARCH_INPUT_CONFIRMED, ON_NAVIGATION_BAR_SEARCH_INPUT_FOCUS_CHANGED } from '@dcloudio/uni-shared';
function getSSRDataType() {
return getCurrentInstance() ? UNI_SSR_DATA : UNI_SSR_GLOBAL_DATA;
}
function assertKey(key, shallow = false) {
if (!key) {
throw new Error(`${shallow ? 'shallowSsrRef' : 'ssrRef'}: You must provide a key.`);
}
}
const ssrClientRef = (value, key, shallow = false) => {
const valRef = shallow ? shallowRef(value) : ref(value);
// 非 h5 平台
if (typeof window === 'undefined') {
return valRef;
}
const __uniSSR = window[UNI_SSR];
if (!__uniSSR) {
return valRef;
}
const type = getSSRDataType();
assertKey(key, shallow);
if (hasOwn(__uniSSR[type], key)) {
valRef.value = __uniSSR[type][key];
if (type === UNI_SSR_DATA) {
delete __uniSSR[type][key]; // TODO 非全局数据仅使用一次?否则下次还会再次使用该数据
}
}
return valRef;
};
const globalData = {};
const ssrRef = (value, key) => {
return ssrClientRef(value, key);
};
const shallowSsrRef = (value, key) => {
return ssrClientRef(value, key, true);
};
function getSsrGlobalData() {
return sanitise(globalData);
function getSSRDataType() {
return getCurrentInstance() ? UNI_SSR_DATA : UNI_SSR_GLOBAL_DATA;
}
function assertKey(key, shallow = false) {
if (!key) {
throw new Error(`${shallow ? 'shallowSsrRef' : 'ssrRef'}: You must provide a key.`);
}
}
const ssrClientRef = (value, key, shallow = false) => {
const valRef = shallow ? shallowRef(value) : ref(value);
// 非 h5 平台
if (typeof window === 'undefined') {
return valRef;
}
const __uniSSR = window[UNI_SSR];
if (!__uniSSR) {
return valRef;
}
const type = getSSRDataType();
assertKey(key, shallow);
if (hasOwn(__uniSSR[type], key)) {
valRef.value = __uniSSR[type][key];
if (type === UNI_SSR_DATA) {
delete __uniSSR[type][key]; // TODO 非全局数据仅使用一次?否则下次还会再次使用该数据
}
}
return valRef;
};
const globalData = {};
const ssrRef = (value, key) => {
return ssrClientRef(value, key);
};
const shallowSsrRef = (value, key) => {
return ssrClientRef(value, key, true);
};
function getSsrGlobalData() {
return sanitise(globalData);
}
/**
* uni 对象是跨实例的,而此处列的 API 均是需要跟当前实例关联的,比如 requireNativePlugin 获取 dom 时,依赖当前 weex 实例
*/
function getCurrentSubNVue() {
// @ts-ignore
return uni.getSubNVueById(plus.webview.currentWebview().id);
}
function requireNativePlugin(name) {
return weex.requireModule(name);
/**
* uni 对象是跨实例的,而此处列的 API 均是需要跟当前实例关联的,比如 requireNativePlugin 获取 dom 时,依赖当前 weex 实例
*/
function getCurrentSubNVue() {
// @ts-ignore
return uni.getSubNVueById(plus.webview.currentWebview().id);
}
function requireNativePlugin(name) {
return weex.requireModule(name);
}
function formatAppLog(type, filename, ...args) {
// @ts-ignore
if (uni.__log__) {
// @ts-ignore
uni.__log__(type, filename, ...args);
}
else {
console[type].apply(console, [...args, filename]);
}
}
function formatH5Log(type, filename, ...args) {
console[type].apply(console, [...args, filename]);
function formatAppLog(type, filename, ...args) {
// @ts-ignore
if (uni.__log__) {
// @ts-ignore
uni.__log__(type, filename, ...args);
}
else {
console[type].apply(console, [...args, filename]);
}
}
function formatH5Log(type, filename, ...args) {
console[type].apply(console, [...args, filename]);
}
function resolveEasycom(component, easycom) {
return isString(component) ? easycom : component;
function resolveEasycom(component, easycom) {
return isString(component) ? easycom : component;
}
/// <reference types="@dcloudio/types" />
const createHook = (lifecycle) => (hook, target = getCurrentInstance()) => {
// post-create lifecycle registrations are noops during SSR
!isInSSRComponentSetup && injectHook(lifecycle, hook, target);
};
const onShow = /*#__PURE__*/ createHook(ON_SHOW);
const onHide = /*#__PURE__*/ createHook(ON_HIDE);
const onLaunch =
/*#__PURE__*/ createHook(ON_LAUNCH);
const onError =
/*#__PURE__*/ createHook(ON_ERROR);
const onThemeChange =
/*#__PURE__*/ createHook(ON_THEME_CHANGE);
const onPageNotFound =
/*#__PURE__*/ createHook(ON_PAGE_NOT_FOUND);
const onUnhandledRejection = /*#__PURE__*/ createHook(ON_UNHANDLE_REJECTION);
const onInit =
/*#__PURE__*/ createHook(ON_INIT);
// 小程序如果想在 setup 的 props 传递页面参数,需要定义 props,故同时暴露 onLoad 吧
const onLoad =
/*#__PURE__*/ createHook(ON_LOAD);
const onReady = /*#__PURE__*/ createHook(ON_READY);
const onUnload = /*#__PURE__*/ createHook(ON_UNLOAD);
const onResize =
/*#__PURE__*/ createHook(ON_RESIZE);
const onBackPress =
/*#__PURE__*/ createHook(ON_BACK_PRESS);
const onPageScroll =
/*#__PURE__*/ createHook(ON_PAGE_SCROLL);
const onTabItemTap =
/*#__PURE__*/ createHook(ON_TAB_ITEM_TAP);
const onReachBottom = /*#__PURE__*/ createHook(ON_REACH_BOTTOM);
const onPullDownRefresh = /*#__PURE__*/ createHook(ON_PULL_DOWN_REFRESH);
const onSaveExitState =
/*#__PURE__*/ createHook(ON_SAVE_EXIT_STATE);
const onShareTimeline =
/*#__PURE__*/ createHook(ON_SHARE_TIMELINE);
const onAddToFavorites =
/*#__PURE__*/ createHook(ON_ADD_TO_FAVORITES);
const onShareAppMessage =
/*#__PURE__*/ createHook(ON_SHARE_APP_MESSAGE);
const onNavigationBarButtonTap = /*#__PURE__*/ createHook(ON_NAVIGATION_BAR_BUTTON_TAP);
const onNavigationBarSearchInputChanged = /*#__PURE__*/ createHook(ON_NAVIGATION_BAR_SEARCH_INPUT_CHANGED);
const onNavigationBarSearchInputClicked = /*#__PURE__*/ createHook(ON_NAVIGATION_BAR_SEARCH_INPUT_CLICKED);
const onNavigationBarSearchInputConfirmed = /*#__PURE__*/ createHook(ON_NAVIGATION_BAR_SEARCH_INPUT_CONFIRMED);
const onNavigationBarSearchInputFocusChanged =
/// <reference types="@dcloudio/types" />
const createHook = (lifecycle) => (hook, target = getCurrentInstance()) => {
// post-create lifecycle registrations are noops during SSR
!isInSSRComponentSetup && injectHook(lifecycle, hook, target);
};
const onShow = /*#__PURE__*/ createHook(ON_SHOW);
const onHide = /*#__PURE__*/ createHook(ON_HIDE);
const onLaunch =
/*#__PURE__*/ createHook(ON_LAUNCH);
const onError =
/*#__PURE__*/ createHook(ON_ERROR);
const onThemeChange =
/*#__PURE__*/ createHook(ON_THEME_CHANGE);
const onPageNotFound =
/*#__PURE__*/ createHook(ON_PAGE_NOT_FOUND);
const onUnhandledRejection = /*#__PURE__*/ createHook(ON_UNHANDLE_REJECTION);
const onInit =
/*#__PURE__*/ createHook(ON_INIT);
// 小程序如果想在 setup 的 props 传递页面参数,需要定义 props,故同时暴露 onLoad 吧
const onLoad =
/*#__PURE__*/ createHook(ON_LOAD);
const onReady = /*#__PURE__*/ createHook(ON_READY);
const onUnload = /*#__PURE__*/ createHook(ON_UNLOAD);
const onResize =
/*#__PURE__*/ createHook(ON_RESIZE);
const onBackPress =
/*#__PURE__*/ createHook(ON_BACK_PRESS);
const onPageScroll =
/*#__PURE__*/ createHook(ON_PAGE_SCROLL);
const onTabItemTap =
/*#__PURE__*/ createHook(ON_TAB_ITEM_TAP);
const onReachBottom = /*#__PURE__*/ createHook(ON_REACH_BOTTOM);
const onPullDownRefresh = /*#__PURE__*/ createHook(ON_PULL_DOWN_REFRESH);
const onSaveExitState =
/*#__PURE__*/ createHook(ON_SAVE_EXIT_STATE);
const onShareTimeline =
/*#__PURE__*/ createHook(ON_SHARE_TIMELINE);
const onAddToFavorites =
/*#__PURE__*/ createHook(ON_ADD_TO_FAVORITES);
const onShareAppMessage =
/*#__PURE__*/ createHook(ON_SHARE_APP_MESSAGE);
const onNavigationBarButtonTap = /*#__PURE__*/ createHook(ON_NAVIGATION_BAR_BUTTON_TAP);
const onNavigationBarSearchInputChanged = /*#__PURE__*/ createHook(ON_NAVIGATION_BAR_SEARCH_INPUT_CHANGED);
const onNavigationBarSearchInputClicked = /*#__PURE__*/ createHook(ON_NAVIGATION_BAR_SEARCH_INPUT_CLICKED);
const onNavigationBarSearchInputConfirmed = /*#__PURE__*/ createHook(ON_NAVIGATION_BAR_SEARCH_INPUT_CONFIRMED);
const onNavigationBarSearchInputFocusChanged =
/*#__PURE__*/ createHook(ON_NAVIGATION_BAR_SEARCH_INPUT_FOCUS_CHANGED);
export { formatAppLog, formatH5Log, getCurrentSubNVue, getSsrGlobalData, onAddToFavorites, onBackPress, onError, onHide, onInit, onLaunch, onLoad, onNavigationBarButtonTap, onNavigationBarSearchInputChanged, onNavigationBarSearchInputClicked, onNavigationBarSearchInputConfirmed, onNavigationBarSearchInputFocusChanged, onPageNotFound, onPageScroll, onPullDownRefresh, onReachBottom, onReady, onResize, onSaveExitState, onShareAppMessage, onShareTimeline, onShow, onTabItemTap, onThemeChange, onUnhandledRejection, onUnload, requireNativePlugin, resolveEasycom, shallowSsrRef, ssrRef };
'use strict';
var index = () => [
/* eslint-disable no-restricted-globals */
...require('@dcloudio/uni-cloud/lib/uni.plugin.js').default(),
/* eslint-disable no-restricted-globals */
...require('@dcloudio/uni-push/lib/uni.plugin.js')(),
/* eslint-disable no-restricted-globals */
...require('@dcloudio/uni-stat/lib/uni.plugin.js')(),
var index = () => [
/* eslint-disable no-restricted-globals */
...require('@dcloudio/uni-cloud/lib/uni.plugin.js').default(),
/* eslint-disable no-restricted-globals */
...require('@dcloudio/uni-push/lib/uni.plugin.js')(),
/* eslint-disable no-restricted-globals */
...require('@dcloudio/uni-stat/lib/uni.plugin.js')(),
];
module.exports = index;
......@@ -36,13 +36,13 @@
"@vue/compiler-sfc": "3.2.47",
"@vue/server-renderer": "3.2.47",
"@vue/shared": "3.2.47",
"autoprefixer": "^10.4.13",
"autoprefixer": "^10.4.14",
"base64url": "^3.0.1",
"chokidar": "^3.5.3",
"compare-versions": "^3.6.0",
"debug": "^4.3.3",
"es-module-lexer": "^0.9.3",
"esbuild": "^0.16.14",
"esbuild": "^0.17.5",
"estree-walker": "^2.0.2",
"fast-glob": "^3.2.11",
"fs-extra": "^10.0.0",
......
......@@ -1151,7 +1151,7 @@ Friction.prototype.setV = function(x, y) {
this._y_a = -this._f * this._y_v / n;
this._t = Math.abs(x / this._x_a) || Math.abs(y / this._y_a);
this._lastDt = null;
this._startTime = new Date().getTime();
this._startTime = (/* @__PURE__ */ new Date()).getTime();
};
Friction.prototype.setS = function(x, y) {
this._x_s = x;
......@@ -1159,7 +1159,7 @@ Friction.prototype.setS = function(x, y) {
};
Friction.prototype.s = function(t2) {
if (void 0 === t2) {
t2 = (new Date().getTime() - this._startTime) / 1e3;
t2 = ((/* @__PURE__ */ new Date()).getTime() - this._startTime) / 1e3;
}
if (t2 > this._t) {
t2 = this._t;
......@@ -1180,7 +1180,7 @@ Friction.prototype.s = function(t2) {
};
Friction.prototype.ds = function(t2) {
if (void 0 === t2) {
t2 = (new Date().getTime() - this._startTime) / 1e3;
t2 = ((/* @__PURE__ */ new Date()).getTime() - this._startTime) / 1e3;
}
if (t2 > this._t) {
t2 = this._t;
......@@ -1297,19 +1297,19 @@ Spring.prototype._solve = function(e2, t2) {
};
Spring.prototype.x = function(e2) {
if (void 0 === e2) {
e2 = (new Date().getTime() - this._startTime) / 1e3;
e2 = ((/* @__PURE__ */ new Date()).getTime() - this._startTime) / 1e3;
}
return this._solution ? this._endPosition + this._solution.x(e2) : 0;
};
Spring.prototype.dx = function(e2) {
if (void 0 === e2) {
e2 = (new Date().getTime() - this._startTime) / 1e3;
e2 = ((/* @__PURE__ */ new Date()).getTime() - this._startTime) / 1e3;
}
return this._solution ? this._solution.dx(e2) : 0;
};
Spring.prototype.setEnd = function(e2, n, i) {
if (!i) {
i = new Date().getTime();
i = (/* @__PURE__ */ new Date()).getTime();
}
if (e2 !== this._endPosition || !t(n, 0.1)) {
n = n || 0;
......@@ -1335,7 +1335,7 @@ Spring.prototype.setEnd = function(e2, n, i) {
}
};
Spring.prototype.snap = function(e2) {
this._startTime = new Date().getTime();
this._startTime = (/* @__PURE__ */ new Date()).getTime();
this._endPosition = e2;
this._solution = {
x: function() {
......@@ -1348,7 +1348,7 @@ Spring.prototype.snap = function(e2) {
};
Spring.prototype.done = function(n) {
if (!n) {
n = new Date().getTime();
n = (/* @__PURE__ */ new Date()).getTime();
}
return e(this.x(), this._endPosition, 0.1) && t(this.dx(), 0.1);
};
......@@ -1358,7 +1358,7 @@ Spring.prototype.reconfigure = function(m, t2, c) {
this._c = c;
if (!this.done()) {
this._solution = this._solve(this.x() - this._endPosition, this.dx());
this._startTime = new Date().getTime();
this._startTime = (/* @__PURE__ */ new Date()).getTime();
}
};
Spring.prototype.springConstant = function() {
......@@ -1398,14 +1398,14 @@ function STD(e2, t2, n) {
this._startTime = 0;
}
STD.prototype.setEnd = function(e2, t2, n, i) {
const r = new Date().getTime();
const r = (/* @__PURE__ */ new Date()).getTime();
this._springX.setEnd(e2, i, r);
this._springY.setEnd(t2, i, r);
this._springScale.setEnd(n, i, r);
this._startTime = r;
};
STD.prototype.x = function() {
const e2 = (new Date().getTime() - this._startTime) / 1e3;
const e2 = ((/* @__PURE__ */ new Date()).getTime() - this._startTime) / 1e3;
return {
x: this._springX.x(e2),
y: this._springY.x(e2),
......@@ -1413,7 +1413,7 @@ STD.prototype.x = function() {
};
};
STD.prototype.done = function() {
const e2 = new Date().getTime();
const e2 = (/* @__PURE__ */ new Date()).getTime();
return this._springX.done(e2) && this._springY.done(e2) && this._springScale.done(e2);
};
STD.prototype.reconfigure = function(e2, t2, n) {
......@@ -2642,7 +2642,7 @@ function padLeft(num) {
}
function getDate(str, _mode) {
str = String(str || "");
const date = new Date();
const date = /* @__PURE__ */ new Date();
if (_mode === mode.TIME) {
const strs = str.split(":");
if (strs.length === 2) {
......@@ -2661,7 +2661,7 @@ function getDefaultStartValue(props2) {
return "00:00";
}
if (props2.mode === mode.DATE) {
const year = new Date().getFullYear() - 100;
const year = (/* @__PURE__ */ new Date()).getFullYear() - 100;
switch (props2.fields) {
case fields.YEAR:
return year;
......@@ -2678,7 +2678,7 @@ function getDefaultEndValue(props2) {
return "23:59";
}
if (props2.mode === mode.DATE) {
const year = new Date().getFullYear() + 100;
const year = (/* @__PURE__ */ new Date()).getFullYear() + 100;
switch (props2.fields) {
case fields.YEAR:
return year;
......
......@@ -6,9 +6,7 @@ import animation from './animation'
* @param options
* @returns
*/
export const defineBuiltInComponent: typeof defineComponent = (
options: any
) => {
export const defineBuiltInComponent = ((options: any) => {
// 标记为保留组件,这样框架其他地方可以据此来识别,比如 onLoad 等生命周期的注入会忽略系统保留组件
options.__reserved = true
// TODO 可能会补充特殊标记
......@@ -18,13 +16,13 @@ export const defineBuiltInComponent: typeof defineComponent = (
;(mixins || (options.mixins = [])).push(animation)
}
return defineSystemComponent(options)
}
}) as typeof defineComponent
/**
* 系统组件(不对外,比如App,Page等)
* @param options
* @returns
*/
export const defineSystemComponent: typeof defineComponent = (options: any) => {
export const defineSystemComponent = ((options: any) => {
// 标记 devtools 隐藏
// options.devtools = { hide: true }
// 标记为保留组件
......@@ -33,7 +31,7 @@ export const defineSystemComponent: typeof defineComponent = (options: any) => {
MODE: 3, // 标记为vue3
}
return defineComponent(options)
}
}) as typeof defineComponent
/**
* 暂未支持的组件
* @param name
......
......@@ -38,7 +38,7 @@
"@types/module-alias": "^2.0.1",
"@types/resolve": "^1.20.2",
"@vue/compiler-core": "3.2.47",
"esbuild": "^0.16.14",
"esbuild": "^0.17.5",
"vue": "3.2.47"
}
}
......@@ -3855,7 +3855,7 @@ Friction.prototype.setV = function(x, y) {
this._y_a = -this._f * this._y_v / n;
this._t = Math.abs(x / this._x_a) || Math.abs(y / this._y_a);
this._lastDt = null;
this._startTime = new Date().getTime();
this._startTime = (/* @__PURE__ */ new Date()).getTime();
};
Friction.prototype.setS = function(x, y) {
this._x_s = x;
......@@ -3863,7 +3863,7 @@ Friction.prototype.setS = function(x, y) {
};
Friction.prototype.s = function(t2) {
if (void 0 === t2) {
t2 = (new Date().getTime() - this._startTime) / 1e3;
t2 = ((/* @__PURE__ */ new Date()).getTime() - this._startTime) / 1e3;
}
if (t2 > this._t) {
t2 = this._t;
......@@ -3884,7 +3884,7 @@ Friction.prototype.s = function(t2) {
};
Friction.prototype.ds = function(t2) {
if (void 0 === t2) {
t2 = (new Date().getTime() - this._startTime) / 1e3;
t2 = ((/* @__PURE__ */ new Date()).getTime() - this._startTime) / 1e3;
}
if (t2 > this._t) {
t2 = this._t;
......@@ -4001,19 +4001,19 @@ Spring.prototype._solve = function(e2, t2) {
};
Spring.prototype.x = function(e2) {
if (void 0 === e2) {
e2 = (new Date().getTime() - this._startTime) / 1e3;
e2 = ((/* @__PURE__ */ new Date()).getTime() - this._startTime) / 1e3;
}
return this._solution ? this._endPosition + this._solution.x(e2) : 0;
};
Spring.prototype.dx = function(e2) {
if (void 0 === e2) {
e2 = (new Date().getTime() - this._startTime) / 1e3;
e2 = ((/* @__PURE__ */ new Date()).getTime() - this._startTime) / 1e3;
}
return this._solution ? this._solution.dx(e2) : 0;
};
Spring.prototype.setEnd = function(e2, n, i) {
if (!i) {
i = new Date().getTime();
i = (/* @__PURE__ */ new Date()).getTime();
}
if (e2 !== this._endPosition || !t(n, 0.1)) {
n = n || 0;
......@@ -4039,7 +4039,7 @@ Spring.prototype.setEnd = function(e2, n, i) {
}
};
Spring.prototype.snap = function(e2) {
this._startTime = new Date().getTime();
this._startTime = (/* @__PURE__ */ new Date()).getTime();
this._endPosition = e2;
this._solution = {
x: function() {
......@@ -4052,7 +4052,7 @@ Spring.prototype.snap = function(e2) {
};
Spring.prototype.done = function(n) {
if (!n) {
n = new Date().getTime();
n = (/* @__PURE__ */ new Date()).getTime();
}
return e(this.x(), this._endPosition, 0.1) && t(this.dx(), 0.1);
};
......@@ -4062,7 +4062,7 @@ Spring.prototype.reconfigure = function(m, t2, c) {
this._c = c;
if (!this.done()) {
this._solution = this._solve(this.x() - this._endPosition, this.dx());
this._startTime = new Date().getTime();
this._startTime = (/* @__PURE__ */ new Date()).getTime();
}
};
Spring.prototype.springConstant = function() {
......@@ -4102,14 +4102,14 @@ function STD(e2, t2, n) {
this._startTime = 0;
}
STD.prototype.setEnd = function(e2, t2, n, i) {
const r = new Date().getTime();
const r = (/* @__PURE__ */ new Date()).getTime();
this._springX.setEnd(e2, i, r);
this._springY.setEnd(t2, i, r);
this._springScale.setEnd(n, i, r);
this._startTime = r;
};
STD.prototype.x = function() {
const e2 = (new Date().getTime() - this._startTime) / 1e3;
const e2 = ((/* @__PURE__ */ new Date()).getTime() - this._startTime) / 1e3;
return {
x: this._springX.x(e2),
y: this._springY.x(e2),
......@@ -4117,7 +4117,7 @@ STD.prototype.x = function() {
};
};
STD.prototype.done = function() {
const e2 = new Date().getTime();
const e2 = (/* @__PURE__ */ new Date()).getTime();
return this._springX.done(e2) && this._springY.done(e2) && this._springScale.done(e2);
};
STD.prototype.reconfigure = function(e2, t2, n) {
......@@ -9933,7 +9933,7 @@ function getDefaultStartValue(props2) {
return "00:00";
}
if (props2.mode === mode.DATE) {
const year = new Date().getFullYear() - 150;
const year = (/* @__PURE__ */ new Date()).getFullYear() - 150;
switch (props2.fields) {
case fields.YEAR:
return year.toString();
......@@ -9950,7 +9950,7 @@ function getDefaultEndValue(props2) {
return "23:59";
}
if (props2.mode === mode.DATE) {
const year = new Date().getFullYear() + 150;
const year = (/* @__PURE__ */ new Date()).getFullYear() + 150;
switch (props2.fields) {
case fields.YEAR:
return year.toString();
......@@ -10341,7 +10341,7 @@ function usePickerMethods(props2, state, trigger, rootRef, pickerRef, selectRef,
state.timeArray.push(hours, minutes);
}
function getYearStartEnd() {
let year = new Date().getFullYear();
let year = (/* @__PURE__ */ new Date()).getFullYear();
let start = year - 150;
let end = year + 150;
if (props2.start) {
......@@ -10597,7 +10597,7 @@ function usePickerMethods(props2, state, trigger, rootRef, pickerRef, selectRef,
const dateArray = state.dateArray;
const max = dateArray[2].length;
const day = Number(dateArray[2][valueArray[2]]) || 1;
const realDay = new Date(`${dateArray[0][valueArray[0]]}/${dateArray[1][valueArray[1]]}/${day}`).getDate();
const realDay = (/* @__PURE__ */ new Date(`${dateArray[0][valueArray[0]]}/${dateArray[1][valueArray[1]]}/${day}`)).getDate();
if (realDay < day) {
valueArray[2] -= realDay + max - day;
}
......
......@@ -10141,7 +10141,7 @@ Friction$1.prototype.setV = function(x, y) {
this._y_a = -this._f * this._y_v / n;
this._t = Math.abs(x / this._x_a) || Math.abs(y / this._y_a);
this._lastDt = null;
this._startTime = new Date().getTime();
this._startTime = (/* @__PURE__ */ new Date()).getTime();
};
Friction$1.prototype.setS = function(x, y) {
this._x_s = x;
......@@ -10149,7 +10149,7 @@ Friction$1.prototype.setS = function(x, y) {
};
Friction$1.prototype.s = function(t2) {
if (void 0 === t2) {
t2 = (new Date().getTime() - this._startTime) / 1e3;
t2 = ((/* @__PURE__ */ new Date()).getTime() - this._startTime) / 1e3;
}
if (t2 > this._t) {
t2 = this._t;
......@@ -10170,7 +10170,7 @@ Friction$1.prototype.s = function(t2) {
};
Friction$1.prototype.ds = function(t2) {
if (void 0 === t2) {
t2 = (new Date().getTime() - this._startTime) / 1e3;
t2 = ((/* @__PURE__ */ new Date()).getTime() - this._startTime) / 1e3;
}
if (t2 > this._t) {
t2 = this._t;
......@@ -10287,19 +10287,19 @@ Spring$1.prototype._solve = function(e2, t2) {
};
Spring$1.prototype.x = function(e2) {
if (void 0 === e2) {
e2 = (new Date().getTime() - this._startTime) / 1e3;
e2 = ((/* @__PURE__ */ new Date()).getTime() - this._startTime) / 1e3;
}
return this._solution ? this._endPosition + this._solution.x(e2) : 0;
};
Spring$1.prototype.dx = function(e2) {
if (void 0 === e2) {
e2 = (new Date().getTime() - this._startTime) / 1e3;
e2 = ((/* @__PURE__ */ new Date()).getTime() - this._startTime) / 1e3;
}
return this._solution ? this._solution.dx(e2) : 0;
};
Spring$1.prototype.setEnd = function(e2, n, i) {
if (!i) {
i = new Date().getTime();
i = (/* @__PURE__ */ new Date()).getTime();
}
if (e2 !== this._endPosition || !t(n, 0.1)) {
n = n || 0;
......@@ -10325,7 +10325,7 @@ Spring$1.prototype.setEnd = function(e2, n, i) {
}
};
Spring$1.prototype.snap = function(e2) {
this._startTime = new Date().getTime();
this._startTime = (/* @__PURE__ */ new Date()).getTime();
this._endPosition = e2;
this._solution = {
x: function() {
......@@ -10338,7 +10338,7 @@ Spring$1.prototype.snap = function(e2) {
};
Spring$1.prototype.done = function(n) {
if (!n) {
n = new Date().getTime();
n = (/* @__PURE__ */ new Date()).getTime();
}
return e(this.x(), this._endPosition, 0.1) && t(this.dx(), 0.1);
};
......@@ -10348,7 +10348,7 @@ Spring$1.prototype.reconfigure = function(m, t2, c) {
this._c = c;
if (!this.done()) {
this._solution = this._solve(this.x() - this._endPosition, this.dx());
this._startTime = new Date().getTime();
this._startTime = (/* @__PURE__ */ new Date()).getTime();
}
};
Spring$1.prototype.springConstant = function() {
......@@ -10388,14 +10388,14 @@ function STD(e2, t2, n) {
this._startTime = 0;
}
STD.prototype.setEnd = function(e2, t2, n, i) {
const r = new Date().getTime();
const r = (/* @__PURE__ */ new Date()).getTime();
this._springX.setEnd(e2, i, r);
this._springY.setEnd(t2, i, r);
this._springScale.setEnd(n, i, r);
this._startTime = r;
};
STD.prototype.x = function() {
const e2 = (new Date().getTime() - this._startTime) / 1e3;
const e2 = ((/* @__PURE__ */ new Date()).getTime() - this._startTime) / 1e3;
return {
x: this._springX.x(e2),
y: this._springY.x(e2),
......@@ -10403,7 +10403,7 @@ STD.prototype.x = function() {
};
};
STD.prototype.done = function() {
const e2 = new Date().getTime();
const e2 = (/* @__PURE__ */ new Date()).getTime();
return this._springX.done(e2) && this._springY.done(e2) && this._springScale.done(e2);
};
STD.prototype.reconfigure = function(e2, t2, n) {
......@@ -11462,14 +11462,14 @@ class Friction {
set(x, v2) {
this._x = x;
this._v = v2;
this._startTime = new Date().getTime();
this._startTime = (/* @__PURE__ */ new Date()).getTime();
}
setVelocityByEnd(e2) {
this._v = (e2 - this._x) * this._dragLog / (Math.pow(this._drag, 100) - 1);
}
x(e2) {
if (e2 === void 0) {
e2 = (new Date().getTime() - this._startTime) / 1e3;
e2 = ((/* @__PURE__ */ new Date()).getTime() - this._startTime) / 1e3;
}
const t2 = e2 === this._dt && this._powDragDt ? this._powDragDt : this._powDragDt = Math.pow(this._drag, e2);
this._dt = e2;
......@@ -11477,7 +11477,7 @@ class Friction {
}
dx(e2) {
if (e2 === void 0) {
e2 = (new Date().getTime() - this._startTime) / 1e3;
e2 = ((/* @__PURE__ */ new Date()).getTime() - this._startTime) / 1e3;
}
const t2 = e2 === this._dt && this._powDragDt ? this._powDragDt : this._powDragDt = Math.pow(this._drag, e2);
this._dt = e2;
......@@ -11603,19 +11603,19 @@ class Spring {
}
x(e2) {
if (e2 === void 0) {
e2 = (new Date().getTime() - this._startTime) / 1e3;
e2 = ((/* @__PURE__ */ new Date()).getTime() - this._startTime) / 1e3;
}
return this._solution ? this._endPosition + this._solution.x(e2) : 0;
}
dx(e2) {
if (e2 === void 0) {
e2 = (new Date().getTime() - this._startTime) / 1e3;
e2 = ((/* @__PURE__ */ new Date()).getTime() - this._startTime) / 1e3;
}
return this._solution ? this._solution.dx(e2) : 0;
}
setEnd(e2, t2, n) {
if (!n) {
n = new Date().getTime();
n = (/* @__PURE__ */ new Date()).getTime();
}
if (e2 !== this._endPosition || !a(t2, 0.4)) {
t2 = t2 || 0;
......@@ -11641,7 +11641,7 @@ class Spring {
}
}
snap(e2) {
this._startTime = new Date().getTime();
this._startTime = (/* @__PURE__ */ new Date()).getTime();
this._endPosition = e2;
this._solution = {
x: function() {
......@@ -11654,7 +11654,7 @@ class Spring {
}
done(e2) {
if (!e2) {
e2 = new Date().getTime();
e2 = (/* @__PURE__ */ new Date()).getTime();
}
return o(this.x(), this._endPosition, 0.4) && a(this.dx(), 0.4);
}
......@@ -11664,7 +11664,7 @@ class Spring {
this._c = n;
if (!this.done()) {
this._solution = this._solve(this.x() - this._endPosition, this.dx());
this._startTime = new Date().getTime();
this._startTime = (/* @__PURE__ */ new Date()).getTime();
}
}
springConstant() {
......@@ -11730,14 +11730,14 @@ class Scroll {
this._springing = false;
}
}
this._startTime = new Date().getTime();
this._startTime = (/* @__PURE__ */ new Date()).getTime();
}
x(e2) {
if (!this._startTime) {
return 0;
}
if (!e2) {
e2 = (new Date().getTime() - this._startTime) / 1e3;
e2 = ((/* @__PURE__ */ new Date()).getTime() - this._startTime) / 1e3;
}
if (this._springing) {
return this._spring.x() + this._springOffset;
......@@ -23617,7 +23617,7 @@ function getDefaultStartValue(props2) {
return "00:00";
}
if (props2.mode === mode.DATE) {
const year = new Date().getFullYear() - 150;
const year = (/* @__PURE__ */ new Date()).getFullYear() - 150;
switch (props2.fields) {
case fields.YEAR:
return year.toString();
......@@ -23634,7 +23634,7 @@ function getDefaultEndValue(props2) {
return "23:59";
}
if (props2.mode === mode.DATE) {
const year = new Date().getFullYear() + 150;
const year = (/* @__PURE__ */ new Date()).getFullYear() + 150;
switch (props2.fields) {
case fields.YEAR:
return year.toString();
......@@ -24048,7 +24048,7 @@ function usePickerMethods(props2, state2, trigger, rootRef, pickerRef, selectRef
state2.timeArray.push(hours, minutes);
}
function getYearStartEnd() {
let year = new Date().getFullYear();
let year = (/* @__PURE__ */ new Date()).getFullYear();
let start = year - 150;
let end = year + 150;
if (props2.start) {
......@@ -24304,7 +24304,7 @@ function usePickerMethods(props2, state2, trigger, rootRef, pickerRef, selectRef
const dateArray = state2.dateArray;
const max = dateArray[2].length;
const day = Number(dateArray[2][valueArray[2]]) || 1;
const realDay = new Date(`${dateArray[0][valueArray[0]]}/${dateArray[1][valueArray[1]]}/${day}`).getDate();
const realDay = (/* @__PURE__ */ new Date(`${dateArray[0][valueArray[0]]}/${dateArray[1][valueArray[1]]}/${day}`)).getDate();
if (realDay < day) {
valueArray[2] -= realDay + max - day;
}
......
......@@ -22,7 +22,7 @@ function handleMediaQueryStr($props: UniApp.DescriptorOptions) {
if (
item !== 'orientation' &&
$props[item as keyof UniApp.DescriptorOptions] &&
Number($props[item as keyof UniApp.DescriptorOptions] >= 0)
Number(($props[item as keyof UniApp.DescriptorOptions] as number) >= 0)
) {
mediaQueryArr.push(
`(${humpToLine(item)}: ${Number(
......
......@@ -104,11 +104,13 @@ export function compile(
compiled.push(token.value)
break
case 'list':
compiled.push(values[parseInt(token.value, 10)])
compiled.push(
(values as Record<string, unknown>)[parseInt(token.value, 10)]
)
break
case 'named':
if (mode === 'named') {
compiled.push(values[token.value])
compiled.push((values as Record<string, unknown>)[token.value])
} else {
if (process.env.NODE_ENV !== 'production') {
console.warn(
......
......@@ -24,296 +24,296 @@ var source = {
enableNodeModuleBabelTransform: enableNodeModuleBabelTransform
};
function transformRef(node, context) {
if (!uniCliShared.isUserComponent(node, context)) {
return;
}
addVueRef(node, context);
}
function addVueRef(node, context) {
// 仅配置了 ref 属性的,才需要增补 vue-ref
const refProp = compilerCore.findProp(node, 'ref');
if (!refProp) {
return;
}
const dataRef = 'u-' +
(context.inVFor
? uniCliShared.VUE_REF_IN_FOR
: uniCliShared.VUE_REF);
if (refProp.type === 6 /* NodeTypes.ATTRIBUTE */) {
refProp.name = dataRef;
}
else {
refProp.arg.content = dataRef;
}
const { props } = node;
props.splice(props.indexOf(refProp), 0, uniCliShared.createAttributeNode('ref', '__r'));
function transformRef(node, context) {
if (!uniCliShared.isUserComponent(node, context)) {
return;
}
addVueRef(node, context);
}
function addVueRef(node, context) {
// 仅配置了 ref 属性的,才需要增补 vue-ref
const refProp = compilerCore.findProp(node, 'ref');
if (!refProp) {
return;
}
const dataRef = 'u-' +
(context.inVFor
? uniCliShared.VUE_REF_IN_FOR
: uniCliShared.VUE_REF);
if (refProp.type === 6 /* NodeTypes.ATTRIBUTE */) {
refProp.name = dataRef;
}
else {
refProp.arg.content = dataRef;
}
const { props } = node;
props.splice(props.indexOf(refProp), 0, uniCliShared.createAttributeNode('ref', '__r'));
}
const customizeRE = /:/g;
function customizeEvent(str) {
return shared.camelize(str.replace(customizeRE, '-'));
const customizeRE = /:/g;
function customizeEvent(str) {
return shared.camelize(str.replace(customizeRE, '-'));
}
const event = {
format(name, { isCatch, isComponent }) {
if (!isComponent && name === 'click') {
name = 'tap';
}
name = eventMap[name] || name;
return `${isCatch ? 'catch' : 'on'}${shared.capitalize(customizeEvent(name))}`;
},
};
const eventMap = {
touchstart: 'touchStart',
touchmove: 'touchMove',
touchend: 'touchEnd',
touchcancel: 'touchCancel',
longtap: 'longTap',
longpress: 'longTap',
transitionend: 'transitionEnd',
animationstart: 'animationStart',
animationiteration: 'animationIteration',
animationend: 'animationEnd',
firstappear: 'firstAppear',
// map
markertap: 'markerTap',
callouttap: 'calloutTap',
controltap: 'controlTap',
regionchange: 'regionChange',
paneltap: 'panelTap',
// scroll-view
scrolltoupper: 'scrollToUpper',
scrolltolower: 'scrollToLower',
// movable-view
changeend: 'changeEnd',
// video
timeupdate: 'timeUpdate',
waiting: 'loading',
fullscreenchange: 'fullScreenChange',
useraction: 'userAction',
renderstart: 'renderStart',
loadedmetadata: 'renderStart',
// swiper
animationfinish: 'animationEnd',
const event = {
format(name, { isCatch, isComponent }) {
if (!isComponent && name === 'click') {
name = 'tap';
}
name = eventMap[name] || name;
return `${isCatch ? 'catch' : 'on'}${shared.capitalize(customizeEvent(name))}`;
},
};
const eventMap = {
touchstart: 'touchStart',
touchmove: 'touchMove',
touchend: 'touchEnd',
touchcancel: 'touchCancel',
longtap: 'longTap',
longpress: 'longTap',
transitionend: 'transitionEnd',
animationstart: 'animationStart',
animationiteration: 'animationIteration',
animationend: 'animationEnd',
firstappear: 'firstAppear',
// map
markertap: 'markerTap',
callouttap: 'calloutTap',
controltap: 'controlTap',
regionchange: 'regionChange',
paneltap: 'panelTap',
// scroll-view
scrolltoupper: 'scrollToUpper',
scrolltolower: 'scrollToLower',
// movable-view
changeend: 'changeEnd',
// video
timeupdate: 'timeUpdate',
waiting: 'loading',
fullscreenchange: 'fullScreenChange',
useraction: 'userAction',
renderstart: 'renderStart',
loadedmetadata: 'renderStart',
// swiper
animationfinish: 'animationEnd',
};
function transformOpenType(node) {
var _a;
if (node.type !== 1 /* NodeTypes.ELEMENT */ || node.tag !== 'button') {
return;
}
const openTypeProp = compilerCore.findProp(node, 'open-type');
if (!openTypeProp) {
return;
}
if (openTypeProp.type !== 6 /* NodeTypes.ATTRIBUTE */ ||
((_a = openTypeProp.value) === null || _a === void 0 ? void 0 : _a.content) !== 'getPhoneNumber') {
return;
}
openTypeProp.value.content = 'getAuthorize';
const { props } = node;
props.splice(props.indexOf(openTypeProp) + 1, 0, uniCliShared.createAttributeNode('scope', 'phoneNumber'));
let getPhoneNumberMethodName = '';
const getPhoneNumberPropIndex = props.findIndex((prop) => {
if (prop.type === 7 /* NodeTypes.DIRECTIVE */ && prop.name === 'on') {
const { arg, exp } = prop;
if ((arg === null || arg === void 0 ? void 0 : arg.type) === 4 /* NodeTypes.SIMPLE_EXPRESSION */ &&
(exp === null || exp === void 0 ? void 0 : exp.type) === 4 /* NodeTypes.SIMPLE_EXPRESSION */ &&
arg.isStatic &&
arg.content === 'getphonenumber') {
getPhoneNumberMethodName = exp.content;
return true;
}
}
});
if (!getPhoneNumberMethodName) {
return;
}
props.splice(getPhoneNumberPropIndex, 1);
const method = compilerCore.isSimpleIdentifier(getPhoneNumberMethodName)
? getPhoneNumberMethodName
: `$event => { ${getPhoneNumberMethodName} }`;
props.push(uniCliShared.createOnDirectiveNode('getAuthorize', `$onAliGetAuthorize(${method},$event)`));
props.push(uniCliShared.createOnDirectiveNode('error', `$onAliAuthError(${method},$event)`));
function transformOpenType(node) {
var _a;
if (node.type !== 1 /* NodeTypes.ELEMENT */ || node.tag !== 'button') {
return;
}
const openTypeProp = compilerCore.findProp(node, 'open-type');
if (!openTypeProp) {
return;
}
if (openTypeProp.type !== 6 /* NodeTypes.ATTRIBUTE */ ||
((_a = openTypeProp.value) === null || _a === void 0 ? void 0 : _a.content) !== 'getPhoneNumber') {
return;
}
openTypeProp.value.content = 'getAuthorize';
const { props } = node;
props.splice(props.indexOf(openTypeProp) + 1, 0, uniCliShared.createAttributeNode('scope', 'phoneNumber'));
let getPhoneNumberMethodName = '';
const getPhoneNumberPropIndex = props.findIndex((prop) => {
if (prop.type === 7 /* NodeTypes.DIRECTIVE */ && prop.name === 'on') {
const { arg, exp } = prop;
if ((arg === null || arg === void 0 ? void 0 : arg.type) === 4 /* NodeTypes.SIMPLE_EXPRESSION */ &&
(exp === null || exp === void 0 ? void 0 : exp.type) === 4 /* NodeTypes.SIMPLE_EXPRESSION */ &&
arg.isStatic &&
arg.content === 'getphonenumber') {
getPhoneNumberMethodName = exp.content;
return true;
}
}
});
if (!getPhoneNumberMethodName) {
return;
}
props.splice(getPhoneNumberPropIndex, 1);
const method = compilerCore.isSimpleIdentifier(getPhoneNumberMethodName)
? getPhoneNumberMethodName
: `$event => { ${getPhoneNumberMethodName} }`;
props.push(uniCliShared.createOnDirectiveNode('getAuthorize', `$onAliGetAuthorize(${method},$event)`));
props.push(uniCliShared.createOnDirectiveNode('error', `$onAliAuthError(${method},$event)`));
}
const projectConfigFilename = 'mini.project.json';
const COMPONENTS_DIR = 'mycomponents';
const miniProgram = {
event,
class: {
array: false,
},
slot: {
$slots: false,
// 支付宝 fallback 有 bug,当多个带默认 slot 组件嵌套使用时,所有的默认slot均会显示,如uni-file-picker(image)
fallbackContent: true,
dynamicSlotNames: true,
},
directive: 'a:',
component: {
dir: COMPONENTS_DIR,
getPropertySync: true,
},
};
const nodeTransforms = [
transformRef,
transformOpenType,
uniCliShared.transformMatchMedia,
uniCliShared.createTransformComponentLink(uniCliShared.COMPONENT_ON_LINK, 6 /* NodeTypes.ATTRIBUTE */),
];
const compilerOptions = {
nodeTransforms,
};
const customElements = [
'lifestyle',
'life-follow',
'contact-button',
'spread',
'error-view',
'poster',
'cashier',
'ix-grid',
'ix-native-grid',
'ix-native-list',
'mkt',
'page-container',
'page-meta',
];
const options = {
cdn: 2,
vite: {
inject: {
uni: [path__default.default.resolve(__dirname, 'uni.api.esm.js'), 'default'],
},
alias: {
'uni-mp-runtime': path__default.default.resolve(__dirname, 'uni.mp.esm.js'),
},
copyOptions: {
assets: [COMPONENTS_DIR],
targets: [
...(process.env.UNI_MP_PLUGIN ? [uniCliShared.copyMiniProgramPluginJson] : []),
{
src: ['customize-tab-bar', 'ext.json'],
get dest() {
return process.env.UNI_OUTPUT_DIR;
},
},
],
},
},
global: 'my',
json: {
windowOptionsMap: {
defaultTitle: 'navigationBarTitleText',
pullRefresh: 'enablePullDownRefresh',
allowsBounceVertical: 'allowsBounceVertical',
titleBarColor: 'navigationBarBackgroundColor',
optionMenu: 'optionMenu',
backgroundColor: 'backgroundColor',
usingComponents: 'usingComponents',
navigationBarShadow: 'navigationBarShadow',
titleImage: 'titleImage',
transparentTitle: 'transparentTitle',
titlePenetrate: 'titlePenetrate',
},
tabBarOptionsMap: {
customize: 'customize',
textColor: 'color',
selectedColor: 'selectedColor',
backgroundColor: 'backgroundColor',
items: 'list',
},
tabBarItemOptionsMap: {
pagePath: 'pagePath',
name: 'text',
icon: 'iconPath',
activeIcon: 'selectedIconPath',
},
},
app: {
darkmode: false,
subpackages: true,
plugins: true,
usingComponents: false,
normalize(appJson) {
// 支付宝小程序默认主包,分包 js 模块不共享,会导致 getCurrentInstance,setCurrentInstance 不一致
appJson.subPackageBuildType = 'shared';
return appJson;
},
},
project: {
filename: projectConfigFilename,
config: ['mini.project.json', 'project.my.json'],
source,
normalize(projectJson) {
var _a;
const miniprogram = (_a = projectJson.condition) === null || _a === void 0 ? void 0 : _a.miniprogram;
if (miniprogram && shared.isArray(miniprogram.list) && miniprogram.list.length) {
const compileModeJson = {
modes: [],
};
compileModeJson.modes = miniprogram.list.map((item) => {
return {
title: item.name,
page: item.pathName,
pageQuery: item.query,
};
});
const miniIdeDir = path__default.default.join(process.env.UNI_OUTPUT_DIR, '.mini-ide');
if (!fs__default.default.existsSync(miniIdeDir)) {
fs__default.default.mkdirSync(miniIdeDir, { recursive: true });
fs__default.default.writeFileSync(path__default.default.join(miniIdeDir, 'compileMode.json'), JSON.stringify(compileModeJson, null, 2));
}
delete projectJson.condition;
}
return projectJson;
},
},
template: Object.assign(Object.assign({}, miniProgram), { customElements, filter: {
extname: '.sjs',
lang: 'sjs',
generate(filter, filename) {
// TODO 标签内的 code 代码需要独立生成一个 sjs 文件
// 暂不处理,让开发者自己全部使用 src 引入
return `<import-sjs name="${filter.name}" from="${filename}.sjs"/>`;
},
}, extname: '.axml', compilerOptions }),
style: {
extname: '.acss',
},
const projectConfigFilename = 'mini.project.json';
const COMPONENTS_DIR = 'mycomponents';
const miniProgram = {
event,
class: {
array: false,
},
slot: {
$slots: false,
// 支付宝 fallback 有 bug,当多个带默认 slot 组件嵌套使用时,所有的默认slot均会显示,如uni-file-picker(image)
fallbackContent: true,
dynamicSlotNames: true,
},
directive: 'a:',
component: {
dir: COMPONENTS_DIR,
getPropertySync: true,
},
};
const nodeTransforms = [
transformRef,
transformOpenType,
uniCliShared.transformMatchMedia,
uniCliShared.createTransformComponentLink(uniCliShared.COMPONENT_ON_LINK, 6 /* NodeTypes.ATTRIBUTE */),
];
const compilerOptions = {
nodeTransforms,
};
const customElements = [
'lifestyle',
'life-follow',
'contact-button',
'spread',
'error-view',
'poster',
'cashier',
'ix-grid',
'ix-native-grid',
'ix-native-list',
'mkt',
'page-container',
'page-meta',
];
const options = {
cdn: 2,
vite: {
inject: {
uni: [path__default.default.resolve(__dirname, 'uni.api.esm.js'), 'default'],
},
alias: {
'uni-mp-runtime': path__default.default.resolve(__dirname, 'uni.mp.esm.js'),
},
copyOptions: {
assets: [COMPONENTS_DIR],
targets: [
...(process.env.UNI_MP_PLUGIN ? [uniCliShared.copyMiniProgramPluginJson] : []),
{
src: ['customize-tab-bar', 'ext.json'],
get dest() {
return process.env.UNI_OUTPUT_DIR;
},
},
],
},
},
global: 'my',
json: {
windowOptionsMap: {
defaultTitle: 'navigationBarTitleText',
pullRefresh: 'enablePullDownRefresh',
allowsBounceVertical: 'allowsBounceVertical',
titleBarColor: 'navigationBarBackgroundColor',
optionMenu: 'optionMenu',
backgroundColor: 'backgroundColor',
usingComponents: 'usingComponents',
navigationBarShadow: 'navigationBarShadow',
titleImage: 'titleImage',
transparentTitle: 'transparentTitle',
titlePenetrate: 'titlePenetrate',
},
tabBarOptionsMap: {
customize: 'customize',
textColor: 'color',
selectedColor: 'selectedColor',
backgroundColor: 'backgroundColor',
items: 'list',
},
tabBarItemOptionsMap: {
pagePath: 'pagePath',
name: 'text',
icon: 'iconPath',
activeIcon: 'selectedIconPath',
},
},
app: {
darkmode: false,
subpackages: true,
plugins: true,
usingComponents: false,
normalize(appJson) {
// 支付宝小程序默认主包,分包 js 模块不共享,会导致 getCurrentInstance,setCurrentInstance 不一致
appJson.subPackageBuildType = 'shared';
return appJson;
},
},
project: {
filename: projectConfigFilename,
config: ['mini.project.json', 'project.my.json'],
source,
normalize(projectJson) {
var _a;
const miniprogram = (_a = projectJson.condition) === null || _a === void 0 ? void 0 : _a.miniprogram;
if (miniprogram && shared.isArray(miniprogram.list) && miniprogram.list.length) {
const compileModeJson = {
modes: [],
};
compileModeJson.modes = miniprogram.list.map((item) => {
return {
title: item.name,
page: item.pathName,
pageQuery: item.query,
};
});
const miniIdeDir = path__default.default.join(process.env.UNI_OUTPUT_DIR, '.mini-ide');
if (!fs__default.default.existsSync(miniIdeDir)) {
fs__default.default.mkdirSync(miniIdeDir, { recursive: true });
fs__default.default.writeFileSync(path__default.default.join(miniIdeDir, 'compileMode.json'), JSON.stringify(compileModeJson, null, 2));
}
delete projectJson.condition;
}
return projectJson;
},
},
template: Object.assign(Object.assign({}, miniProgram), { customElements, filter: {
extname: '.sjs',
lang: 'sjs',
generate(filter, filename) {
// TODO 标签内的 code 代码需要独立生成一个 sjs 文件
// 暂不处理,让开发者自己全部使用 src 引入
return `<import-sjs name="${filter.name}" from="${filename}.sjs"/>`;
},
}, extname: '.axml', compilerOptions }),
style: {
extname: '.acss',
},
};
const uniMiniProgramAlipayPlugin = {
name: 'uni:mp-alipay',
config() {
const buildOptions = {};
if (process.env.NODE_ENV === 'production') {
buildOptions.terserOptions = {
compress: false,
mangle: false,
};
}
return {
define: {
__VUE_CREATED_DEFERRED__: false,
},
build: shared.extend({
assetsInlineLimit: 0,
}, buildOptions),
};
},
// fix question/159362
transform(code, id) {
if (id.includes('@vue/shared') || id.includes('@vue\\shared')) {
return {
code: code.replace('//gs', '//g'),
map: { mappings: '' },
};
}
},
};
const uniMiniProgramAlipayPlugin = {
name: 'uni:mp-alipay',
config() {
const buildOptions = {};
if (process.env.NODE_ENV === 'production') {
buildOptions.terserOptions = {
compress: false,
mangle: false,
};
}
return {
define: {
__VUE_CREATED_DEFERRED__: false,
},
build: shared.extend({
assetsInlineLimit: 0,
}, buildOptions),
};
},
// fix question/159362
transform(code, id) {
if (id.includes('@vue/shared') || id.includes('@vue\\shared')) {
return {
code: code.replace('//gs', '//g'),
map: { mappings: '' },
};
}
},
};
var index = [uniMiniProgramAlipayPlugin, ...initMiniProgramPlugin__default.default(options)];
module.exports = index;
......@@ -35,175 +35,175 @@ var source = {
setting: setting
};
const transformFor = (node, context) => {
if (!uniMpCompiler.isForElementNode(node)) {
return;
}
const { vFor, props } = node;
let sourceCode = vFor.valueAlias + ' in ' + vFor.sourceAlias;
const keyProp = uniMpCompiler.findProp(node, 'key', true);
if (keyProp) {
const { exp } = keyProp;
if (exp) {
const key = uniMpCompiler.rewriteExpression(exp, context).content;
sourceCode = sourceCode + ' trackBy ' + key;
props.splice(props.indexOf(keyProp), 1);
}
}
vFor.valueAlias = '';
vFor.sourceCode = sourceCode;
const transformFor = (node, context) => {
if (!uniMpCompiler.isForElementNode(node)) {
return;
}
const { vFor, props } = node;
let sourceCode = vFor.valueAlias + ' in ' + vFor.sourceAlias;
const keyProp = uniMpCompiler.findProp(node, 'key', true);
if (keyProp) {
const { exp } = keyProp;
if (exp) {
const key = uniMpCompiler.rewriteExpression(exp, context).content;
sourceCode = sourceCode + ' trackBy ' + key;
props.splice(props.indexOf(keyProp), 1);
}
}
vFor.valueAlias = '';
vFor.sourceCode = sourceCode;
};
/**
* 百度小程序的自定义组件,不支持动态事件绑定
*/
/**
* 百度小程序的自定义组件,不支持动态事件绑定
*/
const transformOn = uniCliShared.createTransformOn(uniMpCompiler.transformOn);
/**
* 百度小程序的自定义组件,不支持动态事件绑定,故 v-model 也需要调整
*/
/**
* 百度小程序的自定义组件,不支持动态事件绑定,故 v-model 也需要调整
*/
const transformModel = uniCliShared.createTransformModel(uniMpCompiler.transformModel);
const customElements = [
'animation-video',
'animation-view',
'ar-camera',
'rtc-room',
'rtc-room-item',
'tabs',
'tab-item',
'follow-swan',
'login',
'inline-payment-panel',
'talos-linear-gradient',
'talos-rc-view',
'talos-nested-scroll-view',
'talos-nested-scroll-top-container',
'talos-nested-scroll-bottom-container',
'talos-waterfall-view',
'talos-waterfall-item',
'talos-waterfall-header',
'talos-waterfall-footer',
'talos-pull-refresh',
'talos-control-container',
'talos-na-refresh-control',
'talos-modal',
'talos-svg',
];
const nodeTransforms = [uniCliShared.transformRef, transformFor, uniCliShared.transformMatchMedia];
const directiveTransforms = {
on: transformOn,
model: transformModel,
};
const COMPONENTS_DIR = 'swancomponents';
const miniProgram = {
class: {
array: true,
},
slot: {
fallbackContent: true,
// https://github.com/baidu/san/discussions/601
dynamicSlotNames: false,
},
directive: 's-',
lazyElement: {
editor: [
{
name: 'on',
arg: ['ready'],
},
],
'animation-view': true,
},
component: {
dir: COMPONENTS_DIR,
},
};
const compilerOptions = {
nodeTransforms,
directiveTransforms,
};
const projectConfigFilename = 'project.swan.json';
const options = {
cdn: 3,
vite: {
inject: {
uni: [path__default.default.resolve(__dirname, 'uni.api.esm.js'), 'default'],
},
alias: {
'uni-mp-runtime': path__default.default.resolve(__dirname, 'uni.mp.esm.js'),
},
copyOptions: {
assets: [COMPONENTS_DIR],
targets: [
{
src: ['ext.json'],
get dest() {
return process.env.UNI_OUTPUT_DIR;
},
},
],
},
},
global: 'swan',
app: {
darkmode: false,
subpackages: true,
usingComponents: true,
},
project: {
filename: projectConfigFilename,
config: ['project.swan.json'],
source,
normalize(projectJson) {
var _a;
const miniprogram = (_a = projectJson.condition) === null || _a === void 0 ? void 0 : _a.miniprogram;
if (miniprogram &&
Array.isArray(miniprogram.list) &&
miniprogram.list.length) {
projectJson['compilation-args'].options =
miniprogram.list.map((item) => {
return {
id: item.id,
text: item.name,
extra: {
index: item.pathName,
query: item.query,
},
};
});
delete projectJson.condition;
}
return projectJson;
},
},
template: Object.assign(Object.assign({}, miniProgram), { customElements, filter: {
extname: '.sjs',
lang: 'sjs',
generate(filter, filename) {
if (filename) {
return `<import-sjs src="${filename}.sjs" module="${filter.name}"/>`;
}
const customElements = [
'animation-video',
'animation-view',
'ar-camera',
'rtc-room',
'rtc-room-item',
'tabs',
'tab-item',
'follow-swan',
'login',
'inline-payment-panel',
'talos-linear-gradient',
'talos-rc-view',
'talos-nested-scroll-view',
'talos-nested-scroll-top-container',
'talos-nested-scroll-bottom-container',
'talos-waterfall-view',
'talos-waterfall-item',
'talos-waterfall-header',
'talos-waterfall-footer',
'talos-pull-refresh',
'talos-control-container',
'talos-na-refresh-control',
'talos-modal',
'talos-svg',
];
const nodeTransforms = [uniCliShared.transformRef, transformFor, uniCliShared.transformMatchMedia];
const directiveTransforms = {
on: transformOn,
model: transformModel,
};
const COMPONENTS_DIR = 'swancomponents';
const miniProgram = {
class: {
array: true,
},
slot: {
fallbackContent: true,
// https://github.com/baidu/san/discussions/601
dynamicSlotNames: false,
},
directive: 's-',
lazyElement: {
editor: [
{
name: 'on',
arg: ['ready'],
},
],
'animation-view': true,
},
component: {
dir: COMPONENTS_DIR,
},
};
const compilerOptions = {
nodeTransforms,
directiveTransforms,
};
const projectConfigFilename = 'project.swan.json';
const options = {
cdn: 3,
vite: {
inject: {
uni: [path__default.default.resolve(__dirname, 'uni.api.esm.js'), 'default'],
},
alias: {
'uni-mp-runtime': path__default.default.resolve(__dirname, 'uni.mp.esm.js'),
},
copyOptions: {
assets: [COMPONENTS_DIR],
targets: [
{
src: ['ext.json'],
get dest() {
return process.env.UNI_OUTPUT_DIR;
},
},
],
},
},
global: 'swan',
app: {
darkmode: false,
subpackages: true,
usingComponents: true,
},
project: {
filename: projectConfigFilename,
config: ['project.swan.json'],
source,
normalize(projectJson) {
var _a;
const miniprogram = (_a = projectJson.condition) === null || _a === void 0 ? void 0 : _a.miniprogram;
if (miniprogram &&
Array.isArray(miniprogram.list) &&
miniprogram.list.length) {
projectJson['compilation-args'].options =
miniprogram.list.map((item) => {
return {
id: item.id,
text: item.name,
extra: {
index: item.pathName,
query: item.query,
},
};
});
delete projectJson.condition;
}
return projectJson;
},
},
template: Object.assign(Object.assign({}, miniProgram), { customElements, filter: {
extname: '.sjs',
lang: 'sjs',
generate(filter, filename) {
if (filename) {
return `<import-sjs src="${filename}.sjs" module="${filter.name}"/>`;
}
return `<import-sjs module="${filter.name}">
${filter.code}
</import-sjs>`;
},
}, extname: '.swan', compilerOptions }),
style: {
extname: '.css',
},
</import-sjs>`;
},
}, extname: '.swan', compilerOptions }),
style: {
extname: '.css',
},
};
const uniMiniProgramBaiduPlugin = {
name: 'uni:mp-baidu',
config() {
return {
define: {
__VUE_CREATED_DEFERRED__: false,
},
};
},
};
const uniMiniProgramBaiduPlugin = {
name: 'uni:mp-baidu',
config() {
return {
define: {
__VUE_CREATED_DEFERRED__: false,
},
};
},
};
var index = [uniMiniProgramBaiduPlugin, ...initMiniProgramPlugin__default.default(options)];
module.exports = index;
import { defineComponent } from 'vue'
import { ComponentOptions, defineComponent } from 'vue'
import { initHooks, initUnknownHooks } from '../src/runtime/componentHooks'
const vueBasicOptions = defineComponent({
onLoad() {},
beforeCreate() {},
})
}) as ComponentOptions
const vueExtendsOptions = defineComponent({
extends: vueBasicOptions,
onShow() {},
})
}) as ComponentOptions
const vueMixinsOptions = defineComponent({
mixins: [vueExtendsOptions],
onHide() {},
})
}) as ComponentOptions
const vueExtendsANdMixinsOptions = defineComponent({
extends: vueBasicOptions,
mixins: [vueMixinsOptions],
onReady() {},
})
}) as ComponentOptions
describe('hooks', () => {
test('basic', () => {
......
......@@ -3,7 +3,7 @@ import { normalizeLocale, LOCALE_EN } from '@dcloudio/uni-i18n';
import { LINEFEED, Emitter, onCreateVueApp, invokeCreateVueAppHook } from '@dcloudio/uni-shared';
function getBaseSystemInfo() {
return jd.getSystemInfoSync()
return jd.getSystemInfoSync();
}
function validateProtocolFail(name, msg) {
......
......@@ -104,111 +104,111 @@ var source = {
condition: condition
};
/**
* 快手小程序的自定义组件,不支持动态事件绑定
*/
const transformOn = uniCliShared.createTransformOn(uniMpCompiler.transformOn, {
match: (name, node, context) => {
if (name === 'getphonenumber')
return true;
if (name === 'input' && (node.tag === 'input' || node.tag === 'textarea')) {
return true;
}
return uniCliShared.matchTransformOn(name, node, context);
},
/**
* 快手小程序的自定义组件,不支持动态事件绑定
*/
const transformOn = uniCliShared.createTransformOn(uniMpCompiler.transformOn, {
match: (name, node, context) => {
if (name === 'getphonenumber')
return true;
if (name === 'input' && (node.tag === 'input' || node.tag === 'textarea')) {
return true;
}
return uniCliShared.matchTransformOn(name, node, context);
},
});
/**
* 快手小程序的自定义组件,不支持动态事件绑定,故 v-model 也需要调整,其中 input、textarea 也不支持
*/
const transformModel = uniCliShared.createTransformModel(uniMpCompiler.transformModel, {
match: (node, context) => {
if (node.tag === 'input' || node.tag === 'textarea') {
return true;
}
return uniCliShared.matchTransformModel(node, context);
},
/**
* 快手小程序的自定义组件,不支持动态事件绑定,故 v-model 也需要调整,其中 input、textarea 也不支持
*/
const transformModel = uniCliShared.createTransformModel(uniMpCompiler.transformModel, {
match: (node, context) => {
if (node.tag === 'input' || node.tag === 'textarea') {
return true;
}
return uniCliShared.matchTransformModel(node, context);
},
});
const nodeTransforms = [uniCliShared.transformRef, uniCliShared.transformComponentLink];
const directiveTransforms = {
on: transformOn,
model: transformModel,
};
const compilerOptions = {
nodeTransforms,
directiveTransforms,
};
const COMPONENTS_DIR = 'kscomponents';
const miniProgram = {
class: {
array: false,
},
slot: {
fallbackContent: false,
dynamicSlotNames: false,
},
directive: 'ks:',
lazyElement: {
switch: [{ name: 'on', arg: ['change'] }],
},
component: {
dir: COMPONENTS_DIR,
},
};
const projectConfigFilename = 'project.config.json';
const options = {
cdn: 9,
vite: {
inject: {
uni: [path__default.default.resolve(__dirname, 'uni.api.esm.js'), 'default'],
},
alias: {
'uni-mp-runtime': path__default.default.resolve(__dirname, 'uni.mp.esm.js'),
},
copyOptions: {
assets: [COMPONENTS_DIR],
targets: [
{
src: ['ext.json'],
get dest() {
return process.env.UNI_OUTPUT_DIR;
},
},
],
},
},
global: 'ks',
app: {
darkmode: false,
subpackages: true,
usingComponents: true,
},
project: {
filename: projectConfigFilename,
config: ['project.ks.json'],
source,
},
template: Object.assign(Object.assign({}, miniProgram), { filter: undefined, extname: '.ksml', compilerOptions }),
style: {
extname: '.css',
},
const nodeTransforms = [uniCliShared.transformRef, uniCliShared.transformComponentLink];
const directiveTransforms = {
on: transformOn,
model: transformModel,
};
const compilerOptions = {
nodeTransforms,
directiveTransforms,
};
const COMPONENTS_DIR = 'kscomponents';
const miniProgram = {
class: {
array: false,
},
slot: {
fallbackContent: false,
dynamicSlotNames: false,
},
directive: 'ks:',
lazyElement: {
switch: [{ name: 'on', arg: ['change'] }],
},
component: {
dir: COMPONENTS_DIR,
},
};
const projectConfigFilename = 'project.config.json';
const options = {
cdn: 9,
vite: {
inject: {
uni: [path__default.default.resolve(__dirname, 'uni.api.esm.js'), 'default'],
},
alias: {
'uni-mp-runtime': path__default.default.resolve(__dirname, 'uni.mp.esm.js'),
},
copyOptions: {
assets: [COMPONENTS_DIR],
targets: [
{
src: ['ext.json'],
get dest() {
return process.env.UNI_OUTPUT_DIR;
},
},
],
},
},
global: 'ks',
app: {
darkmode: false,
subpackages: true,
usingComponents: true,
},
project: {
filename: projectConfigFilename,
config: ['project.ks.json'],
source,
},
template: Object.assign(Object.assign({}, miniProgram), { filter: undefined, extname: '.ksml', compilerOptions }),
style: {
extname: '.css',
},
};
const uniMiniProgramKuaishouPlugin = {
name: 'uni:mp-kuaishou',
config() {
return {
define: {
__VUE_CREATED_DEFERRED__: false,
},
build: {
// css 中不支持引用本地资源
assetsInlineLimit: uniCliShared.ASSETS_INLINE_LIMIT,
},
};
},
};
const uniMiniProgramKuaishouPlugin = {
name: 'uni:mp-kuaishou',
config() {
return {
define: {
__VUE_CREATED_DEFERRED__: false,
},
build: {
// css 中不支持引用本地资源
assetsInlineLimit: uniCliShared.ASSETS_INLINE_LIMIT,
},
};
},
};
var index = [uniMiniProgramKuaishouPlugin, ...initMiniProgramPlugin__default.default(options)];
module.exports = index;
此差异已折叠。
......@@ -615,7 +615,7 @@ export declare function removeLeadingSlash(str: string): string;
export declare const RENDERJS_MODULES = "renderjsModules";
export declare function resolveComponentInstance(instance?: ComponentInternalInstance | ComponentPublicInstance): ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}, {}, string>, {}> | undefined;
export declare function resolveComponentInstance(instance?: ComponentInternalInstance | ComponentPublicInstance): ComponentPublicInstance | undefined;
export declare function resolveOwnerEl(instance: ComponentInternalInstance, multi: true): RendererNode[];
......
......@@ -71,7 +71,7 @@ export function scrollTo(
}
}
}
if (scrollTop < 0) {
if ((scrollTop as number) < 0) {
scrollTop = 0
}
const documentElement = document.documentElement
......
......@@ -5,13 +5,13 @@
*/
const sys = uni.getSystemInfoSync();
// 访问开始即启动小程序,访问结束结分为:进入后台超过5min、在前台无任何操作超过30min、在新的来源打开小程序;
const STAT_VERSION = process.env.UNI_COMPILER_VERSION;
const STAT_URL = 'https://tongji.dcloud.io/uni/stat';
const STAT_H5_URL = 'https://tongji.dcloud.io/uni/stat.gif';
const PAGE_PVER_TIME = 1800; // 页面在前台无操作结束访问时间 单位s
const APP_PVER_TIME = 300; // 应用在后台结束访问时间 单位s
const OPERATING_TIME = 10; // 数据上报时间 单位s
// 访问开始即启动小程序,访问结束结分为:进入后台超过5min、在前台无任何操作超过30min、在新的来源打开小程序;
const STAT_VERSION = process.env.UNI_COMPILER_VERSION;
const STAT_URL = 'https://tongji.dcloud.io/uni/stat';
const STAT_H5_URL = 'https://tongji.dcloud.io/uni/stat.gif';
const PAGE_PVER_TIME = 1800; // 页面在前台无操作结束访问时间 单位s
const APP_PVER_TIME = 300; // 应用在后台结束访问时间 单位s
const OPERATING_TIME = 10; // 数据上报时间 单位s
const DIFF_TIME = 60 * 1000 * 60 * 24;
const appid = process.env.UNI_APP_ID; // 做应用隔离
......
......@@ -3,13 +3,13 @@
*/
const sys = uni.getSystemInfoSync();
// 访问开始即启动小程序,访问结束结分为:进入后台超过5min、在前台无任何操作超过30min、在新的来源打开小程序;
const STAT_VERSION = process.env.UNI_COMPILER_VERSION;
const STAT_URL = 'https://tongji.dcloud.io/uni/stat';
const STAT_H5_URL = 'https://tongji.dcloud.io/uni/stat.gif';
const PAGE_PVER_TIME = 1800; // 页面在前台无操作结束访问时间 单位s
const APP_PVER_TIME = 300; // 应用在后台结束访问时间 单位s
const OPERATING_TIME = 10; // 数据上报时间 单位s
// 访问开始即启动小程序,访问结束结分为:进入后台超过5min、在前台无任何操作超过30min、在新的来源打开小程序;
const STAT_VERSION = process.env.UNI_COMPILER_VERSION;
const STAT_URL = 'https://tongji.dcloud.io/uni/stat';
const STAT_H5_URL = 'https://tongji.dcloud.io/uni/stat.gif';
const PAGE_PVER_TIME = 1800; // 页面在前台无操作结束访问时间 单位s
const APP_PVER_TIME = 300; // 应用在后台结束访问时间 单位s
const OPERATING_TIME = 10; // 数据上报时间 单位s
const DIFF_TIME = 60 * 1000 * 60 * 24;
const appid = process.env.UNI_APP_ID; // 做应用隔离
......
此差异已折叠。
......@@ -31,9 +31,9 @@
"@dcloudio/uni-cli-shared": "3.0.0-alpha-3070420230224002",
"@dcloudio/uni-shared": "3.0.0-alpha-3070420230224002",
"@rollup/pluginutils": "^4.2.0",
"@vitejs/plugin-legacy": "^4.0.1",
"@vitejs/plugin-vue": "^4.0.0",
"@vitejs/plugin-vue-jsx": "^3.0.0",
"@vitejs/plugin-legacy": "^4.0.2",
"@vitejs/plugin-vue": "^4.1.0",
"@vitejs/plugin-vue-jsx": "^3.0.1",
"@vue/compiler-core": "3.2.47",
"@vue/compiler-dom": "3.2.47",
"@vue/compiler-sfc": "3.2.47",
......
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册