@cloudbase/lowcode-builder 1.8.25 → 1.8.27
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.
|
@@ -6,7 +6,7 @@ export declare const materialsDirName = "materials";
|
|
|
6
6
|
* src/template的代码,在IDE编辑器插件中构建builder
|
|
7
7
|
* 存放在大账号:100015939275。访问地址:https://console.cloud.tencent.com/cos/bucket?bucket=comp-public-1303824488®ion=ap-shanghai&path=%252Flcap-builder%252F
|
|
8
8
|
*/
|
|
9
|
-
export declare const builderTemplateURL = "https://comp-public-1303824488.cos.ap-shanghai.myqcloud.com/lcap-builder/template.1.8.
|
|
9
|
+
export declare const builderTemplateURL = "https://comp-public-1303824488.cos.ap-shanghai.myqcloud.com/lcap-builder/template.1.8.27.zip";
|
|
10
10
|
/**
|
|
11
11
|
* miniprogram的代码,IDE插件后续会提供端功能
|
|
12
12
|
* 存放在大账号:100015939275。访问地址:https://console.cloud.tencent.com/cos/bucket?bucket=comp-public-1303824488®ion=ap-shanghai&path=%252Flcap-builder%252F
|
|
@@ -45,7 +45,7 @@ exports.materialsDirName = 'materials'; // materials diretory of current project
|
|
|
45
45
|
* src/template的代码,在IDE编辑器插件中构建builder
|
|
46
46
|
* 存放在大账号:100015939275。访问地址:https://console.cloud.tencent.com/cos/bucket?bucket=comp-public-1303824488®ion=ap-shanghai&path=%252Flcap-builder%252F
|
|
47
47
|
*/
|
|
48
|
-
exports.builderTemplateURL = 'https://comp-public-1303824488.cos.ap-shanghai.myqcloud.com/lcap-builder/template.1.8.
|
|
48
|
+
exports.builderTemplateURL = 'https://comp-public-1303824488.cos.ap-shanghai.myqcloud.com/lcap-builder/template.1.8.27.zip';
|
|
49
49
|
/**
|
|
50
50
|
* miniprogram的代码,IDE插件后续会提供端功能
|
|
51
51
|
* 存放在大账号:100015939275。访问地址:https://console.cloud.tencent.com/cos/bucket?bucket=comp-public-1303824488®ion=ap-shanghai&path=%252Flcap-builder%252F
|
|
@@ -22,6 +22,7 @@ export declare function generateConfig(data: {
|
|
|
22
22
|
isPrivateMode?: boolean;
|
|
23
23
|
endpointType?: IBuildContext['endpointType'] | '';
|
|
24
24
|
}, root: string): Promise<void>;
|
|
25
|
+
export declare function normalizePageId(pageId: any): string;
|
|
25
26
|
export declare function writeLowCodeFiles(ctx: IBuildContext, appData: IWeAppData, outDir: string): Promise<void>;
|
|
26
27
|
/**
|
|
27
28
|
* TODO: 与 cals 里的实现进行整合
|
package/lib/builder/mp/index.js
CHANGED
|
@@ -26,7 +26,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.handleUsedComponents = exports.writeLowCodeFiles = exports.generateConfig = exports.generateWxMp = void 0;
|
|
29
|
+
exports.handleUsedComponents = exports.writeLowCodeFiles = exports.normalizePageId = exports.generateConfig = exports.generateWxMp = void 0;
|
|
30
30
|
const chalk_1 = __importDefault(require("chalk"));
|
|
31
31
|
const path_1 = __importDefault(require("path"));
|
|
32
32
|
const util_1 = require("util");
|
|
@@ -288,6 +288,20 @@ async function generateConfig(data, root) {
|
|
|
288
288
|
}, templateDir, root);
|
|
289
289
|
}
|
|
290
290
|
exports.generateConfig = generateConfig;
|
|
291
|
+
/**
|
|
292
|
+
* pageId 名称管理器
|
|
293
|
+
* 因为 pageId 命名为非法
|
|
294
|
+
*/
|
|
295
|
+
const _MANAGER_PAGE_ID_LIST = [];
|
|
296
|
+
const _MANAGER_PAGE_ID_MAP = {};
|
|
297
|
+
function normalizePageId(pageId) {
|
|
298
|
+
if (!_MANAGER_PAGE_ID_MAP[pageId]) {
|
|
299
|
+
_MANAGER_PAGE_ID_MAP[pageId] = `$${_MANAGER_PAGE_ID_LIST.length}`;
|
|
300
|
+
_MANAGER_PAGE_ID_LIST.push(pageId);
|
|
301
|
+
}
|
|
302
|
+
return _MANAGER_PAGE_ID_MAP[pageId];
|
|
303
|
+
}
|
|
304
|
+
exports.normalizePageId = normalizePageId;
|
|
291
305
|
async function generatePkg(ctx, weapp, appRoot, pageConfigs) {
|
|
292
306
|
const wxmlDataPrefix = (0, mp_1.getWxmlDataPrefix)(!ctx.isProduction);
|
|
293
307
|
console.log(`Generating ${em(weapp.rootPath ? 'subApp' : 'app')} to ${appRoot}`);
|
|
@@ -335,7 +349,7 @@ async function generatePkg(ctx, weapp, appRoot, pageConfigs) {
|
|
|
335
349
|
stringifyObj: util_1.inspect,
|
|
336
350
|
},
|
|
337
351
|
[`index.js|${pageFileName}.js`]: {
|
|
338
|
-
|
|
352
|
+
pageNameVar: normalizePageId(page.id),
|
|
339
353
|
pageName: page.id,
|
|
340
354
|
pageSource: page.data.src || '',
|
|
341
355
|
eventHandlers: (0, util_2.createEventHandlers)(ctx, componentInstances, 'this', page),
|
|
@@ -405,6 +419,7 @@ async function generateFramework(ctx, appData, outDir, options) {
|
|
|
405
419
|
(0, weapps_core_1.loopDealWithFn)(appData.pageInstanceList || [], (p) => {
|
|
406
420
|
allCodeModules.push({
|
|
407
421
|
id: p.id,
|
|
422
|
+
pageNameVar: normalizePageId(p.id),
|
|
408
423
|
lowCodes: p.lowCodes || [],
|
|
409
424
|
});
|
|
410
425
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudbase/lowcode-builder",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.27",
|
|
4
4
|
"description": "云开发 Tencent CloudBase Framework Low Code Plugin,将低码配置生成完整项目并一键部署云开发资源。",
|
|
5
5
|
"author": "yhsunshining@gmail.com",
|
|
6
6
|
"homepage": "https://github.com/TencentCloudBase/cloudbase-framework#readme",
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
<% pageModules.forEach(({id: pageId, lowCodes}
|
|
1
|
+
<% pageModules.forEach(({id: pageId, pageNameVar, lowCodes}) => { %>
|
|
2
2
|
<% lowCodes.filter(mod => mod.type === 'handler-fn' && mod.name !== '____index____').forEach(mod => {%>
|
|
3
|
-
import
|
|
3
|
+
import <%= pageNameVar%>_<%= mod.name%> from '../lowcode/<%= pageId%>/handler/<%= mod.name%>'
|
|
4
4
|
<% }) %>
|
|
5
5
|
<% }) %>
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
<% pageModules.forEach(({id: pageId, lowCodes, pageNameVar}) => { %>
|
|
10
10
|
// <%= pageId %>
|
|
11
|
-
export const
|
|
11
|
+
export const <%=pageNameVar %> = {
|
|
12
12
|
<% lowCodes.filter(mod => mod.type === 'handler-fn' && mod.name !== '____index____').forEach(mod => {%>
|
|
13
|
-
['<%= mod.name%>']:
|
|
13
|
+
['<%= mod.name%>']: <%= pageNameVar%>_<%= mod.name%>,
|
|
14
14
|
<% }) %>
|
|
15
15
|
}
|
|
16
16
|
<% }) %>
|
|
@@ -2,7 +2,7 @@ import { observable } from 'mobx';
|
|
|
2
2
|
import { createPage } from '<%= subLevelPath %>../../common/weapp-page'
|
|
3
3
|
import { concatClassList, px2rpx } from '<%= subLevelPath %>../../common/style'
|
|
4
4
|
import { app, $app } from '<%= subLevelPath %>../../app/weapps-api'
|
|
5
|
-
import {
|
|
5
|
+
import { <%= pageNameVar %> as handlers } from '../../app/handlers'
|
|
6
6
|
<%= importor.lifecycle? `import lifecycle from '../../lowcode/${pageName}/lifecycle'` : "const lifecycle = {}" %>
|
|
7
7
|
<%= importor.state? `import state from '../../lowcode/${pageName}/state'` : "const state = {}" %>
|
|
8
8
|
<%= importor.computed? `import computed from '../../lowcode/${pageName}/computed'` : "const computed = {}" %>
|