@cloudbase/lowcode-builder 1.9.2 → 1.9.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/builder/config/dependencies.js +4 -4
- package/lib/builder/config/index.js +2 -2
- package/lib/builder/core/index.d.ts +2 -1
- package/lib/builder/core/index.js +5 -19
- package/lib/builder/mp/BuildContext.d.ts +5 -0
- package/lib/builder/mp/index.js +4 -3
- package/lib/builder/mp/util.js +4 -3
- package/lib/builder/service/webpack.js +1 -7
- package/lib/builder.web.js +4 -4
- package/package.json +2 -2
- package/template/html/index.html.ejs +1 -1
- package/template/mp/app/weapps-api.js +2 -0
- package/template/mp/common/util.js +0 -5
- package/template/mp/datasources/config.js.tpl +2 -1
- package/template/mp/package.json +1 -3
- package/template/mp/packages/$wd_system/pages/login/methods/loginBySms.js +0 -3
- package/template/webpack/web.prod.js +1 -1
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.generatePackageDependencies = void 0;
|
|
4
4
|
const cals_1 = require("@cloudbase/cals");
|
|
5
|
+
const CLOUDBASE_VERSION = '2.6.6-beta.0';
|
|
5
6
|
const BASE_DEPS = {
|
|
6
7
|
'miniprogram-gesture': '^1.0.6',
|
|
7
8
|
mobx: '^5',
|
|
@@ -12,16 +13,15 @@ const BASE_DEPS = {
|
|
|
12
13
|
* 注意锁版本
|
|
13
14
|
*/
|
|
14
15
|
const CLOUDBASE_DEPS = {
|
|
15
|
-
'@cloudbase/
|
|
16
|
+
'@cloudbase/auth': CLOUDBASE_VERSION,
|
|
16
17
|
'@cloudbase/weda-client': '1.1.6',
|
|
17
|
-
'@cloudbase/weda-cloud-sdk': '1.0.
|
|
18
|
+
'@cloudbase/weda-cloud-sdk': '1.0.78',
|
|
18
19
|
};
|
|
19
20
|
function generatePackageDependencies({ importJSSDK, mode, officialLibVersion, uin, }) {
|
|
20
21
|
const deps = {};
|
|
21
22
|
if (importJSSDK) {
|
|
22
|
-
deps['@cloudbase/js-sdk'] =
|
|
23
|
+
deps['@cloudbase/js-sdk'] = CLOUDBASE_VERSION;
|
|
23
24
|
}
|
|
24
|
-
const mod = uin ? Number(uin) % 10 : undefined;
|
|
25
25
|
if (mode === 'lib') {
|
|
26
26
|
// eslint-disable-next-line no-restricted-syntax
|
|
27
27
|
for (const key in CLOUDBASE_DEPS) {
|
|
@@ -48,8 +48,8 @@ exports.materialsDirName = 'materials'; // materials diretory of current project
|
|
|
48
48
|
* 存放在大账号:100015939275。访问地址:https://console.cloud.tencent.com/cos/bucket?bucket=comp-public-replace-1303824488®ion=ap-shanghai&path=%252Flcap-builder%252F
|
|
49
49
|
*/
|
|
50
50
|
const COMP_PUBLIC_DOMAIN = 'comp-public-replace-1303824488-cos.weda.tencent.com';
|
|
51
|
-
exports.miniprogramURL = `https://${COMP_PUBLIC_DOMAIN}/lcap-builder/miniprogram_npm.1.
|
|
52
|
-
exports.cloudbaseMiniprogramURL = `https://${COMP_PUBLIC_DOMAIN}/lcap-builder/cloudbase_miniprogram_npm.1.
|
|
51
|
+
exports.miniprogramURL = `https://${COMP_PUBLIC_DOMAIN}/lcap-builder/miniprogram_npm.1.9.4.zip`;
|
|
52
|
+
exports.cloudbaseMiniprogramURL = `https://${COMP_PUBLIC_DOMAIN}/lcap-builder/cloudbase_miniprogram_npm.1.9.4.zip`;
|
|
53
53
|
exports.systemSubpackageMiniprogramURL = `https://${COMP_PUBLIC_DOMAIN}/lcap-builder/wd_system_miniprogram_npm.zip`;
|
|
54
54
|
exports.RUNTIME_CONFIG_URL = `https://${COMP_PUBLIC_DOMAIN}/release_config/runtime/exp_runtime.json`;
|
|
55
55
|
/**
|
|
@@ -54,6 +54,7 @@ export interface IBuildWedaApp extends IBaseAppProps {
|
|
|
54
54
|
projectConfigJson?: Record<string, any>;
|
|
55
55
|
};
|
|
56
56
|
privatelinkConfig?: Record<string, any>;
|
|
57
|
+
__defaultLoginType__?: 'openId' | 'anonymous';
|
|
57
58
|
}
|
|
58
59
|
export declare function buildWedaConfig({ output, domain, isPrivateMode, endpointType, buildTypeList, }: {
|
|
59
60
|
output: Required<IBuildWedaApp['output']>;
|
|
@@ -62,7 +63,7 @@ export declare function buildWedaConfig({ output, domain, isPrivateMode, endpoin
|
|
|
62
63
|
endpointType?: IBuildWedaApp['endpointType'];
|
|
63
64
|
buildTypeList?: IBuildWedaApp['buildTypeList'];
|
|
64
65
|
}): Promise<void>;
|
|
65
|
-
export declare function buildWedaApp({ cals, subAppCalsList: _subAppCalsList, dependencies, appKey, runtime, ignoreInstall, buildTypeList, mode, devTool, deployOptions,
|
|
66
|
+
export declare function buildWedaApp({ cals, subAppCalsList: _subAppCalsList, dependencies, appKey, runtime, ignoreInstall, buildTypeList, mode, devTool, deployOptions, plugins, extraData, resourceAppId, domain, output, isBrowserMpBuilder, cdnEndpoints: _cdnEndpoints, isPrivateMode, endpointType, enableExpiredTag, enableAd, account, mpConfig, privatelinkConfig, __defaultLoginType__, }: IBuildWedaApp, cb?: WebpackBuildCallBack): Promise<any>;
|
|
66
67
|
export declare function cleanComponentDir(): Promise<void>;
|
|
67
68
|
export declare const version: any;
|
|
68
69
|
export { getFiles, fileToZip, strToBuf } from '../util/generateFiles';
|
|
@@ -58,10 +58,10 @@ async function buildWedaConfig({ output, domain = undefined, isPrivateMode = und
|
|
|
58
58
|
await (0, index_1.generateConfig)(data, outDir);
|
|
59
59
|
}
|
|
60
60
|
exports.buildWedaConfig = buildWedaConfig;
|
|
61
|
-
async function buildWedaApp({ cals, subAppCalsList: _subAppCalsList = [], dependencies = [], appKey = 'test', runtime = types_1.RUNTIME.NONE, ignoreInstall = false, buildTypeList = [common_1.BuildType.WEB], mode = common_1.WebpackModeType.PRODUCTION, devTool = 'webpack', deployOptions = { mode: types_1.DEPLOY_MODE.PREVIEW },
|
|
61
|
+
async function buildWedaApp({ cals, subAppCalsList: _subAppCalsList = [], dependencies = [], appKey = 'test', runtime = types_1.RUNTIME.NONE, ignoreInstall = false, buildTypeList = [common_1.BuildType.WEB], mode = common_1.WebpackModeType.PRODUCTION, devTool = 'webpack', deployOptions = { mode: types_1.DEPLOY_MODE.PREVIEW }, plugins = [], extraData = {
|
|
62
62
|
isComposite: false,
|
|
63
63
|
compProps: {},
|
|
64
|
-
}, resourceAppId = undefined, domain = '', output, isBrowserMpBuilder = false, cdnEndpoints: _cdnEndpoints, isPrivateMode = false, endpointType = undefined, enableExpiredTag = false, enableAd = false, account = {}, mpConfig = {}, privatelinkConfig = undefined, }, cb) {
|
|
64
|
+
}, resourceAppId = undefined, domain = '', output, isBrowserMpBuilder = false, cdnEndpoints: _cdnEndpoints, isPrivateMode = false, endpointType = undefined, enableExpiredTag = false, enableAd = false, account = {}, mpConfig = {}, privatelinkConfig = undefined, __defaultLoginType__ = 'anonymous', }, cb) {
|
|
65
65
|
var _a, _b, _c, _d, _e, _f;
|
|
66
66
|
const cdnEndpoints = (0, config_1.generateCdnEndpoints)(_cdnEndpoints);
|
|
67
67
|
if (!cals) {
|
|
@@ -191,12 +191,13 @@ async function buildWedaApp({ cals, subAppCalsList: _subAppCalsList = [], depend
|
|
|
191
191
|
enableLoading: (_e = cals === null || cals === void 0 ? void 0 : cals.extra) === null || _e === void 0 ? void 0 : _e.enableLoading,
|
|
192
192
|
enableAsyncMaterials: (_f = cals.extra) === null || _f === void 0 ? void 0 : _f.enableAsyncMaterials,
|
|
193
193
|
disablePageComponentInvoke,
|
|
194
|
+
__defaultLoginType__,
|
|
194
195
|
// enableAsyncMaterials: true,
|
|
195
196
|
};
|
|
196
197
|
const result = await (0, index_1.generateWxMp)({
|
|
198
|
+
buildContext: mpBuildContext,
|
|
197
199
|
weapps: apps,
|
|
198
200
|
calses,
|
|
199
|
-
buildContext: mpBuildContext,
|
|
200
201
|
plugins,
|
|
201
202
|
deployOptions,
|
|
202
203
|
options: {
|
|
@@ -485,25 +486,10 @@ async function patchMpComponentNPM({ packageDir, name, version, packageMiniprogr
|
|
|
485
486
|
version: version || packageJSON.version || '0.0.1',
|
|
486
487
|
miniprogram: `./${packageMiniprogramEntry}`,
|
|
487
488
|
keywords: ['微搭', '小程序', '区块组件', 'cloudbase', 'cloudbase-module', 'cloudbase-component'],
|
|
488
|
-
scripts: {
|
|
489
|
-
...packageJSON.scripts,
|
|
490
|
-
postinstall: 'node scripts/fixCloudSdk.js',
|
|
491
|
-
},
|
|
492
489
|
dependencies: {
|
|
493
490
|
...packageJSON.peerDependencies,
|
|
494
491
|
...BASE_DEPS,
|
|
495
492
|
},
|
|
496
493
|
};
|
|
497
|
-
await Promise.all([
|
|
498
|
-
fs_extra_1.default.writeFile(path_1.default.join(packageDir, 'scripts', 'fixCloudSdk.js'), `try {
|
|
499
|
-
const cloudIndex = require.resolve('@cloudbase/weda-cloud-sdk') || '';
|
|
500
|
-
const cloudFixPath = cloudIndex.replace(/@cloudbase\\/weda-cloud-sdk\\/.*$/, '@cloudbase/weda-cloud-sdk/scripts/fix-wx-none-private.js');
|
|
501
|
-
const fix = require(cloudFixPath);
|
|
502
|
-
fix()
|
|
503
|
-
} catch(e) {
|
|
504
|
-
console.log('run scripts error', e)
|
|
505
|
-
}
|
|
506
|
-
`),
|
|
507
|
-
fs_extra_1.default.writeFile(packageJsonPath, JSON.stringify(packageJSON, undefined, 2)),
|
|
508
|
-
]);
|
|
494
|
+
await Promise.all([fs_extra_1.default.writeFile(packageJsonPath, JSON.stringify(packageJSON, undefined, 2))]);
|
|
509
495
|
}
|
|
@@ -109,4 +109,9 @@ export interface IBuildContext extends IAppCommonBuildContext, IMpCommonBuildCon
|
|
|
109
109
|
* app.json文件window配置
|
|
110
110
|
*/
|
|
111
111
|
defaultAppWindowConfig?: IDefaultAppWindowConfig;
|
|
112
|
+
/**
|
|
113
|
+
* 内部定义,请勿使用
|
|
114
|
+
* 如必须使用 @rohyang
|
|
115
|
+
*/
|
|
116
|
+
__defaultLoginType__?: 'openId' | 'anonymous';
|
|
112
117
|
}
|
package/lib/builder/mp/index.js
CHANGED
|
@@ -243,6 +243,7 @@ async function generateWxMp({ buildContext: _buildContext, weapps, calses, deplo
|
|
|
243
243
|
privatelink: buildContext.privatelinkConfig
|
|
244
244
|
? JSON.stringify(buildContext.privatelinkConfig, undefined, 2)
|
|
245
245
|
: undefined,
|
|
246
|
+
defaultLoginType: buildContext.__defaultLoginType__,
|
|
246
247
|
},
|
|
247
248
|
'datasources/datasource-profiles.js.tpl': {
|
|
248
249
|
datasourceProfiles: (0, util_3.JsonToStringWithVariableName)([], { EOL: false }),
|
|
@@ -427,7 +428,9 @@ async function generateWxMp({ buildContext: _buildContext, weapps, calses, deplo
|
|
|
427
428
|
else {
|
|
428
429
|
await (0, webpack_1.installDependencies)(meta.path, {
|
|
429
430
|
ignoreInstall,
|
|
430
|
-
fixNodeModulesMap: {
|
|
431
|
+
fixNodeModulesMap: {
|
|
432
|
+
mobx: true,
|
|
433
|
+
},
|
|
431
434
|
});
|
|
432
435
|
}
|
|
433
436
|
}
|
|
@@ -672,10 +675,8 @@ async function generateFramework(ctx, { cals, weapp: appData }, outDir, options)
|
|
|
672
675
|
subPackageName: appData.rootPath || '',
|
|
673
676
|
importor,
|
|
674
677
|
appConfig: (0, util_3.JsonToStringWithVariableName)({
|
|
675
|
-
id: ctx.appId,
|
|
676
678
|
label: (appData === null || appData === void 0 ? void 0 : appData.label) || '',
|
|
677
679
|
version: (_a = options === null || options === void 0 ? void 0 : options.deployOptions) === null || _a === void 0 ? void 0 : _a.version,
|
|
678
|
-
envId: appData.envId,
|
|
679
680
|
loginConfigVersion: (_b = cals.extra) === null || _b === void 0 ? void 0 : _b.loginConfigVersion,
|
|
680
681
|
basename: ctx.wedaRoot,
|
|
681
682
|
pages: appData.pageInstanceList
|
package/lib/builder/mp/util.js
CHANGED
|
@@ -213,12 +213,13 @@ function generateDataContainerListeners() {
|
|
|
213
213
|
exports.generateDataContainerListeners = generateDataContainerListeners;
|
|
214
214
|
function createTemplateQuery(ctx, query = {}) {
|
|
215
215
|
return Object.entries(query).reduce((map, [key, item]) => {
|
|
216
|
+
var _a, _b;
|
|
216
217
|
const { listeners = [], handler, data, args, ...rest } = item;
|
|
217
218
|
const { staticProps, boundProps } = generatedDynamicData(generateArgsDynamicValueFromData(args, data) || {}, undefined, false);
|
|
218
219
|
map[key] = {
|
|
219
220
|
...rest,
|
|
220
221
|
handler: item.type === cals_1.EQueryType.GeneralFunc
|
|
221
|
-
? `(__data__,__params__) => (${handler['code']})({params:__params__,data:__data__})`
|
|
222
|
+
? `(__data__,__params__) => (${(_b = (_a = handler['code']) === null || _a === void 0 ? void 0 : _a.replace) === null || _b === void 0 ? void 0 : _b.call(_a, /;\s*$/, '')})({params:__params__,data:__data__})`
|
|
222
223
|
: `(...args) => $app.${handler === null || handler === void 0 ? void 0 : handler.name}(...args)`,
|
|
223
224
|
data: staticProps,
|
|
224
225
|
dataBinds: boundProps,
|
|
@@ -250,7 +251,7 @@ function getListenersHandlers(ctx, listeners = [], id, componentApi) {
|
|
|
250
251
|
const { enableAsyncMaterials = false } = ctx;
|
|
251
252
|
const eventHandlers = {};
|
|
252
253
|
listeners.forEach((l) => {
|
|
253
|
-
var _a, _b, _c, _d, _e;
|
|
254
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
254
255
|
const handlerName = (0, wxml_1.getMpEventHandlerName)(id, l.trigger, l);
|
|
255
256
|
const sourceKey = `${((_a = l.handler) === null || _a === void 0 ? void 0 : _a.moduleName) || ''}:${((_b = l.handler) === null || _b === void 0 ? void 0 : _b.name) || ''}`;
|
|
256
257
|
eventHandlers[handlerName] = eventHandlers[handlerName] || [];
|
|
@@ -304,7 +305,7 @@ function getListenersHandlers(ctx, listeners = [], id, componentApi) {
|
|
|
304
305
|
break;
|
|
305
306
|
}
|
|
306
307
|
case weapps_core_1.ActionType.GeneralFunc: {
|
|
307
|
-
handler = `function({event, $w, params}) { return (\n${((_e = l.handler) === null || _e === void 0 ? void 0 : _e.code) || '()=>{}'}\n)({event}) }`;
|
|
308
|
+
handler = `function({event, $w, params}) { return (\n${((_g = (_f = (_e = l.handler) === null || _e === void 0 ? void 0 : _e.code) === null || _f === void 0 ? void 0 : _f.replace) === null || _g === void 0 ? void 0 : _g.call(_f, /;\s*$/, '')) || '()=>{}'}\n)({event}) }`;
|
|
308
309
|
break;
|
|
309
310
|
}
|
|
310
311
|
}
|
|
@@ -54,6 +54,7 @@ async function generateWebpackWebBuildParamsFile({ appId, allAppDataList, appBui
|
|
|
54
54
|
: mode !== common_1.WebpackModeType.PRODUCTION
|
|
55
55
|
? 'eval'
|
|
56
56
|
: false,
|
|
57
|
+
vueVersion,
|
|
57
58
|
}, null, 2);
|
|
58
59
|
const webpackConfigContent = `params = ${paramsString};\nmodule.exports = require('./web.prod.js')(params);`;
|
|
59
60
|
await (0, generateFiles_1.writeFile)(webpackConfigPath, webpackConfigContent);
|
|
@@ -313,13 +314,6 @@ function fixNodeModules(projDir, options = { mobx: false, '@cloudbase/js-sdk': f
|
|
|
313
314
|
}
|
|
314
315
|
}
|
|
315
316
|
}
|
|
316
|
-
if (jsSDK) {
|
|
317
|
-
const scriptPath = path_1.default.resolve(projDir, 'node_modules', '@cloudbase/weda-cloud-sdk/scripts/fix-wx-none-private.js');
|
|
318
|
-
if (fs_extra_1.default.existsSync(scriptPath)) {
|
|
319
|
-
const fix = require(scriptPath);
|
|
320
|
-
fix();
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
317
|
}
|
|
324
318
|
function getMaterialNodeModulesPathList(dependencies = [], materialsDir, base) {
|
|
325
319
|
const localPkg = (0, util_1.getCurrentPackageJson)();
|