@cloudbase/framework-plugin-low-code 0.7.22 → 0.7.23

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.
@@ -1,7 +1,7 @@
1
- import { IMaterialItem, IWeAppData, IPlugin } from '@cloudbase/lowcode-generator/lib/weapps-core';
1
+ import { IMaterialItem, IWeAppData, IPlugin } from '../../weapps-core';
2
2
  import { IBuildContext } from './BuildContext';
3
3
  import { DEPLOY_MODE } from '../../types';
4
- import { BuildType, IAppUsedComp, IUsedComps } from '@cloudbase/lowcode-builder';
4
+ import { BuildType, IAppUsedComp, IUsedComps } from '../types/common';
5
5
  export declare function generateWxMp({ weapps, projDir, appId, domain, materials, plugins, isProduction, deployMode, extraData, isMixMode, options, buildTypeList, }: {
6
6
  weapps: IWeAppData[];
7
7
  projDir: string;
@@ -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,8CAA8C,CAAC;AAMtD,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAW/C,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAiC,YAAY,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAQhH,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;IAC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,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,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,CA+OvC;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"}
@@ -36,7 +36,7 @@ const chalk_1 = __importDefault(require("chalk"));
36
36
  const path_1 = __importDefault(require("path"));
37
37
  const util_1 = require("util");
38
38
  const fs = __importStar(require("fs-extra"));
39
- const weapps_core_1 = require("@cloudbase/lowcode-generator/lib/weapps-core");
39
+ const weapps_core_1 = require("../../weapps-core");
40
40
  const config_1 = require("../config");
41
41
  const mp_1 = require("../config/mp");
42
42
  const generateFiles_1 = __importStar(require("../util/generateFiles"));
@@ -52,7 +52,7 @@ const util_3 = require("../util");
52
52
  const style_1 = require("../util/style");
53
53
  const dataSource_1 = require("../../utils/dataSource");
54
54
  const types_1 = require("../../types");
55
- const lowcode_builder_1 = require("@cloudbase/lowcode-builder");
55
+ const common_1 = require("../types/common");
56
56
  const lodash_1 = require("lodash");
57
57
  const junk = __importStar(require("../util/junk"));
58
58
  const net_1 = require("../util/net");
@@ -107,7 +107,7 @@ function generateWxMp({ weapps, projDir, appId, domain, materials, plugins, isPr
107
107
  appFileData = Object.assign(Object.assign({}, appFileData), { 'common/style.js': {}, 'common/utils.wxs': {
108
108
  domain,
109
109
  }, 'common/util.js': {
110
- isAdminPortal: (0, lowcode_builder_1.buildAsAdminPortalByBuildType)(buildTypeList),
110
+ isAdminPortal: (0, common_1.buildAsAdminPortalByBuildType)(buildTypeList),
111
111
  }, 'common/widget.js': {}, 'common/url.js': {}, 'common/weapp-sdk.js': {}, 'common/weapp-page.js': {
112
112
  dataPropNames: wxmlDataPrefix,
113
113
  debug: !buildContext.isProduction,
package/lib/generate.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- import { IPlugin } from '@cloudbase/lowcode-generator/lib/weapps-core';
1
+ import { IPlugin } from './weapps-core';
2
2
  export declare function handleMpPlugins(plugins: IPlugin[] | undefined, appBuildDir: string): Promise<void>;
3
3
  //# sourceMappingURL=generate.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../src/generate.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,8CAA8C,CAAC;AAIvE,wBAAsB,eAAe,CAAC,OAAO,uBAAgB,EAAE,WAAW,EAAE,MAAM,iBAuBjF"}
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,9 +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';
5
- import { IMaterialItem, IPlugin } from '@cloudbase/lowcode-generator/lib/weapps-core';
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';
6
8
  export declare const DIST_PATH = "./dist";
9
+ export declare const PERSISTENT_DEPENDIENCES_MAP: {};
7
10
  declare const DEFAULT_INPUTS: {
8
11
  _inputFile: string;
9
12
  debug: boolean;
@@ -116,5 +119,4 @@ declare class LowCodePlugin extends Plugin {
116
119
  _checkBroswerHisroty(): boolean;
117
120
  }
118
121
  export declare const plugin: typeof LowCodePlugin;
119
- export {};
120
122
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAOA,OAAW,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAExC,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAIrE,OAAO,EAEL,SAAS,EAET,cAAc,EACd,WAAW,EACX,OAAO,EAMR,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,8CAA8C,CAAC;AAetF,eAAO,MAAM,SAAS,WAAW,CAAC;AAiBlC,QAAA,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;CAoBnB,CAAC;AAEF,MAAM,WAAW,6BAA6B;IAM5C,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,KAAK,CAAC,EAAE,OAAO,CAAC;IAMhB,OAAO,CAAC,EAAE,OAAO,CAAC;IAIlB,KAAK,EAAE,MAAM,CAAC;IAId,oBAAoB,EAAE,GAAG,CAAC;IAI1B,uBAAuB,CAAC,EAAE,GAAG,EAAE,CAAC;IAIhC,YAAY,CAAC,EAAE,aAAa,EAAE,CAAC;IAK/B,aAAa,CAAC,EAAE,SAAS,EAAE,CAAC;IAK5B,cAAc,CAAC,EAAE,cAAc,CAAC;IAIhC,OAAO,CAA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;KACd,CAAC;gBACiB,IAAI,EAAE,MAAM,EAAS,GAAG,EAAE,gBAAgB,EAAS,MAAM,EAAE,6BAA6B;IA4H3G,QAAQ;IAMR,qBAAqB,CAAC,aAAa,EAAE,cAAc;IA0EnD,eAAe;IAQf,KAAK,CAAC,KAAK,KAAA;IASX,QAAQ,CAAC,KAAK,KAAA;IAWR,IAAI;IAKJ,GAAG;IAKH,MAAM;IAKN,OAAO;IAKP,KAAK;IA8QL,OAAO;IA8FP,MAAM;IAkGN,qBAAqB,CAAC,OAAO,EAAE,MAAM;IA+BrC,mBAAmB,CAAC,KAAK,KAAA,EAAE,KAAK,UAAQ;IAgBxC,eAAe,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
  });
@@ -515,7 +561,7 @@ class LowCodePlugin extends framework_core_1.Plugin {
515
561
  ...(this._webPlugin.buildOutput.staticConfig || []),
516
562
  {
517
563
  src: privateJsPath,
518
- cloudPath: `/weda-config/${private_1.PRIVATE_JS_NAME}`,
564
+ cloudPath: `/weda-config/${config_1.PRIVATE_JS_NAME}`,
519
565
  },
520
566
  ];
521
567
  yield Promise.all(deployContent.map((options) => this.api.cloudbaseManager.hosting.uploadFiles({
@@ -534,7 +580,7 @@ class LowCodePlugin extends framework_core_1.Plugin {
534
580
  if (this._resolvedInputs.debug) {
535
581
  yield this._debugInfo();
536
582
  }
537
- if (this._resolvedInputs.runtime === lowcode_builder_1.RUNTIME.CI) {
583
+ if (this._resolvedInputs.runtime === types_1.RUNTIME.CI) {
538
584
  yield this._handleCIProduct();
539
585
  }
540
586
  throw e;
@@ -551,7 +597,7 @@ class LowCodePlugin extends framework_core_1.Plugin {
551
597
  }
552
598
  else if (this._webPlugin) {
553
599
  yield this._webPlugin.deploy();
554
- if ((0, lowcode_builder_1.buildAsAdminPortalByBuildType)(this._resolvedInputs.buildTypeList)) {
600
+ if ((0, common_2.buildAsAdminPortalByBuildType)(this._resolvedInputs.buildTypeList)) {
555
601
  yield this._postProcessAdminPortal();
556
602
  }
557
603
  else {
@@ -563,7 +609,7 @@ class LowCodePlugin extends framework_core_1.Plugin {
563
609
  Param: {
564
610
  WeAppId: this._resolvedInputs.appId,
565
611
  EnvId: this.api.envId,
566
- PublishType: this._resolvedInputs.deployOptions.mode === lowcode_builder_1.DEPLOY_MODE.UPLOAD ? 'product' : 'preview',
612
+ PublishType: this._resolvedInputs.deployOptions.mode === types_1.DEPLOY_MODE.UPLOAD ? 'product' : 'preview',
567
613
  },
568
614
  });
569
615
  this.api.logger.info(`${this.api.emoji('🚀')} custom publish success: ${JSON.stringify(publishAppCustomNavRes)}`);
@@ -576,8 +622,8 @@ class LowCodePlugin extends framework_core_1.Plugin {
576
622
  }
577
623
  try {
578
624
  const { deployOptions, appId } = this._resolvedInputs;
579
- const isPreview = (deployOptions === null || deployOptions === void 0 ? void 0 : deployOptions.mode) === lowcode_builder_1.DEPLOY_MODE.PREVIEW;
580
- const link = (0, lowcode_builder_1.buildAsAdminPortalByBuildType)(this._resolvedInputs.buildTypeList)
625
+ const isPreview = (deployOptions === null || deployOptions === void 0 ? void 0 : deployOptions.mode) === types_1.DEPLOY_MODE.PREVIEW;
626
+ const link = (0, common_2.buildAsAdminPortalByBuildType)(this._resolvedInputs.buildTypeList)
581
627
  ? `https://${this._website.cdnDomain}/adminportal/#/app/${isPreview ? `${appId}-preview` : appId}?envType=${isPreview ? 'preview' : 'prod'}`
582
628
  : this._gatewayConfig
583
629
  ? `https://${this._gatewayConfig.Domain + this._gatewayConfig.Path}`
@@ -623,7 +669,7 @@ class LowCodePlugin extends framework_core_1.Plugin {
623
669
  if (this._resolvedInputs.debug) {
624
670
  yield this._debugInfo();
625
671
  }
626
- if (this._resolvedInputs.runtime === lowcode_builder_1.RUNTIME.CI) {
672
+ if (this._resolvedInputs.runtime === types_1.RUNTIME.CI) {
627
673
  yield this._handleCIProduct();
628
674
  yield this._postPersistentDependiences();
629
675
  }
@@ -825,8 +871,8 @@ class LowCodePlugin extends framework_core_1.Plugin {
825
871
  SecretId: credential === null || credential === void 0 ? void 0 : credential.secretId,
826
872
  SecretKey: credential === null || credential === void 0 ? void 0 : credential.secretKey,
827
873
  });
828
- promises = Object.keys(lowcode_builder_1.PERSISTENT_DEPENDIENCES_MAP).map((key) => __awaiter(this, void 0, void 0, function* () {
829
- let meta = lowcode_builder_1.PERSISTENT_DEPENDIENCES_MAP[key];
874
+ promises = Object.keys(exports.PERSISTENT_DEPENDIENCES_MAP).map((key) => __awaiter(this, void 0, void 0, function* () {
875
+ let meta = exports.PERSISTENT_DEPENDIENCES_MAP[key];
830
876
  const zipPath = path_1.default.join(this.api.projectPath, `${meta.name}@${meta.version}.zip`);
831
877
  try {
832
878
  yield this._zipDir(meta.source, zipPath);
@@ -889,10 +935,10 @@ class LowCodePlugin extends framework_core_1.Plugin {
889
935
  _postProcessAdminPortal() {
890
936
  var _a, _b;
891
937
  return __awaiter(this, void 0, void 0, function* () {
892
- const { buildTypeList } = this._resolvedInputs;
893
- if ((0, lowcode_builder_1.buildAsAdminPortalByBuildType)(buildTypeList)) {
938
+ const { appId, buildTypeList, mainAppSerializeData, deployOptions } = this._resolvedInputs;
939
+ if ((0, common_2.buildAsAdminPortalByBuildType)(buildTypeList)) {
894
940
  try {
895
- 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) {
941
+ 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) {
896
942
  yield this.api.cloudbaseManager.commonService('lowcode', '2021-01-08').call({
897
943
  Action: 'PublishAppCustomUrl',
898
944
  Param: {
@@ -948,7 +994,7 @@ class LowCodePlugin extends framework_core_1.Plugin {
948
994
  return arr;
949
995
  }, []);
950
996
  if (this._gatewayConfig) {
951
- (_a = this._resolvedInputs.mainAppSerializeData.items) === null || _a === void 0 ? void 0 : _a.forEach((page) => {
997
+ (_a = this._resolvedInputs.mainAppSerializeData.pageInstanceList) === null || _a === void 0 ? void 0 : _a.forEach((page) => {
952
998
  rules.push({
953
999
  keyPrefixEquals: `${path.slice(1)}${page.id}`,
954
1000
  replaceKeyWith: path,
@@ -966,7 +1012,7 @@ class LowCodePlugin extends framework_core_1.Plugin {
966
1012
  }));
967
1013
  yield Promise.all(modifyDomainConfigPromises);
968
1014
  yield Promise.all([
969
- ((_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
1015
+ ((_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
970
1016
  ? this.api.cloudbaseManager
971
1017
  .commonService('lowcode', '2021-01-08')
972
1018
  .call({
@@ -997,8 +1043,9 @@ class LowCodePlugin extends framework_core_1.Plugin {
997
1043
  });
998
1044
  }
999
1045
  _checkBroswerHisroty() {
1000
- let historyType = this._resolvedInputs.mainAppSerializeData.extra.historyType ? lowcode_builder_1.HISTORY_TYPE.HASH : '';
1001
- return !historyType || historyType === lowcode_builder_1.HISTORY_TYPE.BROWSER;
1046
+ var _a;
1047
+ let historyType = ((_a = this._resolvedInputs.mainAppSerializeData) === null || _a === void 0 ? void 0 : _a.historyType) ? types_1.HISTORY_TYPE.HASH : '';
1048
+ return !historyType || historyType === types_1.HISTORY_TYPE.BROWSER;
1002
1049
  }
1003
1050
  }
1004
1051
  function resolveInputs(inputs, defaultInputs) {
@@ -1,4 +1,4 @@
1
- import { IWebRuntimeAppData } from '@cloudbase/lowcode-generator/lib/weapps-core';
1
+ import { IWebRuntimeAppData } from 'src/weapps-core';
2
2
  export declare const CLOUD_FUNCTION_TYPE = "cloud-function";
3
3
  export declare const EXTERNAL_FUNCTION_TYPE = "http";
4
4
  export declare const DATABASE_TYPE = "database";
@@ -1 +1 @@
1
- {"version":3,"file":"dataSource.d.ts","sourceRoot":"","sources":["../../src/utils/dataSource.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,kBAAkB,EAEnB,MAAM,8CAA8C,CAAC;AAMtD,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,iBAIvD;AAMD,wBAAgB,iBAAiB,CAAC,GAAG,IAAI,OAAA,MAexC;AAmBD,wBAAgB,YAAY,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,GAAG,CAU1D;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D,wBAAgB,qBAAqB,CAAC,WAAW,KAAA,OAehD;AAOD,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,kBAAkB;;EAU7D;AAiCD,wBAAgB,kBAAkB,CAChC,WAAW,EAAE;IACX,OAAO,CAAC,EAAE,GAAG,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,gBAAgB,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,GAAG,CAAA;KAAE,EAAE,CAAC;CACxC,EACD,IAAI,CAAC,EAAE;IACL,OAAO,CAAC,EAAE,GAAG,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,gBAAgB,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,GAAG,CAAA;KAAE,EAAE,CAAC;CACxC,EAAE,MAiBJ"}
@@ -5,20 +5,20 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.getDatasetProfiles = exports.getDataVarProfiles = exports.getDatasourceProfiles = exports.standardizeDataSource = exports.lowercaseKey = exports.mergeDependencies = exports.getDatasourceDatabaseName = exports.getAppDatasourceResourceName = exports.getDatasourceResourceName = exports.DATABASE_TYPE = exports.EXTERNAL_FUNCTION_TYPE = exports.CLOUD_FUNCTION_TYPE = void 0;
7
7
  const merge_package_json_1 = __importDefault(require("merge-package-json"));
8
- const lowcode_builder_1 = require("@cloudbase/lowcode-builder");
9
- const cals_1 = require("@cloudbase/cals");
10
- const util_1 = require("@cloudbase/lowcode-builder/lib/builder/mp/util");
11
- const index_1 = require("@cloudbase/lowcode-builder/lib/builder/config/index");
8
+ const types_1 = require("../types");
9
+ const expression_1 = require("@cloudbase/cals/lib/parser/expression");
10
+ const util_1 = require("../builder/mp/util");
11
+ const config_1 = require("../builder/config");
12
12
  exports.CLOUD_FUNCTION_TYPE = 'cloud-function';
13
13
  exports.EXTERNAL_FUNCTION_TYPE = 'http';
14
14
  exports.DATABASE_TYPE = 'database';
15
15
  function getDatasourceResourceName(datasrouce, mode) {
16
- let suffix = mode === lowcode_builder_1.DEPLOY_MODE.PREVIEW ? `-preview` : '';
16
+ let suffix = mode === types_1.DEPLOY_MODE.PREVIEW ? `-preview` : '';
17
17
  return `lcap-${datasrouce.id}-${datasrouce.name}${suffix}`;
18
18
  }
19
19
  exports.getDatasourceResourceName = getDatasourceResourceName;
20
20
  function getAppDatasourceResourceName(appId, datasrouce, mode) {
21
- let suffix = mode === lowcode_builder_1.DEPLOY_MODE.PREVIEW ? `-preview` : '';
21
+ let suffix = mode === types_1.DEPLOY_MODE.PREVIEW ? `-preview` : '';
22
22
  return `lcap-${datasrouce.id}-${datasrouce.name}-${appId}${suffix}`;
23
23
  }
24
24
  exports.getAppDatasourceResourceName = getAppDatasourceResourceName;
@@ -136,13 +136,13 @@ function _generateDynamicDataset(dataset) {
136
136
  let processed = {};
137
137
  for (let paramKey in params) {
138
138
  let bind = params[paramKey];
139
- if (!bind.type || bind.type === cals_1.PropBindType.static) {
139
+ if (!bind.type || bind.type === expression_1.PropBindType.static) {
140
140
  let value = bind.value;
141
- processed[paramKey] = `${index_1.REPLACE_SIGN}(app, $page) => (${typeof value === 'string' ? `'${value}'` : JSON.stringify(value)})${index_1.REPLACE_SIGN}`;
141
+ processed[paramKey] = `${config_1.REPLACE_SIGN}(app, $page) => (${typeof value === 'string' ? `'${value}'` : JSON.stringify(value)})${config_1.REPLACE_SIGN}`;
142
142
  }
143
143
  else {
144
144
  let jsExp = (0, util_1.generateDataBind)(bind);
145
- processed[paramKey] = `${index_1.REPLACE_SIGN}(app, $page) => (\n${jsExp || 'undefined'}\n)${index_1.REPLACE_SIGN}`;
145
+ processed[paramKey] = `${config_1.REPLACE_SIGN}(app, $page) => (\n${jsExp || 'undefined'}\n)${config_1.REPLACE_SIGN}`;
146
146
  }
147
147
  }
148
148
  config.initMethod.params = processed;
@@ -162,8 +162,7 @@ function getDatasetProfiles(mainAppData, apps) {
162
162
  (_a = app.pageInstanceList) === null || _a === void 0 ? void 0 : _a.forEach((pageInstance) => {
163
163
  let p = pageInstance;
164
164
  if (p.dataset) {
165
- result[app.rootPath ? `${app.rootPath}/${p.id}` : p.id] =
166
- _generateDynamicDataset(p.dataset);
165
+ result[app.rootPath ? `${app.rootPath}/${p.id}` : p.id] = _generateDynamicDataset(p.dataset);
167
166
  }
168
167
  });
169
168
  });
@@ -1 +1 @@
1
- {"version":3,"file":"postProcess.d.ts","sourceRoot":"","sources":["../../src/utils/postProcess.ts"],"names":[],"mappings":"AAIA,wBAAgB,wBAAwB,CAAC,eAAe,KAAA,EAAE,IAAI,KAAA,QAI7D;AAED,wBAAgB,0BAA0B,CAAC,WAAW,KAAA,EAAE,aAAa,KAAA,QAkBpE"}
1
+ {"version":3,"file":"postProcess.d.ts","sourceRoot":"","sources":["../../src/utils/postProcess.ts"],"names":[],"mappings":"AAKA,wBAAgB,wBAAwB,CAAC,eAAe,KAAA,EAAE,IAAI,KAAA,QAI7D;AAED,wBAAgB,0BAA0B,CAAC,WAAW,KAAA,EAAE,aAAa,KAAA,QAkBpE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudbase/framework-plugin-low-code",
3
- "version": "0.7.22",
3
+ "version": "0.7.23",
4
4
  "description": "云开发 Tencent CloudBase Framework Low Code Plugin,将低码配置生成完整项目并一键部署云开发资源。",
5
5
  "author": "yhsunshining@gmail.com",
6
6
  "homepage": "https://github.com/TencentCloudBase/cloudbase-framework#readme",
@@ -87,4 +87,4 @@
87
87
  "jest": "^26.0.1",
88
88
  "typescript": "^3.8.3"
89
89
  }
90
- }
90
+ }