@cloudbase/lowcode-builder 1.8.73 → 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.
@@ -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,
@@ -42,6 +42,10 @@ export interface ICommonBuildContext {
42
42
  * 是否启用过期
43
43
  */
44
44
  enableExpiredTag?: boolean;
45
+ /**
46
+ * 显示微信云模板toast
47
+ */
48
+ enableAd?: boolean;
45
49
  /**
46
50
  * 应用运行态动态全局配置
47
51
  */
@@ -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, _b;
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 && !((_b = weapps[0]) === null || _b === void 0 ? void 0 : _b.mpPkgUrl)
108
+ .concat(ctx.enableAsyncMaterials
109
109
  ? [
110
110
  {
111
111
  root: config_1.materialsDirName,
@@ -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].[contenthash].bundle.js',
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,