@cloudbase/lowcode-builder 1.8.63 → 1.8.65
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/index.d.ts +2 -1
- package/lib/builder/config/index.js +3 -2
- package/lib/builder/core/index.js +9 -0
- package/lib/builder/h5/index.js +6 -6
- package/lib/builder/mp/BuildContext.d.ts +4 -0
- package/lib/builder/mp/index.js +4 -0
- package/lib/builder/mp/util.js +1 -1
- package/lib/builder.web.js +13 -13
- package/package.json +3 -3
- package/template/html/index.html.ejs +1 -1
- package/template/mp/app/common.js +27 -1
- package/template/mp/app.js +15 -3
- package/template/mp/common/util.js +76 -9
- package/template/mp/common/weapp-component.js +4 -3
- package/template/mp/common/weapp-page.js +4 -1
- package/template/mp/datasources/index.js.tpl +6 -1
|
@@ -6,13 +6,14 @@ 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.file.myqcloud.com/lcap-builder/template.1.8.
|
|
9
|
+
export declare const builderTemplateURL = "https://comp-public-1303824488.file.myqcloud.com/lcap-builder/template.1.8.64.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
|
|
13
13
|
*/
|
|
14
14
|
export declare const miniprogramURL = "https://comp-public-1303824488.file.myqcloud.com/lcap-builder/miniprogram_npm.1.8.57.zip";
|
|
15
15
|
export declare const systemSubpackageMiniprogramURL = "https://comp-public-1303824488.cos.ap-shanghai.myqcloud.com/lcap-builder/wd_system_miniprogram_npm.zip";
|
|
16
|
+
export declare const RUNTIME_CONFIG_URL = "https://comp-public-1303824488.file.myqcloud.com/release_config/runtime/exp_runtime.json";
|
|
16
17
|
/**
|
|
17
18
|
* miniprogram_npm存放目录。IDE插件builder用到
|
|
18
19
|
*/
|
|
@@ -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.REPEATER = exports.generateCdnEndpoints = exports.CDN_ENDPONTS_CONFIG = exports.systemSubpackageMiniprogramDir = exports.miniprogramDir = exports.systemSubpackageMiniprogramURL = exports.miniprogramURL = exports.builderTemplateURL = exports.materialsDirName = exports.appTemplateDir = exports.sharedMaterialsDir = exports.OFFICIAL_LIB_KEY = exports.rpxConfig = exports.remConfig = exports.npmRegistry = exports.KBONE_PAGE_KEYS = exports.MP_CONFIG_MODULE_NAME = exports.REPLACE_SIGN = void 0;
|
|
29
|
+
exports.REPEATER = exports.generateCdnEndpoints = exports.CDN_ENDPONTS_CONFIG = exports.systemSubpackageMiniprogramDir = exports.miniprogramDir = exports.RUNTIME_CONFIG_URL = exports.systemSubpackageMiniprogramURL = exports.miniprogramURL = exports.builderTemplateURL = exports.materialsDirName = exports.appTemplateDir = exports.sharedMaterialsDir = exports.OFFICIAL_LIB_KEY = exports.rpxConfig = exports.remConfig = exports.npmRegistry = exports.KBONE_PAGE_KEYS = exports.MP_CONFIG_MODULE_NAME = exports.REPLACE_SIGN = void 0;
|
|
30
30
|
const path = __importStar(require("path"));
|
|
31
31
|
const os_1 = __importDefault(require("os"));
|
|
32
32
|
const index_1 = require("@cloudbase/lowcode-generator/lib/generator/config/index");
|
|
@@ -45,13 +45,14 @@ 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.file.myqcloud.com/lcap-builder/template.1.8.
|
|
48
|
+
exports.builderTemplateURL = 'https://comp-public-1303824488.file.myqcloud.com/lcap-builder/template.1.8.64.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
|
|
52
52
|
*/
|
|
53
53
|
exports.miniprogramURL = 'https://comp-public-1303824488.file.myqcloud.com/lcap-builder/miniprogram_npm.1.8.57.zip';
|
|
54
54
|
exports.systemSubpackageMiniprogramURL = 'https://comp-public-1303824488.cos.ap-shanghai.myqcloud.com/lcap-builder/wd_system_miniprogram_npm.zip';
|
|
55
|
+
exports.RUNTIME_CONFIG_URL = `https://comp-public-1303824488.file.myqcloud.com/release_config/runtime/exp_runtime.json`;
|
|
55
56
|
/**
|
|
56
57
|
* miniprogram_npm存放目录。IDE插件builder用到
|
|
57
58
|
*/
|
|
@@ -17,6 +17,7 @@ const postProcess_1 = require("../../utils/postProcess");
|
|
|
17
17
|
const cals_1 = require("@cloudbase/cals");
|
|
18
18
|
const net_1 = require("../util/net");
|
|
19
19
|
const config_1 = require("../config");
|
|
20
|
+
const axios_1 = __importDefault(require("axios"));
|
|
20
21
|
const pkg = require('../../../package.json');
|
|
21
22
|
async function buildWedaConfig({ output, domain = undefined, isPrivateMode = undefined, endpointType = undefined, buildTypeList = [common_1.BuildType.WEB], }) {
|
|
22
23
|
if ((0, common_1.buildAsWebByBuildType)(buildTypeList)) {
|
|
@@ -79,6 +80,13 @@ async function buildWedaApp({ cals, subAppCalsList = [], dependencies = [], appK
|
|
|
79
80
|
app.extra.rootPath = (0, util_1.normalizePackageName)(app.extra.rootPath);
|
|
80
81
|
});
|
|
81
82
|
let appBuildDir = (output === null || output === void 0 ? void 0 : output.path) || (runtime === types_1.RUNTIME.CI ? (_a = (0, util_1.getCompileDirs)('app')) === null || _a === void 0 ? void 0 : _a.appBuildDir : (_b = (0, util_1.getCompileDirs)(appKey)) === null || _b === void 0 ? void 0 : _b.appBuildDir);
|
|
83
|
+
let runtimeDynamicConfig = {};
|
|
84
|
+
if (enableExpiredTag) {
|
|
85
|
+
const { data } = await axios_1.default.get(config_1.RUNTIME_CONFIG_URL, { responseType: 'json' });
|
|
86
|
+
if (data) {
|
|
87
|
+
runtimeDynamicConfig = data;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
82
90
|
const buildContext = {
|
|
83
91
|
uin: account === null || account === void 0 ? void 0 : account.uin,
|
|
84
92
|
projDir: appBuildDir,
|
|
@@ -92,6 +100,7 @@ async function buildWedaApp({ cals, subAppCalsList = [], dependencies = [], appK
|
|
|
92
100
|
isPrivateMode,
|
|
93
101
|
endpointType,
|
|
94
102
|
enableExpiredTag,
|
|
103
|
+
runtimeDynamicConfig,
|
|
95
104
|
disabled: (_c = cals.extra) === null || _c === void 0 ? void 0 : _c.disabled,
|
|
96
105
|
statusPageId: (_d = cals.extra) === null || _d === void 0 ? void 0 : _d.statusPageId,
|
|
97
106
|
};
|
package/lib/builder/h5/index.js
CHANGED
|
@@ -51,7 +51,7 @@ if (!process.env.IS_WEB_WORKER) {
|
|
|
51
51
|
BabelTransform = transform.BabelTransform;
|
|
52
52
|
}
|
|
53
53
|
async function buildH5App({ buildContext, i18nConfig, extraData, cals: _cals, buildTypeList = [common_1.BuildType.WEB], subAppCalsList, mode, devTool, runtime = types_1.RUNTIME.NONE, deployOptions = { mode: types_1.DEPLOY_MODE.PREVIEW }, ignoreInstall = false, cdnEndpoints, }) {
|
|
54
|
-
var _a, _b, _c, _d;
|
|
54
|
+
var _a, _b, _c, _d, _e, _f;
|
|
55
55
|
const { projDir: buildDir, domain, materialLibs: dependencies, appId: appKey, isPrivateMode, enableExpiredTag, } = buildContext;
|
|
56
56
|
if (!deployOptions.mode) {
|
|
57
57
|
deployOptions.mode = types_1.DEPLOY_MODE.PREVIEW;
|
|
@@ -75,7 +75,7 @@ async function buildH5App({ buildContext, i18nConfig, extraData, cals: _cals, bu
|
|
|
75
75
|
/**
|
|
76
76
|
* 精简未使用的布局,减少本地写json大小
|
|
77
77
|
*/
|
|
78
|
-
cals.templates = cals.templates.filter((item) => {
|
|
78
|
+
cals.templates = (_b = (_a = cals.templates) === null || _a === void 0 ? void 0 : _a.filter) === null || _b === void 0 ? void 0 : _b.call(_a, (item) => {
|
|
79
79
|
var _a;
|
|
80
80
|
return (_a = used.component['$template']) === null || _a === void 0 ? void 0 : _a.has(item.id);
|
|
81
81
|
});
|
|
@@ -84,12 +84,12 @@ async function buildH5App({ buildContext, i18nConfig, extraData, cals: _cals, bu
|
|
|
84
84
|
if (!mainAppData.extra) {
|
|
85
85
|
mainAppData.extra = { domain };
|
|
86
86
|
}
|
|
87
|
-
if (!((
|
|
87
|
+
if (!((_c = mainAppData.extra) === null || _c === void 0 ? void 0 : _c.domain)) {
|
|
88
88
|
mainAppData.extra.domain = domain;
|
|
89
89
|
}
|
|
90
|
-
const subAppDataList = ((
|
|
90
|
+
const subAppDataList = ((_d = subAppCalsList === null || subAppCalsList === void 0 ? void 0 : subAppCalsList.map) === null || _d === void 0 ? void 0 : _d.call(subAppCalsList, (sub) => (0, weapps_core_1.deserialize)((0, common_2.processCals2WeappsData)(sub, dependencies)))) || [];
|
|
91
91
|
// 前置操作
|
|
92
|
-
const { publicPath, basename, assets = '', _indexPage } = ((
|
|
92
|
+
const { publicPath, basename, assets = '', _indexPage } = ((_e = mainAppData.appConfig) === null || _e === void 0 ? void 0 : _e.window) || {};
|
|
93
93
|
// 获取 插入的cdn 资源
|
|
94
94
|
const jsAssets = await (0, generate_1.handleAssets)({
|
|
95
95
|
appBuildDir: buildDir,
|
|
@@ -193,7 +193,7 @@ async function buildH5App({ buildContext, i18nConfig, extraData, cals: _cals, bu
|
|
|
193
193
|
})
|
|
194
194
|
.filter((item) => !!item);
|
|
195
195
|
// 普通 web 模式,且非hash模式,根据页面生成多份入口
|
|
196
|
-
if (!((
|
|
196
|
+
if (!((_f = cals.extra) === null || _f === void 0 ? void 0 : _f.historyType) || cals.extra.historyType === types_1.HISTORY_TYPE.BROWSER) {
|
|
197
197
|
preHeatUrls.push(path_1.default.posix.join(basename || ''));
|
|
198
198
|
await Promise.all((cals.items || []).map((page) => {
|
|
199
199
|
preHeatUrls.push(path_1.default.posix.join(basename || '', page.id));
|
package/lib/builder/mp/index.js
CHANGED
|
@@ -53,6 +53,7 @@ const net_1 = require("../util/net");
|
|
|
53
53
|
const cals_1 = require("@cloudbase/cals");
|
|
54
54
|
const core_1 = require("../core");
|
|
55
55
|
const theme_1 = require("../../utils/theme");
|
|
56
|
+
const index_1 = require("../config/index");
|
|
56
57
|
const templateDir = `${config_1.appTemplateDir}/mp/`;
|
|
57
58
|
const em = chalk_1.default.blue.bold;
|
|
58
59
|
const error = chalk_1.default.redBright;
|
|
@@ -125,8 +126,11 @@ async function generateWxMp({ buildContext, weapps, calses, plugins, deployOptio
|
|
|
125
126
|
...appFileData,
|
|
126
127
|
'common/style.js': {},
|
|
127
128
|
'common/util.js': {
|
|
129
|
+
skipCheckAuth: process.env.SKIP_CHECK_AUTH,
|
|
128
130
|
isAdminPortal: (0, common_1.buildAsAdminPortalByBuildType)(buildTypeList),
|
|
129
131
|
expirationStartTimesnap,
|
|
132
|
+
runtimeDynamicConfig: buildContext.runtimeDynamicConfig,
|
|
133
|
+
RUNTIME_CONFIG_URL: index_1.RUNTIME_CONFIG_URL,
|
|
130
134
|
},
|
|
131
135
|
'common/widget.js': {},
|
|
132
136
|
'common/weapp-page.js': {
|
package/lib/builder/mp/util.js
CHANGED
|
@@ -301,7 +301,7 @@ function getListenersHandlers(ctx, listeners = [], id, componentApi) {
|
|
|
301
301
|
break;
|
|
302
302
|
}
|
|
303
303
|
case weapps_core_1.ActionType.GeneralFunc: {
|
|
304
|
-
handler = `function({
|
|
304
|
+
handler = `function({event, $w, params}) { return (\n${((_e = l.handler) === null || _e === void 0 ? void 0 : _e.code) || '()=>{}'}\n)({event}) }`;
|
|
305
305
|
break;
|
|
306
306
|
}
|
|
307
307
|
}
|