@cloudbase/framework-plugin-low-code 0.7.25 → 0.7.28

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.
Files changed (53) hide show
  1. package/lib/builder/mp/index.d.ts.map +1 -1
  2. package/lib/builder/mp/index.js +1 -4
  3. package/lib/generate.d.ts +2 -1
  4. package/lib/generate.d.ts.map +1 -1
  5. package/lib/generate.js +5 -4
  6. package/lib/index.d.ts +7 -4
  7. package/lib/index.d.ts.map +1 -1
  8. package/lib/index.js +125 -78
  9. package/lib/utils/dataSource.d.ts +4 -0
  10. package/lib/utils/dataSource.d.ts.map +1 -1
  11. package/lib/utils/dataSource.js +27 -12
  12. package/lib/utils/postProcess.d.ts.map +1 -1
  13. package/lib/weapps-core/utils/style.d.ts.map +1 -1
  14. package/lib/weapps-core/utils/style.js +16 -7
  15. package/package.json +3 -4
  16. package/template/mp/app/app-global.js +4 -0
  17. package/template/mp/app/common.js +26 -0
  18. package/template/mp/app/handlers.js +15 -0
  19. package/template/mp/app/weapps-api.js +89 -0
  20. package/template/mp/app.js +114 -0
  21. package/template/mp/app.json +1 -0
  22. package/template/mp/app.wxss +15 -0
  23. package/template/mp/common/data-patch-test.js +60 -0
  24. package/template/mp/common/data-patch.js +44 -0
  25. package/template/mp/common/merge-renderer.js +67 -0
  26. package/template/mp/common/process.js +1 -0
  27. package/template/mp/common/style.js +34 -0
  28. package/template/mp/common/url.js +21 -0
  29. package/template/mp/common/util.js +395 -0
  30. package/template/mp/common/utils.wxs +11 -0
  31. package/template/mp/common/weapp-component.js +250 -0
  32. package/template/mp/common/weapp-page.js +204 -0
  33. package/template/mp/common/weapp-sdk.js +76 -0
  34. package/template/mp/common/widget.js +381 -0
  35. package/template/mp/common/wx_yypt_report_v2.js +460 -0
  36. package/template/mp/component/index.js +66 -0
  37. package/template/mp/component/index.json +4 -0
  38. package/template/mp/component/index.wxml +1 -0
  39. package/template/mp/component/index.wxss +1 -0
  40. package/template/mp/datasources/config.js.tpl +25 -0
  41. package/template/mp/datasources/dataset-profiles.js.tpl +5 -0
  42. package/template/mp/datasources/datasource-profiles.js.tpl +4 -0
  43. package/template/mp/datasources/index.js +29 -0
  44. package/template/mp/package.json +18 -0
  45. package/template/mp/page/api.js +1 -0
  46. package/template/mp/page/index.js +42 -0
  47. package/template/mp/page/index.json +3 -0
  48. package/template/mp/page/index.wxml +1 -0
  49. package/template/mp/page/index.wxss +3 -0
  50. package/template/mp/project.config.json +1 -0
  51. package/template/package.json +1 -1
  52. package/template/src/datasources/index.js.tpl +0 -2
  53. package/template/webpack/web.prod.js +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/builder/mp/index.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,aAAa,EACb,UAAU,EAEV,OAAO,EAIR,MAAM,mBAAmB,CAAC;AAM3B,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAW/C,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAiC,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAQrG,wBAAsB,YAAY,CAAC,EACjC,MAAM,EACN,OAAO,EACP,KAAK,EACL,MAAM,EACN,SAAS,EACT,OAAO,EACP,YAAY,EACZ,UAAU,EACV,SAAS,EACT,SAAS,EACT,OAAO,EACP,aAAa,GACd,EAAE;IACD,MAAM,EAAE,UAAU,EAAE,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,aAAa,EAAE,CAAC;IAC3B,OAAO,EAAE,OAAO,EAAE,CAAC;IACnB,YAAY,EAAE,OAAO,CAAC;IACtB,UAAU,EAAE,WAAW,CAAC;IACxB,SAAS,EAAE,GAAG,CAAC;IACf,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE;QACP,a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AAC;IACxB,SAAS,EAAE,GAAG,CAAC;IACf,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE;QACP,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,cAAc,EAAE,OAAO,CAAC;KACzB,CAAC;IACF,aAAa,EAAE,SAAS,EAAE,CAAC;CAC5B,GAAG,OAAO,CAAC;IAAE,eAAe,EAAE,MAAM,CAAA;CAAE,CAAC,CAgPvC;AAsJD,wBAAsB,iBAAiB,CAAC,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,aAAa,iBAuB9F;AAiBD,wBAAgB,oBAAoB,CAAC,EACnC,YAAY,EACZ,MAAM,EACN,SAAS,GACV,EAAE;IACD,YAAY,EAAE,aAAa,CAAC;IAC5B,MAAM,EAAE,UAAU,EAAE,CAAC;IACrB,SAAS,EAAE,aAAa,EAAE,CAAC;CAC5B;;;EA6BA"}
@@ -155,10 +155,7 @@ function generateWxMp({ weapps, projDir, appId, domain, materials, plugins, isPr
155
155
  clientID: ((_a = mainAppData.extra) === null || _a === void 0 ? void 0 : _a.clientId) || '',
156
156
  },
157
157
  'datasources/datasource-profiles.js.tpl': {
158
- datasourceProfiles: (0, util_3.JsonToStringWithVariableName)((0, dataSource_1.getDatasourceProfiles)(weapps.reduce((datasources, app) => {
159
- datasources.push(...(app.datasources || []));
160
- return datasources;
161
- }, []))),
158
+ datasourceProfiles: (0, util_3.JsonToStringWithVariableName)((0, dataSource_1.getDatasourceProfiles)([])),
162
159
  },
163
160
  'datasources/dataset-profiles.js.tpl': {
164
161
  datasetProfiles: (0, util_3.JsonToStringWithVariableName)((0, dataSource_1.getDatasetProfiles)(mainAppData, weapps)),
package/lib/generate.d.ts CHANGED
@@ -1,2 +1,3 @@
1
- export declare function handleMpPlugins(plugins: any[] | undefined, appBuildDir: string): Promise<void>;
1
+ import { IPlugin } from './weapps-core';
2
+ export declare function handleMpPlugins(plugins: IPlugin[] | undefined, appBuildDir: string): Promise<void>;
2
3
  //# sourceMappingURL=generate.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../src/generate.ts"],"names":[],"mappings":"AAMA,wBAAsB,eAAe,CAAC,OAAO,mBAAwB,EAAE,WAAW,EAAE,MAAM,iBAuBzF"}
1
+ {"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../src/generate.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAIxC,wBAAsB,eAAe,CACnC,OAAO,uBAAgB,EACvB,WAAW,EAAE,MAAM,iBA6BpB"}
package/lib/generate.js CHANGED
@@ -15,8 +15,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.handleMpPlugins = void 0;
16
16
  const path_1 = __importDefault(require("path"));
17
17
  const fs_extra_1 = __importDefault(require("fs-extra"));
18
- const webpack_1 = require("@cloudbase/lowcode-builder/lib/builder/service/webpack");
19
- const mp_1 = require("@cloudbase/lowcode-builder/lib/builder/util/mp");
18
+ const webpack_1 = require("./builder/service/builder/webpack");
19
+ const mp_config_1 = require("./builder/mp/mp_config");
20
20
  function handleMpPlugins(plugins = [], appBuildDir) {
21
21
  return __awaiter(this, void 0, void 0, function* () {
22
22
  const appBuildMpDir = path_1.default.resolve(appBuildDir, 'dist/mp');
@@ -30,7 +30,8 @@ function handleMpPlugins(plugins = [], appBuildDir) {
30
30
  const mpBuildAppJsonPath = path_1.default.resolve(appBuildMpDir, 'app.json');
31
31
  const pluginAppJsonPath = path_1.default.resolve(appBuildNodeModulesDir, plugin.module, 'app.json');
32
32
  mergeSubPackagesApp(mpBuildAppJsonPath, pluginAppJsonPath);
33
- buildPkgJson.dependencies[plugin.module] = sourcePkgJson.dependencies[plugin.module];
33
+ buildPkgJson.dependencies[plugin.module] =
34
+ sourcePkgJson.dependencies[plugin.module];
34
35
  });
35
36
  fs_extra_1.default.writeJsonSync(mpBuildPkgJsonPath, buildPkgJson, { spaces: 2 });
36
37
  console.log('小程序安装依赖', appBuildMpDir);
@@ -44,6 +45,6 @@ function mergeSubPackagesApp(baseAppJsonPath, mergeAppJsonPath) {
44
45
  if (!mergeJson.subpackages)
45
46
  return;
46
47
  const newJson = Object.assign({}, baseJson);
47
- newJson.subpackages = (0, mp_1.mergeSubPackages)(baseJson.subpackages, mergeJson.subpackages);
48
+ newJson.subpackages = (0, mp_config_1.mergeSubPackages)(baseJson.subpackages, mergeJson.subpackages);
48
49
  fs_extra_1.default.writeJSONSync(baseAppJsonPath, newJson, { spaces: 2 });
49
50
  }
package/lib/index.d.ts CHANGED
@@ -1,8 +1,12 @@
1
1
  /// <reference types="node" />
2
2
  import { PathLike } from 'fs-extra';
3
3
  import { Plugin, PluginServiceApi } from '@cloudbase/framework-core';
4
- import { BuildType, GenerateMpType, DEPLOY_MODE, RUNTIME } from '@cloudbase/lowcode-builder';
4
+ import { BuildType, GenerateMpType } from './builder/types/common';
5
+ import { IMaterialItem, IPlugin } from './weapps-core';
6
+ import { DEPLOY_MODE, RUNTIME } from './types';
7
+ export * as generator from './generator/core/index';
5
8
  export declare const DIST_PATH = "./dist";
9
+ export declare const PERSISTENT_DEPENDIENCES_MAP: {};
6
10
  declare const DEFAULT_INPUTS: {
7
11
  _inputFile: string;
8
12
  debug: boolean;
@@ -34,12 +38,12 @@ export interface IFrameworkPluginLowCodeInputs {
34
38
  appId: string;
35
39
  mainAppSerializeData: any;
36
40
  subAppSerializeDataList?: any[];
37
- dependencies?: any[];
41
+ dependencies?: IMaterialItem[];
38
42
  buildTypeList?: BuildType[];
39
43
  generateMpType?: GenerateMpType;
40
44
  mpAppId?: string;
41
45
  generateMpPath?: string;
42
- plugins?: any[];
46
+ plugins?: IPlugin[];
43
47
  mpDeployPrivateKey?: string;
44
48
  deployOptions: {
45
49
  mode: DEPLOY_MODE;
@@ -115,5 +119,4 @@ declare class LowCodePlugin extends Plugin {
115
119
  _checkBroswerHisroty(): boolean;
116
120
  }
117
121
  export declare const plugin: typeof LowC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,CAAC,KAAK,KAAA,EAAE,KAAK,UAAQ;IAqB1C,eAAe,CAAC,OAAO,KAAA;IAIjB,gBAAgB;IA8GhB,2BAA2B;IA6D3B,UAAU;IAoBV,OAAO,CAAC,GAAG,KAAA,EAAE,IAAI,KAAA;IAejB,uBAAuB;IAoBvB,yBAAyB;IA0F/B,oBAAoB;CAKrB;AA4BD,eAAO,MAAM,MAAM,sBAAgB,CAAC"}
package/lib/index.js CHANGED
@@ -42,14 +42,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
42
42
  return (mod && mod.__esModule) ? mod : { "default": mod };
43
43
  };
44
44
  Object.defineProperty(exports, "__esModule", { value: true });
45
- exports.plugin = exports.DIST_PATH = void 0;
45
+ exports.plugin = exports.PERSISTENT_DEPENDIENCES_MAP = exports.DIST_PATH = exports.generator = void 0;
46
46
  const fs_extra_1 = __importDefault(require("fs-extra"));
47
47
  const path_1 = __importDefault(require("path"));
48
48
  const framework_core_1 = require("@cloudbase/framework-core");
49
49
  const framework_plugin_mp_1 = require("@cloudbase/framework-plugin-mp");
50
50
  const framework_plugin_website_1 = require("@cloudbase/framework-plugin-website");
51
51
  const framework_plugin_auth_1 = require("@cloudbase/framework-plugin-auth");
52
- const lowcode_builder_1 = require("@cloudbase/lowcode-builder");
52
+ const cals_1 = require("@cloudbase/cals");
53
+ const common_1 = require("./utils/common");
54
+ const core_1 = __importDefault(require("./builder/core"));
55
+ const common_2 = require("./builder/types/common");
53
56
  const generate_1 = require("./generate");
54
57
  const postProcess_1 = require("./utils/postProcess");
55
58
  const lodash_1 = require("lodash");
@@ -58,8 +61,11 @@ const cos_nodejs_sdk_v5_1 = __importDefault(require("cos-nodejs-sdk-v5"));
58
61
  const mpci = __importStar(require("miniprogram-ci"));
59
62
  const qrcode_1 = __importDefault(require("qrcode"));
60
63
  const url_1 = __importDefault(require("url"));
61
- const private_1 = require("./config/private");
64
+ const types_1 = require("./types");
65
+ const config_1 = require("./generator/config");
66
+ exports.generator = __importStar(require("./generator/core/index"));
62
67
  exports.DIST_PATH = './dist';
68
+ exports.PERSISTENT_DEPENDIENCES_MAP = {};
63
69
  const DEBUG_PATH = './debug';
64
70
  const QRCODE_PATH = './qrcode.jpg';
65
71
  const LOG_FILE = 'build.log';
@@ -68,10 +74,10 @@ const DEFAULT_CLOUDFUNCTION_ROOT_PATH = path_1.default.join(DEFAULT_CLOUDFUNCTIO
68
74
  const DEFAULT_INPUTS = {
69
75
  _inputFile: 'input.json',
70
76
  debug: false,
71
- runtime: process.env.CLOUDBASE_CIID ? lowcode_builder_1.RUNTIME.CI : lowcode_builder_1.RUNTIME.NONE,
77
+ runtime: process.env.CLOUDBASE_CIID ? types_1.RUNTIME.CI : types_1.RUNTIME.NONE,
72
78
  appId: 'test',
73
- buildTypeList: [lowcode_builder_1.BuildType.MP],
74
- generateMpType: lowcode_builder_1.GenerateMpType.APP,
79
+ buildTypeList: ["mp"],
80
+ generateMpType: "app",
75
81
  generateMpPath: '',
76
82
  subAppSerializeDataList: [],
77
83
  dependencies: [],
@@ -81,7 +87,7 @@ const DEFAULT_INPUTS = {
81
87
  mpAppId: '',
82
88
  mpDeployPrivateKey: process.env.mpDeployPrivateKey || '',
83
89
  deployOptions: {
84
- mode: process.env.deployMode || lowcode_builder_1.DEPLOY_MODE.PREVIEW,
90
+ mode: process.env.deployMode || types_1.DEPLOY_MODE.PREVIEW,
85
91
  },
86
92
  calsVersion: 'latest',
87
93
  ignoreInstall: false,
@@ -112,35 +118,62 @@ class LowCodePlugin extends framework_core_1.Plugin {
112
118
  }
113
119
  return list;
114
120
  }, []);
115
- if (!this._resolvedInputs.mainAppSerializeData.extra) {
116
- this._resolvedInputs.mainAppSerializeData.extra = {};
117
- }
118
- if (!this._resolvedInputs.mainAppSerializeData.mpPkgUrl) {
119
- if (this._resolvedInputs.buildTypeList.includes(lowcode_builder_1.BuildType.APP) ||
120
- this._resolvedInputs.buildTypeList.includes(lowcode_builder_1.BuildType.XPAGE_PC) ||
121
- this._resolvedInputs.buildTypeList.includes(lowcode_builder_1.BuildType.ADMIN_PORTAL)) {
122
- this._resolvedInputs.mainAppSerializeData.extra.historyType = lowcode_builder_1.HISTORY_TYPE.HASH;
121
+ if (this._checkIsVersion(this._resolvedInputs.calsVersion)) {
122
+ const cals = this._resolvedInputs.mainAppSerializeData;
123
+ if (!this._resolvedInputs.mainAppSerializeData.mpPkgUrl) {
124
+ this._resolvedInputs.mainAppSerializeData = (0, cals_1.deserializePlatformApp)(cals, {
125
+ dependencies: this._resolvedInputs.dependencies,
126
+ });
127
+ if ((_a = cals.extra) === null || _a === void 0 ? void 0 : _a.miniprogramPlugins) {
128
+ this._resolvedInputs.mainAppSerializeData.miniprogramPlugins = cals.extra.miniprogramPlugins.map((plugin) => {
129
+ var _a;
130
+ return (Object.assign(Object.assign({}, plugin), { componentConfigs: ((_a = plugin.componentConfigs) === null || _a === void 0 ? void 0 : _a.map((component) => {
131
+ const { data, events, meta = {} } = component, restComponent = __rest(component, ["data", "events", "meta"]);
132
+ const processedCompoennt = Object.assign(Object.assign({}, restComponent), { meta: {
133
+ desc: (meta === null || meta === void 0 ? void 0 : meta.desc) || (meta === null || meta === void 0 ? void 0 : meta.description),
134
+ } });
135
+ if (data) {
136
+ processedCompoennt.dataForm = data.properties;
137
+ }
138
+ if (events) {
139
+ processedCompoennt.emitEvents = events === null || events === void 0 ? void 0 : events.map((event) => ({
140
+ eventName: event.name,
141
+ name: event.title,
142
+ }));
143
+ }
144
+ return processedCompoennt;
145
+ })) || [] }));
146
+ });
147
+ }
148
+ if (this._resolvedInputs.buildTypeList.includes("app") ||
149
+ this._resolvedInputs.buildTypeList.includes("xPagePC") ||
150
+ this._resolvedInputs.buildTypeList.includes("adminPortal")) {
151
+ this._resolvedInputs.mainAppSerializeData.historyType = types_1.HISTORY_TYPE.HASH;
152
+ }
153
+ }
154
+ else {
155
+ this._resolvedInputs.mainAppSerializeData = (0, common_1.processPkgUrlCals2WeappData)(cals);
123
156
  }
124
157
  }
125
- if (!((_b = (_a = this._resolvedInputs.mainAppSerializeData) === null || _a === void 0 ? void 0 : _a.extra) === null || _b === void 0 ? void 0 : _b.envId)) {
126
- this._resolvedInputs.mainAppSerializeData.extra.envId = envId;
158
+ if (!((_b = this._resolvedInputs.mainAppSerializeData) === null || _b === void 0 ? void 0 : _b.envId)) {
159
+ this._resolvedInputs.mainAppSerializeData.envId = envId;
127
160
  }
128
- if ((0, lowcode_builder_1.buildAsWebByBuildType)(this._resolvedInputs.buildTypeList)) {
161
+ if ((0, common_2.buildAsWebByBuildType)(this._resolvedInputs.buildTypeList)) {
129
162
  const { appId, mainAppSerializeData } = this._resolvedInputs;
130
- let { appConfig = {} } = mainAppSerializeData.extra;
163
+ let { appConfig = {} } = mainAppSerializeData;
131
164
  let { window = {} } = appConfig;
132
165
  let path = this._getWebRootPath();
133
166
  window.publicPath = path;
134
- window.basename = (0, lowcode_builder_1.buildAsAdminPortalByBuildType)(this._resolvedInputs.buildTypeList)
135
- ? `app/${appId}${((_c = this._resolvedInputs.deployOptions) === null || _c === void 0 ? void 0 : _c.mode) !== lowcode_builder_1.DEPLOY_MODE.UPLOAD ? '-preview' : ''}`
136
- : (0, lowcode_builder_1.buildAsXPageByBuildType)(this._resolvedInputs.buildTypeList)
167
+ window.basename = (0, common_2.buildAsAdminPortalByBuildType)(this._resolvedInputs.buildTypeList)
168
+ ? `app/${appId}${((_c = this._resolvedInputs.deployOptions) === null || _c === void 0 ? void 0 : _c.mode) !== types_1.DEPLOY_MODE.UPLOAD ? '-preview' : ''}`
169
+ : (0, common_2.buildAsXPageByBuildType)(this._resolvedInputs.buildTypeList)
137
170
  ? '/'
138
171
  : path;
139
172
  appConfig.window = window;
140
- this._resolvedInputs.mainAppSerializeData.extra.appConfig = appConfig;
173
+ this._resolvedInputs.mainAppSerializeData.appConfig = appConfig;
141
174
  this._resolvedInputs.subAppSerializeDataList = [];
142
- if (this._resolvedInputs.mainAppSerializeData.extra.miniprogramPlugins) {
143
- this._resolvedInputs.mainAppSerializeData.extra.miniprogramPlugins = [];
175
+ if (this._resolvedInputs.mainAppSerializeData.miniprogramPlugins) {
176
+ this._resolvedInputs.mainAppSerializeData.miniprogramPlugins = [];
144
177
  }
145
178
  }
146
179
  else {
@@ -165,7 +198,7 @@ class LowCodePlugin extends framework_core_1.Plugin {
165
198
  }
166
199
  _subPluginConstructor(resolveInputs) {
167
200
  var _a, _b;
168
- if (resolveInputs.runtime === lowcode_builder_1.RUNTIME.CLI) {
201
+ if (resolveInputs.runtime === types_1.RUNTIME.CLI) {
169
202
  return;
170
203
  }
171
204
  let { buildTypeList, deployOptions } = resolveInputs;
@@ -185,7 +218,7 @@ class LowCodePlugin extends framework_core_1.Plugin {
185
218
  },
186
219
  ],
187
220
  });
188
- if (buildTypeList.includes(lowcode_builder_1.BuildType.MP)) {
221
+ if (buildTypeList.includes("mp")) {
189
222
  if (deployOptions.mpDeployPrivateKey) {
190
223
  fs_extra_1.default.writeFileSync(path_1.default.join(this.api.projectPath, `./private.${deployOptions.mpAppId}.key`), deployOptions.mpDeployPrivateKey, 'base64');
191
224
  }
@@ -202,7 +235,7 @@ class LowCodePlugin extends framework_core_1.Plugin {
202
235
  privateKeyPath: `./private.${deployOptions.mpAppId}.key`,
203
236
  localPath: exports.DIST_PATH,
204
237
  ignores: ['node_modules/**/*', LOG_FILE].concat(cloudfunctionRoot ? [path_1.default.join(cloudfunctionRoot, '**/*')] : []),
205
- deployMode: deployOptions.mpAppId === deployOptions.targetMpAppId ? deployOptions.mode : lowcode_builder_1.DEPLOY_MODE.UPLOAD,
238
+ deployMode: deployOptions.mpAppId === deployOptions.targetMpAppId ? deployOptions.mode : types_1.DEPLOY_MODE.UPLOAD,
206
239
  uploadOptions: {
207
240
  version: (deployOptions === null || deployOptions === void 0 ? void 0 : deployOptions.version) || '1.0.0',
208
241
  desc: (deployOptions === null || deployOptions === void 0 ? void 0 : deployOptions.description) || '',
@@ -215,7 +248,7 @@ class LowCodePlugin extends framework_core_1.Plugin {
215
248
  },
216
249
  });
217
250
  }
218
- else if ((0, lowcode_builder_1.buildAsWebByBuildType)(buildTypeList)) {
251
+ else if ((0, common_2.buildAsWebByBuildType)(buildTypeList)) {
219
252
  this._webPlugin = new framework_plugin_website_1.plugin('web', this.api, {
220
253
  outputPath: exports.DIST_PATH,
221
254
  cloudPath: this._getWebRootPath(),
@@ -225,7 +258,7 @@ class LowCodePlugin extends framework_core_1.Plugin {
225
258
  }
226
259
  _getWebRootPath() {
227
260
  let { appId, deployOptions } = this._resolvedInputs;
228
- return (deployOptions === null || deployOptions === void 0 ? void 0 : deployOptions.mode) === lowcode_builder_1.DEPLOY_MODE.PREVIEW ? `/${appId}/preview/` : `/${appId}/production/`;
261
+ return (deployOptions === null || deployOptions === void 0 ? void 0 : deployOptions.mode) === types_1.DEPLOY_MODE.PREVIEW ? `/${appId}/preview/` : `/${appId}/production/`;
229
262
  }
230
263
  _time(label) {
231
264
  if (!this._timeMap[label]) {
@@ -256,10 +289,17 @@ class LowCodePlugin extends framework_core_1.Plugin {
256
289
  return __awaiter(this, void 0, void 0, function* () {
257
290
  let { logger } = this.api;
258
291
  const staticDir = path_1.default.resolve(__dirname, '../../../static');
259
- let { debug, mainAppSerializeData, subAppSerializeDataList, dependencies, appId, buildTypeList, generateMpType, plugins, extraData = { isComposite: false, compProps: {} }, } = this._resolvedInputs;
260
- const webpackMode = ((_a = this._resolvedInputs.deployOptions) === null || _a === void 0 ? void 0 : _a.mode) === lowcode_builder_1.DEPLOY_MODE.UPLOAD
261
- ? lowcode_builder_1.WebpackModeType.PRODUCTION
262
- : lowcode_builder_1.WebpackModeType.NONE;
292
+ let { debug, mainAppSerializeData, subAppSerializeDataList, dependencies, appId, buildTypeList, generateMpType, generateMpPath, plugins, extraData = { isComposite: false, compProps: {} }, calsVersion, } = this._resolvedInputs;
293
+ const webpackMode = ((_a = this._resolvedInputs.deployOptions) === null || _a === void 0 ? void 0 : _a.mode) === types_1.DEPLOY_MODE.UPLOAD
294
+ ? "production"
295
+ : "";
296
+ subAppSerializeDataList = subAppSerializeDataList === null || subAppSerializeDataList === void 0 ? void 0 : subAppSerializeDataList.map((item) => {
297
+ if (this._checkIsVersion(calsVersion)) {
298
+ return item.mpPkgUrl ? (0, common_1.processPkgUrlCals2WeappData)(item) : (0, cals_1.deserializePlatformApp)(item, { dependencies });
299
+ }
300
+ return item;
301
+ });
302
+ const nodeModulesPath = (0, common_1.getValidNodeModulesPath)();
263
303
  let miniAppDir = '';
264
304
  let webAppDir = '';
265
305
  const h5url = `./${appId}/index.html`;
@@ -278,14 +318,14 @@ class LowCodePlugin extends framework_core_1.Plugin {
278
318
  throw e;
279
319
  }
280
320
  const domain = ((_b = this._website) === null || _b === void 0 ? void 0 : _b.cdnDomain) || ((_c = mainAppSerializeData.extra) === null || _c === void 0 ? void 0 : _c.domain);
281
- if ((0, lowcode_builder_1.buildAsWebByBuildType)(buildTypeList)) {
282
- let { appConfig = {} } = mainAppSerializeData.extra;
321
+ if ((0, common_2.buildAsWebByBuildType)(buildTypeList)) {
322
+ let { appConfig = {} } = mainAppSerializeData;
283
323
  let { window = {} } = appConfig;
284
- if ((0, lowcode_builder_1.buildAsXPageByBuildType)(buildTypeList)) {
324
+ if ((0, common_2.buildAsXPageByBuildType)(buildTypeList)) {
285
325
  window.publicPath =
286
326
  ((_d = this._resolvedInputs.deployOptions) === null || _d === void 0 ? void 0 : _d.publicPath) || `https://${domain}${this._getWebRootPath()}`;
287
327
  }
288
- else if (this._resolvedInputs.deployOptions.mode === lowcode_builder_1.DEPLOY_MODE.UPLOAD) {
328
+ else if (this._resolvedInputs.deployOptions.mode === types_1.DEPLOY_MODE.UPLOAD) {
289
329
  try {
290
330
  const { Data = {} } = yield this.api.cloudbaseManager.commonService('lowcode', '2021-01-08').call({
291
331
  Action: 'DescribeAppCustomUrls',
@@ -300,7 +340,7 @@ class LowCodePlugin extends framework_core_1.Plugin {
300
340
  if (this._gatewayConfig) {
301
341
  const path = this._gatewayConfig.Path;
302
342
  window.publicPath = `https://${domain}${this._getWebRootPath()}`;
303
- if (!(0, lowcode_builder_1.buildAsAdminPortalByBuildType)(buildTypeList)) {
343
+ if (!(0, common_2.buildAsAdminPortalByBuildType)(buildTypeList)) {
304
344
  window.basename = path;
305
345
  }
306
346
  }
@@ -314,7 +354,7 @@ class LowCodePlugin extends framework_core_1.Plugin {
314
354
  }
315
355
  }
316
356
  appConfig.window = window;
317
- this._resolvedInputs.mainAppSerializeData.extra.appConfig = appConfig;
357
+ this._resolvedInputs.mainAppSerializeData.appConfig = appConfig;
318
358
  }
319
359
  try {
320
360
  if (!debug) {
@@ -322,44 +362,50 @@ class LowCodePlugin extends framework_core_1.Plugin {
322
362
  }
323
363
  this._time("build process");
324
364
  this._appPath = yield new Promise((resolve, reject) => {
365
+ var _a, _b;
325
366
  try {
326
- (0, lowcode_builder_1.buildWedaApp)({
327
- cals: mainAppSerializeData,
328
- subAppCalsList: subAppSerializeDataList,
367
+ (0, core_1.default)({
368
+ mainAppSerializeData,
369
+ subAppSerializeDataList,
329
370
  dependencies,
330
371
  appKey: appId,
372
+ nodeModulesPath,
373
+ buildTypeList,
331
374
  runtime: this._resolvedInputs.runtime,
332
375
  ignoreInstall: this._resolvedInputs.ignoreInstall,
333
- buildTypeList,
334
376
  mode: webpackMode,
335
- deployOptions: this._resolvedInputs.deployOptions,
377
+ deployMode: (_a = this._resolvedInputs.deployOptions) === null || _a === void 0 ? void 0 : _a.mode,
378
+ watch: false,
336
379
  generateMpType,
380
+ generateMpPath,
381
+ isCleanDistDir: false,
337
382
  plugins,
338
383
  extraData,
339
- resourceAppId: this._resolvedInputs.mpAppId,
384
+ isCrossAccount: this._resolvedInputs.mpAppId !== ((_b = this._resolvedInputs.deployOptions) === null || _b === void 0 ? void 0 : _b.targetMpAppId),
385
+ resourceAppid: this._resolvedInputs.mpAppId,
340
386
  domain,
341
387
  }, (err, result) => __awaiter(this, void 0, void 0, function* () {
342
- var _a;
388
+ var _c;
343
389
  if (!err) {
344
390
  try {
345
- const { appConfig = {} } = mainAppSerializeData.extra;
391
+ const { appConfig = {} } = mainAppSerializeData;
346
392
  const { publicPath = '' } = (appConfig === null || appConfig === void 0 ? void 0 : appConfig.window) || {};
347
393
  const { outDir = '', timeElapsed = 0, plugins } = result || {};
348
- if (buildTypeList.includes(lowcode_builder_1.BuildType.MP)) {
394
+ if (buildTypeList.includes("mp")) {
349
395
  miniAppDir = outDir;
350
396
  }
351
- if ((0, lowcode_builder_1.buildAsWebByBuildType)(buildTypeList)) {
397
+ if ((0, common_2.buildAsWebByBuildType)(buildTypeList)) {
352
398
  webAppDir = path_1.default.resolve(outDir, 'preview');
353
399
  }
354
400
  logger.debug(`=== Compilation finished at ${outDir}, elapsed time: ${timeElapsed / 1000}s.===\n`);
355
- if (buildTypeList.includes(lowcode_builder_1.BuildType.MP) && miniAppDir) {
401
+ if (buildTypeList.includes("mp") && miniAppDir) {
356
402
  let projectJsonPath = path_1.default.resolve(miniAppDir, 'project.config.json');
357
403
  yield (0, postProcess_1.postprocessProjectConfig)(projectJsonPath, {
358
404
  appid: this._resolvedInputs.deployOptions.mpAppId,
359
405
  cloudfunctionRoot: undefined,
360
406
  });
361
407
  yield (0, postProcess_1.postprocessDeployExtraJson)(miniAppDir, this._resolvedInputs.deployOptions);
362
- if (generateMpType === lowcode_builder_1.GenerateMpType.APP) {
408
+ if (generateMpType === "app") {
363
409
  fs_extra_1.default.removeSync(path_1.default.resolve(miniAppDir, 'miniprogram_npm'));
364
410
  }
365
411
  if (outDir) {
@@ -368,7 +414,7 @@ class LowCodePlugin extends framework_core_1.Plugin {
368
414
  }
369
415
  }
370
416
  }
371
- else if ((0, lowcode_builder_1.buildAsWebByBuildType)(buildTypeList) && webAppDir) {
417
+ else if ((0, common_2.buildAsWebByBuildType)(buildTypeList) && webAppDir) {
372
418
  const staticAppDir = path_1.default.join(staticDir, publicPath);
373
419
  fs_extra_1.default.ensureDirSync(staticAppDir);
374
420
  }
@@ -378,10 +424,10 @@ class LowCodePlugin extends framework_core_1.Plugin {
378
424
  }
379
425
  else if (webAppDir) {
380
426
  fs_extra_1.default.copySync(webAppDir, distPath);
381
- if ((0, lowcode_builder_1.buildAsWebByBuildType)(buildTypeList) &&
382
- !(0, lowcode_builder_1.buildAsAdminPortalByBuildType)(buildTypeList) &&
427
+ if ((0, common_2.buildAsWebByBuildType)(buildTypeList) &&
428
+ !(0, common_2.buildAsAdminPortalByBuildType)(buildTypeList) &&
383
429
  this._checkBroswerHisroty()) {
384
- yield Promise.all((((_a = this._resolvedInputs.mainAppSerializeData) === null || _a === void 0 ? void 0 : _a.items) || []).map((page) => fs_extra_1.default.copy(path_1.default.join(distPath, 'index.html'), path_1.default.join(distPath, page.id, 'index.html'))));
430
+ yield Promise.all((((_c = this._resolvedInputs.mainAppSerializeData) === null || _c === void 0 ? void 0 : _c.pageInstanceList) || []).map((page) => fs_extra_1.default.copy(path_1.default.join(distPath, 'index.html'), path_1.default.join(distPath, page.id, 'index.html'))));
385
431
  }
386
432
  }
387
433
  resolve(distPath);
@@ -395,7 +441,7 @@ class LowCodePlugin extends framework_core_1.Plugin {
395
441
  if (err.length) {
396
442
  let messageList = (err[0] || '').split('\n');
397
443
  let lineIndex = 0;
398
- let reg = /node_modules\/@babel/;
444
+ let reg = /node_modules\/\@babel/;
399
445
  messageList.find((str, index) => {
400
446
  if (reg.test(str)) {
401
447
  lineIndex = index;
@@ -449,7 +495,7 @@ class LowCodePlugin extends framework_core_1.Plugin {
449
495
  if (debug) {
450
496
  yield this._debugInfo();
451
497
  }
452
- if (this._resolvedInputs.runtime === lowcode_builder_1.RUNTIME.CI) {
498
+ if (this._resolvedInputs.runtime === types_1.RUNTIME.CI) {
453
499
  yield this._handleCIProduct();
454
500
  }
455
501
  logger.info(`low-code build fail: ${e}`);
@@ -478,7 +524,7 @@ class LowCodePlugin extends framework_core_1.Plugin {
478
524
  if (this._miniprogramePlugin) {
479
525
  res = (0, lodash_1.merge)(res, yield this._miniprogramePlugin.compile());
480
526
  }
481
- else if ((0, lowcode_builder_1.buildAsWebByBuildType)(this._resolvedInputs.buildTypeList) && this._webPlugin) {
527
+ else if ((0, common_2.buildAsWebByBuildType)(this._resolvedInputs.buildTypeList) && this._webPlugin) {
482
528
  try {
483
529
  const HostingProvider = (_a = this.api.resourceProviders) === null || _a === void 0 ? void 0 : _a.hosting;
484
530
  const { envId } = this.api;
@@ -498,10 +544,10 @@ class LowCodePlugin extends framework_core_1.Plugin {
498
544
  this.api.logger.error('获取静态托管失败: ', e);
499
545
  throw e;
500
546
  }
501
- const privateJsPath = path_1.default.join('/', 'tmp', private_1.PRIVATE_JS_NAME);
547
+ const privateJsPath = path_1.default.join('/', 'tmp', config_1.PRIVATE_JS_NAME);
502
548
  try {
503
549
  yield fs_extra_1.default.ensureFile(privateJsPath);
504
- yield fs_extra_1.default.writeFile(privateJsPath, private_1.PRIVATE_JS_CODE, {
550
+ yield fs_extra_1.default.writeFile(privateJsPath, config_1.PRIVATE_JS_CODE, {
505
551
  encoding: 'utf8',
506
552
  flag: 'w',
507
553
  });
@@ -510,13 +556,13 @@ class LowCodePlugin extends framework_core_1.Plugin {
510
556
  this.api.logger.error('创建私有化JS文件失败:', e);
511
557
  throw e;
512
558
  }
513
- if (!(0, lowcode_builder_1.buildAsXPageByBuildType)(this._resolvedInputs.buildTypeList)) {
559
+ if (!(0, common_2.buildAsXPageByBuildType)(this._resolvedInputs.buildTypeList)) {
514
560
  const deployContent = [
515
561
  ...(this._webPlugin.buildOutput.static || []),
516
562
  ...(this._webPlugin.buildOutput.staticConfig || []),
517
563
  {
518
564
  src: privateJsPath,
519
- cloudPath: `/weda-config/${private_1.PRIVATE_JS_NAME}`,
565
+ cloudPath: `/weda-config/${config_1.PRIVATE_JS_NAME}`,
520
566
  },
521
567
  ];
522
568
  yield Promise.all(deployContent.map((options) => this.api.cloudbaseManager.hosting.uploadFiles({
@@ -539,7 +585,7 @@ class LowCodePlugin extends framework_core_1.Plugin {
539
585
  if (this._resolvedInputs.debug) {
540
586
  yield this._debugInfo();
541
587
  }
542
- if (this._resolvedInputs.runtime === lowcode_builder_1.RUNTIME.CI) {
588
+ if (this._resolvedInputs.runtime === types_1.RUNTIME.CI) {
543
589
  yield this._handleCIProduct();
544
590
  }
545
591
  throw e;
@@ -556,7 +602,7 @@ class LowCodePlugin extends framework_core_1.Plugin {
556
602
  }
557
603
  else if (this._webPlugin) {
558
604
  yield this._webPlugin.deploy();
559
- if ((0, lowcode_builder_1.buildAsAdminPortalByBuildType)(this._resolvedInputs.buildTypeList)) {
605
+ if ((0, common_2.buildAsAdminPortalByBuildType)(this._resolvedInputs.buildTypeList)) {
560
606
  yield this._postProcessAdminPortal();
561
607
  }
562
608
  else {
@@ -568,7 +614,7 @@ class LowCodePlugin extends framework_core_1.Plugin {
568
614
  Param: {
569
615
  WeAppId: this._resolvedInputs.appId,
570
616
  EnvId: this.api.envId,
571
- PublishType: this._resolvedInputs.deployOptions.mode === lowcode_builder_1.DEPLOY_MODE.UPLOAD ? 'product' : 'preview',
617
+ PublishType: this._resolvedInputs.deployOptions.mode === types_1.DEPLOY_MODE.UPLOAD ? 'product' : 'preview',
572
618
  },
573
619
  });
574
620
  this.api.logger.info(`${this.api.emoji('🚀')} custom publish success: ${JSON.stringify(publishAppCustomNavRes)}`);
@@ -581,8 +627,8 @@ class LowCodePlugin extends framework_core_1.Plugin {
581
627
  }
582
628
  try {
583
629
  const { deployOptions, appId } = this._resolvedInputs;
584
- const isPreview = (deployOptions === null || deployOptions === void 0 ? void 0 : deployOptions.mode) === lowcode_builder_1.DEPLOY_MODE.PREVIEW;
585
- const link = (0, lowcode_builder_1.buildAsAdminPortalByBuildType)(this._resolvedInputs.buildTypeList)
630
+ const isPreview = (deployOptions === null || deployOptions === void 0 ? void 0 : deployOptions.mode) === types_1.DEPLOY_MODE.PREVIEW;
631
+ const link = (0, common_2.buildAsAdminPortalByBuildType)(this._resolvedInputs.buildTypeList)
586
632
  ? `https://${this._website.cdnDomain}/adminportal/#/app/${isPreview ? `${appId}-preview` : appId}?envType=${isPreview ? 'preview' : 'prod'}`
587
633
  : this._gatewayConfig
588
634
  ? `https://${this._gatewayConfig.Domain + this._gatewayConfig.Path}`
@@ -628,7 +674,7 @@ class LowCodePlugin extends framework_core_1.Plugin {
628
674
  if (this._resolvedInputs.debug) {
629
675
  yield this._debugInfo();
630
676
  }
631
- if (this._resolvedInputs.runtime === lowcode_builder_1.RUNTIME.CI) {
677
+ if (this._resolvedInputs.runtime === types_1.RUNTIME.CI) {
632
678
  yield this._handleCIProduct();
633
679
  yield this._postPersistentDependiences();
634
680
  }
@@ -830,8 +876,8 @@ class LowCodePlugin extends framework_core_1.Plugin {
830
876
  SecretId: credential === null || credential === void 0 ? void 0 : credential.secretId,
831
877
  SecretKey: credential === null || credential === void 0 ? void 0 : credential.secretKey,
832
878
  });
833
- promises = Object.keys(lowcode_builder_1.PERSISTENT_DEPENDIENCES_MAP).map((key) => __awaiter(this, void 0, void 0, function* () {
834
- let meta = lowcode_builder_1.PERSISTENT_DEPENDIENCES_MAP[key];
879
+ promises = Object.keys(exports.PERSISTENT_DEPENDIENCES_MAP).map((key) => __awaiter(this, void 0, void 0, function* () {
880
+ let meta = exports.PERSISTENT_DEPENDIENCES_MAP[key];
835
881
  const zipPath = path_1.default.join(this.api.projectPath, `${meta.name}@${meta.version}.zip`);
836
882
  try {
837
883
  yield this._zipDir(meta.source, zipPath);
@@ -894,10 +940,10 @@ class LowCodePlugin extends framework_core_1.Plugin {
894
940
  _postProcessAdminPortal() {
895
941
  var _a, _b;
896
942
  return __awaiter(this, void 0, void 0, function* () {
897
- const { buildTypeList } = this._resolvedInputs;
898
- if ((0, lowcode_builder_1.buildAsAdminPortalByBuildType)(buildTypeList)) {
943
+ const { appId, buildTypeList, mainAppSerializeData, deployOptions } = this._resolvedInputs;
944
+ if ((0, common_2.buildAsAdminPortalByBuildType)(buildTypeList)) {
899
945
  try {
900
- if (((_b = (_a = this._resolvedInputs) === null || _a === void 0 ? void 0 : _a.deployOptions) === null || _b === void 0 ? void 0 : _b.mode) === lowcode_builder_1.DEPLOY_MODE.UPLOAD) {
946
+ if (((_b = (_a = this._resolvedInputs) === null || _a === void 0 ? void 0 : _a.deployOptions) === null || _b === void 0 ? void 0 : _b.mode) === types_1.DEPLOY_MODE.UPLOAD) {
901
947
  yield this.api.cloudbaseManager.commonService('lowcode', '2021-01-08').call({
902
948
  Action: 'PublishAppCustomUrl',
903
949
  Param: {
@@ -953,7 +999,7 @@ class LowCodePlugin extends framework_core_1.Plugin {
953
999
  return arr;
954
1000
  }, []);
955
1001
  if (this._gatewayConfig) {
956
- (_a = this._resolvedInputs.mainAppSerializeData.items) === null || _a === void 0 ? void 0 : _a.forEach((page) => {
1002
+ (_a = this._resolvedInputs.mainAppSerializeData.pageInstanceList) === null || _a === void 0 ? void 0 : _a.forEach((page) => {
957
1003
  rules.push({
958
1004
  keyPrefixEquals: `${path.slice(1)}${page.id}`,
959
1005
  replaceKeyWith: path,
@@ -971,7 +1017,7 @@ class LowCodePlugin extends framework_core_1.Plugin {
971
1017
  }));
972
1018
  yield Promise.all(modifyDomainConfigPromises);
973
1019
  yield Promise.all([
974
- ((_c = (_b = this._resolvedInputs) === null || _b === void 0 ? void 0 : _b.deployOptions) === null || _c === void 0 ? void 0 : _c.mode) === lowcode_builder_1.DEPLOY_MODE.UPLOAD
1020
+ ((_c = (_b = this._resolvedInputs) === null || _b === void 0 ? void 0 : _b.deployOptions) === null || _c === void 0 ? void 0 : _c.mode) === types_1.DEPLOY_MODE.UPLOAD
975
1021
  ? this.api.cloudbaseManager
976
1022
  .commonService('lowcode', '2021-01-08')
977
1023
  .call({
@@ -1002,8 +1048,9 @@ class LowCodePlugin extends framework_core_1.Plugin {
1002
1048
  });
1003
1049
  }
1004
1050
  _checkBroswerHisroty() {
1005
- let historyType = this._resolvedInputs.mainAppSerializeData.extra.historyType ? lowcode_builder_1.HISTORY_TYPE.HASH : '';
1006
- return !historyType || historyType === lowcode_builder_1.HISTORY_TYPE.BROWSER;
1051
+ var _a;
1052
+ let historyType = ((_a = this._resolvedInputs.mainAppSerializeData) === null || _a === void 0 ? void 0 : _a.historyType) ? types_1.HISTORY_TYPE.HASH : '';
1053
+ return !historyType || historyType === types_1.HISTORY_TYPE.BROWSER;
1007
1054
  }
1008
1055
  }
1009
1056
  function resolveInputs(inputs, defaultInputs) {
@@ -1,3 +1,4 @@
1
+ import { IWebRuntimeAppData } from 'src/weapps-core';
1
2
  export declare const CLOUD_FUNCTION_TYPE = "cloud-function";
2
3
  export declare const EXTERNAL_FUNCTION_TYPE = "http";
3
4
  export declare const DATABASE_TYPE = "database";
@@ -8,6 +9,9 @@ export declare function mergeDependencies(...pkgs: any[]): {};
8
9
  export declare function lowercaseKey(obj: any, deep?: boolean): any;
9
10
  export declare function standardizeDataSource(ds: any): any;
10
11
  export declare function getDatasourceProfiles(datasources: any): any;
12
+ export declare function getDataVarProfiles(appData: IWebRuntimeAppData): {
13
+ $global: any[];
14
+ };
11
15
  export declare function getDatasetProfiles(mainAppData: {
12
16
  dataset?: any;
13
17
  rootPath?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"dataSource.d.ts","sourceRoot":"","sources":["../../src/utils/dataSource.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,mBAAmB,mBAAmB,CAAC;AACpD,eAAO,MAAM,sBAAsB,SAAS,CAAC;AAC7C,eAAO,MAAM,aAAa,aAAa,CAAC;AAMxC,wBAAgB,yBAAyB,CAAC,UAAU,KAAA,EAAE,IAAI,KAAA,UAGzD;AAED,wBAAgB,4BAA4B,CAAC,KAAK,KAAA,EAAE,UAAU,KAAA,EAAE,IAAI,KAAA,UAGnE;AAMD,wBAAgB,yBAAyB,CAAC,QAAQ,KAAA,EAAE,IAAI,KAAA,iBAEvD;AAMD,wBAAgB,iBAAiB,CAAC,GAAG,IAAI,OAAA,MAaxC;AAmBD,wBAAgB,YAAY,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,GAAG,CAU1D;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