提交 aa4adcd0 编写于 作者: Q qiang

Merge branch 'dev' into alpha

const path = require('path')
const {
normalizePath
} = require('@dcloudio/uni-cli-shared')
process.UNI_APIS = new Set()
const sourcePath = normalizePath(path.join(require.resolve('@dcloudio/uni-h5'), '../../'))
module.exports = function ({
types: t
}) {
......@@ -21,10 +12,6 @@ module.exports = function ({
path.node.object.name === 'wx'
)
) {
if (normalizePath(state.file.opts.filename).indexOf(sourcePath) === 0) {
path.stop()
return
}
process.UNI_APIS.add(path.node.property.name || path.node.property.value)
}
}
......
......@@ -118,7 +118,7 @@ const isApiSubscribe = filepath => {
return filepath.indexOf('/core/view/bridge/subscribe/api') === 0
}
function parseDeps (apis, manifest) {
function parseDeps (apis, manifest) {
const apiPaths = Object.create(null)
const apiProtocolPaths = Object.create(null)
const invokeApiPaths = Object.create(null)
......@@ -196,7 +196,7 @@ function parseDeps (apis, manifest) {
}
}
module.exports = function updateApis (apis = new Set(), userApis = new Set()) {
module.exports = function updateApis (apis = new Set(), userApis = new Set()) {
if (!fs.existsSync(tmpDir)) {
fs.mkdirSync(tmpDir)
}
......@@ -211,6 +211,15 @@ module.exports = function updateApis (apis = new Set(), userApis = new Set()) {
apis = new Set([...apis, ...userApis])
if (process.UNI_TAGS) {
// TODO 临时硬编码
if (process.UNI_TAGS.has('map')) {
apis.add('getLocation')
apis.add('stopCompass')
apis.add('onCompassChange')
}
}
const {
apiPaths,
apiProtocolPaths,
......@@ -232,4 +241,4 @@ module.exports = function updateApis (apis = new Set(), userApis = new Set()) {
updateCoreComponents(coreComponentsPaths)
updateAppMixins(appMixinsPaths)
updateSystemRoutes(systemRoutesPaths)
}
}
......@@ -18,8 +18,8 @@ export function getSystemInfoSync () {
var pixelRatio = window.devicePixelRatio
// 横屏时 iOS 获取的屏幕宽高颠倒,进行纠正
var landscape = Math.abs(window.orientation) === 90
var screenWidth = Math[landscape ? 'max' : 'min'](screen.width, screen.height)
var screenHeight = Math[landscape ? 'min' : 'max'](screen.height, screen.width)
var screenWidth = typeof window.orientation === 'number' ? Math[landscape ? 'max' : 'min'](screen.width, screen.height) : screen.width
var screenHeight = typeof window.orientation === 'number' ? Math[landscape ? 'min' : 'max'](screen.height, screen.width) : screen.height
var windowWidth = Math.min(window.innerWidth, document.documentElement.clientWidth, screenWidth)
var windowHeight = window.innerHeight
var language = navigator.language
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册