@cloudbase/lowcode-builder 1.3.13 → 1.3.15-private.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/.turbo/turbo-build.log +0 -0
- package/lib/builder/config/index.d.ts +0 -0
- package/lib/builder/config/index.js +1 -1
- package/lib/builder/core/index.d.ts +7 -0
- package/lib/builder/core/index.js +40 -1
- package/lib/builder/core/plugin.d.ts +0 -0
- package/lib/builder/core/plugin.js +0 -0
- package/lib/builder/h5/compile.d.ts +0 -0
- package/lib/builder/h5/compile.js +0 -0
- package/lib/builder/h5/copy.d.ts +0 -0
- package/lib/builder/h5/copy.js +0 -0
- package/lib/builder/h5/generate.d.ts +0 -0
- package/lib/builder/h5/generate.js +3 -2
- package/lib/builder/h5/index.d.ts +0 -0
- package/lib/builder/h5/index.js +0 -0
- package/lib/builder/h5/material.d.ts +0 -0
- package/lib/builder/h5/material.js +0 -0
- package/lib/builder/h5/npm.d.ts +0 -0
- package/lib/builder/h5/npm.js +0 -0
- package/lib/builder/h5/webpack.d.ts +0 -0
- package/lib/builder/h5/webpack.js +0 -0
- package/lib/builder/mp/BuildContext.d.ts +0 -0
- package/lib/builder/mp/BuildContext.js +0 -0
- package/lib/builder/mp/index.d.ts +5 -0
- package/lib/builder/mp/index.js +28 -17
- package/lib/builder/mp/lowcode.d.ts +0 -0
- package/lib/builder/mp/lowcode.js +0 -0
- package/lib/builder/mp/materials.d.ts +0 -0
- package/lib/builder/mp/materials.js +1 -1
- package/lib/builder/mp/mixMode.d.ts +0 -0
- package/lib/builder/mp/mixMode.js +0 -0
- package/lib/builder/mp/mp_config.d.ts +0 -0
- package/lib/builder/mp/mp_config.js +0 -0
- package/lib/builder/mp/plugin.d.ts +0 -0
- package/lib/builder/mp/plugin.js +0 -0
- package/lib/builder/mp/util.d.ts +0 -0
- package/lib/builder/mp/util.js +0 -0
- package/lib/builder/mp/wxml.d.ts +0 -0
- package/lib/builder/mp/wxml.js +0 -0
- package/lib/builder/service/webpack.d.ts +0 -0
- package/lib/builder/service/webpack.js +0 -0
- package/lib/builder/types/common.d.ts +0 -0
- package/lib/builder/types/common.js +0 -0
- package/lib/builder/util/common.d.ts +0 -0
- package/lib/builder/util/common.js +0 -0
- package/lib/builder/util/console.d.ts +0 -0
- package/lib/builder/util/console.js +0 -0
- package/lib/builder/util/generateFiles.d.ts +1 -2
- package/lib/builder/util/generateFiles.js +1 -13
- package/lib/builder/util/index.d.ts +0 -0
- package/lib/builder/util/index.js +0 -0
- package/lib/builder/util/junk.d.ts +0 -0
- package/lib/builder/util/junk.js +0 -0
- package/lib/builder/util/mp.d.ts +0 -0
- package/lib/builder/util/mp.js +0 -0
- package/lib/builder/util/net.d.ts +0 -0
- package/lib/builder/util/net.js +0 -0
- package/lib/builder/util/process.d.ts +0 -0
- package/lib/builder/util/process.js +0 -0
- package/lib/index.d.ts +0 -0
- package/lib/index.js +0 -0
- package/lib/types.d.ts +0 -0
- package/lib/types.js +0 -0
- package/lib/utils/common.d.ts +0 -0
- package/lib/utils/common.js +0 -0
- package/lib/utils/postProcess.d.ts +0 -0
- package/lib/utils/postProcess.js +0 -0
- package/package.json +4 -4
- package/template/html/index.html.ejs +2 -2
- package/template/mp/app/weapps-api.js +8 -4
- package/template/mp/common/config.js +9 -0
- package/template/mp/common/config.wxs +3 -0
- package/template/mp/common/utils.wxs +3 -1
- package/template/mp/common/widget.js +11 -2
- package/template/mp/datasources/config.js.tpl +4 -3
- package/template/.DS_Store +0 -0
|
File without changes
|
|
File without changes
|
|
@@ -59,7 +59,7 @@ exports.CDN_ENDPONTS_CONFIG = {
|
|
|
59
59
|
common: '',
|
|
60
60
|
cloudbase: '//static.cloudbase.net',
|
|
61
61
|
cdngo: 'https://qbase.cdn-go.cn',
|
|
62
|
-
aegis: 'https://cdn-go.cn',
|
|
62
|
+
aegis: 'https://tam.cdn-go.cn',
|
|
63
63
|
};
|
|
64
64
|
function generateCdnEndpoints(endpoints = exports.CDN_ENDPONTS_CONFIG) {
|
|
65
65
|
for (const key in exports.CDN_ENDPONTS_CONFIG) {
|
|
@@ -40,6 +40,13 @@ export interface IBuildWedaApp extends IBaseAppProps {
|
|
|
40
40
|
isPrivateMode?: boolean;
|
|
41
41
|
endpointType?: 'tcb-api' | 'wechat-service';
|
|
42
42
|
}
|
|
43
|
+
export declare function buildWedaConfig({ output, domain, isPrivateMode, endpointType, buildTypeList, }: {
|
|
44
|
+
output: Required<IBuildWedaApp['output']>;
|
|
45
|
+
domain?: string;
|
|
46
|
+
isPrivateMode?: boolean;
|
|
47
|
+
endpointType?: IBuildWedaApp['endpointType'];
|
|
48
|
+
buildTypeList?: IBuildWedaApp['buildTypeList'];
|
|
49
|
+
}): Promise<void>;
|
|
43
50
|
export declare function buildWedaApp({ cals, subAppCalsList, dependencies, appKey, runtime, ignoreInstall, buildTypeList, mode, devTool, deployOptions, generateMpType, plugins, extraData, resourceAppId, domain, output, isBrowserMpBuilder, cdnEndpoints, isPrivateMode, endpointType, }: IBuildWedaApp, cb?: WebpackBuildCallBack): Promise<string | undefined>;
|
|
44
51
|
export declare function cleanComponentDir(): Promise<void>;
|
|
45
52
|
export declare const version: any;
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.normalizeInputs = exports.getCompileDirs = exports.downloadZip = exports.strToBuf = exports.fileToZip = exports.getFiles = exports.version = exports.cleanComponentDir = exports.buildWedaApp = void 0;
|
|
6
|
+
exports.normalizeInputs = exports.getCompileDirs = exports.downloadZip = exports.strToBuf = exports.fileToZip = exports.getFiles = exports.version = exports.cleanComponentDir = exports.buildWedaApp = exports.buildWedaConfig = void 0;
|
|
7
7
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
8
8
|
const chalk_1 = __importDefault(require("chalk"));
|
|
9
9
|
const path_1 = __importDefault(require("path"));
|
|
@@ -18,6 +18,45 @@ const postProcess_1 = require("../../utils/postProcess");
|
|
|
18
18
|
const cals_1 = require("@cloudbase/cals");
|
|
19
19
|
const net_1 = require("../util/net");
|
|
20
20
|
const pkg = require('../../../package.json');
|
|
21
|
+
async function buildWedaConfig({ output, domain = undefined, isPrivateMode = undefined, endpointType = undefined, buildTypeList = [common_1.BuildType.WEB], }) {
|
|
22
|
+
if ((0, common_1.buildAsWebByBuildType)(buildTypeList)) {
|
|
23
|
+
throw new Error('构建类型仅支持 MP');
|
|
24
|
+
}
|
|
25
|
+
let outDir = output === null || output === void 0 ? void 0 : output.path;
|
|
26
|
+
if (!outDir) {
|
|
27
|
+
throw new Error('无效的项目输出路径');
|
|
28
|
+
}
|
|
29
|
+
let miniprogramRoot = outDir;
|
|
30
|
+
let projectJsonPath = path_1.default.resolve(outDir, 'project.config.json');
|
|
31
|
+
if (fs_extra_1.default.existsSync(projectJsonPath)) {
|
|
32
|
+
const projectConfigJson = await fs_extra_1.default.readJson(projectJsonPath);
|
|
33
|
+
miniprogramRoot = path_1.default.join(outDir, projectConfigJson.miniprogramRoot || '/');
|
|
34
|
+
}
|
|
35
|
+
const configPath = path_1.default.resolve(miniprogramRoot, 'common/config.js');
|
|
36
|
+
let data = { domain, isPrivateMode, endpointType };
|
|
37
|
+
if (fs_extra_1.default.existsSync(configPath)) {
|
|
38
|
+
try {
|
|
39
|
+
let config = require(configPath);
|
|
40
|
+
let current = {};
|
|
41
|
+
if (config.__esModule) {
|
|
42
|
+
current = config.default || {};
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
current = config || {};
|
|
46
|
+
}
|
|
47
|
+
for (const key in data) {
|
|
48
|
+
if (data[key] === undefined) {
|
|
49
|
+
data[key] = current[key];
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
catch (e) {
|
|
54
|
+
console.error('parse current file error, overwrite current config', e);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
await (0, index_1.generateConfig)(data, outDir);
|
|
58
|
+
}
|
|
59
|
+
exports.buildWedaConfig = buildWedaConfig;
|
|
21
60
|
async function buildWedaApp({ cals, subAppCalsList = [], dependencies = [], appKey = 'test', runtime = types_1.RUNTIME.NONE, ignoreInstall = false, buildTypeList = [common_1.BuildType.WEB], mode = common_1.WebpackModeType.PRODUCTION, devTool = 'webpack', deployOptions = { mode: types_1.DEPLOY_MODE.PREVIEW }, generateMpType = common_1.GenerateMpType.APP, plugins = [], extraData = {
|
|
22
61
|
isComposite: false,
|
|
23
62
|
compProps: {},
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/lib/builder/h5/copy.d.ts
CHANGED
|
File without changes
|
package/lib/builder/h5/copy.js
CHANGED
|
File without changes
|
|
File without changes
|
|
@@ -74,14 +74,15 @@ async function handleAssets({ appBuildDir, buildTypeList, assets, }) {
|
|
|
74
74
|
if (assetsArr && assetsArr.length > 0) {
|
|
75
75
|
if (buildTypeList.includes('app')) {
|
|
76
76
|
const targetDir = path_1.default.resolve(appBuildDir, './assets');
|
|
77
|
-
assetsArr.
|
|
77
|
+
await Promise.all(assetsArr.map(async (assetUrl) => {
|
|
78
78
|
console.log('============>>>>>> getWebpackWebBuildParams assetUrl', assetUrl);
|
|
79
79
|
if (assetUrl) {
|
|
80
80
|
const fileName = (0, common_1.getFileNameByUrl)(assetUrl);
|
|
81
81
|
jsApis.push(`./${fileName}`);
|
|
82
82
|
await (0, webpack_1.downloadAssets)(targetDir, assetUrl);
|
|
83
|
+
return `./${fileName}`;
|
|
83
84
|
}
|
|
84
|
-
});
|
|
85
|
+
}));
|
|
85
86
|
}
|
|
86
87
|
else {
|
|
87
88
|
jsApis = jsApis.concat(assetsArr);
|
|
File without changes
|
package/lib/builder/h5/index.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/lib/builder/h5/npm.d.ts
CHANGED
|
File without changes
|
package/lib/builder/h5/npm.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -17,6 +17,11 @@ export declare function generateWxMp({ buildContext, weapps, plugins, deployMode
|
|
|
17
17
|
}): Promise<{
|
|
18
18
|
miniprogramRoot: string;
|
|
19
19
|
}>;
|
|
20
|
+
export declare function generateConfig(data: {
|
|
21
|
+
domain?: string;
|
|
22
|
+
isPrivateMode?: boolean;
|
|
23
|
+
endpointType?: IBuildContext['endpointType'] | '';
|
|
24
|
+
}, root: string): Promise<void>;
|
|
20
25
|
export declare function writeLowCodeFiles(ctx: IBuildContext, appData: IWeAppData, outDir: string): Promise<void>;
|
|
21
26
|
/**
|
|
22
27
|
* TODO: 与 cals 里的实现进行整合
|
package/lib/builder/mp/index.js
CHANGED
|
@@ -26,7 +26,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.handleUsedComponents = exports.writeLowCodeFiles = exports.generateWxMp = void 0;
|
|
29
|
+
exports.handleUsedComponents = exports.writeLowCodeFiles = exports.generateConfig = exports.generateWxMp = void 0;
|
|
30
30
|
const chalk_1 = __importDefault(require("chalk"));
|
|
31
31
|
const path_1 = __importDefault(require("path"));
|
|
32
32
|
const util_1 = require("util");
|
|
@@ -76,7 +76,7 @@ async function generateWxMp({ buildContext, weapps, plugins, deployMode, options
|
|
|
76
76
|
'project.config.json': { content: projConfig },
|
|
77
77
|
};
|
|
78
78
|
console.log(`Generating ${em('project')} files`);
|
|
79
|
-
await (0, generateFiles_1.default)(
|
|
79
|
+
await (0, generateFiles_1.default)(projectFileData, templateDir, projDir);
|
|
80
80
|
}
|
|
81
81
|
// #2 生成主包
|
|
82
82
|
await generatePkg({ ...buildContext, rootPath: mainAppData.rootPath }, mainAppData, path_1.default.join(projDir, '/'), pageConfigs[0]);
|
|
@@ -94,12 +94,15 @@ async function generateWxMp({ buildContext, weapps, plugins, deployMode, options
|
|
|
94
94
|
let appJsContent = await fs.readFile(appJsPath);
|
|
95
95
|
await (0, generateFiles_1.writeFile)(appJsPath, `import { app as wedaApp } from './app/weapps-api'\n${appJsContent}`);
|
|
96
96
|
}
|
|
97
|
+
await generateConfig({
|
|
98
|
+
domain,
|
|
99
|
+
isPrivateMode,
|
|
100
|
+
endpointType,
|
|
101
|
+
}, miniprogramRoot);
|
|
97
102
|
appFileData = {
|
|
98
103
|
...appFileData,
|
|
99
104
|
'common/style.js': {},
|
|
100
|
-
'common/utils.wxs': {
|
|
101
|
-
domain,
|
|
102
|
-
},
|
|
105
|
+
'common/utils.wxs': {},
|
|
103
106
|
'common/util.js': {
|
|
104
107
|
isAdminPortal: (0, common_1.buildAsAdminPortalByBuildType)(buildTypeList),
|
|
105
108
|
},
|
|
@@ -164,7 +167,7 @@ async function generateWxMp({ buildContext, weapps, plugins, deployMode, options
|
|
|
164
167
|
};
|
|
165
168
|
}
|
|
166
169
|
console.log(`Generating ${em('miniprogramRoot')} files`);
|
|
167
|
-
await (0, generateFiles_1.default)(
|
|
170
|
+
await (0, generateFiles_1.default)(appFileData, templateDir, miniprogramRoot);
|
|
168
171
|
// 若项目目录与小程序根目录不同,则拷贝素材到小程序根目录
|
|
169
172
|
if (miniprogramRoot !== path_1.default.join(projDir, '/') && fs.existsSync(path_1.default.join(projDir, config_1.materialsDirName))) {
|
|
170
173
|
console.log(`Move ${em(config_1.materialsDirName)} from` + `${projDir} to ${miniprogramRoot}`);
|
|
@@ -180,9 +183,6 @@ async function generateWxMp({ buildContext, weapps, plugins, deployMode, options
|
|
|
180
183
|
resourceAppid: !!options.isCrossAccount ? options.resourceAppId : '',
|
|
181
184
|
isProd: deployMode === types_1.DEPLOY_MODE.UPLOAD,
|
|
182
185
|
clientID: (_a = mainAppData.extra) === null || _a === void 0 ? void 0 : _a.clientId,
|
|
183
|
-
isPrivateMode,
|
|
184
|
-
endpointType,
|
|
185
|
-
tcbApiOrigin: endpointType === 'tcb-api' && isPrivateMode && domain ? `https://${domain}` : '',
|
|
186
186
|
},
|
|
187
187
|
'datasources/datasource-profiles.js.tpl': {
|
|
188
188
|
datasourceProfiles: (0, util_3.JsonToStringWithVariableName)((0, lowcode_generator_1.getDatasourceProfiles)(
|
|
@@ -196,7 +196,7 @@ async function generateWxMp({ buildContext, weapps, plugins, deployMode, options
|
|
|
196
196
|
},
|
|
197
197
|
};
|
|
198
198
|
console.log(`Generating ${em('datasources')} files`);
|
|
199
|
-
await (0, generateFiles_1.default)(
|
|
199
|
+
await (0, generateFiles_1.default)(datasourceFileData, templateDir, miniprogramRoot);
|
|
200
200
|
}
|
|
201
201
|
// 生成子包
|
|
202
202
|
await Promise.all(weapps.map(async (app, index) => {
|
|
@@ -214,7 +214,7 @@ async function generateWxMp({ buildContext, weapps, plugins, deployMode, options
|
|
|
214
214
|
// 生成package.json
|
|
215
215
|
let packageJsonPath = path_1.default.join(subpackageRootPath, 'package.json');
|
|
216
216
|
if (!fs.existsSync(packageJsonPath)) {
|
|
217
|
-
await (0, generateFiles_1.default)(
|
|
217
|
+
await (0, generateFiles_1.default)({
|
|
218
218
|
'package.json': {
|
|
219
219
|
appId,
|
|
220
220
|
importJSSDK: endpointType === 'tcb-api',
|
|
@@ -283,6 +283,20 @@ async function generateWxMp({ buildContext, weapps, plugins, deployMode, options
|
|
|
283
283
|
}
|
|
284
284
|
}
|
|
285
285
|
exports.generateWxMp = generateWxMp;
|
|
286
|
+
async function generateConfig(data, root) {
|
|
287
|
+
const { domain = '', isPrivateMode = false, endpointType = '' } = data;
|
|
288
|
+
await (0, generateFiles_1.default)({
|
|
289
|
+
'common/config.js': {
|
|
290
|
+
domain,
|
|
291
|
+
isPrivateMode,
|
|
292
|
+
endpointType,
|
|
293
|
+
},
|
|
294
|
+
'common/config.wxs': {
|
|
295
|
+
domain,
|
|
296
|
+
},
|
|
297
|
+
}, templateDir, root);
|
|
298
|
+
}
|
|
299
|
+
exports.generateConfig = generateConfig;
|
|
286
300
|
async function generatePkg(ctx, weapp, appRoot, pageConfigs) {
|
|
287
301
|
const wxmlDataPrefix = (0, mp_1.getWxmlDataPrefix)(!ctx.isProduction);
|
|
288
302
|
console.log(`Generating ${em(weapp.rootPath ? 'subApp' : 'app')} to ${appRoot}`);
|
|
@@ -348,7 +362,7 @@ async function generatePkg(ctx, weapp, appRoot, pageConfigs) {
|
|
|
348
362
|
},
|
|
349
363
|
};
|
|
350
364
|
// Generating file by template and data
|
|
351
|
-
await (0, generateFiles_1.default)(
|
|
365
|
+
await (0, generateFiles_1.default)(pageFileData, `${templateDir}/page`, path_1.default.join(appRoot, 'pages', page.id));
|
|
352
366
|
}));
|
|
353
367
|
// #3 writing lowcode files
|
|
354
368
|
await writeLowCodeFiles(ctx, weapp, appRoot);
|
|
@@ -366,7 +380,6 @@ async function generateFramework(ctx, appData, outDir) {
|
|
|
366
380
|
subLevelPath: '',
|
|
367
381
|
subPackageName: '',
|
|
368
382
|
importor: (0, util_3.generateLowcodeImportor)([]),
|
|
369
|
-
domain: ctx.domain || '',
|
|
370
383
|
appConfig: JSON.stringify({}),
|
|
371
384
|
},
|
|
372
385
|
};
|
|
@@ -392,14 +405,12 @@ async function generateFramework(ctx, appData, outDir) {
|
|
|
392
405
|
'app/app-global.js': {},
|
|
393
406
|
'app/weapps-api.js': {
|
|
394
407
|
appId: ctx.appId,
|
|
395
|
-
domain: ctx.domain || '',
|
|
396
408
|
subLevelPath: appData.rootPath ? `${path_1.default.posix.relative(`${appData.rootPath}`, '')}/` : '',
|
|
397
409
|
subPackageName: appData.rootPath || '',
|
|
398
410
|
importor,
|
|
399
411
|
appConfig: (0, util_3.JsonToStringWithVariableName)({
|
|
400
412
|
id: ctx.appId,
|
|
401
413
|
envId: appData.envId,
|
|
402
|
-
staticResourceDomain: ctx.domain || '',
|
|
403
414
|
envVersion: (ctx === null || ctx === void 0 ? void 0 : ctx.isProduction) ? 'production' : 'preview',
|
|
404
415
|
pages: appData.pageInstanceList
|
|
405
416
|
.sort((item) => (item.isHome ? -1 : 1))
|
|
@@ -411,7 +422,7 @@ async function generateFramework(ctx, appData, outDir) {
|
|
|
411
422
|
},
|
|
412
423
|
'app/common.js': {
|
|
413
424
|
mods: appData.lowCodes
|
|
414
|
-
.filter((m) => m.type === cals_1.ECodeType.NORMAL_MODULE && m.name !==
|
|
425
|
+
.filter((m) => m.type === cals_1.ECodeType.NORMAL_MODULE && m.name !== cals_1.ECodeName.PLACEHOLDER)
|
|
415
426
|
.map((m) => m.name)
|
|
416
427
|
.sort(),
|
|
417
428
|
},
|
|
@@ -419,7 +430,7 @@ async function generateFramework(ctx, appData, outDir) {
|
|
|
419
430
|
}
|
|
420
431
|
}
|
|
421
432
|
console.log('Generate app framework');
|
|
422
|
-
await (0, generateFiles_1.default)(
|
|
433
|
+
await (0, generateFiles_1.default)(fileData, templateDir, outDir);
|
|
423
434
|
}
|
|
424
435
|
async function writeLowCodeFiles(ctx, appData, outDir) {
|
|
425
436
|
console.log(`Writing ${em('lowcode')} files:`);
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -311,7 +311,7 @@ async function generateCompositeComponent(ctx, compositedComp, compLibCommonReso
|
|
|
311
311
|
},
|
|
312
312
|
};
|
|
313
313
|
// Generating file by template and data
|
|
314
|
-
await (0, generateFiles_1.default)(
|
|
314
|
+
await (0, generateFiles_1.default)(pageFileData, `${templateDir}/component`, outDir);
|
|
315
315
|
// #3 writing lowcode files
|
|
316
316
|
/**
|
|
317
317
|
* 低码没有开放 index 类别,直接去掉
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/lib/builder/mp/plugin.js
CHANGED
|
File without changes
|
package/lib/builder/mp/util.d.ts
CHANGED
|
File without changes
|
package/lib/builder/mp/util.js
CHANGED
|
File without changes
|
package/lib/builder/mp/wxml.d.ts
CHANGED
|
File without changes
|
package/lib/builder/mp/wxml.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import { IBuildContext } from '../mp/BuildContext';
|
|
3
2
|
import { OutputType } from 'jszip';
|
|
4
3
|
export declare const generatedFileContents: {};
|
|
5
|
-
export default function generateFiles(
|
|
4
|
+
export default function generateFiles(appFileData: any, srcDir: string, dstDir: string): Promise<string[]>;
|
|
6
5
|
export declare function writeFile(outFile: string, content: string): Promise<boolean>;
|
|
7
6
|
export declare function removeFile(file: string): void;
|
|
8
7
|
/**
|
|
@@ -35,7 +35,7 @@ const glob_1 = __importDefault(require("glob"));
|
|
|
35
35
|
const jszip_1 = __importDefault(require("jszip"));
|
|
36
36
|
const buffer_1 = require("buffer");
|
|
37
37
|
exports.generatedFileContents = {}; // generated files for incrmental build
|
|
38
|
-
async function generateFiles(
|
|
38
|
+
async function generateFiles(appFileData, srcDir, dstDir) {
|
|
39
39
|
const filesGenerated = [];
|
|
40
40
|
// Generating file by template and data
|
|
41
41
|
for (const file in appFileData) {
|
|
@@ -46,18 +46,6 @@ async function generateFiles(ctx, appFileData, srcDir, dstDir) {
|
|
|
46
46
|
encoding: 'utf8',
|
|
47
47
|
});
|
|
48
48
|
let generatedCode = (0, lodash_1.template)(tplStr, { interpolate: /<%=([\s\S]+?)%>/ })(appFileData[file]);
|
|
49
|
-
// 混合模式下,引用公共路径要多增加一层,并加多一层命名
|
|
50
|
-
// 混合子包直接在对应目录上生成,而不采用替换的方式 @royhyang
|
|
51
|
-
// if (ctx?.isMixMode && ctx?.rootPath) {
|
|
52
|
-
// generatedCode = generatedCode.replace(
|
|
53
|
-
// /..\/..\/..\/common\//g,
|
|
54
|
-
// '../../../../common/'
|
|
55
|
-
// )
|
|
56
|
-
// generatedCode = generatedCode.replace(
|
|
57
|
-
// /..\/..\/..\/app\//g,
|
|
58
|
-
// '../../../../app/'
|
|
59
|
-
// )
|
|
60
|
-
// }
|
|
61
49
|
const outFile = path_1.default.resolve(dstDir, outFileName.replace(/\.tpl$/, ''));
|
|
62
50
|
if (await writeFile(outFile, generatedCode)) {
|
|
63
51
|
filesGenerated.push(outFileName);
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/lib/builder/util/junk.js
CHANGED
|
File without changes
|
package/lib/builder/util/mp.d.ts
CHANGED
|
File without changes
|
package/lib/builder/util/mp.js
CHANGED
|
File without changes
|
|
File without changes
|
package/lib/builder/util/net.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/lib/index.d.ts
CHANGED
|
File without changes
|
package/lib/index.js
CHANGED
|
File without changes
|
package/lib/types.d.ts
CHANGED
|
File without changes
|
package/lib/types.js
CHANGED
|
File without changes
|
package/lib/utils/common.d.ts
CHANGED
|
File without changes
|
package/lib/utils/common.js
CHANGED
|
File without changes
|
|
File without changes
|
package/lib/utils/postProcess.js
CHANGED
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudbase/lowcode-builder",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.15-private.0",
|
|
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",
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
"url": "https://github.com/TencentCloudBase/cloudbase-framework/issues"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@cloudbase/cals": "
|
|
42
|
-
"@cloudbase/lowcode-generator": "
|
|
41
|
+
"@cloudbase/cals": "^0.5.11",
|
|
42
|
+
"@cloudbase/lowcode-generator": "1.3.7-private.0",
|
|
43
43
|
"axios": "^0.21.0",
|
|
44
44
|
"browserfs": "^1.4.3",
|
|
45
45
|
"browserify-zlib": "^0.2.0",
|
|
@@ -81,4 +81,4 @@
|
|
|
81
81
|
"webpack-dev-server": "^4.7.3",
|
|
82
82
|
"worker-loader": "^3.0.8"
|
|
83
83
|
}
|
|
84
|
-
}
|
|
84
|
+
}
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
<% cssStyles.forEach(function(styleUrl){%>
|
|
20
20
|
<link type="text/css" rel="stylesheet" href="<%=styleUrl %>" />
|
|
21
21
|
<% })%> <% if(cdnEndpoints.aegis){ %>
|
|
22
|
-
<script crossorigin="anonymous" src="<%= cdnEndpoints.aegis %>/aegis
|
|
22
|
+
<script crossorigin="anonymous" src="<%= cdnEndpoints.aegis %>/aegis-sdk/latest/aegis.min.js"></script>
|
|
23
23
|
<script>
|
|
24
24
|
<% if(!isAdminPortal){ %>
|
|
25
25
|
const _aegis = new Aegis({
|
|
@@ -475,7 +475,7 @@
|
|
|
475
475
|
crossorigin
|
|
476
476
|
src="<%=
|
|
477
477
|
cdnEndpoints.cdngo
|
|
478
|
-
%>/lcap/lcap-resource-cdngo/-/0.1.4/_files/static/weda-render/main.
|
|
478
|
+
%>/lcap/lcap-resource-cdngo/-/0.1.4/_files/static/weda-render/main.dd7f29a986538b6b1dce.bundle.js"
|
|
479
479
|
></script>
|
|
480
480
|
</body>
|
|
481
481
|
</html>
|
|
@@ -4,6 +4,7 @@ import { createComputed, formatEnum, enumOptions } from '<%= subLevelPath %>../c
|
|
|
4
4
|
import appGlobal from '<%= subLevelPath %>../app/app-global'
|
|
5
5
|
import { createDataset } from '<%= subLevelPath %>../datasources/index'
|
|
6
6
|
import lodashGet from 'lodash.get';
|
|
7
|
+
import config from '<%= subLevelPath %>../common/config';
|
|
7
8
|
|
|
8
9
|
|
|
9
10
|
<%= importor.state? `import state from '../lowcode/state'` : "const state = {}" %>
|
|
@@ -25,11 +26,14 @@ export const $w = new Proxy(
|
|
|
25
26
|
|
|
26
27
|
function createGlboalApi() {
|
|
27
28
|
const mpApp = createMpApp({
|
|
28
|
-
appConfig:
|
|
29
|
+
appConfig: {
|
|
30
|
+
staticResourceDomain: config.domain,
|
|
31
|
+
...(<%= appConfig %>)
|
|
32
|
+
}
|
|
29
33
|
});
|
|
30
|
-
const globalAPI = {
|
|
34
|
+
const globalAPI = Object.assign(mpApp, {
|
|
31
35
|
id: '<%= appId %>',
|
|
32
|
-
domain:
|
|
36
|
+
domain: config.domain,
|
|
33
37
|
pages: {},
|
|
34
38
|
session: {
|
|
35
39
|
//configure: sdk.configure,
|
|
@@ -45,7 +49,7 @@ function createGlboalApi() {
|
|
|
45
49
|
return $page.invokeComponentMethod(params)
|
|
46
50
|
},
|
|
47
51
|
// ... other sdk apis & apis from mp
|
|
48
|
-
} // The global api exposed to lowcode
|
|
52
|
+
}) // The global api exposed to lowcode
|
|
49
53
|
|
|
50
54
|
globalAPI.__internal__.enumOptions = enumOptions
|
|
51
55
|
globalAPI.utils.formatEnum = formatEnum
|
|
@@ -651,13 +651,22 @@ function mountBuiltinWigetsAPI(widget, owner) {
|
|
|
651
651
|
|
|
652
652
|
switch (widget.widgetType) {
|
|
653
653
|
case `${REPEATER.MODULE_NAME}:${REPEATER.REPEATER_NAME}`: {
|
|
654
|
-
const currentRef = observable({ current:
|
|
654
|
+
const currentRef = observable({ current: {} });
|
|
655
655
|
widget._getInstanceRef = () => {
|
|
656
656
|
return currentRef;
|
|
657
657
|
}; // 默认初始值
|
|
658
658
|
widget._disposers.push(
|
|
659
659
|
autorun((r) => {
|
|
660
|
-
currentRef.current = {
|
|
660
|
+
currentRef.current = {
|
|
661
|
+
data: widget.data,
|
|
662
|
+
items: (widget.children || []).map((item) => {
|
|
663
|
+
const descendants = {};
|
|
664
|
+
Object.keys(item?._descendants || {}).forEach((key) => {
|
|
665
|
+
descendants[key] = item._descendants[key]._userWidget;
|
|
666
|
+
});
|
|
667
|
+
return descendants;
|
|
668
|
+
})
|
|
669
|
+
}
|
|
661
670
|
}),
|
|
662
671
|
);
|
|
663
672
|
break;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import datasetProfiles from './dataset-profiles'
|
|
2
2
|
const dataSourceProfiles = require('./datasource-profiles.js')
|
|
3
|
+
import config from '../common/config'
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* 数据源基本配置
|
|
@@ -25,14 +26,14 @@ export default {
|
|
|
25
26
|
/**
|
|
26
27
|
* 确定调用链路
|
|
27
28
|
*/
|
|
28
|
-
endpointType:
|
|
29
|
+
endpointType: config.endpointType,
|
|
29
30
|
/**
|
|
30
31
|
* 调用链路为 tcb-api 时有效
|
|
31
32
|
* 私有化需要设置
|
|
32
33
|
*/
|
|
33
|
-
tcbApiOrigin:
|
|
34
|
+
tcbApiOrigin: config.tcbApiOrigin,
|
|
34
35
|
/**
|
|
35
36
|
* 是否是处于私有化版本
|
|
36
37
|
*/
|
|
37
|
-
isPrivate:
|
|
38
|
+
isPrivate: config.isPrivate
|
|
38
39
|
}
|
package/template/.DS_Store
DELETED
|
Binary file
|