@cloudbase/lowcode-builder 1.8.109 → 1.9.0
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.d.ts +2 -1
- package/lib/builder/config/dependencies.js +8 -6
- package/lib/builder/core/index.js +3 -2
- package/lib/builder/mp/index.js +10 -2
- package/lib/builder/mp/materials.js +2 -2
- package/lib/builder/mp/util.js +3 -3
- package/lib/builder/mp/wxml.js +1 -1
- package/lib/builder.web.js +7 -7
- package/lib/utils/transform.js +40 -32
- package/package.json +4 -4
- package/template/html/index.html.ejs +3 -3
- package/template/mp/packages/$wd_system/pages/login/index.wxml +5 -5
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
export declare function generatePackageDependencies({ importJSSDK, mode, officialLibVersion, }: {
|
|
1
|
+
export declare function generatePackageDependencies({ importJSSDK, mode, officialLibVersion, uin, }: {
|
|
2
2
|
importJSSDK: boolean;
|
|
3
3
|
mode: 'lib' | string;
|
|
4
4
|
officialLibVersion?: string;
|
|
5
|
+
uin?: string;
|
|
5
6
|
}): {
|
|
6
7
|
'miniprogram-gesture': string;
|
|
7
8
|
mobx: string;
|
|
@@ -12,22 +12,24 @@ const BASE_DEPS = {
|
|
|
12
12
|
* 注意锁版本
|
|
13
13
|
*/
|
|
14
14
|
const CLOUDBASE_DEPS = {
|
|
15
|
-
'@cloudbase/oauth': '0.1.1-alpha.
|
|
16
|
-
'@cloudbase/weda-client': '1.1.
|
|
17
|
-
'@cloudbase/weda-cloud-sdk': '1.0.
|
|
15
|
+
'@cloudbase/oauth': '0.1.1-alpha.14',
|
|
16
|
+
'@cloudbase/weda-client': '1.1.5',
|
|
17
|
+
'@cloudbase/weda-cloud-sdk': '1.0.68',
|
|
18
18
|
};
|
|
19
|
-
function generatePackageDependencies({ importJSSDK, mode, officialLibVersion, }) {
|
|
19
|
+
function generatePackageDependencies({ importJSSDK, mode, officialLibVersion, uin, }) {
|
|
20
20
|
const deps = {};
|
|
21
21
|
if (importJSSDK) {
|
|
22
|
-
deps['@cloudbase/js-sdk'] = '2.5.
|
|
22
|
+
deps['@cloudbase/js-sdk'] = '2.5.46-beta.0';
|
|
23
23
|
}
|
|
24
|
+
const mod = uin ? Number(uin) % 10 : undefined;
|
|
24
25
|
if (mode === 'lib') {
|
|
25
26
|
// eslint-disable-next-line no-restricted-syntax
|
|
26
27
|
for (const key in CLOUDBASE_DEPS) {
|
|
28
|
+
const version = CLOUDBASE_DEPS[key];
|
|
27
29
|
/**
|
|
28
30
|
* lib 模式下采用松散的引用
|
|
29
31
|
*/
|
|
30
|
-
deps[key] = /^\d/.test(
|
|
32
|
+
deps[key] = /^\d/.test(version) ? `^${version}` : version;
|
|
31
33
|
}
|
|
32
34
|
if (officialLibVersion) {
|
|
33
35
|
deps[cals_1.OFFICIAL_LIB_MP_NPM_PACKAGENAME] = officialLibVersion;
|
|
@@ -476,14 +476,15 @@ async function patchMpComponentNPM({ packageDir, name, version, packageMiniprogr
|
|
|
476
476
|
}
|
|
477
477
|
packageJSON = {
|
|
478
478
|
...packageJSON,
|
|
479
|
-
name: `@
|
|
479
|
+
name: `@cloudbase-module/${name || 'components'}`,
|
|
480
480
|
version: version || packageJSON.version || '0.0.1',
|
|
481
481
|
miniprogram: `./${packageMiniprogramEntry}`,
|
|
482
|
+
keywords: ['微搭', '小程序', '区块组件', 'cloudbase', 'cloudbase-module', 'cloudbase-component'],
|
|
482
483
|
scripts: {
|
|
483
484
|
...packageJSON.scripts,
|
|
484
485
|
postinstall: 'node scripts/fixCloudSdk.js',
|
|
485
486
|
},
|
|
486
|
-
|
|
487
|
+
dependencies: {
|
|
487
488
|
...packageJSON.peerDependencies,
|
|
488
489
|
...BASE_DEPS,
|
|
489
490
|
},
|
package/lib/builder/mp/index.js
CHANGED
|
@@ -212,7 +212,11 @@ async function generateWxMp({ buildContext: _buildContext, weapps, calses, deplo
|
|
|
212
212
|
'package.json': {
|
|
213
213
|
appId,
|
|
214
214
|
extraDeps: {
|
|
215
|
-
...(0, index_1.generatePackageDependencies)({
|
|
215
|
+
...(0, index_1.generatePackageDependencies)({
|
|
216
|
+
importJSSDK: endpointType === 'tcb-api',
|
|
217
|
+
mode: 'app',
|
|
218
|
+
uin: buildContext.uin,
|
|
219
|
+
}),
|
|
216
220
|
...resolveNpmDeps(weapps, materials),
|
|
217
221
|
},
|
|
218
222
|
},
|
|
@@ -382,7 +386,11 @@ async function generateWxMp({ buildContext: _buildContext, weapps, calses, deplo
|
|
|
382
386
|
'package.json': {
|
|
383
387
|
appId,
|
|
384
388
|
extraDeps: {
|
|
385
|
-
...(0, index_1.generatePackageDependencies)({
|
|
389
|
+
...(0, index_1.generatePackageDependencies)({
|
|
390
|
+
importJSSDK: endpointType === 'tcb-api',
|
|
391
|
+
mode: 'app',
|
|
392
|
+
uin: buildContext.uin,
|
|
393
|
+
}),
|
|
386
394
|
...resolveNpmDeps(weapps, materials),
|
|
387
395
|
},
|
|
388
396
|
cdnEndpoints,
|
|
@@ -301,7 +301,7 @@ async function generateCompositeComponent(compositeCtx, compositedComp, lowcalWe
|
|
|
301
301
|
// path: 'index',
|
|
302
302
|
// });
|
|
303
303
|
// }
|
|
304
|
-
codes.map((mod) => {
|
|
304
|
+
await Promise.all(codes.map((mod) => {
|
|
305
305
|
let themeCode;
|
|
306
306
|
if (mod.type === cals_1.ECodeType.STYLE && compLibCommonResource) {
|
|
307
307
|
themeCode = `
|
|
@@ -317,7 +317,7 @@ async function generateCompositeComponent(compositeCtx, compositedComp, lowcalWe
|
|
|
317
317
|
return;
|
|
318
318
|
}
|
|
319
319
|
return (0, lowcode_1.writeCode2file)(compositeCtx, mod, path.join(componentDir, LOWCODE_DIR_NAME), { comp: compositedComp }, themeCode, mode === 'lib' ? true : false);
|
|
320
|
-
});
|
|
320
|
+
}));
|
|
321
321
|
// await writeLowCodeFiles(weapp, appRoot)
|
|
322
322
|
// await generateFramework(weapp, appRoot)
|
|
323
323
|
}
|
package/lib/builder/mp/util.js
CHANGED
|
@@ -557,13 +557,13 @@ function generateScopedStyleText(widgets, weightPrefix = '#wd-page-root') {
|
|
|
557
557
|
// 移除换行及其前后的空白符
|
|
558
558
|
.replace(/\s*\n\s*/g, '')
|
|
559
559
|
// 添加 `#wd-page-root` 前缀以增加样式权重
|
|
560
|
-
.replace(/(:scope.*?{)/g, `\n${weightPrefix} $1`)
|
|
560
|
+
.replace(/(:scope.*?[,{])/g, `\n${weightPrefix} $1`)
|
|
561
561
|
// 替换 `:scope`
|
|
562
562
|
.replace(/:scope/g, `.wd-comp-id-${id}`)
|
|
563
563
|
// `: ` => `:`
|
|
564
|
-
|
|
564
|
+
// `, ` => `,`
|
|
565
565
|
// ` {` => `{`
|
|
566
|
-
.replace(/\s*{\s*/g, '
|
|
566
|
+
.replace(/\s*([:,{])\s*/g, '$1')
|
|
567
567
|
// `;}` => `}`
|
|
568
568
|
.replace(/;\s*}/g, '}');
|
|
569
569
|
cssTextList.push(cssText.trim());
|
package/lib/builder/mp/wxml.js
CHANGED
|
@@ -327,7 +327,7 @@ function generateWxml(ctx, widgets, docTag, wxmlDataPrefix, usingComponents, com
|
|
|
327
327
|
/**
|
|
328
328
|
* 来自外部引用的组件,添加系统系别的事件绑定
|
|
329
329
|
*/
|
|
330
|
-
if (
|
|
330
|
+
if (componentGenerics[tagName] || usingComponents[tagName] /* && !ctx.disablePageComponentInvoke */) {
|
|
331
331
|
node.attributes['bind:attached'] = '__mnt__';
|
|
332
332
|
node.attributes['bind:detached'] = '__unmnt__';
|
|
333
333
|
}
|