@cloudbase/framework-plugin-low-code 0.7.21 → 0.7.22
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/mp/index.d.ts +2 -2
- package/lib/builder/mp/index.d.ts.map +1 -1
- package/lib/builder/mp/index.js +3 -3
- package/lib/generate.d.ts +1 -1
- package/lib/generate.d.ts.map +1 -1
- package/lib/generate.js +4 -5
- package/lib/index.d.ts +3 -5
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +77 -124
- package/lib/utils/dataSource.d.ts +1 -1
- package/lib/utils/dataSource.d.ts.map +1 -1
- package/lib/utils/dataSource.js +11 -10
- package/lib/utils/postProcess.d.ts.map +1 -1
- package/package.json +1 -1
- package/template/html/index.html.ejs +1 -1
- package/template/mp/package.json +1 -1
- package/template/package.json +2 -1
- package/template/src/handlers/lifecycle.js +5 -5
- package/template/webpack/getCSSModuleLocalIdent.js +28 -0
- package/template/webpack/web.prod.js +9 -5
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { IMaterialItem, IWeAppData, IPlugin } from '
|
|
1
|
+
import { IMaterialItem, IWeAppData, IPlugin } from '@cloudbase/lowcode-generator/lib/weapps-core';
|
|
2
2
|
import { IBuildContext } from './BuildContext';
|
|
3
3
|
import { DEPLOY_MODE } from '../../types';
|
|
4
|
-
import { BuildType, IAppUsedComp, IUsedComps } from '
|
|
4
|
+
import { BuildType, IAppUsedComp, IUsedComps } from '@cloudbase/lowcode-builder';
|
|
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,
|
|
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;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"}
|
package/lib/builder/mp/index.js
CHANGED
|
@@ -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("
|
|
39
|
+
const weapps_core_1 = require("@cloudbase/lowcode-generator/lib/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
|
|
55
|
+
const lowcode_builder_1 = require("@cloudbase/lowcode-builder");
|
|
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,
|
|
110
|
+
isAdminPortal: (0, lowcode_builder_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
package/lib/generate.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../src/generate.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,
|
|
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"}
|
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("
|
|
19
|
-
const
|
|
18
|
+
const webpack_1 = require("@cloudbase/lowcode-builder/lib/builder/service/webpack");
|
|
19
|
+
const mp_1 = require("@cloudbase/lowcode-builder/lib/builder/util/mp");
|
|
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,8 +30,7 @@ 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] =
|
|
34
|
-
sourcePkgJson.dependencies[plugin.module];
|
|
33
|
+
buildPkgJson.dependencies[plugin.module] = sourcePkgJson.dependencies[plugin.module];
|
|
35
34
|
});
|
|
36
35
|
fs_extra_1.default.writeJsonSync(mpBuildPkgJsonPath, buildPkgJson, { spaces: 2 });
|
|
37
36
|
console.log('小程序安装依赖', appBuildMpDir);
|
|
@@ -45,6 +44,6 @@ function mergeSubPackagesApp(baseAppJsonPath, mergeAppJsonPath) {
|
|
|
45
44
|
if (!mergeJson.subpackages)
|
|
46
45
|
return;
|
|
47
46
|
const newJson = Object.assign({}, baseJson);
|
|
48
|
-
newJson.subpackages = (0,
|
|
47
|
+
newJson.subpackages = (0, mp_1.mergeSubPackages)(baseJson.subpackages, mergeJson.subpackages);
|
|
49
48
|
fs_extra_1.default.writeJSONSync(baseAppJsonPath, newJson, { spaces: 2 });
|
|
50
49
|
}
|
package/lib/index.d.ts
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
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 } from '
|
|
5
|
-
import { IMaterialItem, IPlugin } from '
|
|
6
|
-
import { DEPLOY_MODE, RUNTIME } from './types';
|
|
7
|
-
export * as generator from './generator/core/index';
|
|
4
|
+
import { BuildType, GenerateMpType, DEPLOY_MODE, RUNTIME } from '@cloudbase/lowcode-builder';
|
|
5
|
+
import { IMaterialItem, IPlugin } from '@cloudbase/lowcode-generator/lib/weapps-core';
|
|
8
6
|
export declare const DIST_PATH = "./dist";
|
|
9
|
-
export declare const PERSISTENT_DEPENDIENCES_MAP: {};
|
|
10
7
|
declare const DEFAULT_INPUTS: {
|
|
11
8
|
_inputFile: string;
|
|
12
9
|
debug: boolean;
|
|
@@ -119,4 +116,5 @@ declare class LowCodePlugin extends Plugin {
|
|
|
119
116
|
_checkBroswerHisroty(): boolean;
|
|
120
117
|
}
|
|
121
118
|
export declare const plugin: typeof LowCodePlugin;
|
|
119
|
+
export {};
|
|
122
120
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.d.ts.map
CHANGED
|
@@ -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;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"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"}
|
package/lib/index.js
CHANGED
|
@@ -42,17 +42,14 @@ 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.
|
|
45
|
+
exports.plugin = exports.DIST_PATH = 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
|
|
53
|
-
const common_1 = require("./utils/common");
|
|
54
|
-
const core_1 = __importDefault(require("./builder/core"));
|
|
55
|
-
const common_2 = require("./builder/types/common");
|
|
52
|
+
const lowcode_builder_1 = require("@cloudbase/lowcode-builder");
|
|
56
53
|
const generate_1 = require("./generate");
|
|
57
54
|
const postProcess_1 = require("./utils/postProcess");
|
|
58
55
|
const lodash_1 = require("lodash");
|
|
@@ -61,11 +58,8 @@ const cos_nodejs_sdk_v5_1 = __importDefault(require("cos-nodejs-sdk-v5"));
|
|
|
61
58
|
const mpci = __importStar(require("miniprogram-ci"));
|
|
62
59
|
const qrcode_1 = __importDefault(require("qrcode"));
|
|
63
60
|
const url_1 = __importDefault(require("url"));
|
|
64
|
-
const
|
|
65
|
-
const config_1 = require("./generator/config");
|
|
66
|
-
exports.generator = __importStar(require("./generator/core/index"));
|
|
61
|
+
const private_1 = require("./config/private");
|
|
67
62
|
exports.DIST_PATH = './dist';
|
|
68
|
-
exports.PERSISTENT_DEPENDIENCES_MAP = {};
|
|
69
63
|
const DEBUG_PATH = './debug';
|
|
70
64
|
const QRCODE_PATH = './qrcode.jpg';
|
|
71
65
|
const LOG_FILE = 'build.log';
|
|
@@ -74,10 +68,10 @@ const DEFAULT_CLOUDFUNCTION_ROOT_PATH = path_1.default.join(DEFAULT_CLOUDFUNCTIO
|
|
|
74
68
|
const DEFAULT_INPUTS = {
|
|
75
69
|
_inputFile: 'input.json',
|
|
76
70
|
debug: false,
|
|
77
|
-
runtime: process.env.CLOUDBASE_CIID ?
|
|
71
|
+
runtime: process.env.CLOUDBASE_CIID ? lowcode_builder_1.RUNTIME.CI : lowcode_builder_1.RUNTIME.NONE,
|
|
78
72
|
appId: 'test',
|
|
79
|
-
buildTypeList: [
|
|
80
|
-
generateMpType:
|
|
73
|
+
buildTypeList: [lowcode_builder_1.BuildType.MP],
|
|
74
|
+
generateMpType: lowcode_builder_1.GenerateMpType.APP,
|
|
81
75
|
generateMpPath: '',
|
|
82
76
|
subAppSerializeDataList: [],
|
|
83
77
|
dependencies: [],
|
|
@@ -87,7 +81,7 @@ const DEFAULT_INPUTS = {
|
|
|
87
81
|
mpAppId: '',
|
|
88
82
|
mpDeployPrivateKey: process.env.mpDeployPrivateKey || '',
|
|
89
83
|
deployOptions: {
|
|
90
|
-
mode: process.env.deployMode ||
|
|
84
|
+
mode: process.env.deployMode || lowcode_builder_1.DEPLOY_MODE.PREVIEW,
|
|
91
85
|
},
|
|
92
86
|
calsVersion: 'latest',
|
|
93
87
|
ignoreInstall: false,
|
|
@@ -118,62 +112,35 @@ class LowCodePlugin extends framework_core_1.Plugin {
|
|
|
118
112
|
}
|
|
119
113
|
return list;
|
|
120
114
|
}, []);
|
|
121
|
-
if (this.
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
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);
|
|
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;
|
|
156
123
|
}
|
|
157
124
|
}
|
|
158
|
-
if (!((_b = this._resolvedInputs.mainAppSerializeData) === null || _b === void 0 ? void 0 : _b.envId)) {
|
|
159
|
-
this._resolvedInputs.mainAppSerializeData.envId = envId;
|
|
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;
|
|
160
127
|
}
|
|
161
|
-
if ((0,
|
|
128
|
+
if ((0, lowcode_builder_1.buildAsWebByBuildType)(this._resolvedInputs.buildTypeList)) {
|
|
162
129
|
const { appId, mainAppSerializeData } = this._resolvedInputs;
|
|
163
|
-
let { appConfig = {} } = mainAppSerializeData;
|
|
130
|
+
let { appConfig = {} } = mainAppSerializeData.extra;
|
|
164
131
|
let { window = {} } = appConfig;
|
|
165
132
|
let path = this._getWebRootPath();
|
|
166
133
|
window.publicPath = path;
|
|
167
|
-
window.basename = (0,
|
|
168
|
-
? `app/${appId}${((_c = this._resolvedInputs.deployOptions) === null || _c === void 0 ? void 0 : _c.mode) !==
|
|
169
|
-
: (0,
|
|
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)
|
|
170
137
|
? '/'
|
|
171
138
|
: path;
|
|
172
139
|
appConfig.window = window;
|
|
173
|
-
this._resolvedInputs.mainAppSerializeData.appConfig = appConfig;
|
|
140
|
+
this._resolvedInputs.mainAppSerializeData.extra.appConfig = appConfig;
|
|
174
141
|
this._resolvedInputs.subAppSerializeDataList = [];
|
|
175
|
-
if (this._resolvedInputs.mainAppSerializeData.miniprogramPlugins) {
|
|
176
|
-
this._resolvedInputs.mainAppSerializeData.miniprogramPlugins = [];
|
|
142
|
+
if (this._resolvedInputs.mainAppSerializeData.extra.miniprogramPlugins) {
|
|
143
|
+
this._resolvedInputs.mainAppSerializeData.extra.miniprogramPlugins = [];
|
|
177
144
|
}
|
|
178
145
|
}
|
|
179
146
|
else {
|
|
@@ -198,7 +165,7 @@ class LowCodePlugin extends framework_core_1.Plugin {
|
|
|
198
165
|
}
|
|
199
166
|
_subPluginConstructor(resolveInputs) {
|
|
200
167
|
var _a, _b;
|
|
201
|
-
if (resolveInputs.runtime ===
|
|
168
|
+
if (resolveInputs.runtime === lowcode_builder_1.RUNTIME.CLI) {
|
|
202
169
|
return;
|
|
203
170
|
}
|
|
204
171
|
let { buildTypeList, deployOptions } = resolveInputs;
|
|
@@ -218,7 +185,7 @@ class LowCodePlugin extends framework_core_1.Plugin {
|
|
|
218
185
|
},
|
|
219
186
|
],
|
|
220
187
|
});
|
|
221
|
-
if (buildTypeList.includes(
|
|
188
|
+
if (buildTypeList.includes(lowcode_builder_1.BuildType.MP)) {
|
|
222
189
|
if (deployOptions.mpDeployPrivateKey) {
|
|
223
190
|
fs_extra_1.default.writeFileSync(path_1.default.join(this.api.projectPath, `./private.${deployOptions.mpAppId}.key`), deployOptions.mpDeployPrivateKey, 'base64');
|
|
224
191
|
}
|
|
@@ -235,7 +202,7 @@ class LowCodePlugin extends framework_core_1.Plugin {
|
|
|
235
202
|
privateKeyPath: `./private.${deployOptions.mpAppId}.key`,
|
|
236
203
|
localPath: exports.DIST_PATH,
|
|
237
204
|
ignores: ['node_modules/**/*', LOG_FILE].concat(cloudfunctionRoot ? [path_1.default.join(cloudfunctionRoot, '**/*')] : []),
|
|
238
|
-
deployMode: deployOptions.mpAppId === deployOptions.targetMpAppId ? deployOptions.mode :
|
|
205
|
+
deployMode: deployOptions.mpAppId === deployOptions.targetMpAppId ? deployOptions.mode : lowcode_builder_1.DEPLOY_MODE.UPLOAD,
|
|
239
206
|
uploadOptions: {
|
|
240
207
|
version: (deployOptions === null || deployOptions === void 0 ? void 0 : deployOptions.version) || '1.0.0',
|
|
241
208
|
desc: (deployOptions === null || deployOptions === void 0 ? void 0 : deployOptions.description) || '',
|
|
@@ -248,7 +215,7 @@ class LowCodePlugin extends framework_core_1.Plugin {
|
|
|
248
215
|
},
|
|
249
216
|
});
|
|
250
217
|
}
|
|
251
|
-
else if ((0,
|
|
218
|
+
else if ((0, lowcode_builder_1.buildAsWebByBuildType)(buildTypeList)) {
|
|
252
219
|
this._webPlugin = new framework_plugin_website_1.plugin('web', this.api, {
|
|
253
220
|
outputPath: exports.DIST_PATH,
|
|
254
221
|
cloudPath: this._getWebRootPath(),
|
|
@@ -258,7 +225,7 @@ class LowCodePlugin extends framework_core_1.Plugin {
|
|
|
258
225
|
}
|
|
259
226
|
_getWebRootPath() {
|
|
260
227
|
let { appId, deployOptions } = this._resolvedInputs;
|
|
261
|
-
return (deployOptions === null || deployOptions === void 0 ? void 0 : deployOptions.mode) ===
|
|
228
|
+
return (deployOptions === null || deployOptions === void 0 ? void 0 : deployOptions.mode) === lowcode_builder_1.DEPLOY_MODE.PREVIEW ? `/${appId}/preview/` : `/${appId}/production/`;
|
|
262
229
|
}
|
|
263
230
|
_time(label) {
|
|
264
231
|
if (!this._timeMap[label]) {
|
|
@@ -289,17 +256,10 @@ class LowCodePlugin extends framework_core_1.Plugin {
|
|
|
289
256
|
return __awaiter(this, void 0, void 0, function* () {
|
|
290
257
|
let { logger } = this.api;
|
|
291
258
|
const staticDir = path_1.default.resolve(__dirname, '../../../static');
|
|
292
|
-
let { debug, mainAppSerializeData, subAppSerializeDataList, dependencies, appId, buildTypeList, generateMpType,
|
|
293
|
-
const webpackMode = ((_a = this._resolvedInputs.deployOptions) === null || _a === void 0 ? void 0 : _a.mode) ===
|
|
294
|
-
?
|
|
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)();
|
|
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;
|
|
303
263
|
let miniAppDir = '';
|
|
304
264
|
let webAppDir = '';
|
|
305
265
|
const h5url = `./${appId}/index.html`;
|
|
@@ -318,14 +278,14 @@ class LowCodePlugin extends framework_core_1.Plugin {
|
|
|
318
278
|
throw e;
|
|
319
279
|
}
|
|
320
280
|
const domain = ((_b = this._website) === null || _b === void 0 ? void 0 : _b.cdnDomain) || ((_c = mainAppSerializeData.extra) === null || _c === void 0 ? void 0 : _c.domain);
|
|
321
|
-
if ((0,
|
|
322
|
-
let { appConfig = {} } = mainAppSerializeData;
|
|
281
|
+
if ((0, lowcode_builder_1.buildAsWebByBuildType)(buildTypeList)) {
|
|
282
|
+
let { appConfig = {} } = mainAppSerializeData.extra;
|
|
323
283
|
let { window = {} } = appConfig;
|
|
324
|
-
if ((0,
|
|
284
|
+
if ((0, lowcode_builder_1.buildAsXPageByBuildType)(buildTypeList)) {
|
|
325
285
|
window.publicPath =
|
|
326
286
|
((_d = this._resolvedInputs.deployOptions) === null || _d === void 0 ? void 0 : _d.publicPath) || `https://${domain}${this._getWebRootPath()}`;
|
|
327
287
|
}
|
|
328
|
-
else if (this._resolvedInputs.deployOptions.mode ===
|
|
288
|
+
else if (this._resolvedInputs.deployOptions.mode === lowcode_builder_1.DEPLOY_MODE.UPLOAD) {
|
|
329
289
|
try {
|
|
330
290
|
const { Data = {} } = yield this.api.cloudbaseManager.commonService('lowcode', '2021-01-08').call({
|
|
331
291
|
Action: 'DescribeAppCustomUrls',
|
|
@@ -340,7 +300,7 @@ class LowCodePlugin extends framework_core_1.Plugin {
|
|
|
340
300
|
if (this._gatewayConfig) {
|
|
341
301
|
const path = this._gatewayConfig.Path;
|
|
342
302
|
window.publicPath = `https://${domain}${this._getWebRootPath()}`;
|
|
343
|
-
if (!(0,
|
|
303
|
+
if (!(0, lowcode_builder_1.buildAsAdminPortalByBuildType)(buildTypeList)) {
|
|
344
304
|
window.basename = path;
|
|
345
305
|
}
|
|
346
306
|
}
|
|
@@ -354,7 +314,7 @@ class LowCodePlugin extends framework_core_1.Plugin {
|
|
|
354
314
|
}
|
|
355
315
|
}
|
|
356
316
|
appConfig.window = window;
|
|
357
|
-
this._resolvedInputs.mainAppSerializeData.appConfig = appConfig;
|
|
317
|
+
this._resolvedInputs.mainAppSerializeData.extra.appConfig = appConfig;
|
|
358
318
|
}
|
|
359
319
|
try {
|
|
360
320
|
if (!debug) {
|
|
@@ -362,50 +322,44 @@ class LowCodePlugin extends framework_core_1.Plugin {
|
|
|
362
322
|
}
|
|
363
323
|
this._time("build process");
|
|
364
324
|
this._appPath = yield new Promise((resolve, reject) => {
|
|
365
|
-
var _a, _b;
|
|
366
325
|
try {
|
|
367
|
-
(0,
|
|
368
|
-
mainAppSerializeData,
|
|
369
|
-
subAppSerializeDataList,
|
|
326
|
+
(0, lowcode_builder_1.buildWedaApp)({
|
|
327
|
+
cals: mainAppSerializeData,
|
|
328
|
+
subAppCalsList: subAppSerializeDataList,
|
|
370
329
|
dependencies,
|
|
371
330
|
appKey: appId,
|
|
372
|
-
nodeModulesPath,
|
|
373
|
-
buildTypeList,
|
|
374
331
|
runtime: this._resolvedInputs.runtime,
|
|
375
332
|
ignoreInstall: this._resolvedInputs.ignoreInstall,
|
|
333
|
+
buildTypeList,
|
|
376
334
|
mode: webpackMode,
|
|
377
|
-
|
|
378
|
-
watch: false,
|
|
335
|
+
deployOptions: this._resolvedInputs.deployOptions,
|
|
379
336
|
generateMpType,
|
|
380
|
-
generateMpPath,
|
|
381
|
-
isCleanDistDir: false,
|
|
382
337
|
plugins,
|
|
383
338
|
extraData,
|
|
384
|
-
|
|
385
|
-
resourceAppid: this._resolvedInputs.mpAppId,
|
|
339
|
+
resourceAppId: this._resolvedInputs.mpAppId,
|
|
386
340
|
domain,
|
|
387
341
|
}, (err, result) => __awaiter(this, void 0, void 0, function* () {
|
|
388
|
-
var
|
|
342
|
+
var _a;
|
|
389
343
|
if (!err) {
|
|
390
344
|
try {
|
|
391
|
-
const { appConfig = {} } = mainAppSerializeData;
|
|
345
|
+
const { appConfig = {} } = mainAppSerializeData.extra;
|
|
392
346
|
const { publicPath = '' } = (appConfig === null || appConfig === void 0 ? void 0 : appConfig.window) || {};
|
|
393
347
|
const { outDir = '', timeElapsed = 0, plugins } = result || {};
|
|
394
|
-
if (buildTypeList.includes(
|
|
348
|
+
if (buildTypeList.includes(lowcode_builder_1.BuildType.MP)) {
|
|
395
349
|
miniAppDir = outDir;
|
|
396
350
|
}
|
|
397
|
-
if ((0,
|
|
351
|
+
if ((0, lowcode_builder_1.buildAsWebByBuildType)(buildTypeList)) {
|
|
398
352
|
webAppDir = path_1.default.resolve(outDir, 'preview');
|
|
399
353
|
}
|
|
400
354
|
logger.debug(`=== Compilation finished at ${outDir}, elapsed time: ${timeElapsed / 1000}s.===\n`);
|
|
401
|
-
if (buildTypeList.includes(
|
|
355
|
+
if (buildTypeList.includes(lowcode_builder_1.BuildType.MP) && miniAppDir) {
|
|
402
356
|
let projectJsonPath = path_1.default.resolve(miniAppDir, 'project.config.json');
|
|
403
357
|
yield (0, postProcess_1.postprocessProjectConfig)(projectJsonPath, {
|
|
404
358
|
appid: this._resolvedInputs.deployOptions.mpAppId,
|
|
405
359
|
cloudfunctionRoot: undefined,
|
|
406
360
|
});
|
|
407
361
|
yield (0, postProcess_1.postprocessDeployExtraJson)(miniAppDir, this._resolvedInputs.deployOptions);
|
|
408
|
-
if (generateMpType ===
|
|
362
|
+
if (generateMpType === lowcode_builder_1.GenerateMpType.APP) {
|
|
409
363
|
fs_extra_1.default.removeSync(path_1.default.resolve(miniAppDir, 'miniprogram_npm'));
|
|
410
364
|
}
|
|
411
365
|
if (outDir) {
|
|
@@ -414,7 +368,7 @@ class LowCodePlugin extends framework_core_1.Plugin {
|
|
|
414
368
|
}
|
|
415
369
|
}
|
|
416
370
|
}
|
|
417
|
-
else if ((0,
|
|
371
|
+
else if ((0, lowcode_builder_1.buildAsWebByBuildType)(buildTypeList) && webAppDir) {
|
|
418
372
|
const staticAppDir = path_1.default.join(staticDir, publicPath);
|
|
419
373
|
fs_extra_1.default.ensureDirSync(staticAppDir);
|
|
420
374
|
}
|
|
@@ -424,10 +378,10 @@ class LowCodePlugin extends framework_core_1.Plugin {
|
|
|
424
378
|
}
|
|
425
379
|
else if (webAppDir) {
|
|
426
380
|
fs_extra_1.default.copySync(webAppDir, distPath);
|
|
427
|
-
if ((0,
|
|
428
|
-
!(0,
|
|
381
|
+
if ((0, lowcode_builder_1.buildAsWebByBuildType)(buildTypeList) &&
|
|
382
|
+
!(0, lowcode_builder_1.buildAsAdminPortalByBuildType)(buildTypeList) &&
|
|
429
383
|
this._checkBroswerHisroty()) {
|
|
430
|
-
yield Promise.all((((
|
|
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'))));
|
|
431
385
|
}
|
|
432
386
|
}
|
|
433
387
|
resolve(distPath);
|
|
@@ -441,7 +395,7 @@ class LowCodePlugin extends framework_core_1.Plugin {
|
|
|
441
395
|
if (err.length) {
|
|
442
396
|
let messageList = (err[0] || '').split('\n');
|
|
443
397
|
let lineIndex = 0;
|
|
444
|
-
let reg = /node_modules
|
|
398
|
+
let reg = /node_modules\/@babel/;
|
|
445
399
|
messageList.find((str, index) => {
|
|
446
400
|
if (reg.test(str)) {
|
|
447
401
|
lineIndex = index;
|
|
@@ -495,7 +449,7 @@ class LowCodePlugin extends framework_core_1.Plugin {
|
|
|
495
449
|
if (debug) {
|
|
496
450
|
yield this._debugInfo();
|
|
497
451
|
}
|
|
498
|
-
if (this._resolvedInputs.runtime ===
|
|
452
|
+
if (this._resolvedInputs.runtime === lowcode_builder_1.RUNTIME.CI) {
|
|
499
453
|
yield this._handleCIProduct();
|
|
500
454
|
}
|
|
501
455
|
logger.info(`low-code build fail: ${e}`);
|
|
@@ -524,7 +478,7 @@ class LowCodePlugin extends framework_core_1.Plugin {
|
|
|
524
478
|
if (this._miniprogramePlugin) {
|
|
525
479
|
res = (0, lodash_1.merge)(res, yield this._miniprogramePlugin.compile());
|
|
526
480
|
}
|
|
527
|
-
else if ((0,
|
|
481
|
+
else if ((0, lowcode_builder_1.buildAsWebByBuildType)(this._resolvedInputs.buildTypeList) && this._webPlugin) {
|
|
528
482
|
try {
|
|
529
483
|
const HostingProvider = (_a = this.api.resourceProviders) === null || _a === void 0 ? void 0 : _a.hosting;
|
|
530
484
|
const { envId } = this.api;
|
|
@@ -544,10 +498,10 @@ class LowCodePlugin extends framework_core_1.Plugin {
|
|
|
544
498
|
this.api.logger.error('获取静态托管失败: ', e);
|
|
545
499
|
throw e;
|
|
546
500
|
}
|
|
547
|
-
const privateJsPath = path_1.default.join('/', 'tmp',
|
|
501
|
+
const privateJsPath = path_1.default.join('/', 'tmp', private_1.PRIVATE_JS_NAME);
|
|
548
502
|
try {
|
|
549
503
|
yield fs_extra_1.default.ensureFile(privateJsPath);
|
|
550
|
-
yield fs_extra_1.default.writeFile(privateJsPath,
|
|
504
|
+
yield fs_extra_1.default.writeFile(privateJsPath, private_1.PRIVATE_JS_CODE, {
|
|
551
505
|
encoding: 'utf8',
|
|
552
506
|
flag: 'w',
|
|
553
507
|
});
|
|
@@ -561,7 +515,7 @@ class LowCodePlugin extends framework_core_1.Plugin {
|
|
|
561
515
|
...(this._webPlugin.buildOutput.staticConfig || []),
|
|
562
516
|
{
|
|
563
517
|
src: privateJsPath,
|
|
564
|
-
cloudPath: `/weda-config/${
|
|
518
|
+
cloudPath: `/weda-config/${private_1.PRIVATE_JS_NAME}`,
|
|
565
519
|
},
|
|
566
520
|
];
|
|
567
521
|
yield Promise.all(deployContent.map((options) => this.api.cloudbaseManager.hosting.uploadFiles({
|
|
@@ -580,7 +534,7 @@ class LowCodePlugin extends framework_core_1.Plugin {
|
|
|
580
534
|
if (this._resolvedInputs.debug) {
|
|
581
535
|
yield this._debugInfo();
|
|
582
536
|
}
|
|
583
|
-
if (this._resolvedInputs.runtime ===
|
|
537
|
+
if (this._resolvedInputs.runtime === lowcode_builder_1.RUNTIME.CI) {
|
|
584
538
|
yield this._handleCIProduct();
|
|
585
539
|
}
|
|
586
540
|
throw e;
|
|
@@ -597,7 +551,7 @@ class LowCodePlugin extends framework_core_1.Plugin {
|
|
|
597
551
|
}
|
|
598
552
|
else if (this._webPlugin) {
|
|
599
553
|
yield this._webPlugin.deploy();
|
|
600
|
-
if ((0,
|
|
554
|
+
if ((0, lowcode_builder_1.buildAsAdminPortalByBuildType)(this._resolvedInputs.buildTypeList)) {
|
|
601
555
|
yield this._postProcessAdminPortal();
|
|
602
556
|
}
|
|
603
557
|
else {
|
|
@@ -609,7 +563,7 @@ class LowCodePlugin extends framework_core_1.Plugin {
|
|
|
609
563
|
Param: {
|
|
610
564
|
WeAppId: this._resolvedInputs.appId,
|
|
611
565
|
EnvId: this.api.envId,
|
|
612
|
-
PublishType: this._resolvedInputs.deployOptions.mode ===
|
|
566
|
+
PublishType: this._resolvedInputs.deployOptions.mode === lowcode_builder_1.DEPLOY_MODE.UPLOAD ? 'product' : 'preview',
|
|
613
567
|
},
|
|
614
568
|
});
|
|
615
569
|
this.api.logger.info(`${this.api.emoji('🚀')} custom publish success: ${JSON.stringify(publishAppCustomNavRes)}`);
|
|
@@ -622,8 +576,8 @@ class LowCodePlugin extends framework_core_1.Plugin {
|
|
|
622
576
|
}
|
|
623
577
|
try {
|
|
624
578
|
const { deployOptions, appId } = this._resolvedInputs;
|
|
625
|
-
const isPreview = (deployOptions === null || deployOptions === void 0 ? void 0 : deployOptions.mode) ===
|
|
626
|
-
const link = (0,
|
|
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)
|
|
627
581
|
? `https://${this._website.cdnDomain}/adminportal/#/app/${isPreview ? `${appId}-preview` : appId}?envType=${isPreview ? 'preview' : 'prod'}`
|
|
628
582
|
: this._gatewayConfig
|
|
629
583
|
? `https://${this._gatewayConfig.Domain + this._gatewayConfig.Path}`
|
|
@@ -669,7 +623,7 @@ class LowCodePlugin extends framework_core_1.Plugin {
|
|
|
669
623
|
if (this._resolvedInputs.debug) {
|
|
670
624
|
yield this._debugInfo();
|
|
671
625
|
}
|
|
672
|
-
if (this._resolvedInputs.runtime ===
|
|
626
|
+
if (this._resolvedInputs.runtime === lowcode_builder_1.RUNTIME.CI) {
|
|
673
627
|
yield this._handleCIProduct();
|
|
674
628
|
yield this._postPersistentDependiences();
|
|
675
629
|
}
|
|
@@ -871,8 +825,8 @@ class LowCodePlugin extends framework_core_1.Plugin {
|
|
|
871
825
|
SecretId: credential === null || credential === void 0 ? void 0 : credential.secretId,
|
|
872
826
|
SecretKey: credential === null || credential === void 0 ? void 0 : credential.secretKey,
|
|
873
827
|
});
|
|
874
|
-
promises = Object.keys(
|
|
875
|
-
let meta =
|
|
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];
|
|
876
830
|
const zipPath = path_1.default.join(this.api.projectPath, `${meta.name}@${meta.version}.zip`);
|
|
877
831
|
try {
|
|
878
832
|
yield this._zipDir(meta.source, zipPath);
|
|
@@ -935,10 +889,10 @@ class LowCodePlugin extends framework_core_1.Plugin {
|
|
|
935
889
|
_postProcessAdminPortal() {
|
|
936
890
|
var _a, _b;
|
|
937
891
|
return __awaiter(this, void 0, void 0, function* () {
|
|
938
|
-
const {
|
|
939
|
-
if ((0,
|
|
892
|
+
const { buildTypeList } = this._resolvedInputs;
|
|
893
|
+
if ((0, lowcode_builder_1.buildAsAdminPortalByBuildType)(buildTypeList)) {
|
|
940
894
|
try {
|
|
941
|
-
if (((_b = (_a = this._resolvedInputs) === null || _a === void 0 ? void 0 : _a.deployOptions) === null || _b === void 0 ? void 0 : _b.mode) ===
|
|
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) {
|
|
942
896
|
yield this.api.cloudbaseManager.commonService('lowcode', '2021-01-08').call({
|
|
943
897
|
Action: 'PublishAppCustomUrl',
|
|
944
898
|
Param: {
|
|
@@ -994,7 +948,7 @@ class LowCodePlugin extends framework_core_1.Plugin {
|
|
|
994
948
|
return arr;
|
|
995
949
|
}, []);
|
|
996
950
|
if (this._gatewayConfig) {
|
|
997
|
-
(_a = this._resolvedInputs.mainAppSerializeData.
|
|
951
|
+
(_a = this._resolvedInputs.mainAppSerializeData.items) === null || _a === void 0 ? void 0 : _a.forEach((page) => {
|
|
998
952
|
rules.push({
|
|
999
953
|
keyPrefixEquals: `${path.slice(1)}${page.id}`,
|
|
1000
954
|
replaceKeyWith: path,
|
|
@@ -1012,7 +966,7 @@ class LowCodePlugin extends framework_core_1.Plugin {
|
|
|
1012
966
|
}));
|
|
1013
967
|
yield Promise.all(modifyDomainConfigPromises);
|
|
1014
968
|
yield Promise.all([
|
|
1015
|
-
((_c = (_b = this._resolvedInputs) === null || _b === void 0 ? void 0 : _b.deployOptions) === null || _c === void 0 ? void 0 : _c.mode) ===
|
|
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
|
|
1016
970
|
? this.api.cloudbaseManager
|
|
1017
971
|
.commonService('lowcode', '2021-01-08')
|
|
1018
972
|
.call({
|
|
@@ -1043,9 +997,8 @@ class LowCodePlugin extends framework_core_1.Plugin {
|
|
|
1043
997
|
});
|
|
1044
998
|
}
|
|
1045
999
|
_checkBroswerHisroty() {
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
return !historyType || historyType === types_1.HISTORY_TYPE.BROWSER;
|
|
1000
|
+
let historyType = this._resolvedInputs.mainAppSerializeData.extra.historyType ? lowcode_builder_1.HISTORY_TYPE.HASH : '';
|
|
1001
|
+
return !historyType || historyType === lowcode_builder_1.HISTORY_TYPE.BROWSER;
|
|
1049
1002
|
}
|
|
1050
1003
|
}
|
|
1051
1004
|
function resolveInputs(inputs, defaultInputs) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IWebRuntimeAppData } from '
|
|
1
|
+
import { IWebRuntimeAppData } from '@cloudbase/lowcode-generator/lib/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,
|
|
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;AAOD,wBAAgB,qBAAqB,CAAC,EAAE,EAAE,GAAG,OA6C5C;AAOD,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,MAgBJ"}
|
package/lib/utils/dataSource.js
CHANGED
|
@@ -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
|
|
9
|
-
const
|
|
10
|
-
const util_1 = require("
|
|
11
|
-
const
|
|
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");
|
|
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 ===
|
|
16
|
+
let suffix = mode === lowcode_builder_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 ===
|
|
21
|
+
let suffix = mode === lowcode_builder_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 ===
|
|
139
|
+
if (!bind.type || bind.type === cals_1.PropBindType.static) {
|
|
140
140
|
let value = bind.value;
|
|
141
|
-
processed[paramKey] = `${
|
|
141
|
+
processed[paramKey] = `${index_1.REPLACE_SIGN}(app, $page) => (${typeof value === 'string' ? `'${value}'` : JSON.stringify(value)})${index_1.REPLACE_SIGN}`;
|
|
142
142
|
}
|
|
143
143
|
else {
|
|
144
144
|
let jsExp = (0, util_1.generateDataBind)(bind);
|
|
145
|
-
processed[paramKey] = `${
|
|
145
|
+
processed[paramKey] = `${index_1.REPLACE_SIGN}(app, $page) => (\n${jsExp || 'undefined'}\n)${index_1.REPLACE_SIGN}`;
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
148
|
config.initMethod.params = processed;
|
|
@@ -162,7 +162,8 @@ 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] =
|
|
165
|
+
result[app.rootPath ? `${app.rootPath}/${p.id}` : p.id] =
|
|
166
|
+
_generateDynamicDataset(p.dataset);
|
|
166
167
|
}
|
|
167
168
|
});
|
|
168
169
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"postProcess.d.ts","sourceRoot":"","sources":["../../src/utils/postProcess.ts"],"names":[],"mappings":"
|
|
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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudbase/framework-plugin-low-code",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.22",
|
|
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",
|
|
@@ -436,7 +436,7 @@
|
|
|
436
436
|
></script>
|
|
437
437
|
<script
|
|
438
438
|
crossorigin="anonymous"
|
|
439
|
-
src="https://qbase.cdn-go.cn/lcap/lcap-resource-cdngo/-/release/_npm/@cloudbase/weda-cloud-sdk@1.0.
|
|
439
|
+
src="https://qbase.cdn-go.cn/lcap/lcap-resource-cdngo/-/release/_npm/@cloudbase/weda-cloud-sdk@1.0.12/dist/h5.browser.js"
|
|
440
440
|
></script>
|
|
441
441
|
<script>
|
|
442
442
|
// zxing polifill
|
package/template/mp/package.json
CHANGED
package/template/package.json
CHANGED
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"babel-plugin-import": "^1.13.0",
|
|
37
37
|
"base64-inline-loader": "^1.1.1",
|
|
38
38
|
"copy-webpack-plugin": "^6.2.1",
|
|
39
|
-
"css-loader": "^
|
|
39
|
+
"css-loader": "^5",
|
|
40
40
|
"happypack": "^5.0.1",
|
|
41
41
|
"dart-sass": "^1.24.0",
|
|
42
42
|
"postcss": "^8.3.6",
|
|
@@ -46,6 +46,7 @@
|
|
|
46
46
|
"qiankun": "^2.7.0",
|
|
47
47
|
"less": "^4.0.0",
|
|
48
48
|
"less-loader": "^7.0.1",
|
|
49
|
+
"loader-utils": "^3.2.0",
|
|
49
50
|
"sass-loader": "^8.0.0",
|
|
50
51
|
"terser-webpack-plugin": "^3.0.2",
|
|
51
52
|
"mini-css-extract-plugin": "^0.8.0",
|
|
@@ -139,7 +139,7 @@ export function pageLifeCycleMount(
|
|
|
139
139
|
onTabItemTap,
|
|
140
140
|
},
|
|
141
141
|
app = {},
|
|
142
|
-
extra = {}
|
|
142
|
+
extra = {},
|
|
143
143
|
) {
|
|
144
144
|
let queryText = location.href.split('?')[1];
|
|
145
145
|
let query = querystring.parse(queryText);
|
|
@@ -148,7 +148,7 @@ export function pageLifeCycleMount(
|
|
|
148
148
|
// 包装页面加载回掉, 增加取数据变量值逻辑
|
|
149
149
|
const onPageLoadCallback = (...args) => {
|
|
150
150
|
beforePageCustomLaunch(...args);
|
|
151
|
-
onPageLoad
|
|
151
|
+
onPageLoad?.(...args);
|
|
152
152
|
};
|
|
153
153
|
useEffect(() => {
|
|
154
154
|
onPageLoadCallback(query);
|
|
@@ -160,13 +160,13 @@ export function pageLifeCycleMount(
|
|
|
160
160
|
}
|
|
161
161
|
if (typeof onPageScroll === 'function' || typeof onReachBottom === 'function') {
|
|
162
162
|
window.onscroll = throttle(() => {
|
|
163
|
-
|
|
163
|
+
// 变量scrollTop是滚动条滚动时,滚动条上端距离顶部的距离
|
|
164
164
|
let scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
|
|
165
165
|
|
|
166
|
-
|
|
166
|
+
// 变量windowHeight是可视区的高度
|
|
167
167
|
let windowHeight = document.documentElement.clientHeight || document.body.clientHeight;
|
|
168
168
|
|
|
169
|
-
|
|
169
|
+
// 变量scrollHeight是滚动条的总高度(当前可滚动的页面的总高度)
|
|
170
170
|
let scrollHeight = document.documentElement.scrollHeight || document.body.scrollHeight;
|
|
171
171
|
if (typeof onPageScroll === 'function') {
|
|
172
172
|
onPageScroll({
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// Stolen from https://github.com/facebook/create-react-app/blob/cee26589ff919e946030a5651a93ccba78a93293/packages/react-dev-utils/getCSSModuleLocalIdent.js
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) 2015-present, Facebook, Inc.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the MIT license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
'use strict';
|
|
10
|
+
|
|
11
|
+
const loaderUtils = require('loader-utils');
|
|
12
|
+
const path = require('path');
|
|
13
|
+
|
|
14
|
+
module.exports = function getLocalIdent(context, localIdentName, localName, options) {
|
|
15
|
+
// Use the filename or folder name, based on some uses the index.js / index.module.(css|scss|sass) project style
|
|
16
|
+
const fileNameOrFolder = context.resourcePath.match(/index\.module\.(css|scss|sass)$/) ? '[folder]' : '[name]';
|
|
17
|
+
// Create a hash based on a the file location and class name. Will be unique across a project, and close to globally unique.
|
|
18
|
+
const hash = loaderUtils.getHashDigest(
|
|
19
|
+
path.posix.relative(context.rootContext, context.resourcePath) + localName,
|
|
20
|
+
'md5',
|
|
21
|
+
'base64',
|
|
22
|
+
5,
|
|
23
|
+
);
|
|
24
|
+
// Use loaderUtils to find the file or folder name
|
|
25
|
+
const className = loaderUtils.interpolateName(context, fileNameOrFolder + '_' + localName + '__' + hash, options);
|
|
26
|
+
// Remove the .module that appears in every classname when based on the file and replace all "." with "_".
|
|
27
|
+
return className.replace('.module_', '_').replace(/\./g, '_');
|
|
28
|
+
};
|
|
@@ -3,9 +3,9 @@ const webpack = require('webpack');
|
|
|
3
3
|
const TerserPlugin = require('terser-webpack-plugin');
|
|
4
4
|
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
|
5
5
|
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
|
6
|
-
const HardSourceWebpackPlugin = require('hard-source-webpack-plugin');
|
|
7
6
|
const CopyWebpackPlugin = require('copy-webpack-plugin');
|
|
8
7
|
const themeVars = require('./themeVars');
|
|
8
|
+
const getCSSModuleLocalIdent = require('./getCSSModuleLocalIdent');
|
|
9
9
|
const HappyPack = require('happypack');
|
|
10
10
|
const core = 4;
|
|
11
11
|
const happyThreadPool = HappyPack.ThreadPool({ size: core });
|
|
@@ -125,8 +125,8 @@ module.exports = function (options) {
|
|
|
125
125
|
'process.env.isMiniprogram': false, // 注入环境变量,用于业务代码判断
|
|
126
126
|
'process.env.SSR': false,
|
|
127
127
|
},
|
|
128
|
-
definePlugin
|
|
129
|
-
)
|
|
128
|
+
definePlugin,
|
|
129
|
+
),
|
|
130
130
|
),
|
|
131
131
|
new CopyWebpackPlugin({
|
|
132
132
|
patterns: [
|
|
@@ -153,7 +153,10 @@ module.exports = function (options) {
|
|
|
153
153
|
{
|
|
154
154
|
loader: 'css-loader',
|
|
155
155
|
options: {
|
|
156
|
-
modules:
|
|
156
|
+
modules: {
|
|
157
|
+
auto: true,
|
|
158
|
+
getLocalIdent: getCSSModuleLocalIdent,
|
|
159
|
+
},
|
|
157
160
|
importLoaders: 2,
|
|
158
161
|
},
|
|
159
162
|
},
|
|
@@ -216,7 +219,8 @@ module.exports = function (options) {
|
|
|
216
219
|
},
|
|
217
220
|
{
|
|
218
221
|
test: /\.(js|jsx)$/,
|
|
219
|
-
exclude:
|
|
222
|
+
exclude:
|
|
223
|
+
/node_modules\/(?!(@cloudbase\/weda-ui)|(@tcwd\/vuera)|(@tcwd\/weapps-core)|(@tcwd\/weapps-core))|gsd-kbone-react/,
|
|
220
224
|
use: ['happypack/loader?id=babel'],
|
|
221
225
|
},
|
|
222
226
|
{
|