@cloudbase/lowcode-builder 1.8.35 → 1.8.36
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/dist/builder.web.js +11 -11
- package/lib/builder/mp/materials.js +5 -4
- package/lib/builder/types/common.d.ts +1 -1
- package/lib/builder/util/common.d.ts +1 -1
- package/lib/builder/util/net.d.ts +2 -2
- package/lib/builder/util/net.js +9 -7
- package/lib/builder.web.js +11 -11
- package/package.json +6 -5
- package/template/html/index.html.ejs +1 -1
- package/template/mp/common/weapp-page.js +2 -2
|
@@ -57,7 +57,8 @@ async function installMaterials(ctx, projDir, usedComps, weapps) {
|
|
|
57
57
|
}
|
|
58
58
|
else {
|
|
59
59
|
materialsSrcDir = path.join(config_1.sharedMaterialsDir, `${name}-mp@${version}`);
|
|
60
|
-
|
|
60
|
+
const noCache = mpPkgUrl.indexOf('127.0.0.1') >= 0;
|
|
61
|
+
await downloadMaterial(mpPkgUrl, materialsSrcDir, ctx.isBrowserMpBuilder, noCache);
|
|
61
62
|
}
|
|
62
63
|
function libUpdated(libDir, version) {
|
|
63
64
|
const meta = (0, util_2.readComponentLibMata)(libDir);
|
|
@@ -229,10 +230,10 @@ function extractUsedCompsRecursively(comps, checkedComps, compositedLibs, output
|
|
|
229
230
|
return usedComps;
|
|
230
231
|
}
|
|
231
232
|
exports.extractUsedCompsRecursively = extractUsedCompsRecursively;
|
|
232
|
-
async function downloadMaterial(zipUrl, dstFolder, isBrowser = false) {
|
|
233
|
-
if (fs.existsSync(path.join(dstFolder, 'meta.json')))
|
|
233
|
+
async function downloadMaterial(zipUrl, dstFolder, isBrowser = false, noCache = false) {
|
|
234
|
+
if (!noCache && fs.existsSync(path.join(dstFolder, 'meta.json')))
|
|
234
235
|
return;
|
|
235
|
-
await (0, net_1.downloadZip)(zipUrl, dstFolder, isBrowser);
|
|
236
|
+
await (0, net_1.downloadZip)(zipUrl, dstFolder, isBrowser, noCache);
|
|
236
237
|
}
|
|
237
238
|
async function generateCompositeComponent(ctx, compositedComp, compLibCommonResource) {
|
|
238
239
|
const compositeCtx = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { BuildType, GenerateMpType, WebpackModeType, WebpackBuildCallBack, IPackageJson, buildAsWebByBuildType, buildAsAdminPortalByBuildType, buildAsXPageByBuildType, IAppUsedComp, IUsedComps, ISyncProp, IComponentInputProps, IFileCodeMap, } from '@cloudbase/lowcode-generator/lib/generator/types/common';
|
|
2
2
|
import { IComponentMeta, ICompositedComponent } from '@cloudbase/lowcode-generator/lib/weapps-core';
|
|
3
|
-
export
|
|
3
|
+
export type IComponentsInfoMap = {
|
|
4
4
|
[componentSourceKey: string]: ({
|
|
5
5
|
meta: IComponentMeta;
|
|
6
6
|
} & {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IComponentInputProps, IComponentsInfoMap, IPackageJson } from '../types/common';
|
|
2
2
|
import { IMaterialItem, IWeAppComponentInstance, IWeAppCode } from '@cloudbase/lowcode-generator/lib/weapps-core';
|
|
3
3
|
export { getMetaInfoBySourceKey, isArray, isPlainObject, deepDeal, simpleDeepClone, deepDealSchema, getFileNameByUrl, } from '@cloudbase/lowcode-generator/lib/generator/util/common';
|
|
4
|
-
|
|
4
|
+
type PromiseResult<T> = Promise<[null, T] | [Error, null]>;
|
|
5
5
|
export declare function promiseWrapper<T>(p: Promise<T>): PromiseResult<T>;
|
|
6
6
|
export declare function getCurrentPackageJson(): {
|
|
7
7
|
name: any;
|
|
@@ -4,7 +4,7 @@ export declare function downloadFile(url: string, filePath: string): Promise<voi
|
|
|
4
4
|
* @param url
|
|
5
5
|
* @param dstDir folder to hold the extract zip content
|
|
6
6
|
*/
|
|
7
|
-
export declare function downloadZip(url: string, dstDir: string, isBrowser?: boolean): Promise<void>;
|
|
7
|
+
export declare function downloadZip(url: string, dstDir: string, isBrowser?: boolean, noCache?: boolean): Promise<void>;
|
|
8
8
|
/**
|
|
9
9
|
* node中下载和保存zip文件
|
|
10
10
|
* @param url 下载的url
|
|
@@ -17,7 +17,7 @@ export declare function downloadZipInNode(url: string, dstDir: string): Promise<
|
|
|
17
17
|
* @param dstDir 存放文件夹
|
|
18
18
|
* @returns
|
|
19
19
|
*/
|
|
20
|
-
export declare function downloadZipInBrowser(url: string, dstDir: string): Promise<void>;
|
|
20
|
+
export declare function downloadZipInBrowser(url: string, dstDir: string, noCache: boolean): Promise<void>;
|
|
21
21
|
/**
|
|
22
22
|
* 微信IDE builder需要下载template文件和miniprogram_npm
|
|
23
23
|
* miniprogram_npm待微信提供端能力
|
package/lib/builder/util/net.js
CHANGED
|
@@ -46,10 +46,10 @@ exports.downloadFile = downloadFile;
|
|
|
46
46
|
* @param url
|
|
47
47
|
* @param dstDir folder to hold the extract zip content
|
|
48
48
|
*/
|
|
49
|
-
async function downloadZip(url, dstDir, isBrowser = false) {
|
|
49
|
+
async function downloadZip(url, dstDir, isBrowser = false, noCache = false) {
|
|
50
50
|
// TODO 待加上平台判断
|
|
51
51
|
if (isBrowser) {
|
|
52
|
-
await downloadZipInBrowser(url, dstDir);
|
|
52
|
+
await downloadZipInBrowser(url, dstDir, noCache);
|
|
53
53
|
return;
|
|
54
54
|
}
|
|
55
55
|
await downloadZipInNode(url, dstDir);
|
|
@@ -72,9 +72,9 @@ exports.downloadZipInNode = downloadZipInNode;
|
|
|
72
72
|
* @param dstDir 存放文件夹
|
|
73
73
|
* @returns
|
|
74
74
|
*/
|
|
75
|
-
async function downloadZipInBrowser(url, dstDir) {
|
|
75
|
+
async function downloadZipInBrowser(url, dstDir, noCache) {
|
|
76
76
|
// IMPORTANT 防止保存的时候保存
|
|
77
|
-
if (fs_extra_1.default.existsSync(dstDir)) {
|
|
77
|
+
if (!noCache && fs_extra_1.default.existsSync(dstDir)) {
|
|
78
78
|
return;
|
|
79
79
|
}
|
|
80
80
|
fs_extra_1.default.ensureDirSync(dstDir);
|
|
@@ -96,9 +96,11 @@ async function saveFiles(files, dstDir) {
|
|
|
96
96
|
continue;
|
|
97
97
|
}
|
|
98
98
|
if (files[fileName].dir) { // 如果该文件为目录需先创建文件夹
|
|
99
|
-
fs_extra_1.default.
|
|
100
|
-
|
|
101
|
-
|
|
99
|
+
if (!fs_extra_1.default.pathExistsSync(dest)) {
|
|
100
|
+
fs_extra_1.default.mkdirSync(dest, {
|
|
101
|
+
recursive: true
|
|
102
|
+
});
|
|
103
|
+
}
|
|
102
104
|
}
|
|
103
105
|
else {
|
|
104
106
|
const ret = await files[fileName].async('nodebuffer'); // 由于这里有await,不能用forEach
|