提交 45bae809 编写于 作者: Q qiang

Merge branch 'dev' into alpha

......@@ -42,7 +42,7 @@
"pluginUni.runDebugMode": "Please note that in running mode, due to log output, sourcemap, and uncompressed source code, the performance and package size are not as good as release mode.",
"pluginUni.runDebugModeNvue": "Especially the sourcemap of app-nvue has a greater impact",
"pluginUni.runDebugModeMP": "To officially release, please click the release menu or use the cli release command to release",
"pluginUni.compileToMpPluginOnlySupportWeChat": "Compile to mini-program plug-in only supports WeChat mini-program",
"pluginUni.compileToMpPluginOnlySupportPlatform": "Compile to mini-program plug-in only supports WeChat mini-program and AliPay mini-program",
"pluginUni.startCompileProjectToPlatform": "Start to compile the current project to the {{0}} {{1}}...",
"pluginUni.fileNoExistsCheckAfterRetry": "{{0}} file does not exist, please check and try again",
"pluginUni.entryDileNoExistsCheckAfterRetry": "{{0}} The entry file does not exist, please check and try again",
......@@ -67,4 +67,4 @@
"pagesLoader.needInPagesNode": "{{0}} needs to be in the pages array",
"i18n.fallbackLocale.default": "fallbackLocale is missing in manifest.json, use:{{locale}}",
"i18n.fallbackLocale.missing": "./local/{locale}.json is missing"
}
}
......@@ -42,7 +42,7 @@
"pluginUni.runDebugMode": "请注意运行模式下,因日志输出、sourcemap以及未压缩源码等原因,性能和包体积,均不及发行模式。",
"pluginUni.runDebugModeNvue": "尤其是app-nvue的sourcemap影响较大",
"pluginUni.runDebugModeMP": "若要正式发布,请点击发行菜单或使用cli发布命令进行发布",
"pluginUni.compileToMpPluginOnlySupportWeChat": "编译到小程序插件只支持微信小程序",
"pluginUni.compileToMpPluginOnlySupportPlatform": "编译到小程序插件只支持微信小程序和阿里小程序",
"pluginUni.startCompileProjectToPlatform": "开始编译当前项目至 {{0}} {{1}}...",
"pluginUni.fileNoExistsCheckAfterRetry": "{{0}} 文件不存在,请检查后重试",
"pluginUni.entryDileNoExistsCheckAfterRetry": "{{0}} 入口文件不存在,请检查后重试",
......@@ -67,4 +67,4 @@
"pagesLoader.needInPagesNode": "{{0}} 需在 pages 数组中",
"i18n.fallbackLocale.default": "当前应用未在 manifest.json 配置 fallbackLocale,默认使用:{{locale}}",
"i18n.fallbackLocale.missing": "当前应用配置的 fallbackLocale 或 locale 为:{locale},但 locale 目录缺少该语言文件"
}
}
......@@ -15,6 +15,6 @@
"license": "Apache-2.0",
"dependencies": {
"i18n": "^0.13.3",
"os-locale-s-fix": "^1.0.8-fix"
"os-locale-s-fix": "^1.0.8-fix-1"
}
}
const path = require('path')
const { parseJson } = require('@dcloudio/uni-cli-shared/lib/json')
module.exports = {
options: {
global: 'my',
......@@ -21,6 +24,14 @@ module.exports = {
global.uniModules.forEach(module => {
copyOptions.push('uni_modules/' + module + '/mycomponents')
})
if (process.env.UNI_MP_PLUGIN) {
copyOptions.push({
from: path.resolve(process.env.UNI_INPUT_DIR, 'plugin.json'),
transform: content => JSON.stringify(parseJson(content.toString(), true))
})
}
return copyOptions
}
}
}
import { isSymbol, isObject, toRawType, def, isArray, isFunction, NOOP, remove, toHandlerKey, camelize, capitalize, isString, normalizeClass, extend, normalizeStyle, isOn, isPromise, EMPTY_OBJ, hasChanged, isSet, isMap, isPlainObject, invokeArrayFns, hasOwn, NO, isIntegerKey, toNumber, hyphenate, isReservedProp, EMPTY_ARR, makeMap, toTypeString } from '@vue/shared';
import { isSymbol, isObject, toRawType, def, hasChanged, isArray, isFunction, NOOP, remove, toHandlerKey, camelize, capitalize, isString, normalizeClass, extend, normalizeStyle, isOn, isPromise, EMPTY_OBJ, isSet, isMap, isPlainObject, invokeArrayFns, hasOwn, NO, isIntegerKey, toNumber, hyphenate, isReservedProp, EMPTY_ARR, makeMap, toTypeString } from '@vue/shared';
export { camelize } from '@vue/shared';
// lifecycle
......@@ -232,23 +232,6 @@ function cleanupEffect(effect) {
deps.length = 0;
}
}
function effect(fn, options) {
if (fn.effect) {
fn = fn.effect.fn;
}
const _effect = new ReactiveEffect(fn);
if (options) {
extend(_effect, options);
if (options.scope)
recordEffectScope(_effect, options.scope);
}
if (!options || !options.lazy) {
_effect.run();
}
const runner = _effect.run.bind(_effect);
runner.effect = _effect;
return runner;
}
let shouldTrack = true;
const trackStack = [];
function pauseTracking() {
......@@ -570,8 +553,6 @@ const shallowReadonlyHandlers = /*#__PURE__*/ extend({}, readonlyHandlers, {
get: shallowReadonlyGet
});
const toReactive = (value) => isObject(value) ? reactive(value) : value;
const toReadonly = (value) => isObject(value) ? readonly(value) : value;
const toShallow = (value) => value;
const getProto = (v) => Reflect.getPrototypeOf(v);
function get$1(target, key, isReadonly = false, isShallow = false) {
......@@ -960,7 +941,9 @@ function toRaw(observed) {
function markRaw(value) {
def(value, "__v_skip" /* SKIP */, true);
return value;
}
}
const toReactive = (value) => isObject(value) ? reactive(value) : value;
const toReadonly = (value) => isObject(value) ? readonly(value) : value;
function trackRefValue(ref) {
if (isTracking()) {
......@@ -996,7 +979,6 @@ function triggerRefValue(ref, newVal) {
}
}
}
const convert = (val) => isObject(val) ? reactive(val) : val;
function isRef(r) {
return Boolean(r && r.__v_isRef === true);
}
......@@ -1006,13 +988,19 @@ function ref(value) {
function shallowRef(value) {
return createRef(value, true);
}
function createRef(rawValue, shallow) {
if (isRef(rawValue)) {
return rawValue;
}
return new RefImpl(rawValue, shallow);
}
class RefImpl {
constructor(value, _shallow) {
this._shallow = _shallow;
this.dep = undefined;
this.__v_isRef = true;
this._rawValue = _shallow ? value : toRaw(value);
this._value = _shallow ? value : convert(value);
this._value = _shallow ? value : toReactive(value);
}
get value() {
trackRefValue(this);
......@@ -1022,17 +1010,11 @@ class RefImpl {
newVal = this._shallow ? newVal : toRaw(newVal);
if (hasChanged(newVal, this._rawValue)) {
this._rawValue = newVal;
this._value = this._shallow ? newVal : convert(newVal);
this._value = this._shallow ? newVal : toReactive(newVal);
triggerRefValue(this, newVal);
}
}
}
function createRef(rawValue, shallow) {
if (isRef(rawValue)) {
return rawValue;
}
return new RefImpl(rawValue, shallow);
}
function triggerRef(ref) {
triggerRefValue(ref, (process.env.NODE_ENV !== 'production') ? ref.value : void 0);
}
......@@ -1134,7 +1116,8 @@ class ComputedRefImpl {
function computed(getterOrOptions, debugOptions) {
let getter;
let setter;
if (isFunction(getterOrOptions)) {
const onlyGetter = isFunction(getterOrOptions);
if (onlyGetter) {
getter = getterOrOptions;
setter = (process.env.NODE_ENV !== 'production')
? () => {
......@@ -1146,7 +1129,7 @@ function computed(getterOrOptions, debugOptions) {
getter = getterOrOptions.get;
setter = getterOrOptions.set;
}
const cRef = new ComputedRefImpl(getter, setter, isFunction(getterOrOptions) || !getterOrOptions.set);
const cRef = new ComputedRefImpl(getter, setter, onlyGetter || !setter);
if ((process.env.NODE_ENV !== 'production') && debugOptions) {
cRef.effect.onTrack = debugOptions.onTrack;
cRef.effect.onTrigger = debugOptions.onTrigger;
......@@ -1154,7 +1137,13 @@ function computed(getterOrOptions, debugOptions) {
return cRef;
}
function emit(instance, event, ...rawArgs) {
function emit(event, ...args) {
}
function devtoolsComponentEmit(component, event, params) {
emit("component:emit" /* COMPONENT_EMIT */, component.appContext.app, component, event, params);
}
function emit$1(instance, event, ...rawArgs) {
const props = instance.vnode.props || EMPTY_OBJ;
if ((process.env.NODE_ENV !== 'production')) {
const { emitsOptions, propsOptions: [propsOptions] } = instance;
......@@ -1191,7 +1180,9 @@ function emit(instance, event, ...rawArgs) {
args = rawArgs.map(toNumber);
}
}
if ((process.env.NODE_ENV !== 'production') || false) ;
if ((process.env.NODE_ENV !== 'production') || false) {
devtoolsComponentEmit(instance, event, args);
}
if ((process.env.NODE_ENV !== 'production')) {
const lowerCaseEvent = event.toLowerCase();
if (lowerCaseEvent !== event && props[toHandlerKey(lowerCaseEvent)]) {
......@@ -2277,8 +2268,8 @@ function createAppContext() {
};
}
let uid = 0;
// fixed by xxxxxx
function createAppAPI(render, hydrate) {
function createAppAPI(render, // fixed by xxxxxx
hydrate) {
return function createApp(rootComponent, rootProps = null) {
if (rootProps != null && !isObject(rootProps)) {
(process.env.NODE_ENV !== 'production') && warn$1(`root props passed to app.mount() must be an object.`);
......@@ -2425,7 +2416,11 @@ function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false
return Component;
}
if ((process.env.NODE_ENV !== 'production') && warnMissing && !res) {
warn$1(`Failed to resolve ${type.slice(0, -1)}: ${name}`);
const extra = type === COMPONENTS
? `\nIf this is a native custom element, make sure to exclude it from ` +
`component resolution via compilerOptions.isCustomElement.`
: ``;
warn$1(`Failed to resolve ${type.slice(0, -1)}: ${name}${extra}`);
}
return res;
}
......@@ -2979,17 +2974,19 @@ function exposePropsOnRenderContext(instance) {
function exposeSetupStateOnRenderContext(instance) {
const { ctx, setupState } = instance;
Object.keys(toRaw(setupState)).forEach(key => {
if (!setupState.__isScriptSetup && (key[0] === '$' || key[0] === '_')) {
warn$1(`setup() return property ${JSON.stringify(key)} should not start with "$" or "_" ` +
`which are reserved prefixes for Vue internals.`);
return;
if (!setupState.__isScriptSetup) {
if (key[0] === '$' || key[0] === '_') {
warn$1(`setup() return property ${JSON.stringify(key)} should not start with "$" or "_" ` +
`which are reserved prefixes for Vue internals.`);
return;
}
Object.defineProperty(ctx, key, {
enumerable: true,
configurable: true,
get: () => setupState[key],
set: NOOP
});
}
Object.defineProperty(ctx, key, {
enumerable: true,
configurable: true,
get: () => setupState[key],
set: NOOP
});
});
}
......@@ -3072,7 +3069,7 @@ function createComponentInstance(vnode, parent, suspense) {
instance.ctx = { _: instance };
}
instance.root = parent ? parent.root : instance;
instance.emit = emit.bind(null, instance);
instance.emit = emit$1.bind(null, instance);
// apply custom element special handling
if (vnode.ce) {
vnode.ce(instance);
......@@ -3714,11 +3711,19 @@ function flushJobs(seen) {
// 2. If a component is unmounted during a parent component's update,
// its update can be skipped.
queue.sort((a, b) => getId(a) - getId(b));
// conditional usage of checkRecursiveUpdate must be determined out of
// try ... catch block since Rollup by default de-optimizes treeshaking
// inside try-catch. This can leave all warning code unshaked. Although
// they would get eventually shaken by a minifier like terser, some minifiers
// would fail to do that (e.g. https://github.com/evanw/esbuild/issues/1610)
const check = (process.env.NODE_ENV !== 'production')
? (job) => checkRecursiveUpdates(seen, job)
: NOOP;
try {
for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {
const job = queue[flushIndex];
if (job && job.active !== false) {
if ((process.env.NODE_ENV !== 'production') && checkRecursiveUpdates(seen, job)) {
if ((process.env.NODE_ENV !== 'production') && check(job)) {
continue;
}
// console.log(`running:`, job.id)
......@@ -3974,7 +3979,7 @@ function createPathGetter(ctx, path) {
return cur;
};
}
function traverse(value, seen = new Set()) {
function traverse(value, seen) {
if (!isObject(value) || value["__v_skip" /* SKIP */]) {
return value;
}
......@@ -4024,7 +4029,7 @@ function defineEmits() {
}
// Core API ------------------------------------------------------------------
const version = "3.2.11";
const version = "3.2.14";
// import deepCopy from './deepCopy'
/**
......@@ -4315,7 +4320,8 @@ var MPType;
})(MPType || (MPType = {}));
const queuePostRenderEffect$1 = queuePostFlushCb;
function mountComponent(initialVNode, options) {
const instance = (initialVNode.component = createComponentInstance(initialVNode, options.parentComponent, null));
const instance = (initialVNode.component =
createComponentInstance(initialVNode, options.parentComponent, null));
if (__VUE_OPTIONS_API__) {
instance.ctx.$onApplyOptions = onApplyOptions;
instance.ctx.$children = [];
......@@ -4333,8 +4339,7 @@ function mountComponent(initialVNode, options) {
if (__VUE_OPTIONS_API__) {
// $children
if (options.parentComponent && instance.proxy) {
options.parentComponent.ctx
.$children.push(instance.proxy);
options.parentComponent.ctx.$children.push(instance.proxy);
}
}
setupRenderEffect(instance);
......@@ -4343,19 +4348,8 @@ function mountComponent(initialVNode, options) {
}
return instance.proxy;
}
const prodEffectOptions = {
scheduler: queueJob
};
function createDevEffectOptions(instance) {
return {
scheduler: queueJob,
onTrack: instance.rtc ? e => invokeArrayFns(instance.rtc, e) : void 0,
onTrigger: instance.rtg ? e => invokeArrayFns(instance.rtg, e) : void 0
};
}
function setupRenderEffect(instance) {
// create reactive effect for rendering
instance.update = effect(function componentEffect() {
const componentUpdateFn = () => {
if (!instance.isMounted) {
instance.render && instance.render.call(instance.proxy);
patch(instance);
......@@ -4364,17 +4358,38 @@ function setupRenderEffect(instance) {
instance.render && instance.render.call(instance.proxy);
// updateComponent
const { bu, u } = instance;
effect.allowRecurse = false;
// beforeUpdate hook
if (bu) {
invokeArrayFns(bu);
}
effect.allowRecurse = true;
patch(instance);
// updated hook
if (u) {
queuePostRenderEffect$1(u);
}
}
}, (process.env.NODE_ENV !== 'production') ? createDevEffectOptions(instance) : prodEffectOptions);
};
// create reactive effect for rendering
const effect = new ReactiveEffect(componentUpdateFn, () => queueJob(instance.update), instance.scope // track it in component's effect scope
);
const update = (instance.update = effect.run.bind(effect));
update.id = instance.uid;
// allowRecurse
// #1801, #2043 component render effects should allow recursive updates
effect.allowRecurse = update.allowRecurse = true;
if ((process.env.NODE_ENV !== 'production')) {
effect.onTrack = instance.rtc
? e => invokeArrayFns(instance.rtc, e)
: void 0;
effect.onTrigger = instance.rtg
? e => invokeArrayFns(instance.rtg, e)
: void 0;
// @ts-ignore (for scheduler)
update.ownerInstance = instance;
}
update();
}
function unmountComponent(instance) {
const { bum, scope, update, um } = instance;
......
const fs = require('fs')
const path = require('path')
const { parseJson } = require('@dcloudio/uni-cli-shared/lib/json')
const COMPONENTS_DIR_NAME = 'wxcomponents'
......@@ -31,7 +32,12 @@ module.exports = {
'functional-pages'
]
if (process.env.UNI_MP_PLUGIN) copyOptions.push('plugin.json')
if (process.env.UNI_MP_PLUGIN) {
copyOptions.push({
from: path.resolve(process.env.UNI_INPUT_DIR, 'plugin.json'),
transform: content => JSON.stringify(parseJson(content.toString(), true))
})
}
const workers = platformOptions.workers
workers && copyOptions.push(workers)
......
......@@ -2,7 +2,8 @@ const path = require('path')
const {
runByHBuilderX,
isInHBuilderX
isInHBuilderX,
parseJson
} = require('@dcloudio/uni-cli-shared')
const uniI18n = require('@dcloudio/uni-cli-i18n')
......@@ -45,13 +46,14 @@ module.exports = (api, options) => {
process.env.UNI_SUBPACKGE = args.subpackage
}
const mpPluginPlatforms = ['mp-weixin', 'mp-alipay']
if (args.plugin) {
if (process.env.UNI_PLATFORM === 'mp-weixin') {
if (mpPluginPlatforms.includes(process.env.UNI_PLATFORM)) {
process.env.UNI_MP_PLUGIN = args.plugin
analysisPluginDir()
} else {
console.log()
console.error(uniI18n.__('pluginUni.compileToMpPluginOnlySupportWeChat'))
console.error(uniI18n.__('pluginUni.compileToMpPluginOnlySupportPlatform'))
console.log()
process.exit(0)
}
......@@ -224,7 +226,7 @@ function analysisPluginDir () {
process.exit(0)
}
const pluginJson = require(pluginJsonPath)
const pluginJson = parseJson(fs.readFileSync(pluginJsonPath, 'utf-8'), true)
// main 入口文件是否存在
process.env.UNI_MP_PLUGIN_MAIN = pluginJson.main
......
......@@ -84,11 +84,13 @@ function processWxss (name, assets) {
}
}
const parseRequirePath = path => path.startsWith('common') ? `./${path}` : path
function procssJs (name, assets, hasVendor) {
const dirname = path.dirname(name)
const runtimeJsCode = `require('${normalizePath(path.relative(dirname, 'common/runtime.js'))}');`
const vendorJsCode = hasVendor ? `require('${normalizePath(path.relative(dirname, 'common/vendor.js'))}');` : ''
const mainJsCode = `require('${normalizePath(path.relative(dirname, 'common/main.js'))}');`
const runtimeJsCode = `require('${normalizePath(parseRequirePath(path.relative(dirname, 'common/runtime.js')))}');`
const vendorJsCode = hasVendor ? `require('${normalizePath(parseRequirePath(path.relative(dirname, 'common/vendor.js')))}');` : ''
const mainJsCode = `require('${normalizePath(parseRequirePath(path.relative(dirname, 'common/main.js')))}');`
const code = `${runtimeJsCode}${vendorJsCode}${mainJsCode}` + assets[name].source().toString()
assets[name] = {
size () {
......@@ -172,7 +174,7 @@ module.exports = {
if (process.env.UNI_MP_PLUGIN) {
// 小程序插件入口使用
// packages\webpack-uni-mp-loader\lib\plugin\index-new.js -> addMPPluginRequire
beforeCode += `wx.__webpack_require_${process.env.UNI_MP_PLUGIN.replace(/-/g, '_')}__ = __webpack_require__;`
beforeCode += `${process.env.UNI_PLATFORM === 'mp-alipay' ? 'my' : 'wx'}.__webpack_require_${process.env.UNI_MP_PLUGIN.replace(/-/g, '_')}__ = __webpack_require__;`
const UNI_MP_PLUGIN_MAIN = process.env.UNI_MP_PLUGIN_MAIN
if (UNI_MP_PLUGIN_MAIN) {
......@@ -309,4 +311,4 @@ module.exports = {
webpackConfig.plugins.delete('preload')
webpackConfig.plugins.delete('prefetch')
}
}
}
......@@ -80,7 +80,7 @@ function addMPPluginRequire (compilation) {
const newlineIndex = compilation.assets[name].source().lastIndexOf('\n')
const source = compilation.assets[name].source().substring(0, newlineIndex) +
`\nmodule.exports = wx.__webpack_require_${process.env.UNI_MP_PLUGIN.replace(/-/g, '_')}__('${uniModuleId}');\n` +
`\nmodule.exports = ${process.env.UNI_PLATFORM === 'mp-alipay' ? 'my' : 'wx'}.__webpack_require_${process.env.UNI_MP_PLUGIN.replace(/-/g, '_')}__('${uniModuleId}');\n` +
compilation.assets[name].source().substring(newlineIndex + 1)
compilation.assets[name] = {
......
......@@ -110,7 +110,7 @@ export const request = {
}
}
export const configMTLS = {
export const configMTLS = {
certificates: {
type: Array,
required: true,
......@@ -120,4 +120,4 @@ export const configMTLS = {
}
}
}
}
\ No newline at end of file
}
......@@ -59,11 +59,11 @@ export function chooseImage ({
const camera = plus.camera.getCamera()
camera.captureImage(path => successCallback([path]),
errorCallback, {
filename: TEMP_PATH + '/camera/',
resolution: 'high',
crop,
sizeType
})
filename: TEMP_PATH + '/camera/',
resolution: 'high',
crop,
sizeType
})
}
function openAlbum () {
......
......@@ -193,22 +193,22 @@ export function operateRequestTask ({
}
}
export function configMTLS ({certificates}, callbackId) {
export function configMTLS ({ certificates }, callbackId) {
const stream = requireNativePlugin('stream')
stream.configMTLS(certificates, ({type, code, message}) => {
stream.configMTLS(certificates, ({ type, code, message }) => {
switch (type) {
case 'success':
invoke(callbackId, {
errMsg: 'configMTLS:ok',
code
})
break;
break
case 'fail':
invoke(callbackId, {
errMsg: 'configMTLS:fail ' + message,
code
})
break;
break
}
});
}
\ No newline at end of file
})
}
......@@ -238,7 +238,7 @@ export function registerApp (appVm, Vue) {
initSubscribeHandlers()
initAppLaunch(Vue, appVm)
initAppLaunch(appVm)
// 10s后清理临时文件
setTimeout(clearTempFile, 10000)
......
......@@ -6670,10 +6670,10 @@ os-homedir@^1.0.0, os-homedir@^1.0.1:
version "1.0.2"
resolved "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz#ffbc4988336e0e833de0c168c7ef152121aa7fb3"
os-locale-s-fix@^1.0.8-fix:
version "1.0.8-fix"
resolved "https://registry.yarnpkg.com/os-locale-s-fix/-/os-locale-s-fix-1.0.8-fix.tgz#e9e8ab797072d650fde878692bae2765b804529a"
integrity sha512-00BFYcNU6Cdn8uYNGSNinXMxQtKiA5lqTQKrbhxpHToZ6aCUip6G4ygK4ui+YIkk+xtfPsHy2tETVKIgxd1iAQ==
os-locale-s-fix@^1.0.8-fix-1:
version "1.0.8-fix-1"
resolved "https://registry.yarnpkg.com/os-locale-s-fix/-/os-locale-s-fix-1.0.8-fix-1.tgz#7db4f9fc7cea29e9266900ea0bc72aaff13ff14a"
integrity sha512-Sv0OvhPiMutICiwORAUefv02DCPb62IelBmo8ZsSrRHyI3FStqIWZvjqDkvtjU+lcujo7UNir+dCwKSqlEQ/5w==
dependencies:
lcid "^3.0.0"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册