提交 09ff4930 编写于 作者: Q qiang

Merge branch 'dev' into alpha

......@@ -6,7 +6,7 @@ module.exports = {
input: 'src/core/runtime/web-view/index.js',
output: {
name: 'uni',
file: 'dist/uni.webview.1.5.3.js',
file: 'dist/uni.webview.1.5.4.js',
format: 'umd'
},
plugins: [
......
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(e=e||self).uni=n()}(this,(function(){"use strict";try{var e={};Object.defineProperty(e,"passive",{get:function(){!0}}),window.addEventListener("test-passive",null,e)}catch(e){}var n=Object.prototype.hasOwnProperty;function i(e,i){return n.call(e,i)}var t=[];function r(){return window.__dcloud_weex_postMessage||window.__dcloud_weex_}var o=function(e,n){var i={options:{timestamp:+new Date},name:e,arg:n};if(r()){if("postMessage"===e){var o={data:[n]};return window.__dcloud_weex_postMessage?window.__dcloud_weex_postMessage(o):window.__dcloud_weex_.postMessage(JSON.stringify(o))}var a={type:"WEB_INVOKE_APPSERVICE",args:{data:i,webviewIds:t}};window.__dcloud_weex_postMessage?window.__dcloud_weex_postMessageToService(a):window.__dcloud_weex_.postMessageToService(JSON.stringify(a))}if(!window.plus)return window.parent.postMessage({type:"WEB_INVOKE_APPSERVICE",data:i,pageId:""},"*");if(0===t.length){var d=plus.webview.currentWebview();if(!d)throw new Error("plus.webview.currentWebview() is undefined");var s=d.parent(),w="";w=s?s.id:d.id,t.push(w)}if(plus.webview.getWebviewById("__uniapp__service"))plus.webview.postMessageToUniNView({type:"WEB_INVOKE_APPSERVICE",args:{data:i,webviewIds:t}},"__uniapp__service");else{var u=JSON.stringify(i);plus.webview.getLaunchWebview().evalJS('UniPlusBridge.subscribeHandler("'.concat("WEB_INVOKE_APPSERVICE",'",').concat(u,",").concat(JSON.stringify(t),");"))}},a={navigateTo:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.url;o("navigateTo",{url:encodeURI(n)})},navigateBack:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.delta;o("navigateBack",{delta:parseInt(n)||1})},switchTab:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.url;o("switchTab",{url:encodeURI(n)})},reLaunch:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.url;o("reLaunch",{url:encodeURI(n)})},redirectTo:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.url;o("redirectTo",{url:encodeURI(n)})},getEnv:function(e){r()?e({nvue:!0}):window.plus?e({plus:!0}):e({h5:!0})},postMessage:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};o("postMessage",e.data||{})}},d=/uni-app/i.test(navigator.userAgent),s=/Html5Plus/i.test(navigator.userAgent),w=/complete|loaded|interactive/;var u=window.my&&navigator.userAgent.indexOf(["t","n","e","i","l","C","y","a","p","i","l","A"].reverse().join(""))>-1;var g=window.swan&&window.swan.webView&&/swan/i.test(navigator.userAgent);var v=window.qq&&window.qq.miniProgram&&/QQ/i.test(navigator.userAgent)&&/miniProgram/i.test(navigator.userAgent);var c=window.tt&&window.tt.miniProgram&&/toutiaomicroapp/i.test(navigator.userAgent);var m=window.wx&&window.wx.miniProgram&&/micromessenger/i.test(navigator.userAgent)&&/miniProgram/i.test(navigator.userAgent);var p=window.qa&&/quickapp/i.test(navigator.userAgent);var f=window.ks&&window.ks.miniProgram&&/micromessenger/i.test(navigator.userAgent)&&/miniProgram/i.test(navigator.userAgent);var l=window.tt&&window.tt.miniProgram&&/Lark|Feishu/i.test(navigator.userAgent);var _=window.jd&&window.jd.miniProgram&&/micromessenger/i.test(navigator.userAgent)&&/miniProgram/i.test(navigator.userAgent);var E=window.xhs&&window.xhs.miniProgram&&/xhsminiapp/i.test(navigator.userAgent);for(var h,P=function(){window.UniAppJSBridge=!0,document.dispatchEvent(new CustomEvent("UniAppJSBridgeReady",{bubbles:!0,cancelable:!0}))},b=[function(e){if(d||s)return window.__dcloud_weex_postMessage||window.__dcloud_weex_?document.addEventListener("DOMContentLoaded",e):window.plus&&w.test(document.readyState)?setTimeout(e,0):document.addEventListener("plusready",e),a},function(e){if(m)return window.WeixinJSBridge&&window.WeixinJSBridge.invoke?setTimeout(e,0):document.addEventListener("WeixinJSBridgeReady",e),window.wx.miniProgram},function(e){if(v)return window.QQJSBridge&&window.QQJSBridge.invoke?setTimeout(e,0):document.addEventListener("QQJSBridgeReady",e),window.qq.miniProgram},function(e){if(u){document.addEventListener("DOMContentLoaded",e);var n=window.my;return{navigateTo:n.navigateTo,navigateBack:n.navigateBack,switchTab:n.switchTab,reLaunch:n.reLaunch,redirectTo:n.redirectTo,postMessage:n.postMessage,getEnv:n.getEnv}}},function(e){if(g)return document.addEventListener("DOMContentLoaded",e),window.swan.webView},function(e){if(c)return document.addEventListener("DOMContentLoaded",e),window.tt.miniProgram},function(e){if(p){window.QaJSBridge&&window.QaJSBridge.invoke?setTimeout(e,0):document.addEventListener("QaJSBridgeReady",e);var n=window.qa;return{navigateTo:n.navigateTo,navigateBack:n.navigateBack,switchTab:n.switchTab,reLaunch:n.reLaunch,redirectTo:n.redirectTo,postMessage:n.postMessage,getEnv:n.getEnv}}},function(e){if(f)return window.WeixinJSBridge&&window.WeixinJSBridge.invoke?setTimeout(e,0):document.addEventListener("WeixinJSBridgeReady",e),window.ks.miniProgram},function(e){if(l)return document.addEventListener("DOMContentLoaded",e),window.tt.miniProgram},function(e){if(_)return window.JDJSBridgeReady&&window.JDJSBridgeReady.invoke?setTimeout(e,0):document.addEventListener("JDJSBridgeReady",e),window.jd.miniProgram},function(e){if(E)return window.xhs.miniProgram},function(e){return document.addEventListener("DOMContentLoaded",e),a}],y=0;y<b.length&&!(h=b[y](P));y++);h||(h={});var B="undefined"!=typeof uni?uni:{};if(!B.navigateTo)for(var S in h)i(h,S)&&(B[S]=h[S]);return B.webView=h,B}));
......@@ -17,8 +17,6 @@ moduleAlias.addAlias('@vue/component-compiler-utils/package.json', require.resol
'@dcloudio/vue-cli-plugin-uni/packages/@vue/component-compiler-utils/package.json'))
if (isInHBuilderX) {
moduleAlias.addAlias('typescript', path.resolve(process.env.UNI_HBUILDERX_PLUGINS,
'compile-typescript/node_modules/typescript'))
moduleAlias.addAlias('less', path.resolve(process.env.UNI_HBUILDERX_PLUGINS,
'compile-less/node_modules/less'))
moduleAlias.addAlias('node-sass', path.resolve(process.env.UNI_HBUILDERX_PLUGINS,
......
{
"_from": "typescript@^2.8.3",
"_id": "typescript@2.9.2",
"_inBundle": false,
"_integrity": "sha512-Gr4p6nFNaoufRIY4NMdpQRNmgxVIGMs4Fcu/ujdYk3nAZqk7supzBE9idmvfZIlH/Cuj//dvi+019qEue9lV0w==",
"_location": "/typescript",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "typescript@^2.8.3",
"name": "typescript",
"escapedName": "typescript",
"rawSpec": "^2.8.3",
"saveSpec": null,
"fetchSpec": "^2.8.3"
},
"_requiredBy": [
"/"
],
"_resolved": "https://registry.npmjs.org/typescript/-/typescript-2.9.2.tgz",
"_shasum": "1cbf61d05d6b96269244eb6a3bce4bd914e0f00c",
"_spec": "typescript@^2.8.3",
"_where": "/Applications/HBuilderX.app/Contents/HBuilderX/plugins/compile-typescript",
"author": {
"name": "Microsoft Corp."
},
"bin": {
"tsc": "./bin/tsc",
"tsserver": "./bin/tsserver"
},
"browser": {
"fs": false,
"os": false,
"path": false
},
"bugs": {
"url": "https://github.com/Microsoft/TypeScript/issues"
},
"bundleDependencies": false,
"deprecated": false,
"description": "TypeScript is a language for application scale JavaScript development",
"devDependencies": {
"@octokit/rest": "latest",
"@types/browserify": "latest",
"@types/chai": "latest",
"@types/convert-source-map": "latest",
"@types/del": "latest",
"@types/glob": "latest",
"@types/gulp": "3.X",
"@types/gulp-concat": "latest",
"@types/gulp-help": "latest",
"@types/gulp-newer": "latest",
"@types/gulp-sourcemaps": "latest",
"@types/jake": "latest",
"@types/merge2": "latest",
"@types/minimatch": "latest",
"@types/minimist": "latest",
"@types/mkdirp": "latest",
"@types/mocha": "latest",
"@types/node": "8.5.5",
"@types/q": "latest",
"@types/run-sequence": "latest",
"@types/source-map-support": "latest",
"@types/through2": "latest",
"@types/travis-fold": "latest",
"@types/xml2js": "^0.4.0",
"browser-resolve": "^1.11.2",
"browserify": "latest",
"chai": "latest",
"chalk": "latest",
"convert-source-map": "latest",
"del": "latest",
"gulp": "3.X",
"gulp-clone": "latest",
"gulp-concat": "latest",
"gulp-help": "latest",
"gulp-insert": "latest",
"gulp-newer": "latest",
"gulp-sourcemaps": "latest",
"gulp-typescript": "latest",
"istanbul": "latest",
"jake": "latest",
"merge2": "latest",
"minimist": "latest",
"mkdirp": "latest",
"mocha": "latest",
"mocha-fivemat-progress-reporter": "latest",
"q": "latest",
"run-sequence": "latest",
"sorcery": "latest",
"source-map-support": "latest",
"through2": "latest",
"travis-fold": "latest",
"tslint": "latest",
"typescript": "next",
"vinyl": "latest",
"xml2js": "^0.4.19"
},
"engines": {
"node": ">=4.2.0"
},
"homepage": "http://typescriptlang.org/",
"keywords": [
"TypeScript",
"Microsoft",
"compiler",
"language",
"javascript"
],
"license": "Apache-2.0",
"main": "./lib/typescript.js",
"name": "typescript",
"repository": {
"type": "git",
"url": "git+https://github.com/Microsoft/TypeScript.git"
},
"scripts": {
"build": "npm run build:compiler && npm run build:tests",
"build:compiler": "jake local",
"build:tests": "jake tests",
"clean": "jake clean",
"gulp": "gulp",
"jake": "jake",
"lint": "jake lint",
"pretest": "jake tests",
"setup-hooks": "node scripts/link-hooks.js",
"start": "node lib/tsc",
"test": "jake runtests-parallel light=false"
},
"typings": "./lib/typescript.d.ts",
"version": "2.9.2"
"author": "Microsoft Corp.",
"homepage": "https://www.typescriptlang.org/",
"version": "3.7.5",
"license": "Apache-2.0",
"description": "TypeScript is a language for application scale JavaScript development",
"keywords": [
"TypeScript",
"Microsoft",
"compiler",
"language",
"javascript"
],
"bugs": {
"url": "https://github.com/Microsoft/TypeScript/issues"
},
"repository": {
"type": "git",
"url": "https://github.com/Microsoft/TypeScript.git"
},
"main": "./lib/typescript.js",
"typings": "./lib/typescript.d.ts",
"bin": {
"tsc": "./bin/tsc",
"tsserver": "./bin/tsserver"
},
"engines": {
"node": ">=4.2.0"
},
"devDependencies": {
"@octokit/rest": "latest",
"@types/browserify": "latest",
"@types/chai": "latest",
"@types/convert-source-map": "latest",
"@types/glob": "latest",
"@types/gulp": "^4.0.5",
"@types/gulp-concat": "latest",
"@types/gulp-newer": "latest",
"@types/gulp-rename": "0.0.33",
"@types/gulp-sourcemaps": "0.0.32",
"@types/jake": "latest",
"@types/merge2": "latest",
"@types/microsoft__typescript-etw": "latest",
"@types/minimatch": "latest",
"@types/minimist": "latest",
"@types/mkdirp": "latest",
"@types/mocha": "latest",
"@types/ms": "latest",
"@types/node": "latest",
"@types/node-fetch": "^2.3.4",
"@types/q": "latest",
"@types/source-map-support": "latest",
"@types/through2": "latest",
"@types/travis-fold": "latest",
"@types/xml2js": "^0.4.0",
"@typescript-eslint/eslint-plugin": "2.3.2",
"@typescript-eslint/experimental-utils": "2.3.2",
"@typescript-eslint/parser": "2.3.2",
"async": "latest",
"azure-devops-node-api": "^8.0.0",
"browser-resolve": "^1.11.2",
"browserify": "latest",
"chai": "latest",
"chalk": "latest",
"convert-source-map": "latest",
"del": "5.1.0",
"eslint": "6.5.1",
"eslint-formatter-autolinkable-stylish": "1.0.3",
"eslint-plugin-import": "2.18.2",
"eslint-plugin-jsdoc": "15.9.9",
"eslint-plugin-no-null": "1.0.2",
"fancy-log": "latest",
"fs-extra": "^6.0.1",
"glob": "latest",
"gulp": "^4.0.0",
"gulp-concat": "latest",
"gulp-insert": "latest",
"gulp-newer": "latest",
"gulp-rename": "latest",
"gulp-sourcemaps": "latest",
"istanbul": "latest",
"merge2": "latest",
"minimist": "latest",
"mkdirp": "latest",
"mocha": "latest",
"mocha-fivemat-progress-reporter": "latest",
"ms": "latest",
"node-fetch": "^2.6.0",
"plugin-error": "latest",
"pretty-hrtime": "^1.0.3",
"prex": "^0.4.3",
"q": "latest",
"remove-internal": "^2.9.2",
"simple-git": "^1.113.0",
"source-map-support": "latest",
"through2": "latest",
"travis-fold": "latest",
"typescript": "next",
"vinyl": "latest",
"vinyl-sourcemaps-apply": "latest",
"xml2js": "^0.4.19"
},
"scripts": {
"prepare": "gulp build-eslint-rules",
"pretest": "gulp tests",
"test": "gulp runtests-parallel --light=false",
"test:eslint-rules": "gulp run-eslint-rules-tests",
"build": "npm run build:compiler && npm run build:tests",
"build:compiler": "gulp local",
"build:tests": "gulp tests",
"start": "node lib/tsc",
"clean": "gulp clean",
"gulp": "gulp",
"jake": "gulp",
"lint": "gulp lint",
"lint:ci": "gulp lint --ci",
"lint:compiler": "gulp lint-compiler",
"lint:scripts": "gulp lint-scripts",
"setup-hooks": "node scripts/link-hooks.js",
"update-costly-tests": "node scripts/costly-tests.js"
},
"browser": {
"fs": false,
"os": false,
"path": false,
"crypto": false,
"buffer": false,
"@microsoft/typescript-etw": false,
"source-map-support": false,
"inspector": false
},
"dependencies": {}
}
......@@ -8,11 +8,11 @@ const {
getPartialIdentifier
} = require('./util')
function resolve (dir) {
function resolve(dir) {
return path.resolve(__dirname, '..', dir)
}
module.exports = function chainWebpack (platformOptions, vueOptions, api) {
module.exports = function chainWebpack(platformOptions, vueOptions, api) {
const {
runByHBuilderX, // 使用 HBuilderX 运行
cssPreprocessOptions
......@@ -150,5 +150,15 @@ module.exports = function chainWebpack (platformOptions, vueOptions, api) {
if (process.env.BUILD_ENV === 'ali-ide') {
webpackConfig.plugins.delete('progress')
}
webpackConfig.resolve.alias
.delete('@')
.set(
'@/pages.json',
path.resolve(process.env.UNI_INPUT_DIR, 'pages.json')
+ '?' + JSON.stringify({
type: 'origin-pages-json'
})
)
.set('@', path.resolve(process.env.UNI_INPUT_DIR))
}
}
......@@ -84,6 +84,15 @@ module.exports = function (content, map) {
process.exit(0)
}
if (this.resourceQuery) {
const queryParam = loaderUtils.parseQuery(this.resourceQuery)
if (queryParam) {
if (queryParam.type === 'origin-pages-json') {
return `export default ${JSON.stringify(pagesJson)}`
}
}
}
if (global.uniPlugin.defaultTheme) {
pagesJson = parseTheme(pagesJson)
this.addDependency(path.resolve(process.env.UNI_INPUT_DIR, 'theme.json'))
......
......@@ -31,12 +31,13 @@ function checkEmitFile (filePath, jsonObj, changedEmitFiles) {
module.exports = function (content, map) {
// content = JSON.stringify(require('@dcloudio/uni-cli-shared/lib/uni_modules').getPagesJson(content))
let queryParam
if (this.resourceQuery) {
const params = loaderUtils.parseQuery(this.resourceQuery)
if (params) {
if (params.type === 'style') {
queryParam = loaderUtils.parseQuery(this.resourceQuery)
if (queryParam) {
if (queryParam.type === 'style') {
return `export default ${JSON.stringify(getPagesJson())}`
} else if (params.type === 'stat') {
} else if (queryParam.type === 'stat') {
return `export default ${JSON.stringify(process.UNI_STAT_CONFIG || {})}`
}
}
......@@ -73,6 +74,14 @@ module.exports = function (content, map) {
}
})
if (this.resourceQuery && queryParam) {
if (queryParam) {
if (queryParam.type === 'origin-pages-json') {
return `export default ${JSON.stringify(pagesJson)}`
}
}
}
if (manifestJson.transformPx === false) {
process.UNI_TRANSFORM_PX = false
} else {
......
......@@ -452,10 +452,10 @@ module.exports = function (pagesJson, userManifestJson, isAppView) {
}
// 检查 webview 版本 || 下载 X5 后启动
let plusWebview = manifestJson['plus'].webView
const plusWebview = manifestJson.plus.webView
if (plusWebview) {
manifestJson.plus['uni-app'].webView = plusWebview
delete manifestJson['plus'].webView
delete manifestJson.plus.webView
}
// 记录编译器版本号
......
......@@ -9,7 +9,8 @@ const {
const {
hasOwn,
parseStyle,
parseTabBar
parseTabBar,
NON_APP_JSON_KEYS
} = require('../util')
function defaultCopy (name, value, json) {
......@@ -38,6 +39,8 @@ function copyToJson (json, fromJson, options) {
})
}
const projectKeys = ['component2', 'enableAppxNg']
module.exports = function (pagesJson, manifestJson) {
const app = {
pages: [],
......@@ -70,24 +73,24 @@ module.exports = function (pagesJson, manifestJson) {
copyToJson(app, pagesJson, pagesJson2AppJson)
const platformJson = manifestJson['mp-alipay'] || {}
if (hasOwn(platformJson, 'plugins')) {
app.plugins = platformJson.plugins
}
if (platformJson.useDynamicPlugins) {
app.useDynamicPlugins = true
}
Object.keys(platformJson).forEach(key => {
if (!projectKeys.includes(key) && !NON_APP_JSON_KEYS.includes(key)) {
// usingComponents 是编译模式开关,需要过滤,不能拷贝到 app
app[key] = platformJson[key]
}
})
if (app.usingComponents) {
updateAppJsonUsingComponents(app.usingComponents)
}
const project = Object.assign({}, manifestJson['mp-alipay'] || {})
delete project.usingComponents
delete project.plugins
delete project.useDynamicPlugins
!('component2' in project) && (project.component2 = true)
!('enableAppxNg' in project) && (project.enableAppxNg = true)
const project = Object.assign({
appid: platformJson.appid
})
project.component2 = hasOwn(platformJson, 'component2') ? platformJson.component2 : true
project.enableAppxNg = hasOwn(platformJson, 'enableAppxNg') ? platformJson.enableAppxNg : true
return [{
name: 'app',
......@@ -96,4 +99,4 @@ module.exports = function (pagesJson, manifestJson) {
name: 'mini.project',
content: project
}]
}
}
......@@ -20,7 +20,8 @@ const {
const {
hasOwn,
parseStyle,
trimMPJson
trimMPJson,
NON_APP_JSON_KEYS
} = require('../util')
const uniI18n = require('@dcloudio/uni-cli-i18n')
......@@ -262,7 +263,7 @@ module.exports = function (pagesJson, manifestJson, project = {}) {
Object.keys(platformJson).forEach(key => {
if (
!projectKeys.includes(key) && ['usingComponents', 'optimization'].indexOf(key) === -1
!projectKeys.includes(key) && !NON_APP_JSON_KEYS.includes(key)
) {
// usingComponents 是编译模式开关,需要过滤,不能拷贝到 app
app[key] = platformJson[key]
......
......@@ -129,10 +129,19 @@ function parseTabBar (style = {}) {
return style
}
const NON_APP_JSON_KEYS = [
'appid',
'unipush',
'usingComponents',
'optimization',
'scopedSlotsCompiler',
'usingComponents',
'uniStatistics'
]
module.exports = {
hasOwn,
parseStyle,
parseTabBar,
trimMPJson
}
trimMPJson,
NON_APP_JSON_KEYS
}
......@@ -8,7 +8,6 @@ import {
} from '../bridge'
const TABBAR_HEIGHT = 50
const isIOS = plus.os.name === 'iOS'
let config
/**
......@@ -180,7 +179,7 @@ export default {
// tabBar是否遮挡内容区域
get cover () {
const array = ['extralight', 'light', 'dark']
return isIOS && array.indexOf(config.blurEffect) >= 0
return array.indexOf(config.blurEffect) >= 0
},
setStyle ({ mask }) {
tabBar.setMask({
......
......@@ -56,6 +56,7 @@ const attrs = [
'pageGesture',
'enableProgressGesture',
'showPlayBtn',
'showMuteBtn',
'enablePlayGesture',
'vslideGesture',
'vslideGestureInFullscreen',
......@@ -158,6 +159,10 @@ export default {
type: [Boolean, String],
default: true
},
showMuteBtn: {
type: [Boolean, String],
default: false
},
enablePlayGesture: {
type: [Boolean, String],
default: true
......
const isAlipay = window.my && navigator.userAgent.indexOf('AlipayClient') > -1
const AC = ['t', 'n', 'e', 'i', 'l', 'C', 'y', 'a', 'p', 'i', 'l', 'A'];
const isAlipay = window.my && navigator.userAgent.indexOf(AC.reverse().join('')) > -1
export function initWebviewApi (readyCallback) {
if (!isAlipay) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册