@cloudbase/lowcode-builder 1.8.72 → 1.8.74
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/core/index.d.ts +2 -1
- package/lib/builder/core/index.js +2 -1
- package/lib/builder/mp/BuildContext.d.ts +4 -0
- package/lib/builder/mp/index.js +14 -5
- package/lib/builder/mp/materials.js +1 -0
- package/lib/builder/mp/mp_config.js +2 -2
- package/lib/builder/mp/wxml.js +16 -0
- package/lib/builder/service/webpack.js +1 -1
- package/lib/builder.web.js +13 -13
- package/package.json +2 -2
- package/template/html/index.html.ejs +2 -2
- package/template/mp/common/data-patch.js +1 -1
- package/template/mp/common/merge-renderer.js +1 -5
- package/template/mp/common/style.js +1 -1
- package/template/mp/common/weapp-page.js +43 -7
- package/template/mp/component/index.wxss +2 -0
- package/template/mp/package.json +2 -2
- package/template/mp/page/api.js +5 -6
- package/template/package.json +6 -5
- package/template/webpack/web.dev.js +21 -0
|
@@ -44,6 +44,7 @@ export interface IBuildWedaApp extends IBaseAppProps {
|
|
|
44
44
|
isPrivateMode?: boolean;
|
|
45
45
|
endpointType?: 'tcb-api' | 'wechat-service';
|
|
46
46
|
enableExpiredTag?: boolean;
|
|
47
|
+
enableAd?: boolean;
|
|
47
48
|
account?: {
|
|
48
49
|
uin?: string;
|
|
49
50
|
};
|
|
@@ -59,7 +60,7 @@ export declare function buildWedaConfig({ output, domain, isPrivateMode, endpoin
|
|
|
59
60
|
endpointType?: IBuildWedaApp['endpointType'];
|
|
60
61
|
buildTypeList?: IBuildWedaApp['buildTypeList'];
|
|
61
62
|
}): Promise<void>;
|
|
62
|
-
export declare function buildWedaApp({ cals, subAppCalsList, dependencies, appKey, runtime, ignoreInstall, buildTypeList, mode, devTool, deployOptions, generateMpType, plugins, extraData, resourceAppId, domain, output, isBrowserMpBuilder, cdnEndpoints, isPrivateMode, endpointType, enableExpiredTag, account, mpConfig, }: IBuildWedaApp, cb?: WebpackBuildCallBack): Promise<any>;
|
|
63
|
+
export declare function buildWedaApp({ cals, subAppCalsList, dependencies, appKey, runtime, ignoreInstall, buildTypeList, mode, devTool, deployOptions, generateMpType, plugins, extraData, resourceAppId, domain, output, isBrowserMpBuilder, cdnEndpoints, isPrivateMode, endpointType, enableExpiredTag, enableAd, account, mpConfig, }: IBuildWedaApp, cb?: WebpackBuildCallBack): Promise<any>;
|
|
63
64
|
export declare function cleanComponentDir(): Promise<void>;
|
|
64
65
|
export declare const version: any;
|
|
65
66
|
export { getFiles, fileToZip, strToBuf } from '../util/generateFiles';
|
|
@@ -61,7 +61,7 @@ exports.buildWedaConfig = buildWedaConfig;
|
|
|
61
61
|
async function buildWedaApp({ cals, 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 }, generateMpType = common_1.GenerateMpType.APP, plugins = [], extraData = {
|
|
62
62
|
isComposite: false,
|
|
63
63
|
compProps: {},
|
|
64
|
-
}, resourceAppId = undefined, domain = '', output, isBrowserMpBuilder = false, cdnEndpoints, isPrivateMode = false, endpointType = undefined, enableExpiredTag = false, account = {}, mpConfig = {}, }, cb) {
|
|
64
|
+
}, resourceAppId = undefined, domain = '', output, isBrowserMpBuilder = false, cdnEndpoints, isPrivateMode = false, endpointType = undefined, enableExpiredTag = false, enableAd = false, account = {}, mpConfig = {}, }, cb) {
|
|
65
65
|
var _a, _b, _c, _d, _e, _f;
|
|
66
66
|
if (!cals) {
|
|
67
67
|
console.error('无效的应用配置');
|
|
@@ -100,6 +100,7 @@ async function buildWedaApp({ cals, subAppCalsList = [], dependencies = [], appK
|
|
|
100
100
|
isPrivateMode,
|
|
101
101
|
endpointType,
|
|
102
102
|
enableExpiredTag,
|
|
103
|
+
enableAd,
|
|
103
104
|
runtimeDynamicConfig,
|
|
104
105
|
disabled: (_c = cals.extra) === null || _c === void 0 ? void 0 : _c.disabled,
|
|
105
106
|
statusPageId: (_d = cals.extra) === null || _d === void 0 ? void 0 : _d.statusPageId,
|
package/lib/builder/mp/index.js
CHANGED
|
@@ -119,12 +119,15 @@ async function generateWxMp({ buildContext, weapps, calses, plugins, deployOptio
|
|
|
119
119
|
endpointType,
|
|
120
120
|
}, miniprogramRoot);
|
|
121
121
|
const expirationStartTimesnap = buildContext.enableExpiredTag ? Date.now() : 0;
|
|
122
|
-
const
|
|
122
|
+
const cssVarMap = Object.entries((0, theme_1.mergeCssVarConfig)((_b = (_a = calses[0]) === null || _a === void 0 ? void 0 : _a.theme) === null || _b === void 0 ? void 0 : _b.cssVarConfig, 'MP'))
|
|
123
123
|
.map(([key, _value]) => {
|
|
124
124
|
const value = _value || '';
|
|
125
|
-
return
|
|
125
|
+
return [key, value.replace(/;$/, '')];
|
|
126
126
|
})
|
|
127
|
-
.
|
|
127
|
+
.reduce((map, [key, value]) => {
|
|
128
|
+
map[key] = value;
|
|
129
|
+
return map;
|
|
130
|
+
}, {}) || {};
|
|
128
131
|
appFileData = {
|
|
129
132
|
...appFileData,
|
|
130
133
|
'common/style.js': {},
|
|
@@ -138,7 +141,7 @@ async function generateWxMp({ buildContext, weapps, calses, plugins, deployOptio
|
|
|
138
141
|
'common/widget.js': {},
|
|
139
142
|
'common/weapp-page.js': {
|
|
140
143
|
expirationStartTimesnap,
|
|
141
|
-
pageStyle:
|
|
144
|
+
pageStyle: JSON.stringify(cssVarMap || {}, undefined, 2),
|
|
142
145
|
},
|
|
143
146
|
'common/weapp-component.js': {},
|
|
144
147
|
'common/merge-renderer.js': {
|
|
@@ -417,10 +420,16 @@ async function generatePkg(ctx, { cals, weapp }, appRoot, pageConfigs) {
|
|
|
417
420
|
const subLevelPath = rootPath ? `${path_1.default.posix.relative(`packages/${rootPath}`, '')}/` : '';
|
|
418
421
|
const pageDataBinds = {};
|
|
419
422
|
Object.entries(page.data || {}).forEach(([prop, val]) => {
|
|
420
|
-
if (
|
|
423
|
+
if (/^(appShareMessage)/.test(prop)) {
|
|
421
424
|
(0, util_2.setDataBind)(pageDataBinds, prop, val);
|
|
422
425
|
}
|
|
423
426
|
});
|
|
427
|
+
if (page.styleBindPath) {
|
|
428
|
+
(0, util_2.setDataBind)(pageDataBinds, 'style', {
|
|
429
|
+
type: cals_1.PropBindType.expression,
|
|
430
|
+
value: page.styleBindPath,
|
|
431
|
+
});
|
|
432
|
+
}
|
|
424
433
|
/**
|
|
425
434
|
* 使用最终的 usingComponents 生成一份 componentPlaceholder
|
|
426
435
|
*/
|
|
@@ -288,6 +288,7 @@ async function generateCompositeComponent(ctx, compositedComp, compLibCommonReso
|
|
|
288
288
|
},
|
|
289
289
|
'index.wxss': {
|
|
290
290
|
importStyles: importor.styles.map((mod) => path.posix.join(LOWCODE_DIR_NAME, (0, weapps_core_1.getCodeModuleFilePath)('global', mod, { style: '.wxss' }))),
|
|
291
|
+
content: (0, util_3.generateScopedStyleText)(componentInstances),
|
|
291
292
|
},
|
|
292
293
|
};
|
|
293
294
|
// Generating file by template and data
|
|
@@ -41,7 +41,7 @@ const chalk_1 = __importDefault(require("chalk"));
|
|
|
41
41
|
* @param appConfigs app config from prop edit panel
|
|
42
42
|
*/
|
|
43
43
|
function generateMpConfig(ctx, weapps, options) {
|
|
44
|
-
var _a
|
|
44
|
+
var _a;
|
|
45
45
|
const appConfig = {
|
|
46
46
|
useExtendedLib: { weui: true },
|
|
47
47
|
};
|
|
@@ -105,7 +105,7 @@ function generateMpConfig(ctx, weapps, options) {
|
|
|
105
105
|
pages: [],
|
|
106
106
|
},
|
|
107
107
|
]
|
|
108
|
-
.concat(ctx.enableAsyncMaterials
|
|
108
|
+
.concat(ctx.enableAsyncMaterials
|
|
109
109
|
? [
|
|
110
110
|
{
|
|
111
111
|
root: config_1.materialsDirName,
|
package/lib/builder/mp/wxml.js
CHANGED
|
@@ -127,6 +127,22 @@ function generateWxml(ctx, widgets, docTag, wxmlDataPrefix, usingComponents, com
|
|
|
127
127
|
_parent: pageMeta,
|
|
128
128
|
});
|
|
129
129
|
}
|
|
130
|
+
if (ctx.enableAd) {
|
|
131
|
+
const textNode = {
|
|
132
|
+
type: 'text',
|
|
133
|
+
text: '当前小程序正使用云开发免费版云模板,升级后即可免广告。',
|
|
134
|
+
};
|
|
135
|
+
pageMeta.elements.unshift({
|
|
136
|
+
type: 'element',
|
|
137
|
+
name: 'view',
|
|
138
|
+
attributes: {
|
|
139
|
+
style: 'position: fixed;top: 0;left: 0;right: 0;z-index:10000; background: rgba(255, 103, 112, 0.95); font-size: 12px; color: white; line-height: 2.5em;padding-left: .5em;',
|
|
140
|
+
},
|
|
141
|
+
elements: [textNode],
|
|
142
|
+
_order: -Infinity,
|
|
143
|
+
_parent: pageMeta,
|
|
144
|
+
});
|
|
145
|
+
}
|
|
130
146
|
if (ctx.enableLoading) {
|
|
131
147
|
pageMeta.elements.push({
|
|
132
148
|
type: 'element',
|
|
@@ -127,7 +127,7 @@ function getWebpackWebBuildParams(appId, appBuildDir, publicPath = '/', mode = c
|
|
|
127
127
|
entry: path_1.default.resolve(appBuildDir, 'src/index.jsx'),
|
|
128
128
|
output: {
|
|
129
129
|
path: path_1.default.resolve(appBuildDir, exports.OUTPUT_DIR),
|
|
130
|
-
filename: '[name].[
|
|
130
|
+
filename: '[name].[hash].bundle.js',
|
|
131
131
|
chunkFilename: '[name].[contenthash].chunk.js',
|
|
132
132
|
publicPath: buildTypeList.includes(common_1.BuildType.APP) || buildTypeList.includes(common_1.BuildType.ADMIN_PORTAL) ? '' : publicPath,
|
|
133
133
|
pathinfo: false,
|