diff --git a/build/build.qa.js b/build/build.qa.js index e37f1cb353846b4a91e1617174376d281bc516ea..5c0d2e706e9a4fc925632e30a322a1f7fa86db71 100644 --- a/build/build.qa.js +++ b/build/build.qa.js @@ -51,18 +51,18 @@ dsl.onInitApp(function({ });` }) const pageCode = pageOutput[0].code - const vueCode = fs.readFileSync(path.resolve(__dirname, '../packages/uni-quickapp-vue/assets/' + filename)) + const vueCode = fs.readFileSync(path.resolve(__dirname, '../packages/uni-quickapp-native/assets/' + filename)) fs.writeFileSync( - path.resolve(__dirname, '../packages/uni-quickapp-vue/dist/' + filename), + path.resolve(__dirname, '../packages/uni-quickapp-native/dist/' + filename), vueCode + bridgeCode + appCode + pageCode, { encoding: 'utf8' } ) if (process.env.NODE_ENV === 'production') { // 命令会执行dev,prod两次,仅prod时执行copy - const componentsSrc = path.resolve(__dirname, '../src/platforms/quickapp-vue/view/components/**/*') - const componentsDest = path.resolve(__dirname, '../packages/uni-quickapp-vue/components') + const componentsSrc = path.resolve(__dirname, '../src/platforms/quickapp-native/view/components/**/*') + const componentsDest = path.resolve(__dirname, '../packages/uni-quickapp-native/components') del.sync([componentsDest]) diff --git a/build/rollup.config.mp.js b/build/rollup.config.mp.js index 92f6fb1b622cd8fb667a7024d7b889d94f3e0877..9637e733cdc2a31cfd342a49b203630b45289da5 100644 --- a/build/rollup.config.mp.js +++ b/build/rollup.config.mp.js @@ -23,9 +23,9 @@ const PLATFORMS = { prefix: 'tt', title: '头条小程序' }, - 'quickapp-light': { + 'quickapp-webview': { prefix: 'qa', - title: '快应用(Light)版' + title: '快应用(Webview)版' }, 'app-plus': { prefix: 'wx', diff --git a/build/rollup.config.qa.js b/build/rollup.config.qa.js index 67f43a56c806f8ecb885ed72bf9a528e55fa7891..a635919e7a211b8a999de1a3757e8b8d748f558d 100644 --- a/build/rollup.config.qa.js +++ b/build/rollup.config.qa.js @@ -6,7 +6,7 @@ const commonjs = require('@rollup/plugin-commonjs') const terser = require('rollup-plugin-terser') const requireContext = require('../lib/rollup-plugin-require-context') -process.env.UNI_PLATFORM = 'quickapp-vue' +process.env.UNI_PLATFORM = 'quickapp-native' const external = [] @@ -36,7 +36,7 @@ alias({ replacement: resolve('src/core') }, { find: 'uni-platform', - replacement: resolve('src/platforms/quickapp-vue') + replacement: resolve('src/platforms/quickapp-native') }, { find: 'uni-platforms', replacement: resolve('src/platforms') @@ -48,10 +48,10 @@ alias({ replacement: resolve('src/core/helpers') }, { find: 'uni-invoke-api', - replacement: resolve('src/platforms/quickapp-vue/service/invoke-api') + replacement: resolve('src/platforms/quickapp-native/service/invoke-api') }, { find: 'uni-service-api', - replacement: resolve('src/platforms/quickapp-vue/service/api') + replacement: resolve('src/platforms/quickapp-native/service/api') }, { find: 'uni-api-protocol', replacement: resolve('src/core/helpers/protocol') @@ -62,7 +62,7 @@ requireContext(), commonjs(), replace({ __PLATFORM__: JSON.stringify(process.env.UNI_PLATFORM), - __PLATFORM_TITLE__: '快应用(Vue)版' + __PLATFORM_TITLE__: '快应用(Native)版' }) ] @@ -74,11 +74,11 @@ module.exports = function (type) { let input = '' if (type === 'bridge') { - input = 'src/platforms/quickapp-vue/runtime/bridge.js' + input = 'src/platforms/quickapp-native/runtime/bridge.js' } else if (type === 'app') { - input = 'src/platforms/quickapp-vue/runtime/app.js' + input = 'src/platforms/quickapp-native/runtime/app.js' } else if (type === 'page') { - input = 'src/platforms/quickapp-vue/runtime/page.js' + input = 'src/platforms/quickapp-native/runtime/page.js' } return { diff --git a/package.json b/package.json index f20f92adca84237a3d7bf9dbec0a4e9c72027d4c..daddb041072805b75f2b626fb29948ecef39ddcd 100644 --- a/package.json +++ b/package.json @@ -18,11 +18,11 @@ "build:mp-baidu": "cross-env UNI_PLATFORM=mp-baidu rollup -c build/rollup.config.mp.js", "build:mp-alipay": "cross-env UNI_PLATFORM=mp-alipay rollup -c build/rollup.config.mp.js", "build:mp-toutiao": "cross-env UNI_PLATFORM=mp-toutiao rollup -c build/rollup.config.mp.js", - "build:quickapp-light": "cross-env UNI_PLATFORM=quickapp-light rollup -c build/rollup.config.mp.js", + "build:quickapp-webview": "cross-env UNI_PLATFORM=quickapp-webview rollup -c build/rollup.config.mp.js", "build:mp-weixin:mp": "cross-env UNI_PLATFORM=mp-weixin UNI_MP=true rollup -c build/rollup.config.mp.js", "build:mp-weixin:wxs": "rollup -c build/rollup.config.wxs.js", - "build:quickapp-vue": "cross-env NODE_ENV=development node build/build.qa.js && cross-env NODE_ENV=production node build/build.qa.js", - "build:runtime": "npm run lint && npm run build:mp-weixin && npm run build:mp-qq && npm run build:mp-alipay && npm run build:mp-baidu && npm run build:mp-toutiao && npm run build:app-plus && npm run build:quickapp-light && npm run build:quickapp-vue", + "build:quickapp-native": "cross-env NODE_ENV=development node build/build.qa.js && cross-env NODE_ENV=production node build/build.qa.js", + "build:runtime": "npm run lint && npm run build:mp-weixin && npm run build:mp-qq && npm run build:mp-alipay && npm run build:mp-baidu && npm run build:mp-toutiao && npm run build:app-plus && npm run build:quickapp-webview && npm run build:quickapp-native", "build:stat": "npm run lint && rollup -c build/rollup.config.stat.js", "build:web-view": "rollup -c build/rollup.config.web-view.js", "test:cli": "cross-env NODE_ENV=test jest", diff --git a/packages/uni-cli-shared/lib/pages.js b/packages/uni-cli-shared/lib/pages.js index 055b58c5e10b3bb28b3e189bf7757ec5347d2d15..421b447be53d95e9f469b7fcacb2bd7e6cdd5d43 100644 --- a/packages/uni-cli-shared/lib/pages.js +++ b/packages/uni-cli-shared/lib/pages.js @@ -359,10 +359,10 @@ function initAutoImportScanComponents () { const components = getAutoComponentsByDir(componentsPath) - if (process.env.UNI_PLATFORM === 'quickapp-vue') { + if (process.env.UNI_PLATFORM === 'quickapp-native') { if (!uniQuickAppAutoImportScanComponents) { uniQuickAppAutoImportScanComponents = getAutoComponentsByDir( - path.resolve(require.resolve('@dcloudio/uni-quickapp-vue'), '../../components'), + path.resolve(require.resolve('@dcloudio/uni-quickapp-native'), '../../components'), true ) } diff --git a/packages/uni-migration/__tests__/demo.js b/packages/uni-migration/__tests__/demo.js index a315ae33a0abc1c9452811aed5913a9a0e00e3f1..28d9af49069348dd1ffeedcd48d1c70edc1f8e45 100644 --- a/packages/uni-migration/__tests__/demo.js +++ b/packages/uni-migration/__tests__/demo.js @@ -1,13 +1,36 @@ -const migrate = require('../lib/index') +// const migrate = require('../lib/index') -migrate('/Users/fxy/Downloads/wa-vantui_1.1') +// migrate('/Users/fxy/Downloads/wa-vantui_1.1') // migrate('/Users/fxy/Downloads/wa-vantui_1.1/pages') -// const { -// parse -// } = require('mustache') -// console.log(parse("van-notice-bar__content {{ !scrollable && !wrapable ? 'van-ellipsis' : '' }}")) +const { + parse +} = require('mustache') + +function parseMustache(expr, identifier = false) { + if (!expr) { + return '' + } + const tokens = parse(expr) + const isIdentifier = tokens.length === 1 + return tokens.map(token => { + if (token[0] === 'text') { + if (identifier) { + return token[1] + } + return `'${token[1]}'` + } else if (token[0] === '!') { // {{ !loading }} + return `(!${token[1]})` + } else if (token[0] === 'name') { + if (isIdentifier) { + return token[1] + } + return `(${token[1]})` + } + }).join('+') +} +console.log(parseMustache("click ",true)==='click ') // const { // transformTemplate diff --git a/packages/uni-migration/__tests__/wxml.spec.js b/packages/uni-migration/__tests__/wxml.spec.js index ed0928d2aa8ec1f83c4d5f912e963502ef209ef2..aad6f6191d5cfa4bf50790494dc90300262e8e55 100644 --- a/packages/uni-migration/__tests__/wxml.spec.js +++ b/packages/uni-migration/__tests__/wxml.spec.js @@ -9,11 +9,11 @@ describe('wxml:compiler', () => { it('generate event', () => { assertCodegen( ``, - `` + `` ) assertCodegen( ``, - `` + `` ) }) it('generate class', () => { diff --git a/packages/uni-migration/lib/mp-weixin/transform/template-transformer/transform/traverse.js b/packages/uni-migration/lib/mp-weixin/transform/template-transformer/transform/traverse.js index 5be4b130e7824366191684ddc1138df3993c47d1..fc1a5b0d46d1d5da5804a9174e9f5a3f4d151fe8 100644 --- a/packages/uni-migration/lib/mp-weixin/transform/template-transformer/transform/traverse.js +++ b/packages/uni-migration/lib/mp-weixin/transform/template-transformer/transform/traverse.js @@ -127,7 +127,7 @@ function transformFor(attribs) { if (vKey) { if (vKey === '*this') { vKey = vItem - } else if (vKey !== vItem && vKey.indexOf('.')===-1) {// wx:for-key="{{item.value}}" + } else if (vKey !== vItem && vKey.indexOf('.') === -1) { // wx:for-key="{{item.value}}" vKey = vItem + '.' + vKey } attribs[':key'] = vKey @@ -163,7 +163,11 @@ function transformEvent(name, value, attribs, state) { event = transformEventName(name.replace(captureCatchRE, ''), state) + '.stop.prevent.capture' } if (event !== name) { - attribs[event] = parseMustache(value, true) + let newValue = parseMustache(value, true) + if (newValue !== value) { + newValue = `_$self[(${newValue})||'_$noop']($event)` + } + attribs[event] = newValue return true } } diff --git a/packages/uni-mp-weixin/dist/mp.js b/packages/uni-mp-weixin/dist/mp.js index 4bf7df6fad85196bd73b1abd26b8c9b94d172f39..fae6b1f3f85a54ac2752ed8702d3ea34bd0bcf3a 100644 --- a/packages/uni-mp-weixin/dist/mp.js +++ b/packages/uni-mp-weixin/dist/mp.js @@ -758,6 +758,9 @@ var polyfill = { beforeCreate () { // 取消 development 时的 Proxy,避免小程序组件模板中使用尚未定义的属性告警 this._renderProxy = this; + + this._$self = this; + this._$noop = noop; }, created () { // properties 中可能会访问 methods,故需要在 created 中初始化 initState(this); diff --git a/packages/uni-quickapp-light/package.json b/packages/uni-quickapp-light/package.json deleted file mode 100644 index 308705a5e5e1da1ce37920e1182424112fd6128b..0000000000000000000000000000000000000000 --- a/packages/uni-quickapp-light/package.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "name": "@dcloudio/uni-quickapp-light", - "version": "2.0.0-alpha-27020200429001", - "description": "uni-app quickapp-light", - "main": "dist/index.js", - "repository": { - "type": "git", - "url": "git+https://github.com/dcloudio/uni-app.git", - "directory": "packages/uni-quickapp-light" - }, - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "author": "fxy060608", - "license": "Apache-2.0", - "uni-app": { - "name": "quickapp-light", - "title": "快应用(Light)版" - }, - "gitHead": "56868b5e04d0c94c33e40d13f26937b43ea05156" -} diff --git a/packages/uni-quickapp-vue/LICENSE b/packages/uni-quickapp-native/LICENSE similarity index 100% rename from packages/uni-quickapp-vue/LICENSE rename to packages/uni-quickapp-native/LICENSE diff --git a/packages/uni-quickapp-vue/assets/vue.dev.js b/packages/uni-quickapp-native/assets/vue.dev.js similarity index 100% rename from packages/uni-quickapp-vue/assets/vue.dev.js rename to packages/uni-quickapp-native/assets/vue.dev.js diff --git a/packages/uni-quickapp-vue/assets/vue.prod.js b/packages/uni-quickapp-native/assets/vue.prod.js similarity index 100% rename from packages/uni-quickapp-vue/assets/vue.prod.js rename to packages/uni-quickapp-native/assets/vue.prod.js diff --git a/packages/uni-quickapp-vue/bin/serve.js b/packages/uni-quickapp-native/bin/serve.js similarity index 100% rename from packages/uni-quickapp-vue/bin/serve.js rename to packages/uni-quickapp-native/bin/serve.js diff --git a/packages/uni-quickapp-vue/bin/service.js b/packages/uni-quickapp-native/bin/service.js similarity index 91% rename from packages/uni-quickapp-vue/bin/service.js rename to packages/uni-quickapp-native/bin/service.js index d39bac6736106aee20bed101cb59717c310c1e27..65e4b8084ac870c1ecd4feac26a7ca41d26a82e5 100644 --- a/packages/uni-quickapp-vue/bin/service.js +++ b/packages/uni-quickapp-native/bin/service.js @@ -24,7 +24,7 @@ function getProjectName(e, t) { const stripJsonComments = require('strip-json-comments'); const r = _path.default.join(e, t, "manifest.json"); const s = JSON.parse(stripJsonComments(_fs.default.readFileSync(r).toString())) - return s && s['quickapp-vue'] && s['quickapp-vue']['package'] || s.name || "Bundle" + return s && s['quickapp-native'] && s['quickapp-native']['package'] || s.name || "Bundle" } catch (e) { _sharedUtils.colorconsole.error(`### App Server ### 获取项目名称出错:${e.message}`) } @@ -50,7 +50,7 @@ function getDistFilePath(e, t, r) { let s; if (!process.env.UNI_OUTPUT_DIR) { const mode = process.env.NODE_ENV === 'production' ? 'build' : 'dev' - process.env.UNI_OUTPUT_DIR = _path.default.join(process.cwd(), 'dist/' + mode + '/quickapp-vue') + process.env.UNI_OUTPUT_DIR = _path.default.join(process.cwd(), 'dist/' + mode + '/quickapp-native') } return s = _path.default.join(process.env.UNI_OUTPUT_DIR, `${t}.debug.${r}`), _fs.default.existsSync(s) ? s : (s = _path.default.join(e, diff --git a/packages/uni-quickapp-vue/components/button/button.vue b/packages/uni-quickapp-native/components/button/button.vue similarity index 100% rename from packages/uni-quickapp-vue/components/button/button.vue rename to packages/uni-quickapp-native/components/button/button.vue diff --git a/packages/uni-quickapp-vue/dist/vue.dev.js b/packages/uni-quickapp-native/dist/vue.dev.js similarity index 100% rename from packages/uni-quickapp-vue/dist/vue.dev.js rename to packages/uni-quickapp-native/dist/vue.dev.js diff --git a/packages/uni-quickapp-vue/dist/vue.prod.js b/packages/uni-quickapp-native/dist/vue.prod.js similarity index 100% rename from packages/uni-quickapp-vue/dist/vue.prod.js rename to packages/uni-quickapp-native/dist/vue.prod.js diff --git a/packages/uni-quickapp-vue/lib/chain-webpack.js b/packages/uni-quickapp-native/lib/chain-webpack.js similarity index 91% rename from packages/uni-quickapp-vue/lib/chain-webpack.js rename to packages/uni-quickapp-native/lib/chain-webpack.js index c8573326f0762484f3dec17cbc513042f93f05db..9d66d0954ee61ae9a86ce8fce043b9b733f5b749 100644 --- a/packages/uni-quickapp-vue/lib/chain-webpack.js +++ b/packages/uni-quickapp-native/lib/chain-webpack.js @@ -7,7 +7,7 @@ module.exports = config => { .use('vue-loader') .loader(vueLoader.loader) .tap(options => Object.assign(options, vueLoader.options({}, { - 'quickapp-vue': true + 'quickapp-native': true }))) config.module diff --git a/packages/uni-quickapp-vue/lib/compiler-module.js b/packages/uni-quickapp-native/lib/compiler-module.js similarity index 100% rename from packages/uni-quickapp-vue/lib/compiler-module.js rename to packages/uni-quickapp-native/lib/compiler-module.js diff --git a/packages/uni-quickapp-vue/lib/configure-webpack.js b/packages/uni-quickapp-native/lib/configure-webpack.js similarity index 100% rename from packages/uni-quickapp-vue/lib/configure-webpack.js rename to packages/uni-quickapp-native/lib/configure-webpack.js diff --git a/packages/uni-quickapp-vue/lib/loader/main-loader.js b/packages/uni-quickapp-native/lib/loader/main-loader.js similarity index 100% rename from packages/uni-quickapp-vue/lib/loader/main-loader.js rename to packages/uni-quickapp-native/lib/loader/main-loader.js diff --git a/packages/uni-quickapp-vue/lib/manifest/base-parser.js b/packages/uni-quickapp-native/lib/manifest/base-parser.js similarity index 100% rename from packages/uni-quickapp-vue/lib/manifest/base-parser.js rename to packages/uni-quickapp-native/lib/manifest/base-parser.js diff --git a/packages/uni-quickapp-vue/lib/manifest/display-parser.js b/packages/uni-quickapp-native/lib/manifest/display-parser.js similarity index 89% rename from packages/uni-quickapp-vue/lib/manifest/display-parser.js rename to packages/uni-quickapp-native/lib/manifest/display-parser.js index 13b9d1371aae1776693b3aa927b9855126419126..b870b7f4e5b8036acc7b8e8531f8fe09dcfb0fc4 100644 --- a/packages/uni-quickapp-vue/lib/manifest/display-parser.js +++ b/packages/uni-quickapp-native/lib/manifest/display-parser.js @@ -6,7 +6,7 @@ const PLATFORMS = [ 'mp-baidu', 'mp-alipay', 'mp-toutiao', - 'quickapp-vue' + 'quickapp-native' ] const DISPLAY = { @@ -44,8 +44,8 @@ function parseStyle(style = {}) { } } }) - if (style['quickapp-vue']) { - Object.assign(ret, style['quickapp-vue']) + if (style['quickapp-native']) { + Object.assign(ret, style['quickapp-native']) } return ret } diff --git a/packages/uni-quickapp-vue/lib/manifest/entry-parser.js b/packages/uni-quickapp-native/lib/manifest/entry-parser.js similarity index 100% rename from packages/uni-quickapp-vue/lib/manifest/entry-parser.js rename to packages/uni-quickapp-native/lib/manifest/entry-parser.js diff --git a/packages/uni-quickapp-vue/lib/manifest/index.js b/packages/uni-quickapp-native/lib/manifest/index.js similarity index 90% rename from packages/uni-quickapp-vue/lib/manifest/index.js rename to packages/uni-quickapp-native/lib/manifest/index.js index f2dbe0b833c798cd48f3ba59b2aea81e057a38d0..bf009be950edad0f5a662575650503961d27c16b 100644 --- a/packages/uni-quickapp-vue/lib/manifest/index.js +++ b/packages/uni-quickapp-native/lib/manifest/index.js @@ -27,7 +27,7 @@ function getPages(pagesJson) { module.exports = function(pagesJson, manifestJson, loader) { - const manifest = manifestJson['quickapp-vue'] || {} + const manifest = manifestJson['quickapp-native'] || {} parseBase(manifest, manifestJson) diff --git a/packages/uni-quickapp-vue/lib/manifest/pages-parser.js b/packages/uni-quickapp-native/lib/manifest/pages-parser.js similarity index 100% rename from packages/uni-quickapp-vue/lib/manifest/pages-parser.js rename to packages/uni-quickapp-native/lib/manifest/pages-parser.js diff --git a/packages/uni-quickapp-vue/lib/plugin/instvue-plugin.js b/packages/uni-quickapp-native/lib/plugin/instvue-plugin.js similarity index 100% rename from packages/uni-quickapp-vue/lib/plugin/instvue-plugin.js rename to packages/uni-quickapp-native/lib/plugin/instvue-plugin.js diff --git a/packages/uni-quickapp-vue/lib/polyfill.css b/packages/uni-quickapp-native/lib/polyfill.css similarity index 100% rename from packages/uni-quickapp-vue/lib/polyfill.css rename to packages/uni-quickapp-native/lib/polyfill.css diff --git a/packages/uni-quickapp-vue/lib/uni.config.js b/packages/uni-quickapp-native/lib/uni.config.js similarity index 100% rename from packages/uni-quickapp-vue/lib/uni.config.js rename to packages/uni-quickapp-native/lib/uni.config.js diff --git a/packages/uni-quickapp-vue/lib/validate.js b/packages/uni-quickapp-native/lib/validate.js similarity index 87% rename from packages/uni-quickapp-vue/lib/validate.js rename to packages/uni-quickapp-native/lib/validate.js index fc83313ab041a61e6cc1b7ef089328b38d5678a8..648629014137e82a66286d11f5ef1a87d0ebee16 100644 --- a/packages/uni-quickapp-vue/lib/validate.js +++ b/packages/uni-quickapp-native/lib/validate.js @@ -5,7 +5,7 @@ module.exports = function () { const manifest = global.framework.manifest if (manifest.package === 'Bundle') { - console.error('> 建议配置 manifest.json->quickapp-vue->package 应用包名') + console.error('> 建议配置 manifest.json->quickapp-native->package 应用包名') } const signPath = './sign/' + (process.env.NODE_ENV === 'production' ? 'release' : 'debug') diff --git a/packages/uni-quickapp-vue/lib/vue.config.js b/packages/uni-quickapp-native/lib/vue.config.js similarity index 100% rename from packages/uni-quickapp-vue/lib/vue.config.js rename to packages/uni-quickapp-native/lib/vue.config.js diff --git a/packages/uni-quickapp-vue/package.json b/packages/uni-quickapp-native/package.json similarity index 74% rename from packages/uni-quickapp-vue/package.json rename to packages/uni-quickapp-native/package.json index 3faf80f5e7bcedd068c141e9b5fdf0b82a1430a6..2588c4a96d1ea92c4909fcd55d2ba4141245e349 100644 --- a/packages/uni-quickapp-vue/package.json +++ b/packages/uni-quickapp-native/package.json @@ -1,12 +1,12 @@ { - "name": "@dcloudio/uni-quickapp-vue", - "version": "2.0.0-alpha-27020200429001", - "description": "uni-app quickapp-vue", + "name": "@dcloudio/uni-quickapp-native", + "version": "2.0.0-alpha-26920200407011", + "description": "uni-app quickapp-native", "main": "dist/vue.prod.js", "repository": { "type": "git", "url": "git+https://github.com/dcloudio/uni-app.git", - "directory": "packages/uni-quickapp-vue" + "directory": "packages/uni-quickapp-native" }, "files": [ "bin", @@ -21,7 +21,7 @@ "license": "Apache-2.0", "gitHead": "5ed6c58ef3a74a43b11bd65f8f6f488e470716c8", "uni-app": { - "name": "quickapp-vue", + "name": "quickapp-native", "title": "快应用(Vue)版" }, "dependencies": { diff --git a/packages/uni-quickapp-light/dist/index.js b/packages/uni-quickapp-webview/dist/index.js similarity index 95% rename from packages/uni-quickapp-light/dist/index.js rename to packages/uni-quickapp-webview/dist/index.js index e22adc698650ebe39ef3657297829ba129a69f4a..9a8fad48e8403f5129d5cee2a6599d6a79da9a4c 100644 --- a/packages/uni-quickapp-light/dist/index.js +++ b/packages/uni-quickapp-webview/dist/index.js @@ -417,7 +417,7 @@ function processArgs (methodName, fromArgs, argsOption = {}, returnValue = {}, k keyOption = keyOption(fromArgs[key], fromArgs, toArgs); } if (!keyOption) { // 不支持的参数 - console.warn(`快应用(Light)版 ${methodName}暂不支持${key}`); + console.warn(`快应用(Webview)版 ${methodName}暂不支持${key}`); } else if (isStr(keyOption)) { // 重写参数 key toArgs[keyOption] = fromArgs[key]; } else if (isPlainObject(keyOption)) { // {name:newName,value:value}可重新指定参数 key:value @@ -450,7 +450,7 @@ function wrapper (methodName, method) { const protocol = protocols[methodName]; if (!protocol) { // 暂不支持的 api return function () { - console.error(`快应用(Light)版 暂不支持${methodName}`); + console.error(`快应用(Webview)版 暂不支持${methodName}`); } } return function (arg1, arg2) { // 目前 api 最多两个参数 @@ -1146,7 +1146,7 @@ function parseBaseApp (vm, { Vue.prototype.$store = vm.$options.store; } - Vue.prototype.mpHost = "quickapp-light"; + Vue.prototype.mpHost = "quickapp-webview"; Vue.mixin({ beforeCreate () { @@ -1580,7 +1580,7 @@ canIUses.forEach(canIUseApi => { let uni = {}; -if (typeof Proxy !== 'undefined' && "quickapp-light" !== 'app-plus') { +if (typeof Proxy !== 'undefined' && "quickapp-webview" !== 'app-plus') { uni = new Proxy({}, { get (target, name) { if (target[name]) { diff --git a/packages/uni-quickapp-light/lib/assets/jsconfig.json b/packages/uni-quickapp-webview/lib/assets/jsconfig.json similarity index 100% rename from packages/uni-quickapp-light/lib/assets/jsconfig.json rename to packages/uni-quickapp-webview/lib/assets/jsconfig.json diff --git a/packages/uni-quickapp-light/lib/uni.compiler.js b/packages/uni-quickapp-webview/lib/uni.compiler.js similarity index 100% rename from packages/uni-quickapp-light/lib/uni.compiler.js rename to packages/uni-quickapp-webview/lib/uni.compiler.js diff --git a/packages/uni-quickapp-light/lib/uni.config.js b/packages/uni-quickapp-webview/lib/uni.config.js similarity index 87% rename from packages/uni-quickapp-light/lib/uni.config.js rename to packages/uni-quickapp-webview/lib/uni.config.js index 2ad6f23d7cc013cfd840da88bf0955c8ecfabc54..a76d12c980c1a229cbcf33dc5392b7512ad1dac9 100644 --- a/packages/uni-quickapp-light/lib/uni.config.js +++ b/packages/uni-quickapp-webview/lib/uni.config.js @@ -31,10 +31,10 @@ module.exports = { }, validate (platformOptions, manifestJson) { if (!platformOptions.package) { - console.warn('manifest.json->quickapp-light 缺少 package 配置') + console.warn('manifest.json->quickapp-webview 缺少 package 配置') } if (!platformOptions.icon) { - console.warn('manifest.json->quickapp-light 缺少 icon 配置') + console.warn('manifest.json->quickapp-webview 缺少 icon 配置') } }, copyWebpackOptions (platformOptions, vueOptions) { diff --git a/packages/uni-quickapp-webview/package.json b/packages/uni-quickapp-webview/package.json new file mode 100644 index 0000000000000000000000000000000000000000..2778ed9626b329066368db0ca7975875c376a1b4 --- /dev/null +++ b/packages/uni-quickapp-webview/package.json @@ -0,0 +1,21 @@ +{ + "name": "@dcloudio/uni-quickapp-webview", + "version": "2.0.0-alpha-26920200407011", + "description": "uni-app quickapp-webview", + "main": "dist/index.js", + "repository": { + "type": "git", + "url": "git+https://github.com/dcloudio/uni-app.git", + "directory": "packages/uni-quickapp-webview" + }, + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "fxy060608", + "license": "Apache-2.0", + "uni-app": { + "name": "quickapp-webview", + "title": "快应用(Webview)版" + }, + "gitHead": "5ed6c58ef3a74a43b11bd65f8f6f488e470716c8" +} diff --git a/packages/uni-template-compiler/__tests__/compiler-quickapp-light.spec.js b/packages/uni-template-compiler/__tests__/compiler-quickapp-webview.spec.js similarity index 89% rename from packages/uni-template-compiler/__tests__/compiler-quickapp-light.spec.js rename to packages/uni-template-compiler/__tests__/compiler-quickapp-webview.spec.js index e187c8a844058eab243de2622db3c1559559d457..54fbac39dcfa1adb42170d4176760aea0e61ace6 100644 --- a/packages/uni-template-compiler/__tests__/compiler-quickapp-light.spec.js +++ b/packages/uni-template-compiler/__tests__/compiler-quickapp-webview.spec.js @@ -6,7 +6,7 @@ function assertCodegen (template, templateCode, renderCode = 'with(this){}', opt mp: Object.assign({ minified: true, isTest: true, - platform: 'quickapp-light' + platform: 'quickapp-webview' }, options) }) @@ -14,7 +14,7 @@ function assertCodegen (template, templateCode, renderCode = 'with(this){}', opt expect(res.render).toBe(renderCode) } -describe('mp:compiler-quickapp-light', () => { +describe('mp:compiler-quickapp-webview', () => { it('generate v-for directive', () => { assertCodegen( '', diff --git a/packages/uni-template-compiler/lib/auto-components.js b/packages/uni-template-compiler/lib/auto-components.js index 823df79197bebc295496578c6b259aeaa4092f71..0b135ded71e9d056d79e65061b7d53eae5e81301 100644 --- a/packages/uni-template-compiler/lib/auto-components.js +++ b/packages/uni-template-compiler/lib/auto-components.js @@ -86,7 +86,7 @@ function compileTemplate (source, options, compile) { const compilerModule = { preTransformNode (el, options) { - if (process.env.UNI_PLATFORM === 'quickapp-vue') { + if (process.env.UNI_PLATFORM === 'quickapp-native') { // 排查所有标签 (options.isUnaryTag.autoComponents || (options.isUnaryTag.autoComponents = new Set())).add(el.tag) } else if (isComponent(el.tag) && el.tag !== 'App') { // App.vue diff --git a/packages/uni-template-compiler/lib/index.js b/packages/uni-template-compiler/lib/index.js index 3ee46100a72285453bb1385904c33a483ae4e44b..93a9579f6776d312aaf33180bb0e49f690875fbd 100644 --- a/packages/uni-template-compiler/lib/index.js +++ b/packages/uni-template-compiler/lib/index.js @@ -78,12 +78,12 @@ module.exports = { console.error(source) throw e } - } else if (options['quickapp-vue']) { + } else if (options['quickapp-native']) { // 后续改版,应统一由具体包实现 - (options.modules || (options.modules = [])).push(require('@dcloudio/uni-quickapp-vue/lib/compiler-module')) + (options.modules || (options.modules = [])).push(require('@dcloudio/uni-quickapp-native/lib/compiler-module')) } - if (!options.mp) { // h5,quickapp-vue + if (!options.mp) { // h5,quickapp-native return compileTemplate(source, options, compile) } diff --git a/packages/vue-cli-plugin-uni/generator.js b/packages/vue-cli-plugin-uni/generator.js index 56f1299af3fc43f08a20106cf2f68749483101d0..2b60082c52495057a1f8376a78649d5395ae1b01 100644 --- a/packages/vue-cli-plugin-uni/generator.js +++ b/packages/vue-cli-plugin-uni/generator.js @@ -9,23 +9,23 @@ module.exports = (api, options, rootOptions) => { info: 'node node_modules/@dcloudio/vue-cli-plugin-uni/commands/info.js', serve: 'npm run dev:h5', build: 'npm run build:h5', - 'serve:quickapp-vue': 'node node_modules/@dcloudio/uni-quickapp-vue/bin/serve.js', + 'serve:quickapp-native': 'node node_modules/@dcloudio/uni-quickapp-native/bin/serve.js', 'dev:h5': 'cross-env NODE_ENV=development UNI_PLATFORM=h5 vue-cli-service uni-serve', 'dev:mp-qq': 'cross-env NODE_ENV=development UNI_PLATFORM=mp-qq vue-cli-service uni-build --watch', 'dev:mp-weixin': 'cross-env NODE_ENV=development UNI_PLATFORM=mp-weixin vue-cli-service uni-build --watch', 'dev:mp-baidu': 'cross-env NODE_ENV=development UNI_PLATFORM=mp-baidu vue-cli-service uni-build --watch', 'dev:mp-alipay': 'cross-env NODE_ENV=development UNI_PLATFORM=mp-alipay vue-cli-service uni-build --watch', 'dev:mp-toutiao': 'cross-env NODE_ENV=development UNI_PLATFORM=mp-toutiao vue-cli-service uni-build --watch', - 'dev:quickapp-vue': 'cross-env NODE_ENV=development UNI_PLATFORM=quickapp-vue vue-cli-service uni-build --watch', - 'dev:quickapp-light': 'cross-env NODE_ENV=development UNI_PLATFORM=quickapp-light vue-cli-service uni-build --watch', + 'dev:quickapp-native': 'cross-env NODE_ENV=development UNI_PLATFORM=quickapp-native vue-cli-service uni-build --watch', + 'dev:quickapp-webview': 'cross-env NODE_ENV=development UNI_PLATFORM=quickapp-webview vue-cli-service uni-build --watch', 'build:h5': 'cross-env NODE_ENV=production UNI_PLATFORM=h5 vue-cli-service uni-build', 'build:mp-qq': 'cross-env NODE_ENV=production UNI_PLATFORM=mp-qq vue-cli-service uni-build', 'build:mp-weixin': 'cross-env NODE_ENV=production UNI_PLATFORM=mp-weixin vue-cli-service uni-build', 'build:mp-baidu': 'cross-env NODE_ENV=production UNI_PLATFORM=mp-baidu vue-cli-service uni-build', 'build:mp-alipay': 'cross-env NODE_ENV=production UNI_PLATFORM=mp-alipay vue-cli-service uni-build', 'build:mp-toutiao': 'cross-env NODE_ENV=production UNI_PLATFORM=mp-toutiao vue-cli-service uni-build', - 'build:quickapp-vue': 'cross-env NODE_ENV=production UNI_PLATFORM=quickapp-vue vue-cli-service uni-build', - 'build:quickapp-light': 'cross-env NODE_ENV=production UNI_PLATFORM=quickapp-light vue-cli-service uni-build', + 'build:quickapp-native': 'cross-env NODE_ENV=production UNI_PLATFORM=quickapp-native vue-cli-service uni-build', + 'build:quickapp-webview': 'cross-env NODE_ENV=production UNI_PLATFORM=quickapp-webview vue-cli-service uni-build', 'dev:custom': 'cross-env NODE_ENV=development uniapp-cli custom', 'build:custom': 'cross-env NODE_ENV=production uniapp-cli custom', 'test:h5': 'cross-env UNI_PLATFORM=h5 jest -i', @@ -45,8 +45,8 @@ module.exports = (api, options, rootOptions) => { '@dcloudio/uni-mp-baidu': version, '@dcloudio/uni-mp-alipay': version, '@dcloudio/uni-mp-toutiao': version, - '@dcloudio/uni-quickapp-light': version, - '@dcloudio/uni-quickapp-vue': version, + '@dcloudio/uni-quickapp-webview': version, + '@dcloudio/uni-quickapp-native': version, '@dcloudio/uni-stat': version, flyio: '^0.6.2', vuex: '^3.2.0' diff --git a/packages/vue-cli-plugin-uni/index.js b/packages/vue-cli-plugin-uni/index.js index 20bd60e1ce654ef98c2a27b326b3258a197882cf..d64d1f1160005a5c3fc1dda3ba2924f8356c8515 100644 --- a/packages/vue-cli-plugin-uni/index.js +++ b/packages/vue-cli-plugin-uni/index.js @@ -19,7 +19,7 @@ module.exports = (api, options) => { initBuildCommand(api, options) - if (process.env.UNI_PLATFORM === 'quickapp-vue') { + if (process.env.UNI_PLATFORM === 'quickapp-native') { process.env.UNI_OUTPUT_DIR = path.resolve(process.env.UNI_OUTPUT_DIR, 'build') Object.assign(options, { assetsDir, @@ -35,7 +35,7 @@ module.exports = (api, options) => { api.configureWebpack(require('./lib/configure-webpack')(platformOptions, manifestPlatformOptions, options, api)) api.chainWebpack(require('./lib/chain-webpack')(platformOptions, options, api)) - const vueConfig = require('@dcloudio/uni-quickapp-vue/lib/vue.config.js') + const vueConfig = require('@dcloudio/uni-quickapp-native/lib/vue.config.js') api.configureWebpack(vueConfig.configureWebpack) api.chainWebpack(vueConfig.chainWebpack) return diff --git a/packages/vue-cli-plugin-uni/lib/configure-webpack.js b/packages/vue-cli-plugin-uni/lib/configure-webpack.js index fbd5eb0dba56da515997c47c756de0949b9ad3cb..ad682bdc8566048f9e9061996338b31039a7adde 100644 --- a/packages/vue-cli-plugin-uni/lib/configure-webpack.js +++ b/packages/vue-cli-plugin-uni/lib/configure-webpack.js @@ -198,19 +198,22 @@ module.exports = function configureWebpack (platformOptions, manifestPlatformOpt plugins.push(new CopyWebpackPlugin(getCopyWebpackPluginOptions(manifestPlatformOptions, vueOptions))) } - plugins.push(new CopyWebpackPlugin([{ - from: require.resolve('@dcloudio/uni-automator/dist/automator.json'), - to: '../.automator/' + (process.env.UNI_SUB_PLATFORM || process.env.UNI_PLATFORM) + - '/.automator.json', - transform (content) { - if (process.env.UNI_AUTOMATOR_WS_ENDPOINT) { - return JSON.stringify({ - wsEndpoint: process.env.UNI_AUTOMATOR_WS_ENDPOINT - }) + try { + const automatorJson = require.resolve('@dcloudio/uni-automator/dist/automator.json') + plugins.push(new CopyWebpackPlugin([{ + from: automatorJson, + to: '../.automator/' + (process.env.UNI_SUB_PLATFORM || process.env.UNI_PLATFORM) + + '/.automator.json', + transform (content) { + if (process.env.UNI_AUTOMATOR_WS_ENDPOINT) { + return JSON.stringify({ + wsEndpoint: process.env.UNI_AUTOMATOR_WS_ENDPOINT + }) + } + return '' } - return '' - } - }])) + }])) + } catch (e) {} if (process.UNI_SCRIPT_ENV && Object.keys(process.UNI_SCRIPT_ENV).length) { // custom define diff --git a/packages/vue-cli-plugin-uni/lib/env.js b/packages/vue-cli-plugin-uni/lib/env.js index 4b47d6ab2c51e6d4011b92d9acf1f8d57cb01c63..7752e88fff5736d83b15ce8b283d9f806e21be85 100644 --- a/packages/vue-cli-plugin-uni/lib/env.js +++ b/packages/vue-cli-plugin-uni/lib/env.js @@ -289,7 +289,7 @@ if (process.env.UNI_USING_NATIVE || process.env.UNI_USING_V3_NATIVE) { console.log('当前nvue编译模式' + (process.env.UNI_USING_V3_NATIVE ? '(v3)' : '') + ':' + (isNVueCompiler ? 'uni-app' : 'weex') + ' 。编译模式差异见:https://ask.dcloud.net.cn/article/36074') -} else if (process.env.UNI_PLATFORM !== 'h5' && process.env.UNI_PLATFORM !== 'quickapp-vue') { +} else if (process.env.UNI_PLATFORM !== 'h5' && process.env.UNI_PLATFORM !== 'quickapp-native') { try { let info = '' if (process.env.UNI_PLATFORM === 'app-plus') { diff --git a/packages/vue-cli-plugin-uni/packages/postcss/index.js b/packages/vue-cli-plugin-uni/packages/postcss/index.js index 0eaae1063e4a1330b122295c17dfa0db5a09f0b0..245fec5a28cf4d5756f2ef6d3ac42ac57ae513e0 100644 --- a/packages/vue-cli-plugin-uni/packages/postcss/index.js +++ b/packages/vue-cli-plugin-uni/packages/postcss/index.js @@ -241,7 +241,7 @@ if (process.env.UNI_USING_V3) { // Transform each property declaration here decl.value = tranformValue(decl, opts) }) - if (process.env.UNI_PLATFORM !== 'quickapp-vue') { + if (process.env.UNI_PLATFORM !== 'quickapp-native') { rule.selectors = rule.selectors.map(complexSelector => { return transformSelector(complexSelector, simpleSelectors => { return simpleSelectors.walkTags(tag => { diff --git a/packages/vue-cli-plugin-uni/packages/uni-cloud/dist/index.js b/packages/vue-cli-plugin-uni/packages/uni-cloud/dist/index.js index c7d325b999fb20369c376b8f276a6f45204794e6..5bda47390ffa1c8442829319375936d8115f3d26 100644 --- a/packages/vue-cli-plugin-uni/packages/uni-cloud/dist/index.js +++ b/packages/vue-cli-plugin-uni/packages/uni-cloud/dist/index.js @@ -1 +1 @@ -var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function t(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function n(e,t){return e(t={exports:{}},t.exports),t.exports}var r=n((function(e,t){var n;e.exports=(n=n||function(e,t){var n=Object.create||function(){function e(){}return function(t){var n;return e.prototype=t,n=new e,e.prototype=null,n}}(),r={},o=r.lib={},s=o.Base={extend:function(e){var t=n(this);return e&&t.mixIn(e),t.hasOwnProperty("init")&&this.init!==t.init||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},i=o.WordArray=s.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:4*e.length},toString:function(e){return(e||c).stringify(this)},concat:function(e){var t=this.words,n=e.words,r=this.sigBytes,o=e.sigBytes;if(this.clamp(),r%4)for(var s=0;s>>2]>>>24-s%4*8&255;t[r+s>>>2]|=i<<24-(r+s)%4*8}else for(s=0;s>>2]=n[s>>>2];return this.sigBytes+=o,this},clamp:function(){var t=this.words,n=this.sigBytes;t[n>>>2]&=4294967295<<32-n%4*8,t.length=e.ceil(n/4)},clone:function(){var e=s.clone.call(this);return e.words=this.words.slice(0),e},random:function(t){for(var n,r=[],o=function(t){t=t;var n=987654321,r=4294967295;return function(){var o=((n=36969*(65535&n)+(n>>16)&r)<<16)+(t=18e3*(65535&t)+(t>>16)&r)&r;return o/=4294967296,(o+=.5)*(e.random()>.5?1:-1)}},s=0;s>>2]>>>24-o%4*8&255;r.push((s>>>4).toString(16)),r.push((15&s).toString(16))}return r.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r>>3]|=parseInt(e.substr(r,2),16)<<24-r%8*4;return new i.init(n,t/2)}},u=a.Latin1={stringify:function(e){for(var t=e.words,n=e.sigBytes,r=[],o=0;o>>2]>>>24-o%4*8&255;r.push(String.fromCharCode(s))}return r.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r>>2]|=(255&e.charCodeAt(r))<<24-r%4*8;return new i.init(n,t)}},l=a.Utf8={stringify:function(e){try{return decodeURIComponent(escape(u.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return u.parse(unescape(encodeURIComponent(e)))}},f=o.BufferedBlockAlgorithm=s.extend({reset:function(){this._data=new i.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=l.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var n=this._data,r=n.words,o=n.sigBytes,s=this.blockSize,a=o/(4*s),c=(a=t?e.ceil(a):e.max((0|a)-this._minBufferSize,0))*s,u=e.min(4*c,o);if(c){for(var l=0;l>>24)|4278255360&(o<<24|o>>>8)}var s=this._hash.words,i=e[t+0],c=e[t+1],h=e[t+2],d=e[t+3],y=e[t+4],v=e[t+5],g=e[t+6],_=e[t+7],m=e[t+8],b=e[t+9],w=e[t+10],E=e[t+11],T=e[t+12],O=e[t+13],S=e[t+14],k=e[t+15],A=s[0],P=s[1],I=s[2],N=s[3];A=u(A,P,I,N,i,7,a[0]),N=u(N,A,P,I,c,12,a[1]),I=u(I,N,A,P,h,17,a[2]),P=u(P,I,N,A,d,22,a[3]),A=u(A,P,I,N,y,7,a[4]),N=u(N,A,P,I,v,12,a[5]),I=u(I,N,A,P,g,17,a[6]),P=u(P,I,N,A,_,22,a[7]),A=u(A,P,I,N,m,7,a[8]),N=u(N,A,P,I,b,12,a[9]),I=u(I,N,A,P,w,17,a[10]),P=u(P,I,N,A,E,22,a[11]),A=u(A,P,I,N,T,7,a[12]),N=u(N,A,P,I,O,12,a[13]),I=u(I,N,A,P,S,17,a[14]),A=l(A,P=u(P,I,N,A,k,22,a[15]),I,N,c,5,a[16]),N=l(N,A,P,I,g,9,a[17]),I=l(I,N,A,P,E,14,a[18]),P=l(P,I,N,A,i,20,a[19]),A=l(A,P,I,N,v,5,a[20]),N=l(N,A,P,I,w,9,a[21]),I=l(I,N,A,P,k,14,a[22]),P=l(P,I,N,A,y,20,a[23]),A=l(A,P,I,N,b,5,a[24]),N=l(N,A,P,I,S,9,a[25]),I=l(I,N,A,P,d,14,a[26]),P=l(P,I,N,A,m,20,a[27]),A=l(A,P,I,N,O,5,a[28]),N=l(N,A,P,I,h,9,a[29]),I=l(I,N,A,P,_,14,a[30]),A=f(A,P=l(P,I,N,A,T,20,a[31]),I,N,v,4,a[32]),N=f(N,A,P,I,m,11,a[33]),I=f(I,N,A,P,E,16,a[34]),P=f(P,I,N,A,S,23,a[35]),A=f(A,P,I,N,c,4,a[36]),N=f(N,A,P,I,y,11,a[37]),I=f(I,N,A,P,_,16,a[38]),P=f(P,I,N,A,w,23,a[39]),A=f(A,P,I,N,O,4,a[40]),N=f(N,A,P,I,i,11,a[41]),I=f(I,N,A,P,d,16,a[42]),P=f(P,I,N,A,g,23,a[43]),A=f(A,P,I,N,b,4,a[44]),N=f(N,A,P,I,T,11,a[45]),I=f(I,N,A,P,k,16,a[46]),A=p(A,P=f(P,I,N,A,h,23,a[47]),I,N,i,6,a[48]),N=p(N,A,P,I,_,10,a[49]),I=p(I,N,A,P,S,15,a[50]),P=p(P,I,N,A,v,21,a[51]),A=p(A,P,I,N,T,6,a[52]),N=p(N,A,P,I,d,10,a[53]),I=p(I,N,A,P,w,15,a[54]),P=p(P,I,N,A,c,21,a[55]),A=p(A,P,I,N,m,6,a[56]),N=p(N,A,P,I,k,10,a[57]),I=p(I,N,A,P,g,15,a[58]),P=p(P,I,N,A,O,21,a[59]),A=p(A,P,I,N,y,6,a[60]),N=p(N,A,P,I,E,10,a[61]),I=p(I,N,A,P,h,15,a[62]),P=p(P,I,N,A,b,21,a[63]),s[0]=s[0]+A|0,s[1]=s[1]+P|0,s[2]=s[2]+I|0,s[3]=s[3]+N|0},_doFinalize:function(){var t=this._data,n=t.words,r=8*this._nDataBytes,o=8*t.sigBytes;n[o>>>5]|=128<<24-o%32;var s=e.floor(r/4294967296),i=r;n[15+(o+64>>>9<<4)]=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),n[14+(o+64>>>9<<4)]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8),t.sigBytes=4*(n.length+1),this._process();for(var a=this._hash,c=a.words,u=0;u<4;u++){var l=c[u];c[u]=16711935&(l<<8|l>>>24)|4278255360&(l<<24|l>>>8)}return a},clone:function(){var e=s.clone.call(this);return e._hash=this._hash.clone(),e}});function u(e,t,n,r,o,s,i){var a=e+(t&n|~t&r)+o+i;return(a<>>32-s)+t}function l(e,t,n,r,o,s,i){var a=e+(t&r|n&~r)+o+i;return(a<>>32-s)+t}function f(e,t,n,r,o,s,i){var a=e+(t^n^r)+o+i;return(a<>>32-s)+t}function p(e,t,n,r,o,s,i){var a=e+(n^(t|~r))+o+i;return(a<>>32-s)+t}t.MD5=s._createHelper(c),t.HmacMD5=s._createHmacHelper(c)}(Math),n.MD5)})),n((function(e,t){var n,o,s;e.exports=(o=(n=r).lib.Base,s=n.enc.Utf8,void(n.algo.HMAC=o.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=s.parse(t));var n=e.blockSize,r=4*n;t.sigBytes>r&&(t=e.finalize(t)),t.clamp();for(var o=this._oKey=t.clone(),i=this._iKey=t.clone(),a=o.words,c=i.words,u=0;ue.code},requestId:{get:()=>e.requestId},message:{get(){return this.errMsg},set(e){this.errMsg=e}}})}}var i={sign:function(e,t){let n="";return Object.keys(e).sort().forEach((function(t){e[t]&&(n=n+"&"+t+"="+e[t])})),n=n.slice(1),o(n,t).toString()},wrappedRequest:function(e){return new Promise((t,n)=>{uni.request(Object.assign(e,{complete(e){e||(e={}),0===e.errMsg.indexOf("request:fail")&&"h5"===process.env.VUE_APP_PLATFORM&&"development"===process.env.NODE_ENV&&console.warn("发布H5,需要在uniCloud后台操作,绑定安全域名,否则会因为跨域问题而无法访问。教程参考:https://uniapp.dcloud.io/uniCloud/quickstart?id=H5%E4%B8%AD%E4%BD%BF%E7%94%A8unicloud");const r=e.data&&e.data.header&&e.data.header["x-serverless-request-id"]||e.header&&e.header["request-id"];if(!e.statusCode||e.statusCode>=400)return n(new s({code:"SYS_ERR",message:e.errMsg||"request:fail",requestId:r}));const o=e.data;if(o.error)return n(new s({code:o.error.code,message:o.error.message,requestId:r}));o.result=o.data,o.requestId=r,delete o.data,t(o)}}))})}};const a={image:"image/*",jpg:"image/jpeg",jpeg:"image/jpeg",png:"image/png",gif:"image/gif",webp:"image/webp",svg:"image/svg+xml",mp3:"audio/mp3",mp4:"video/mp4",ogg:"audio/ogg",webm:"video/webm"};function c(e){return a[e.toLowerCase()]}class u{constructor(e){["spaceId","clientSecret"].forEach(t=>{if(!Object.prototype.hasOwnProperty.call(e,t))throw new Error(`缺少参数${t}`)}),this.config=Object.assign({},{endpoint:"https://api.bspapp.com"},e),this.config.provider="aliyun",this.config.requestUrl=this.config.endpoint+"/client",this.config.envType=this.config.envType||"public",this.config.accessTokenKey="access_token_"+this.config.spaceId}get hasAccessToken(){return!!this.accessToken}setAccessToken(e){this.accessToken=e}requestAuth(e){return i.wrappedRequest(e)}request(e,t){return this.hasAccessToken?t?i.wrappedRequest(e):i.wrappedRequest(e).catch(t=>new Promise((e,n)=>{!t||"GATEWAY_INVALID_TOKEN"!==t.code&&"InvalidParameter.InvalidToken"!==t.code?n(t):e()}).then(()=>this.getAccessToken()).then(()=>{const t=this.rebuildRequest(e);return this.request(t,!0)})):this.getAccessToken().then(()=>{const t=this.rebuildRequest(e);return this.request(t,!0)})}rebuildRequest(e){const t=Object.assign({},e);return t.data.token=this.accessToken,t.header["x-basement-token"]=this.accessToken,t.header["x-serverless-sign"]=i.sign(t.data,this.config.clientSecret),t}setupRequest(e,t){const n=Object.assign({},e,{spaceId:this.config.spaceId,timestamp:Date.now()}),r={"Content-Type":"application/json"};return"auth"!==t&&(n.token=this.accessToken,r["x-basement-token"]=this.accessToken),r["x-serverless-sign"]=i.sign(n,this.config.clientSecret),{url:this.config.requestUrl,method:"POST",data:n,dataType:"json",header:r}}getAccessToken(){return this.requestAuth(this.setupRequest({method:"serverless.auth.user.anonymousAuthorize",params:"{}"},"auth")).then(e=>new Promise((t,n)=>{e.result&&e.result.accessToken?(this.setAccessToken(e.result.accessToken),t(this.accessToken)):n(new s({code:"AUTH_FAILED",message:"获取accessToken失败"}))}))}authorize(){this.getAccessToken()}callFunction(e){const t={method:"serverless.function.runtime.invoke",params:JSON.stringify({functionTarget:e.name,functionArgs:e.data||{}})};return this.config.useDebugFunction?this.request(this.setupRequest(t)).then(t=>{if(t&&t.requestId){const n=JSON.stringify({spaceId:this.config.spaceId,functionName:e.name,requestId:t.requestId});console.log(`[aliyun-request]${n}[/aliyun-request]`)}return Promise.resolve(t)}).catch(t=>{if(t&&t.requestId){const n=JSON.stringify({spaceId:this.config.spaceId,functionName:e.name,requestId:t.requestId});console.log(`[aliyun-request]${n}[/aliyun-request]`)}return Promise.reject(t)}):this.request(this.setupRequest(t))}getOSSUploadOptionsFromPath(e){const t={method:"serverless.file.resource.generateProximalSign",params:JSON.stringify(e)};return this.request(this.setupRequest(t))}uploadFileToOSS({url:e,formData:t,fileName:n,name:r,filePath:o,fileType:i,contentType:a,onUploadProgress:c}){return new Promise((a,u)=>{const l=uni.uploadFile({url:e,formData:t,fileName:n,name:r,filePath:o,fileType:i,header:{"X-OSS-server-side-encrpytion":"AES256"},success(e){e&&e.statusCode<400?a(e):u(new s({code:"UPLOAD_FAILED",message:"文件上传失败"}))},fail(e){u(e)}});"function"==typeof c&&l.onProgressUpdate(e=>{c({loaded:e.totalBytesSent,total:e.totalBytesExpectedToSend})})})}reportOSSUpload(e){const t={method:"serverless.file.resource.report",params:JSON.stringify(e)};return this.request(this.setupRequest(t))}uploadFile({filePath:e,cloudPath:t,onUploadProgress:n,config:r}){const o=r&&r.envType||this.config.envType;let i,u,l,f,p,h=t||e.split("/").pop();return(i="h5"===process.env.VUE_APP_PLATFORM?new Promise((n,r)=>{var o=new XMLHttpRequest;o.open("GET",e,!0),o.responseType="blob",o.onload=function(){(u=function(e){let t;return Object.keys(a).forEach(n=>{a[n]===e&&(t=n)}),t}(this.response.type))||r(new s({code:"UNSUPPORTED_FILE_TYPE",message:"不支持的文件类型"})),t||(h+="."+u),n()},o.send()}):c(u=e.split("?")[0].split(".").pop())?Promise.resolve():Promise.reject(new s({code:"UNSUPPORTED_FILE_TYPE",message:"不支持的文件类型"}))).then(()=>new Promise((t,n)=>{uni.getFileInfo?uni.getFileInfo({filePath:e,success(e){t(e.size)},fail(e){n(e)}}):t(0)})).then(e=>this.getOSSUploadOptionsFromPath({env:o,filename:h,size:e})).then(t=>{const r=t.result;l=c(u),f=r.id,p="https://"+r.cdnDomain+"/"+r.ossPath;const o={url:"https://"+r.host,formData:{"Cache-Control":"max-age=2592000","Content-Disposition":"attachment",OSSAccessKeyId:r.accessKeyId,Signature:r.signature,host:r.host,id:f,key:r.ossPath,policy:r.policy,success_action_status:200},fileName:"file",name:"file",filePath:e,fileType:"image",contentType:l};return this.uploadFileToOSS(Object.assign({},o,{onUploadProgress:n}))}).then(()=>this.reportOSSUpload({id:f,contentType:l})).then(t=>new Promise((n,r)=>{t.success?n({success:!0,filePath:e,fileID:p}):r(new s({code:"UPLOAD_FAILED",message:"文件上传失败"}))}))}deleteFile({fileList:e}){const t={method:"serverless.file.resource.delete",params:JSON.stringify({id:e[0]})};return this.request(this.setupRequest(t))}}const l=require("uni-stat-config").default||require("uni-stat-config"),f="__DC_STAT_UUID",p="__DC_UUID_VALUE",h="https://ide.dcloud.net.cn/serverless/function/invoke";let d,y;function v(){if("n"===g()){try{d=plus.runtime.getDCloudId()}catch(e){d=""}return d}return d||(d=Date.now()+""+Math.floor(1e7*Math.random()),uni.setStorage({key:f,data:d})),d}function g(){return{"app-plus":"n",h5:"h5","mp-weixin":"wx","mp-alipay":"ali","mp-baidu":"bd","mp-toutiao":"tt","mp-qq":"qq","quickapp-vue":"qv"}[process.env.VUE_APP_PLATFORM]}function _(e){return function(t){if(!((t=t||{}).success||t.fail||t.complete))return e.call(this,t);e.call(this,t).then(e=>{t.success&&t.success(e),t.complete&&t.complete(e)}).catch(e=>{t.fail&&t.fail(e),t.complete&&t.complete(e)})}}setTimeout((function(){uni.getStorage({key:f,success(e){d=e.data},fail(){d=p}}),y="qv"===g()?"android":uni.getSystemInfoSync().platform}),0);const m={init(e){const t=new u(e);return["uploadFile","deleteFile"].forEach(e=>{t[e]=_(t[e]).bind(t)}),setTimeout(()=>{t.authorize()},0),t}};var b;function w(e,t,n){void 0===n&&(n={});var r=/\?/.test(t),o="";for(var s in n)""===o?!r&&(t+="?"):o+="&",o+=s+"="+encodeURIComponent(n[s]);return/^http(s)?\:\/\//.test(t+=o)?t:""+e+t}!function(e){e.local="local",e.none="none",e.session="session"}(b||(b={}));var E,T=(E=function(e,t){return(E=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}E(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),O=function(){return(O=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=0;s-=1)r[s].split("=")[0]===e&&r.splice(s,1);n=n+"?"+r.join("&")}return n},t.createPromiseCallback=function(){var e;if(!Promise){(e=function(){}).promise={};var t=function(){throw new Error('Your Node runtime does support ES6 Promises. Set "global.Promise" to your preferred implementation of promises.')};return Object.defineProperty(e.promise,"then",{get:t}),Object.defineProperty(e.promise,"catch",{get:t}),e}var n=new Promise((function(t,n){e=function(e,r){return e?n(e):t(r)}}));return e.promise=n,e},t.getWeixinCode=function(){return t.getQuery("code")||t.getHash("code")},t.getMiniAppCode=function(){return new Promise((function(e,t){wx.login({success:function(t){e(t.code)},fail:function(e){t(e)}})}))},t.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)},t.isString=function(e){return"string"==typeof e},t.isUndefined=function(e){return void 0===e},t.isInstanceOf=function(e,t){return e instanceof t},t.isFormData=function(e){return"[object FormData]"===Object.prototype.toString.call(e)},t.genSeqId=function(){return Math.random().toString(16).slice(2)},t.getArgNames=function(e){var t=e.toString();return t.slice(t.indexOf("(")+1,t.indexOf(")")).match(/([^\s,]+)/g)},t.formatUrl=function(e,t,n){void 0===n&&(n={});var r=/\?/.test(t),o="";for(var s in n)""===o?!r&&(t+="?"):o+="&",o+=s+"="+encodeURIComponent(n[s]);return/^http(s)?\:\/\//.test(t+=o)?t:""+e+t}}));t(I);I.getQuery,I.getHash,I.removeParam,I.createPromiseCallback,I.getWeixinCode,I.getMiniAppCode,I.isArray,I.isString,I.isUndefined,I.isInstanceOf,I.isFormData,I.genSeqId,I.getArgNames,I.formatUrl;var N,C="dist/index.js",R="./dist/index.d.ts",x={build:"npm run tsc && webpack",tsc:"tsc -p tsconfig.json","tsc:w":"tsc -p tsconfig.json -w",test:"jest --verbose false -i",e2e:'NODE_ENV=e2e webpack && jest --config="./jest.e2e.config.js" --verbose false -i "e2e"',start:"webpack-dev-server --hot --open",eslint:'eslint "./**/*.js" "./**/*.ts"',"eslint-fix":'eslint --fix "./**/*.js" "./**/*.ts"',test_web:"npm run tsc && webpack-dev-server --devtool eval-source-map --progress --colors --hot --inline --content-base ./dist --host jimmytest-088bef.tcb.qcloud.la --port 80 --disableHostCheck true --mode development --config webpack.test.js"},q={type:"git",url:"https://github.com/TencentCloudBase/tcb-js-sdk"},U=["tcb","js-sdk"],j={"@cloudbase/adapter-interface":"^0.2.0","@cloudbase/adapter-wx_mp":"^0.2.1","@cloudbase/database":"^0.9.8"},L={"@babel/core":"^7.6.2","@babel/plugin-proposal-class-properties":"^7.5.5","@babel/plugin-proposal-object-rest-spread":"^7.6.2","@babel/plugin-transform-runtime":"^7.6.2","@babel/preset-env":"^7.6.2","@babel/preset-typescript":"^7.6.0","@babel/runtime":"^7.6.2","@types/jest":"^23.1.4","@types/node":"^10.14.4","@types/superagent":"^4.1.4",axios:"^0.19.0","babel-eslint":"^10.0.1","babel-loader":"^8.0.6","babel-polyfill":"^6.26.0",eslint:"^5.16.0","eslint-config-alloy":"^1.4.2","eslint-config-prettier":"^4.1.0","eslint-plugin-prettier":"^3.0.1","eslint-plugin-typescript":"^1.0.0-rc.3",express:"^4.17.1",husky:"^3.1.0",jest:"^24.7.1","jest-puppeteer":"^4.3.0","lint-staged":"^9.5.0","power-assert":"^1.6.1",puppeteer:"^1.20.0","serve-static":"^1.14.1","ts-jest":"^23.10.4","ts-loader":"^6.2.1",typescript:"^3.4.3","typescript-eslint-parser":"^22.0.0",webpack:"^4.41.3","webpack-bundle-analyzer":"^3.4.1","webpack-cli":"^3.3.0","webpack-dev-server":"^3.3.1","webpack-merge":"^4.2.2","webpack-visualizer-plugin":"^0.1.11"},D={hooks:{"pre-commit":"lint-staged"}},F={name:"tcb-js-sdk",version:"1.3.5",description:"js sdk for tcb",main:C,types:R,scripts:x,repository:q,keywords:U,author:"jimmyjzhang",license:"ISC",dependencies:j,devDependencies:L,husky:D,"lint-staged":{"*.{js,ts}":["eslint --fix","git add"]}},M=(N=Object.freeze({__proto__:null,name:"tcb-js-sdk",version:"1.3.5",description:"js sdk for tcb",main:C,types:R,scripts:x,repository:q,keywords:U,author:"jimmyjzhang",license:"ISC",dependencies:j,devDependencies:L,husky:D,default:F}))&&N.default||N,K=n((function(t,n){var r=e&&e.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t};Object.defineProperty(n,"__esModule",{value:!0});var o=r(M);n.SDK_VERISON=o.version,n.ACCESS_TOKEN="access_token",n.ACCESS_TOKEN_Expire="access_token_expire",n.REFRESH_TOKEN="refresh_token",n.ANONYMOUS_UUID="anonymous_uuid",n.LOGIN_TYPE_KEY="login_type",n.protocol="undefined"!=typeof location&&"http:"===location.protocol?"http:":"https:",n.BASE_URL="e2e"===process.env.NODE_ENV&&"pre"===process.env.END_POINT?"//tcb-pre.tencentcloudapi.com/web":"//tcb-api.tencentcloudapi.com/web"}));t(K);var G;K.SDK_VERISON,K.ACCESS_TOKEN,K.ACCESS_TOKEN_Expire,K.REFRESH_TOKEN,K.ANONYMOUS_UUID,K.LOGIN_TYPE_KEY,K.protocol,K.BASE_URL;!function(e){e.local="local",e.none="none",e.session="session"}(G||(G={}));var H=function(){},Y=function(){};var V=Object.freeze({__proto__:null,get StorageType(){return G},AbstractSDKRequest:H,AbstractStorage:Y,formatUrl:function(e,t,n){void 0===n&&(n={});var r=/\?/.test(t),o="";for(var s in n)""===o?!r&&(t+="?"):o+="&",o+=s+"="+encodeURIComponent(n[s]);return/^http(s)?\:\/\//.test(t+=o)?t:""+e+t}}),B=n((function(t,n){var r=e&&e.__extends||function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),o=e&&e.__assign||function(){return(o=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0&&o[o.length-1])&&(6===s[0]||2===s[0])){i=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]=0?JSON.parse(n).content:""},e.prototype.removeStore=function(e){this.storageClass.removeItem(e)},e}();n.Cache=o;var s=function(e){function t(){var t=e.call(this)||this;return W.Adapter.adapter.root.tcbObject||(W.Adapter.adapter.root.tcbObject={}),t}return r(t,e),t.prototype.setItem=function(e,t){W.Adapter.adapter.root.tcbObject[e]=t},t.prototype.getItem=function(e){return W.Adapter.adapter.root.tcbObject[e]},t.prototype.removeItem=function(e){delete W.Adapter.adapter.root.tcbObject[e]},t.prototype.clear=function(){delete W.Adapter.adapter.root.tcbObject},t}(V.AbstractStorage)}));t(z);z.Cache;var J=n((function(t,n){var r=e&&e.__extends||function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),o=e&&e.__spreadArrays||function(){for(var e=0,t=0,n=arguments.length;t0},e}();n.IEventEmitter=a;var c=new a;n.addEventListener=function(e,t){c.on(e,t)},n.activateEvent=function(e,t){void 0===t&&(t={}),c.fire(e,t)},n.removeEventListener=function(e,t){c.off(e,t)},n.EVENTS={LOGIN_STATE_CHANGED:"loginStateChanged",LOGIN_STATE_EXPIRE:"loginStateExpire",LOGIN_TYPE_CHANGE:"loginTypeChanged",ANONYMOUS_CONVERTED:"anonymousConverted",REFRESH_ACCESS_TOKEN:"refreshAccessToken"}}));t(J);J.IEvent,J.IErrorEvent,J.IEventEmitter,J.addEventListener,J.activateEvent,J.removeEventListener,J.EVENTS;var X=n((function(t,n){var r=e&&e.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0&&o[o.length-1])&&(6===s[0]||2===s[0])){i=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]0&&o[o.length-1])&&(6===s[0]||2===s[0])){i=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]0&&o[o.length-1])&&(6===s[0]||2===s[0])){i=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]Date.now())return[2,{credential:{accessToken:e,refreshToken:this.cache.getStore(this.refreshTokenKey)}}];this.cache.removeStore(this.accessTokenKey),this.cache.removeStore(this.accessTokenExpireKey)}if(!1===Object.values(a).includes(a[this.scope]))throw new Error("错误的scope类型");return W.Adapter.runtime!==W.RUNTIME.WX_MP?[3,2]:[4,u.getMiniAppCode()];case 1:return n=s.sent(),[3,4];case 2:return[4,u.getWeixinCode()];case 3:if(!(n=s.sent()))return[2,this.redirect()];s.label=4;case 4:return r=function(e){switch(e){case a.snsapi_login:return"WECHAT-OPEN";default:return"WECHAT-PUBLIC"}}(this.scope),[4,this.getRefreshTokenByWXCode(this.appid,r,n)];case 5:return o=s.sent(),i=o.refreshToken,this.cache.setStore(this.refreshTokenKey,i),o.accessToken&&this.cache.setStore(this.accessTokenKey,o.accessToken),o.accessTokenExpire&&this.cache.setStore(this.accessTokenExpireKey,o.accessTokenExpire+Date.now()),J.activateEvent(J.EVENTS.LOGIN_STATE_CHANGED),J.activateEvent(J.EVENTS.LOGIN_TYPE_CHANGE,l.LOGINTYPE.WECHAT),[2,{credential:{refreshToken:i}}]}}))}))},t.prototype.redirect=function(){var e=u.removeParam("code",location.href);e=u.removeParam("state",e),e=encodeURIComponent(e);var t="//open.weixin.qq.com/connect/oauth2/authorize";"snsapi_login"===this.scope&&(t="//open.weixin.qq.com/connect/qrconnect"),"redirect"===c[this.loginMode]&&(location.href=t+"?appid="+this.appid+"&redirect_uri="+e+"&response_type=code&scope="+this.scope+"&state="+this.state+"#wechat_redirect")},t}(l.default);n.default=p}));t(Q);var Z=n((function(t,n){var r=e&&e.__extends||function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),o=e&&e.__assign||function(){return(o=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0&&o[o.length-1])&&(6===s[0]||2===s[0])){i=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]0&&o[o.length-1])&&(6===s[0]||2===s[0])){i=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]0&&o[o.length-1])&&(6===s[0]||2===s[0])){i=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]{uni.request({url:h,method:"POST",data:{param:c},complete(r){r||(r={});const o=r.data&&r.data.body;if(!o)return void t(new s({message:`[FUNCTIONS_EXECUTE_FAIL] Request Fail: [${a}]`}));if("tcb"===n&&o.log&&""!==o.log.trim()&&console.log(o.log),0!==o.invokeResult&&"0"!==o.invokeResult)return void t(new s({message:o.errorMsg}));const i=o.requestId;let c={};try{c=JSON.parse(o.result)}catch(e){c=o.result}e({requestId:i,result:c})}})})}oe.init=function(e){e.env=e.spaceId;const t=se.call(this,e);t.config.provider="tencent",t.config.spaceId=e.spaceId;const n=t.auth;t.auth=function(e){const t=n.call(this,e);return["linkAndRetrieveDataWithTicket","signInAnonymously","signOut","getAccessToken","getLoginState","signInWithTicket","getUserInfo"].forEach(e=>{t[e]=_(t[e]).bind(t)}),t};if(["uploadFile","deleteFile","getTempFileURL","downloadFile"].forEach(e=>{t[e]=_(t[e]).bind(t)}),!1!==e.autoSignIn){const e=t.auth();e.getLoginState().then(t=>{t||e.signInAnonymously()})}return"development"===process.env.NODE_ENV&&console.log("使用腾讯云作为服务商时,调用云函数的同时会获取云函数运行日志,云函数响应会比发行慢,云函数实际响应时间应以发行为准"),t};const le={init(e){let t={},n=!(!1===e.debugFunction||"development"!==process.env.NODE_ENV||!process.env.HBX_USER_TOKEN);switch(e.provider){case"tencent":t=oe.init(Object.assign(e,{useDebugFunction:n}));break;case"aliyun":n=n&&("h5"===process.env.VUE_APP_PLATFORM&&navigator.userAgent.indexOf("HBuilderX")>0||"app-plus"===process.env.VUE_APP_PLATFORM),t=m.init(Object.assign(e,{useDebugFunction:n}));break;default:throw new Error("未提供正确的provider参数")}return function(e){let t=e.callFunction;e.config.useDebugFunction&&"tencent"===e.config.provider&&(t=ue),e.callFunction=function(e){const n=ce.call(this,e);return new Promise((r,o)=>{t.call(this,n).then(e=>{r(e)}).catch(t=>{t&&t.message&&(t.message=`[${e.name}]: ${t.message}`),o(t)})})};const n=e.callFunction;e.callFunction=function(e){return _(n).call(this,e)}}(t),t.init=this.init,t}};let fe=le;try{let e={};1===process.env.UNI_CLOUD_PROVIDER.length&&(e=process.env.UNI_CLOUD_PROVIDER[0]),fe=le.init(e)}catch(e){["auth","callFunction","uploadFile","deleteFile","getTempFileURL","downloadFile"].forEach(e=>{fe[e]=function(){const e=process.env.UNI_CLOUD_PROVIDER.length>0?"应用有多个服务空间,请通过uniCloud.init方法指定要使用的服务空间":"应用未关联服务空间,请在cloudfunctions目录右键关联服务空间";return console.error(e),Promise.reject(new s({code:"SYS_ERR",message:e}))}})}var pe=fe;export default pe; +var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function t(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function n(e,t){return e(t={exports:{}},t.exports),t.exports}var r=n((function(e,t){var n;e.exports=(n=n||function(e,t){var n=Object.create||function(){function e(){}return function(t){var n;return e.prototype=t,n=new e,e.prototype=null,n}}(),r={},o=r.lib={},s=o.Base={extend:function(e){var t=n(this);return e&&t.mixIn(e),t.hasOwnProperty("init")&&this.init!==t.init||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},i=o.WordArray=s.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:4*e.length},toString:function(e){return(e||c).stringify(this)},concat:function(e){var t=this.words,n=e.words,r=this.sigBytes,o=e.sigBytes;if(this.clamp(),r%4)for(var s=0;s>>2]>>>24-s%4*8&255;t[r+s>>>2]|=i<<24-(r+s)%4*8}else for(s=0;s>>2]=n[s>>>2];return this.sigBytes+=o,this},clamp:function(){var t=this.words,n=this.sigBytes;t[n>>>2]&=4294967295<<32-n%4*8,t.length=e.ceil(n/4)},clone:function(){var e=s.clone.call(this);return e.words=this.words.slice(0),e},random:function(t){for(var n,r=[],o=function(t){t=t;var n=987654321,r=4294967295;return function(){var o=((n=36969*(65535&n)+(n>>16)&r)<<16)+(t=18e3*(65535&t)+(t>>16)&r)&r;return o/=4294967296,(o+=.5)*(e.random()>.5?1:-1)}},s=0;s>>2]>>>24-o%4*8&255;r.push((s>>>4).toString(16)),r.push((15&s).toString(16))}return r.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r>>3]|=parseInt(e.substr(r,2),16)<<24-r%8*4;return new i.init(n,t/2)}},u=a.Latin1={stringify:function(e){for(var t=e.words,n=e.sigBytes,r=[],o=0;o>>2]>>>24-o%4*8&255;r.push(String.fromCharCode(s))}return r.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r>>2]|=(255&e.charCodeAt(r))<<24-r%4*8;return new i.init(n,t)}},l=a.Utf8={stringify:function(e){try{return decodeURIComponent(escape(u.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return u.parse(unescape(encodeURIComponent(e)))}},f=o.BufferedBlockAlgorithm=s.extend({reset:function(){this._data=new i.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=l.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var n=this._data,r=n.words,o=n.sigBytes,s=this.blockSize,a=o/(4*s),c=(a=t?e.ceil(a):e.max((0|a)-this._minBufferSize,0))*s,u=e.min(4*c,o);if(c){for(var l=0;l>>24)|4278255360&(o<<24|o>>>8)}var s=this._hash.words,i=e[t+0],c=e[t+1],h=e[t+2],d=e[t+3],y=e[t+4],v=e[t+5],g=e[t+6],_=e[t+7],m=e[t+8],b=e[t+9],w=e[t+10],E=e[t+11],T=e[t+12],O=e[t+13],S=e[t+14],k=e[t+15],A=s[0],P=s[1],I=s[2],N=s[3];A=u(A,P,I,N,i,7,a[0]),N=u(N,A,P,I,c,12,a[1]),I=u(I,N,A,P,h,17,a[2]),P=u(P,I,N,A,d,22,a[3]),A=u(A,P,I,N,y,7,a[4]),N=u(N,A,P,I,v,12,a[5]),I=u(I,N,A,P,g,17,a[6]),P=u(P,I,N,A,_,22,a[7]),A=u(A,P,I,N,m,7,a[8]),N=u(N,A,P,I,b,12,a[9]),I=u(I,N,A,P,w,17,a[10]),P=u(P,I,N,A,E,22,a[11]),A=u(A,P,I,N,T,7,a[12]),N=u(N,A,P,I,O,12,a[13]),I=u(I,N,A,P,S,17,a[14]),A=l(A,P=u(P,I,N,A,k,22,a[15]),I,N,c,5,a[16]),N=l(N,A,P,I,g,9,a[17]),I=l(I,N,A,P,E,14,a[18]),P=l(P,I,N,A,i,20,a[19]),A=l(A,P,I,N,v,5,a[20]),N=l(N,A,P,I,w,9,a[21]),I=l(I,N,A,P,k,14,a[22]),P=l(P,I,N,A,y,20,a[23]),A=l(A,P,I,N,b,5,a[24]),N=l(N,A,P,I,S,9,a[25]),I=l(I,N,A,P,d,14,a[26]),P=l(P,I,N,A,m,20,a[27]),A=l(A,P,I,N,O,5,a[28]),N=l(N,A,P,I,h,9,a[29]),I=l(I,N,A,P,_,14,a[30]),A=f(A,P=l(P,I,N,A,T,20,a[31]),I,N,v,4,a[32]),N=f(N,A,P,I,m,11,a[33]),I=f(I,N,A,P,E,16,a[34]),P=f(P,I,N,A,S,23,a[35]),A=f(A,P,I,N,c,4,a[36]),N=f(N,A,P,I,y,11,a[37]),I=f(I,N,A,P,_,16,a[38]),P=f(P,I,N,A,w,23,a[39]),A=f(A,P,I,N,O,4,a[40]),N=f(N,A,P,I,i,11,a[41]),I=f(I,N,A,P,d,16,a[42]),P=f(P,I,N,A,g,23,a[43]),A=f(A,P,I,N,b,4,a[44]),N=f(N,A,P,I,T,11,a[45]),I=f(I,N,A,P,k,16,a[46]),A=p(A,P=f(P,I,N,A,h,23,a[47]),I,N,i,6,a[48]),N=p(N,A,P,I,_,10,a[49]),I=p(I,N,A,P,S,15,a[50]),P=p(P,I,N,A,v,21,a[51]),A=p(A,P,I,N,T,6,a[52]),N=p(N,A,P,I,d,10,a[53]),I=p(I,N,A,P,w,15,a[54]),P=p(P,I,N,A,c,21,a[55]),A=p(A,P,I,N,m,6,a[56]),N=p(N,A,P,I,k,10,a[57]),I=p(I,N,A,P,g,15,a[58]),P=p(P,I,N,A,O,21,a[59]),A=p(A,P,I,N,y,6,a[60]),N=p(N,A,P,I,E,10,a[61]),I=p(I,N,A,P,h,15,a[62]),P=p(P,I,N,A,b,21,a[63]),s[0]=s[0]+A|0,s[1]=s[1]+P|0,s[2]=s[2]+I|0,s[3]=s[3]+N|0},_doFinalize:function(){var t=this._data,n=t.words,r=8*this._nDataBytes,o=8*t.sigBytes;n[o>>>5]|=128<<24-o%32;var s=e.floor(r/4294967296),i=r;n[15+(o+64>>>9<<4)]=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),n[14+(o+64>>>9<<4)]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8),t.sigBytes=4*(n.length+1),this._process();for(var a=this._hash,c=a.words,u=0;u<4;u++){var l=c[u];c[u]=16711935&(l<<8|l>>>24)|4278255360&(l<<24|l>>>8)}return a},clone:function(){var e=s.clone.call(this);return e._hash=this._hash.clone(),e}});function u(e,t,n,r,o,s,i){var a=e+(t&n|~t&r)+o+i;return(a<>>32-s)+t}function l(e,t,n,r,o,s,i){var a=e+(t&r|n&~r)+o+i;return(a<>>32-s)+t}function f(e,t,n,r,o,s,i){var a=e+(t^n^r)+o+i;return(a<>>32-s)+t}function p(e,t,n,r,o,s,i){var a=e+(n^(t|~r))+o+i;return(a<>>32-s)+t}t.MD5=s._createHelper(c),t.HmacMD5=s._createHmacHelper(c)}(Math),n.MD5)})),n((function(e,t){var n,o,s;e.exports=(o=(n=r).lib.Base,s=n.enc.Utf8,void(n.algo.HMAC=o.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=s.parse(t));var n=e.blockSize,r=4*n;t.sigBytes>r&&(t=e.finalize(t)),t.clamp();for(var o=this._oKey=t.clone(),i=this._iKey=t.clone(),a=o.words,c=i.words,u=0;ue.code},requestId:{get:()=>e.requestId},message:{get(){return this.errMsg},set(e){this.errMsg=e}}})}}var i={sign:function(e,t){let n="";return Object.keys(e).sort().forEach((function(t){e[t]&&(n=n+"&"+t+"="+e[t])})),n=n.slice(1),o(n,t).toString()},wrappedRequest:function(e){return new Promise((t,n)=>{uni.request(Object.assign(e,{complete(e){e||(e={}),0===e.errMsg.indexOf("request:fail")&&"h5"===process.env.VUE_APP_PLATFORM&&"development"===process.env.NODE_ENV&&console.warn("发布H5,需要在uniCloud后台操作,绑定安全域名,否则会因为跨域问题而无法访问。教程参考:https://uniapp.dcloud.io/uniCloud/quickstart?id=H5%E4%B8%AD%E4%BD%BF%E7%94%A8unicloud");const r=e.data&&e.data.header&&e.data.header["x-serverless-request-id"]||e.header&&e.header["request-id"];if(!e.statusCode||e.statusCode>=400)return n(new s({code:"SYS_ERR",message:e.errMsg||"request:fail",requestId:r}));const o=e.data;if(o.error)return n(new s({code:o.error.code,message:o.error.message,requestId:r}));o.result=o.data,o.requestId=r,delete o.data,t(o)}}))})}};const a={image:"image/*",jpg:"image/jpeg",jpeg:"image/jpeg",png:"image/png",gif:"image/gif",webp:"image/webp",svg:"image/svg+xml",mp3:"audio/mp3",mp4:"video/mp4",ogg:"audio/ogg",webm:"video/webm"};function c(e){return a[e.toLowerCase()]}class u{constructor(e){["spaceId","clientSecret"].forEach(t=>{if(!Object.prototype.hasOwnProperty.call(e,t))throw new Error(`缺少参数${t}`)}),this.config=Object.assign({},{endpoint:"https://api.bspapp.com"},e),this.config.provider="aliyun",this.config.requestUrl=this.config.endpoint+"/client",this.config.envType=this.config.envType||"public",this.config.accessTokenKey="access_token_"+this.config.spaceId}get hasAccessToken(){return!!this.accessToken}setAccessToken(e){this.accessToken=e}requestAuth(e){return i.wrappedRequest(e)}request(e,t){return this.hasAccessToken?t?i.wrappedRequest(e):i.wrappedRequest(e).catch(t=>new Promise((e,n)=>{!t||"GATEWAY_INVALID_TOKEN"!==t.code&&"InvalidParameter.InvalidToken"!==t.code?n(t):e()}).then(()=>this.getAccessToken()).then(()=>{const t=this.rebuildRequest(e);return this.request(t,!0)})):this.getAccessToken().then(()=>{const t=this.rebuildRequest(e);return this.request(t,!0)})}rebuildRequest(e){const t=Object.assign({},e);return t.data.token=this.accessToken,t.header["x-basement-token"]=this.accessToken,t.header["x-serverless-sign"]=i.sign(t.data,this.config.clientSecret),t}setupRequest(e,t){const n=Object.assign({},e,{spaceId:this.config.spaceId,timestamp:Date.now()}),r={"Content-Type":"application/json"};return"auth"!==t&&(n.token=this.accessToken,r["x-basement-token"]=this.accessToken),r["x-serverless-sign"]=i.sign(n,this.config.clientSecret),{url:this.config.requestUrl,method:"POST",data:n,dataType:"json",header:r}}getAccessToken(){return this.requestAuth(this.setupRequest({method:"serverless.auth.user.anonymousAuthorize",params:"{}"},"auth")).then(e=>new Promise((t,n)=>{e.result&&e.result.accessToken?(this.setAccessToken(e.result.accessToken),t(this.accessToken)):n(new s({code:"AUTH_FAILED",message:"获取accessToken失败"}))}))}authorize(){this.getAccessToken()}callFunction(e){const t={method:"serverless.function.runtime.invoke",params:JSON.stringify({functionTarget:e.name,functionArgs:e.data||{}})};return this.config.useDebugFunction?this.request(this.setupRequest(t)).then(t=>{if(t&&t.requestId){const n=JSON.stringify({spaceId:this.config.spaceId,functionName:e.name,requestId:t.requestId});console.log(`[aliyun-request]${n}[/aliyun-request]`)}return Promise.resolve(t)}).catch(t=>{if(t&&t.requestId){const n=JSON.stringify({spaceId:this.config.spaceId,functionName:e.name,requestId:t.requestId});console.log(`[aliyun-request]${n}[/aliyun-request]`)}return Promise.reject(t)}):this.request(this.setupRequest(t))}getOSSUploadOptionsFromPath(e){const t={method:"serverless.file.resource.generateProximalSign",params:JSON.stringify(e)};return this.request(this.setupRequest(t))}uploadFileToOSS({url:e,formData:t,fileName:n,name:r,filePath:o,fileType:i,contentType:a,onUploadProgress:c}){return new Promise((a,u)=>{const l=uni.uploadFile({url:e,formData:t,fileName:n,name:r,filePath:o,fileType:i,header:{"X-OSS-server-side-encrpytion":"AES256"},success(e){e&&e.statusCode<400?a(e):u(new s({code:"UPLOAD_FAILED",message:"文件上传失败"}))},fail(e){u(e)}});"function"==typeof c&&l.onProgressUpdate(e=>{c({loaded:e.totalBytesSent,total:e.totalBytesExpectedToSend})})})}reportOSSUpload(e){const t={method:"serverless.file.resource.report",params:JSON.stringify(e)};return this.request(this.setupRequest(t))}uploadFile({filePath:e,cloudPath:t,onUploadProgress:n,config:r}){const o=r&&r.envType||this.config.envType;let i,u,l,f,p,h=t||e.split("/").pop();return(i="h5"===process.env.VUE_APP_PLATFORM?new Promise((n,r)=>{var o=new XMLHttpRequest;o.open("GET",e,!0),o.responseType="blob",o.onload=function(){(u=function(e){let t;return Object.keys(a).forEach(n=>{a[n]===e&&(t=n)}),t}(this.response.type))||r(new s({code:"UNSUPPORTED_FILE_TYPE",message:"不支持的文件类型"})),t||(h+="."+u),n()},o.send()}):c(u=e.split("?")[0].split(".").pop())?Promise.resolve():Promise.reject(new s({code:"UNSUPPORTED_FILE_TYPE",message:"不支持的文件类型"}))).then(()=>new Promise((t,n)=>{uni.getFileInfo?uni.getFileInfo({filePath:e,success(e){t(e.size)},fail(e){n(e)}}):t(0)})).then(e=>this.getOSSUploadOptionsFromPath({env:o,filename:h,size:e})).then(t=>{const r=t.result;l=c(u),f=r.id,p="https://"+r.cdnDomain+"/"+r.ossPath;const o={url:"https://"+r.host,formData:{"Cache-Control":"max-age=2592000","Content-Disposition":"attachment",OSSAccessKeyId:r.accessKeyId,Signature:r.signature,host:r.host,id:f,key:r.ossPath,policy:r.policy,success_action_status:200},fileName:"file",name:"file",filePath:e,fileType:"image",contentType:l};return this.uploadFileToOSS(Object.assign({},o,{onUploadProgress:n}))}).then(()=>this.reportOSSUpload({id:f,contentType:l})).then(t=>new Promise((n,r)=>{t.success?n({success:!0,filePath:e,fileID:p}):r(new s({code:"UPLOAD_FAILED",message:"文件上传失败"}))}))}deleteFile({fileList:e}){const t={method:"serverless.file.resource.delete",params:JSON.stringify({id:e[0]})};return this.request(this.setupRequest(t))}}const l=require("uni-stat-config").default||require("uni-stat-config"),f="__DC_STAT_UUID",p="__DC_UUID_VALUE",h="https://ide.dcloud.net.cn/serverless/function/invoke";let d,y;function v(){if("n"===g()){try{d=plus.runtime.getDCloudId()}catch(e){d=""}return d}return d||(d=Date.now()+""+Math.floor(1e7*Math.random()),uni.setStorage({key:f,data:d})),d}function g(){return{"app-plus":"n",h5:"h5","mp-weixin":"wx","mp-alipay":"ali","mp-baidu":"bd","mp-toutiao":"tt","mp-qq":"qq","quickapp-native":"qv"}[process.env.VUE_APP_PLATFORM]}function _(e){return function(t){if(!((t=t||{}).success||t.fail||t.complete))return e.call(this,t);e.call(this,t).then(e=>{t.success&&t.success(e),t.complete&&t.complete(e)}).catch(e=>{t.fail&&t.fail(e),t.complete&&t.complete(e)})}}setTimeout((function(){uni.getStorage({key:f,success(e){d=e.data},fail(){d=p}}),y="qv"===g()?"android":uni.getSystemInfoSync().platform}),0);const m={init(e){const t=new u(e);return["uploadFile","deleteFile"].forEach(e=>{t[e]=_(t[e]).bind(t)}),setTimeout(()=>{t.authorize()},0),t}};var b;function w(e,t,n){void 0===n&&(n={});var r=/\?/.test(t),o="";for(var s in n)""===o?!r&&(t+="?"):o+="&",o+=s+"="+encodeURIComponent(n[s]);return/^http(s)?\:\/\//.test(t+=o)?t:""+e+t}!function(e){e.local="local",e.none="none",e.session="session"}(b||(b={}));var E,T=(E=function(e,t){return(E=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}E(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),O=function(){return(O=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=0;s-=1)r[s].split("=")[0]===e&&r.splice(s,1);n=n+"?"+r.join("&")}return n},t.createPromiseCallback=function(){var e;if(!Promise){(e=function(){}).promise={};var t=function(){throw new Error('Your Node runtime does support ES6 Promises. Set "global.Promise" to your preferred implementation of promises.')};return Object.defineProperty(e.promise,"then",{get:t}),Object.defineProperty(e.promise,"catch",{get:t}),e}var n=new Promise((function(t,n){e=function(e,r){return e?n(e):t(r)}}));return e.promise=n,e},t.getWeixinCode=function(){return t.getQuery("code")||t.getHash("code")},t.getMiniAppCode=function(){return new Promise((function(e,t){wx.login({success:function(t){e(t.code)},fail:function(e){t(e)}})}))},t.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)},t.isString=function(e){return"string"==typeof e},t.isUndefined=function(e){return void 0===e},t.isInstanceOf=function(e,t){return e instanceof t},t.isFormData=function(e){return"[object FormData]"===Object.prototype.toString.call(e)},t.genSeqId=function(){return Math.random().toString(16).slice(2)},t.getArgNames=function(e){var t=e.toString();return t.slice(t.indexOf("(")+1,t.indexOf(")")).match(/([^\s,]+)/g)},t.formatUrl=function(e,t,n){void 0===n&&(n={});var r=/\?/.test(t),o="";for(var s in n)""===o?!r&&(t+="?"):o+="&",o+=s+"="+encodeURIComponent(n[s]);return/^http(s)?\:\/\//.test(t+=o)?t:""+e+t}}));t(I);I.getQuery,I.getHash,I.removeParam,I.createPromiseCallback,I.getWeixinCode,I.getMiniAppCode,I.isArray,I.isString,I.isUndefined,I.isInstanceOf,I.isFormData,I.genSeqId,I.getArgNames,I.formatUrl;var N,C="dist/index.js",R="./dist/index.d.ts",x={build:"npm run tsc && webpack",tsc:"tsc -p tsconfig.json","tsc:w":"tsc -p tsconfig.json -w",test:"jest --verbose false -i",e2e:'NODE_ENV=e2e webpack && jest --config="./jest.e2e.config.js" --verbose false -i "e2e"',start:"webpack-dev-server --hot --open",eslint:'eslint "./**/*.js" "./**/*.ts"',"eslint-fix":'eslint --fix "./**/*.js" "./**/*.ts"',test_web:"npm run tsc && webpack-dev-server --devtool eval-source-map --progress --colors --hot --inline --content-base ./dist --host jimmytest-088bef.tcb.qcloud.la --port 80 --disableHostCheck true --mode development --config webpack.test.js"},q={type:"git",url:"https://github.com/TencentCloudBase/tcb-js-sdk"},U=["tcb","js-sdk"],j={"@cloudbase/adapter-interface":"^0.2.0","@cloudbase/adapter-wx_mp":"^0.2.1","@cloudbase/database":"^0.9.8"},L={"@babel/core":"^7.6.2","@babel/plugin-proposal-class-properties":"^7.5.5","@babel/plugin-proposal-object-rest-spread":"^7.6.2","@babel/plugin-transform-runtime":"^7.6.2","@babel/preset-env":"^7.6.2","@babel/preset-typescript":"^7.6.0","@babel/runtime":"^7.6.2","@types/jest":"^23.1.4","@types/node":"^10.14.4","@types/superagent":"^4.1.4",axios:"^0.19.0","babel-eslint":"^10.0.1","babel-loader":"^8.0.6","babel-polyfill":"^6.26.0",eslint:"^5.16.0","eslint-config-alloy":"^1.4.2","eslint-config-prettier":"^4.1.0","eslint-plugin-prettier":"^3.0.1","eslint-plugin-typescript":"^1.0.0-rc.3",express:"^4.17.1",husky:"^3.1.0",jest:"^24.7.1","jest-puppeteer":"^4.3.0","lint-staged":"^9.5.0","power-assert":"^1.6.1",puppeteer:"^1.20.0","serve-static":"^1.14.1","ts-jest":"^23.10.4","ts-loader":"^6.2.1",typescript:"^3.4.3","typescript-eslint-parser":"^22.0.0",webpack:"^4.41.3","webpack-bundle-analyzer":"^3.4.1","webpack-cli":"^3.3.0","webpack-dev-server":"^3.3.1","webpack-merge":"^4.2.2","webpack-visualizer-plugin":"^0.1.11"},D={hooks:{"pre-commit":"lint-staged"}},F={name:"tcb-js-sdk",version:"1.3.5",description:"js sdk for tcb",main:C,types:R,scripts:x,repository:q,keywords:U,author:"jimmyjzhang",license:"ISC",dependencies:j,devDependencies:L,husky:D,"lint-staged":{"*.{js,ts}":["eslint --fix","git add"]}},M=(N=Object.freeze({__proto__:null,name:"tcb-js-sdk",version:"1.3.5",description:"js sdk for tcb",main:C,types:R,scripts:x,repository:q,keywords:U,author:"jimmyjzhang",license:"ISC",dependencies:j,devDependencies:L,husky:D,default:F}))&&N.default||N,K=n((function(t,n){var r=e&&e.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t};Object.defineProperty(n,"__esModule",{value:!0});var o=r(M);n.SDK_VERISON=o.version,n.ACCESS_TOKEN="access_token",n.ACCESS_TOKEN_Expire="access_token_expire",n.REFRESH_TOKEN="refresh_token",n.ANONYMOUS_UUID="anonymous_uuid",n.LOGIN_TYPE_KEY="login_type",n.protocol="undefined"!=typeof location&&"http:"===location.protocol?"http:":"https:",n.BASE_URL="e2e"===process.env.NODE_ENV&&"pre"===process.env.END_POINT?"//tcb-pre.tencentcloudapi.com/web":"//tcb-api.tencentcloudapi.com/web"}));t(K);var G;K.SDK_VERISON,K.ACCESS_TOKEN,K.ACCESS_TOKEN_Expire,K.REFRESH_TOKEN,K.ANONYMOUS_UUID,K.LOGIN_TYPE_KEY,K.protocol,K.BASE_URL;!function(e){e.local="local",e.none="none",e.session="session"}(G||(G={}));var H=function(){},Y=function(){};var V=Object.freeze({__proto__:null,get StorageType(){return G},AbstractSDKRequest:H,AbstractStorage:Y,formatUrl:function(e,t,n){void 0===n&&(n={});var r=/\?/.test(t),o="";for(var s in n)""===o?!r&&(t+="?"):o+="&",o+=s+"="+encodeURIComponent(n[s]);return/^http(s)?\:\/\//.test(t+=o)?t:""+e+t}}),B=n((function(t,n){var r=e&&e.__extends||function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),o=e&&e.__assign||function(){return(o=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0&&o[o.length-1])&&(6===s[0]||2===s[0])){i=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]=0?JSON.parse(n).content:""},e.prototype.removeStore=function(e){this.storageClass.removeItem(e)},e}();n.Cache=o;var s=function(e){function t(){var t=e.call(this)||this;return W.Adapter.adapter.root.tcbObject||(W.Adapter.adapter.root.tcbObject={}),t}return r(t,e),t.prototype.setItem=function(e,t){W.Adapter.adapter.root.tcbObject[e]=t},t.prototype.getItem=function(e){return W.Adapter.adapter.root.tcbObject[e]},t.prototype.removeItem=function(e){delete W.Adapter.adapter.root.tcbObject[e]},t.prototype.clear=function(){delete W.Adapter.adapter.root.tcbObject},t}(V.AbstractStorage)}));t(z);z.Cache;var J=n((function(t,n){var r=e&&e.__extends||function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),o=e&&e.__spreadArrays||function(){for(var e=0,t=0,n=arguments.length;t0},e}();n.IEventEmitter=a;var c=new a;n.addEventListener=function(e,t){c.on(e,t)},n.activateEvent=function(e,t){void 0===t&&(t={}),c.fire(e,t)},n.removeEventListener=function(e,t){c.off(e,t)},n.EVENTS={LOGIN_STATE_CHANGED:"loginStateChanged",LOGIN_STATE_EXPIRE:"loginStateExpire",LOGIN_TYPE_CHANGE:"loginTypeChanged",ANONYMOUS_CONVERTED:"anonymousConverted",REFRESH_ACCESS_TOKEN:"refreshAccessToken"}}));t(J);J.IEvent,J.IErrorEvent,J.IEventEmitter,J.addEventListener,J.activateEvent,J.removeEventListener,J.EVENTS;var X=n((function(t,n){var r=e&&e.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0&&o[o.length-1])&&(6===s[0]||2===s[0])){i=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]0&&o[o.length-1])&&(6===s[0]||2===s[0])){i=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]0&&o[o.length-1])&&(6===s[0]||2===s[0])){i=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]Date.now())return[2,{credential:{accessToken:e,refreshToken:this.cache.getStore(this.refreshTokenKey)}}];this.cache.removeStore(this.accessTokenKey),this.cache.removeStore(this.accessTokenExpireKey)}if(!1===Object.values(a).includes(a[this.scope]))throw new Error("错误的scope类型");return W.Adapter.runtime!==W.RUNTIME.WX_MP?[3,2]:[4,u.getMiniAppCode()];case 1:return n=s.sent(),[3,4];case 2:return[4,u.getWeixinCode()];case 3:if(!(n=s.sent()))return[2,this.redirect()];s.label=4;case 4:return r=function(e){switch(e){case a.snsapi_login:return"WECHAT-OPEN";default:return"WECHAT-PUBLIC"}}(this.scope),[4,this.getRefreshTokenByWXCode(this.appid,r,n)];case 5:return o=s.sent(),i=o.refreshToken,this.cache.setStore(this.refreshTokenKey,i),o.accessToken&&this.cache.setStore(this.accessTokenKey,o.accessToken),o.accessTokenExpire&&this.cache.setStore(this.accessTokenExpireKey,o.accessTokenExpire+Date.now()),J.activateEvent(J.EVENTS.LOGIN_STATE_CHANGED),J.activateEvent(J.EVENTS.LOGIN_TYPE_CHANGE,l.LOGINTYPE.WECHAT),[2,{credential:{refreshToken:i}}]}}))}))},t.prototype.redirect=function(){var e=u.removeParam("code",location.href);e=u.removeParam("state",e),e=encodeURIComponent(e);var t="//open.weixin.qq.com/connect/oauth2/authorize";"snsapi_login"===this.scope&&(t="//open.weixin.qq.com/connect/qrconnect"),"redirect"===c[this.loginMode]&&(location.href=t+"?appid="+this.appid+"&redirect_uri="+e+"&response_type=code&scope="+this.scope+"&state="+this.state+"#wechat_redirect")},t}(l.default);n.default=p}));t(Q);var Z=n((function(t,n){var r=e&&e.__extends||function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),o=e&&e.__assign||function(){return(o=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0&&o[o.length-1])&&(6===s[0]||2===s[0])){i=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]0&&o[o.length-1])&&(6===s[0]||2===s[0])){i=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]0&&o[o.length-1])&&(6===s[0]||2===s[0])){i=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]{uni.request({url:h,method:"POST",data:{param:c},complete(r){r||(r={});const o=r.data&&r.data.body;if(!o)return void t(new s({message:`[FUNCTIONS_EXECUTE_FAIL] Request Fail: [${a}]`}));if("tcb"===n&&o.log&&""!==o.log.trim()&&console.log(o.log),0!==o.invokeResult&&"0"!==o.invokeResult)return void t(new s({message:o.errorMsg}));const i=o.requestId;let c={};try{c=JSON.parse(o.result)}catch(e){c=o.result}e({requestId:i,result:c})}})})}oe.init=function(e){e.env=e.spaceId;const t=se.call(this,e);t.config.provider="tencent",t.config.spaceId=e.spaceId;const n=t.auth;t.auth=function(e){const t=n.call(this,e);return["linkAndRetrieveDataWithTicket","signInAnonymously","signOut","getAccessToken","getLoginState","signInWithTicket","getUserInfo"].forEach(e=>{t[e]=_(t[e]).bind(t)}),t};if(["uploadFile","deleteFile","getTempFileURL","downloadFile"].forEach(e=>{t[e]=_(t[e]).bind(t)}),!1!==e.autoSignIn){const e=t.auth();e.getLoginState().then(t=>{t||e.signInAnonymously()})}return"development"===process.env.NODE_ENV&&console.log("使用腾讯云作为服务商时,调用云函数的同时会获取云函数运行日志,云函数响应会比发行慢,云函数实际响应时间应以发行为准"),t};const le={init(e){let t={},n=!(!1===e.debugFunction||"development"!==process.env.NODE_ENV||!process.env.HBX_USER_TOKEN);switch(e.provider){case"tencent":t=oe.init(Object.assign(e,{useDebugFunction:n}));break;case"aliyun":n=n&&("h5"===process.env.VUE_APP_PLATFORM&&navigator.userAgent.indexOf("HBuilderX")>0||"app-plus"===process.env.VUE_APP_PLATFORM),t=m.init(Object.assign(e,{useDebugFunction:n}));break;default:throw new Error("未提供正确的provider参数")}return function(e){let t=e.callFunction;e.config.useDebugFunction&&"tencent"===e.config.provider&&(t=ue),e.callFunction=function(e){const n=ce.call(this,e);return new Promise((r,o)=>{t.call(this,n).then(e=>{r(e)}).catch(t=>{t&&t.message&&(t.message=`[${e.name}]: ${t.message}`),o(t)})})};const n=e.callFunction;e.callFunction=function(e){return _(n).call(this,e)}}(t),t.init=this.init,t}};let fe=le;try{let e={};1===process.env.UNI_CLOUD_PROVIDER.length&&(e=process.env.UNI_CLOUD_PROVIDER[0]),fe=le.init(e)}catch(e){["auth","callFunction","uploadFile","deleteFile","getTempFileURL","downloadFile"].forEach(e=>{fe[e]=function(){const e=process.env.UNI_CLOUD_PROVIDER.length>0?"应用有多个服务空间,请通过uniCloud.init方法指定要使用的服务空间":"应用未关联服务空间,请在cloudfunctions目录右键关联服务空间";return console.error(e),Promise.reject(new s({code:"SYS_ERR",message:e}))}})}var pe=fe;export default pe; diff --git a/packages/webpack-uni-pages-loader/lib/index-new.js b/packages/webpack-uni-pages-loader/lib/index-new.js index 95be12fd984fca54eeacf2d1f2ef0e08930d4f58..b28f7298fab7f1a0ac6e456ea82e6c26d12a7917 100644 --- a/packages/webpack-uni-pages-loader/lib/index-new.js +++ b/packages/webpack-uni-pages-loader/lib/index-new.js @@ -69,8 +69,8 @@ module.exports = function (content) { if (process.env.UNI_PLATFORM === 'h5') { return require('./platforms/h5')(pagesJson, manifestJson, this) } - if (process.env.UNI_PLATFORM === 'quickapp-vue') { - return require('./platforms/quickapp-vue')(pagesJson, manifestJson, this) + if (process.env.UNI_PLATFORM === 'quickapp-native') { + return require('./platforms/quickapp-native')(pagesJson, manifestJson, this) } if (!process.env.UNI_USING_V3) { diff --git a/packages/webpack-uni-pages-loader/lib/index.js b/packages/webpack-uni-pages-loader/lib/index.js index baff3139c5432af4a303c6f52377c9afaf830de8..b6ba3dede6bef198b67621bc9d6dceec95f0ae47 100644 --- a/packages/webpack-uni-pages-loader/lib/index.js +++ b/packages/webpack-uni-pages-loader/lib/index.js @@ -44,7 +44,7 @@ module.exports = function (content) { if ( process.env.UNI_USING_COMPONENTS || process.env.UNI_PLATFORM === 'h5' || - process.env.UNI_PLATFORM === 'quickapp-vue' + process.env.UNI_PLATFORM === 'quickapp-native' ) { return require('./index-new').call(this, content) } diff --git a/packages/webpack-uni-pages-loader/lib/platforms/quickapp-native.js b/packages/webpack-uni-pages-loader/lib/platforms/quickapp-native.js new file mode 100644 index 0000000000000000000000000000000000000000..fb98e487cf24bfb20331fbc4666a277f9291c960 --- /dev/null +++ b/packages/webpack-uni-pages-loader/lib/platforms/quickapp-native.js @@ -0,0 +1,3 @@ +module.exports = function (pagesJson, manifestJson, loader) { + return require('@dcloudio/uni-quickapp-native/lib/manifest')(pagesJson, manifestJson, loader) +} diff --git a/packages/webpack-uni-pages-loader/lib/platforms/quickapp-vue.js b/packages/webpack-uni-pages-loader/lib/platforms/quickapp-vue.js deleted file mode 100644 index 17c9e6b30db814b5e27d1175eaf14c6d744f7e0b..0000000000000000000000000000000000000000 --- a/packages/webpack-uni-pages-loader/lib/platforms/quickapp-vue.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = function (pagesJson, manifestJson, loader) { - return require('@dcloudio/uni-quickapp-vue/lib/manifest')(pagesJson, manifestJson, loader) -} diff --git a/packages/webpack-uni-pages-loader/lib/platforms/quickapp-light/index.js b/packages/webpack-uni-pages-loader/lib/platforms/quickapp-webview/index.js similarity index 88% rename from packages/webpack-uni-pages-loader/lib/platforms/quickapp-light/index.js rename to packages/webpack-uni-pages-loader/lib/platforms/quickapp-webview/index.js index d25bed0611a797453752822990d06625590744b9..babb93a0b019a16fdb8b78d366784fd72a154ebb 100644 --- a/packages/webpack-uni-pages-loader/lib/platforms/quickapp-light/index.js +++ b/packages/webpack-uni-pages-loader/lib/platforms/quickapp-webview/index.js @@ -16,7 +16,7 @@ module.exports = function (pagesJson, manifestJson) { manifestJson.versionName && (baseJson.versionName = manifestJson.versionName) manifestJson.versionCode && (baseJson.versionCode = manifestJson.versionCode) - Object.assign(app.content, baseJson, manifestJson['quickapp-light'] || {}) + Object.assign(app.content, baseJson, manifestJson['quickapp-webview'] || {}) if (!app.content.package) { app.content.package = manifestJson.name diff --git a/packages/webpack-uni-pages-loader/lib/platforms/quickapp-light/project.config.json b/packages/webpack-uni-pages-loader/lib/platforms/quickapp-webview/project.config.json similarity index 100% rename from packages/webpack-uni-pages-loader/lib/platforms/quickapp-light/project.config.json rename to packages/webpack-uni-pages-loader/lib/platforms/quickapp-webview/project.config.json diff --git a/src/core/runtime/mp/polyfill/index.js b/src/core/runtime/mp/polyfill/index.js index 5296d7154441be332b746cb63025cf81296a83b0..0bda8b7a0b1853eec5de3ac68800f835f1aea3a4 100644 --- a/src/core/runtime/mp/polyfill/index.js +++ b/src/core/runtime/mp/polyfill/index.js @@ -1,3 +1,7 @@ +import { + noop +} from 'uni-shared' + import { initState } from './state/index' @@ -19,6 +23,9 @@ export default { beforeCreate () { // 取消 development 时的 Proxy,避免小程序组件模板中使用尚未定义的属性告警 this._renderProxy = this + + this._$self = this + this._$noop = noop }, created () { // properties 中可能会访问 methods,故需要在 created 中初始化 initState(this) diff --git a/src/core/runtime/web-view/index.js b/src/core/runtime/web-view/index.js index 527bf1e680e5c0f9fb4378f96a16ee4b8071041e..13ca271f5a0ee37c4dbefa4769bfe6084d343ad8 100644 --- a/src/core/runtime/web-view/index.js +++ b/src/core/runtime/web-view/index.js @@ -25,7 +25,7 @@ import { } from 'uni-platforms/mp-weixin/runtime/web-view' import { initWebviewApi as initQuickappWebviewApi -} from 'uni-platforms/quickapp-light/runtime/web-view' +} from 'uni-platforms/quickapp-webview/runtime/web-view' const UniAppJSBridgeReady = function () { window.UniAppJSBridge = true diff --git a/src/platforms/quickapp-vue/README.md b/src/platforms/quickapp-native/README.md similarity index 100% rename from src/platforms/quickapp-vue/README.md rename to src/platforms/quickapp-native/README.md diff --git a/src/platforms/quickapp-vue/helpers/Emitter.js b/src/platforms/quickapp-native/helpers/Emitter.js similarity index 100% rename from src/platforms/quickapp-vue/helpers/Emitter.js rename to src/platforms/quickapp-native/helpers/Emitter.js diff --git a/src/platforms/quickapp-vue/helpers/can-i-use.js b/src/platforms/quickapp-native/helpers/can-i-use.js similarity index 100% rename from src/platforms/quickapp-vue/helpers/can-i-use.js rename to src/platforms/quickapp-native/helpers/can-i-use.js diff --git a/src/platforms/quickapp-vue/helpers/get-real-path.js b/src/platforms/quickapp-native/helpers/get-real-path.js similarity index 100% rename from src/platforms/quickapp-vue/helpers/get-real-path.js rename to src/platforms/quickapp-native/helpers/get-real-path.js diff --git a/src/platforms/quickapp-vue/runtime/app.js b/src/platforms/quickapp-native/runtime/app.js similarity index 100% rename from src/platforms/quickapp-vue/runtime/app.js rename to src/platforms/quickapp-native/runtime/app.js diff --git a/src/platforms/quickapp-vue/runtime/bridge.js b/src/platforms/quickapp-native/runtime/bridge.js similarity index 100% rename from src/platforms/quickapp-vue/runtime/bridge.js rename to src/platforms/quickapp-native/runtime/bridge.js diff --git a/src/platforms/quickapp-vue/runtime/page.js b/src/platforms/quickapp-native/runtime/page.js similarity index 100% rename from src/platforms/quickapp-vue/runtime/page.js rename to src/platforms/quickapp-native/runtime/page.js diff --git a/src/platforms/quickapp-vue/service/api.js b/src/platforms/quickapp-native/service/api.js similarity index 100% rename from src/platforms/quickapp-vue/service/api.js rename to src/platforms/quickapp-native/service/api.js diff --git a/src/platforms/quickapp-vue/service/api/device/clipboard.js b/src/platforms/quickapp-native/service/api/device/clipboard.js similarity index 100% rename from src/platforms/quickapp-vue/service/api/device/clipboard.js rename to src/platforms/quickapp-native/service/api/device/clipboard.js diff --git a/src/platforms/quickapp-vue/service/api/network/request.js b/src/platforms/quickapp-native/service/api/network/request.js similarity index 100% rename from src/platforms/quickapp-vue/service/api/network/request.js rename to src/platforms/quickapp-native/service/api/network/request.js diff --git a/src/platforms/quickapp-vue/service/api/route/navigate-back.js b/src/platforms/quickapp-native/service/api/route/navigate-back.js similarity index 100% rename from src/platforms/quickapp-vue/service/api/route/navigate-back.js rename to src/platforms/quickapp-native/service/api/route/navigate-back.js diff --git a/src/platforms/quickapp-vue/service/api/route/navigate-to.js b/src/platforms/quickapp-native/service/api/route/navigate-to.js similarity index 100% rename from src/platforms/quickapp-vue/service/api/route/navigate-to.js rename to src/platforms/quickapp-native/service/api/route/navigate-to.js diff --git a/src/platforms/quickapp-vue/service/api/route/redirect-to.js b/src/platforms/quickapp-native/service/api/route/redirect-to.js similarity index 100% rename from src/platforms/quickapp-vue/service/api/route/redirect-to.js rename to src/platforms/quickapp-native/service/api/route/redirect-to.js diff --git a/src/platforms/quickapp-vue/service/api/route/util.js b/src/platforms/quickapp-native/service/api/route/util.js similarity index 100% rename from src/platforms/quickapp-vue/service/api/route/util.js rename to src/platforms/quickapp-native/service/api/route/util.js diff --git a/src/platforms/quickapp-vue/service/api/storage/storage.js b/src/platforms/quickapp-native/service/api/storage/storage.js similarity index 100% rename from src/platforms/quickapp-vue/service/api/storage/storage.js rename to src/platforms/quickapp-native/service/api/storage/storage.js diff --git a/src/platforms/quickapp-vue/service/api/ui/popup.js b/src/platforms/quickapp-native/service/api/ui/popup.js similarity index 100% rename from src/platforms/quickapp-vue/service/api/ui/popup.js rename to src/platforms/quickapp-native/service/api/ui/popup.js diff --git a/src/platforms/quickapp-vue/service/base-api.js b/src/platforms/quickapp-native/service/base-api.js similarity index 100% rename from src/platforms/quickapp-vue/service/base-api.js rename to src/platforms/quickapp-native/service/base-api.js diff --git a/src/platforms/quickapp-vue/service/bridge.js b/src/platforms/quickapp-native/service/bridge.js similarity index 100% rename from src/platforms/quickapp-vue/service/bridge.js rename to src/platforms/quickapp-native/service/bridge.js diff --git a/src/platforms/quickapp-vue/service/framework/app.js b/src/platforms/quickapp-native/service/framework/app.js similarity index 100% rename from src/platforms/quickapp-vue/service/framework/app.js rename to src/platforms/quickapp-native/service/framework/app.js diff --git a/src/platforms/quickapp-vue/service/framework/page.js b/src/platforms/quickapp-native/service/framework/page.js similarity index 100% rename from src/platforms/quickapp-vue/service/framework/page.js rename to src/platforms/quickapp-native/service/framework/page.js diff --git a/src/platforms/quickapp-vue/service/framework/vue.js b/src/platforms/quickapp-native/service/framework/vue.js similarity index 100% rename from src/platforms/quickapp-vue/service/framework/vue.js rename to src/platforms/quickapp-native/service/framework/vue.js diff --git a/src/platforms/quickapp-vue/service/index.js b/src/platforms/quickapp-native/service/index.js similarity index 100% rename from src/platforms/quickapp-vue/service/index.js rename to src/platforms/quickapp-native/service/index.js diff --git a/src/platforms/quickapp-vue/service/invoke-api.js b/src/platforms/quickapp-native/service/invoke-api.js similarity index 100% rename from src/platforms/quickapp-vue/service/invoke-api.js rename to src/platforms/quickapp-native/service/invoke-api.js diff --git a/src/platforms/quickapp-vue/service/platform-api.js b/src/platforms/quickapp-native/service/platform-api.js similarity index 100% rename from src/platforms/quickapp-vue/service/platform-api.js rename to src/platforms/quickapp-native/service/platform-api.js diff --git a/src/platforms/quickapp-vue/service/publish-handler.js b/src/platforms/quickapp-native/service/publish-handler.js similarity index 100% rename from src/platforms/quickapp-vue/service/publish-handler.js rename to src/platforms/quickapp-native/service/publish-handler.js diff --git a/src/platforms/quickapp-vue/view/components/button/button.vue b/src/platforms/quickapp-native/view/components/button/button.vue similarity index 100% rename from src/platforms/quickapp-vue/view/components/button/button.vue rename to src/platforms/quickapp-native/view/components/button/button.vue diff --git a/src/platforms/quickapp-light/runtime/api/index.js b/src/platforms/quickapp-webview/runtime/api/index.js similarity index 100% rename from src/platforms/quickapp-light/runtime/api/index.js rename to src/platforms/quickapp-webview/runtime/api/index.js diff --git a/src/platforms/quickapp-light/runtime/api/protocols.js b/src/platforms/quickapp-webview/runtime/api/protocols.js similarity index 100% rename from src/platforms/quickapp-light/runtime/api/protocols.js rename to src/platforms/quickapp-webview/runtime/api/protocols.js diff --git a/src/platforms/quickapp-light/runtime/api/providers.js b/src/platforms/quickapp-webview/runtime/api/providers.js similarity index 100% rename from src/platforms/quickapp-light/runtime/api/providers.js rename to src/platforms/quickapp-webview/runtime/api/providers.js diff --git a/src/platforms/quickapp-light/runtime/index.js b/src/platforms/quickapp-webview/runtime/index.js similarity index 100% rename from src/platforms/quickapp-light/runtime/index.js rename to src/platforms/quickapp-webview/runtime/index.js diff --git a/src/platforms/quickapp-light/runtime/web-view.js b/src/platforms/quickapp-webview/runtime/web-view.js similarity index 100% rename from src/platforms/quickapp-light/runtime/web-view.js rename to src/platforms/quickapp-webview/runtime/web-view.js diff --git a/src/platforms/quickapp-light/runtime/wrapper/app-parser.js b/src/platforms/quickapp-webview/runtime/wrapper/app-parser.js similarity index 100% rename from src/platforms/quickapp-light/runtime/wrapper/app-parser.js rename to src/platforms/quickapp-webview/runtime/wrapper/app-parser.js diff --git a/src/platforms/quickapp-light/runtime/wrapper/component-parser.js b/src/platforms/quickapp-webview/runtime/wrapper/component-parser.js similarity index 100% rename from src/platforms/quickapp-light/runtime/wrapper/component-parser.js rename to src/platforms/quickapp-webview/runtime/wrapper/component-parser.js diff --git a/src/platforms/quickapp-light/runtime/wrapper/page-parser.js b/src/platforms/quickapp-webview/runtime/wrapper/page-parser.js similarity index 100% rename from src/platforms/quickapp-light/runtime/wrapper/page-parser.js rename to src/platforms/quickapp-webview/runtime/wrapper/page-parser.js diff --git a/src/platforms/quickapp-light/runtime/wrapper/util.js b/src/platforms/quickapp-webview/runtime/wrapper/util.js similarity index 100% rename from src/platforms/quickapp-light/runtime/wrapper/util.js rename to src/platforms/quickapp-webview/runtime/wrapper/util.js