@vnxjs/plugin-platform-qq
Version:
QQ Mini Program Platform Plugin
111 lines (100 loc) • 3.85 kB
JavaScript
;
Object.defineProperty(exports, '__esModule', { value: true });
var pluginPlatformWeapp = require('@vnxjs/plugin-platform-weapp');
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
function __awaiter(thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
}
const components = {
// ======== Adjust Properties ========
Button: {
'app-packagename': '',
'app-bundleid': '',
'app-connect-id': '',
'group-id': '',
'public-id': '',
'guild-id': '',
'share-type': '27',
'share-mode': '[\'qq\', \'qzone\']',
'aria-label': '',
'open-id': '',
'share-message-friend-info': '',
bindAddFriend: '',
bindAddGroupApp: ''
}
};
const PACKAGE_NAME = '@vnxjs/plugin-platform-qq';
class QQ extends pluginPlatformWeapp.Weapp {
/**
* 1. setupTransaction - init
* 2. setup
* 3. setupTransaction - close
* 4. buildTransaction - init
* 5. build
* 6. buildTransaction - close
*/
constructor(ctx, config, pluginOptions) {
super(ctx, config, pluginOptions);
this.platform = 'qq';
this.globalObject = 'qq';
this.projectConfigJson = 'project.qq.json';
this.runtimePath = `${PACKAGE_NAME}/dist/runtime`;
this.fileType = {
templ: '.qml',
style: '.qss',
config: '.json',
script: '.js',
xs: '.wxs'
};
this.buildTransaction.addWrapper({
init: this.beforeBuild
});
}
beforeBuild() {
// Processing QQ Departure from the components of micromail
this.template.mergeComponents(this.ctx, components);
this.template.Adapter = {
if: 'qq:if',
else: 'qq:else',
elseif: 'qq:elif',
for: 'qq:for',
forItem: 'qq:for-item',
forIndex: 'qq:for-index',
key: 'qq:key',
xs: 'wxs',
type: 'qq'
};
}
}
var index = (ctx, options) => {
ctx.registerPlatform({
name: 'qq',
useConfigName: 'mini',
fn({ config }) {
return __awaiter(this, void 0, void 0, function* () {
const program = new QQ(ctx, config, options);
yield program.start();
});
}
});
};
exports.QQ = QQ;
exports["default"] = index;
//# sourceMappingURL=index.js.map