miniprogram-ci 2.0.9 → 2.0.11
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/CHANGELOG.md +5 -0
- package/README.md +5 -0
- package/dist/@types/ci/upload.d.ts +0 -1
- package/dist/@types/ci/utils/progressupdate.d.ts +2 -0
- package/dist/@types/common/code-analyse/index.d.ts +1 -0
- package/dist/@types/config/config.d.ts +1 -1
- package/dist/@types/modules/corecompiler/baseCompiler.d.ts +5 -0
- package/dist/@types/modules/corecompiler/original/validate/schemaValidate.d.ts +1 -1
- package/dist/@types/modules/corecompiler/original/workerThread/task/minifywxml.d.ts +21 -25
- package/dist/@types/modules/corecompiler/originalCompiler.d.ts +1 -0
- package/dist/@types/modules/corecompiler/processHandler.d.ts +2 -21
- package/dist/@types/modules/corecompiler/summer/graph/basegraph.d.ts +1 -0
- package/dist/@types/modules/corecompiler/summer/module.d.ts +20 -14
- package/dist/@types/modules/corecompiler/summerCompiler.d.ts +5 -4
- package/dist/@types/modules/index.d.ts +2 -0
- package/dist/@types/modules/nativecompiler/index.d.ts +1 -0
- package/dist/@types/modules/nativecompiler/ios/buildCloud.d.ts +9 -2
- package/dist/@types/modules/nativecompiler/ios/index.d.ts +2 -0
- package/dist/@types/modules/nativecompiler/nativeCompiler.d.ts +3 -0
- package/dist/@types/modules/precompiler/conditioncompile/index.d.ts +3 -2
- package/dist/@types/modules/precompiler/index.d.ts +3 -2
- package/dist/@types/schema/@types/appjson.d.ts +215 -0
- package/dist/@types/schema/@types/extjson.d.ts +82 -0
- package/dist/@types/schema/@types/gamejson.d.ts +55 -0
- package/dist/@types/schema/@types/pagejson.d.ts +47 -0
- package/dist/@types/schema/@types/pluginjson.d.ts +17 -0
- package/dist/@types/schema/@types/pluginpagejson.d.ts +5 -0
- package/dist/@types/schema/@types/projectconfigjson.d.ts +194 -0
- package/dist/@types/schema/@types/projectprivateconfigjson.d.ts +114 -0
- package/dist/@types/schema/@types/sitemapjson.d.ts +10 -0
- package/dist/@types/schema/@types/themejson.d.ts +8 -0
- package/dist/@types/schema/src/index.d.ts +60 -0
- package/dist/@types/types/ci.d.ts +1 -1
- package/dist/@types/types/core.d.ts +3 -3
- package/dist/@types/types/devtools.d.ts +22 -3
- package/dist/@types/types/miniapp/index.d.ts +5 -0
- package/dist/@types/types/summer.d.ts +2 -0
- package/dist/@types/utils/messageHub.d.ts +2 -2
- package/dist/@types/utils/miniapp-builder.d.ts +13 -3
- package/dist/@types/utils/progressRecorder.d.ts +3 -1
- package/dist/@types/utils/subprocess/processManager.d.ts +4 -1
- package/dist/@types/utils/taskstatus.d.ts +3 -3
- package/dist/@types/utils/tools.d.ts +1 -0
- package/dist/@types/utils/usbProcess.d.ts +3 -0
- package/dist/ci/getCompiledResult.js +1 -1
- package/dist/ci/getcompiler.js +1 -1
- package/dist/ci/upload.js +1 -1
- package/dist/ci/utils/progressupdate.js +1 -0
- package/dist/common/code-analyse/index.js +1 -1
- package/dist/config/config.js +1 -1
- package/dist/modules/corecompiler/baseCompiler.js +1 -1
- package/dist/modules/corecompiler/original/workerThread/task/index.js +1 -1
- package/dist/modules/corecompiler/original/workerThread/task/minifywxml.js +1 -1
- package/dist/modules/corecompiler/originalCompiler.js +1 -1
- package/dist/modules/corecompiler/processHandler.js +1 -1
- package/dist/modules/corecompiler/summer/graph/appgraph.js +1 -1
- package/dist/modules/corecompiler/summer/graph/basegraph.js +1 -1
- package/dist/modules/corecompiler/summer/module.js +1 -1
- package/dist/modules/corecompiler/summer/plugins/base/es6module.js +1 -1
- package/dist/modules/corecompiler/summer/plugins/base/javascript.js +1 -1
- package/dist/modules/corecompiler/summer/plugins/base/swc.js +1 -1
- package/dist/modules/corecompiler/summer/plugins/base/wxss.js +1 -1
- package/dist/modules/corecompiler/summer/plugins/enhance.js +1 -1
- package/dist/modules/corecompiler/summer/plugins/less.js +1 -1
- package/dist/modules/corecompiler/summer/plugins/minifywxml.js +1 -1
- package/dist/modules/corecompiler/summer/plugins/sass.js +1 -1
- package/dist/modules/corecompiler/summer/plugins/terser.js +1 -1
- package/dist/modules/corecompiler/summer/plugins/typescript.js +1 -1
- package/dist/modules/corecompiler/summer/plugins/worklet.js +1 -1
- package/dist/modules/corecompiler/summer/summer.js +1 -1
- package/dist/modules/corecompiler/summer/worker.js +1 -1
- package/dist/modules/corecompiler/summerCompiler.js +1 -1
- package/dist/modules/createSummer.js +1 -1
- package/dist/modules/index.js +1 -1
- package/dist/modules/nativecompiler/index.js +1 -1
- package/dist/modules/nativecompiler/ios/buildCloud.js +1 -1
- package/dist/modules/nativecompiler/ios/index.js +1 -1
- package/dist/modules/nativecompiler/nativeCompiler.js +1 -1
- package/dist/modules/nativecompiler/nativeEntryProcess.js +1 -1
- package/dist/modules/precompiler/conditioncompile/index.js +1 -1
- package/dist/modules/precompiler/index.js +1 -1
- package/dist/project/advance/precompileProject.js +1 -1
- package/dist/project/baseProject.js +1 -1
- package/dist/schema/@types/appjson.js +1 -0
- package/dist/schema/@types/extjson.js +1 -0
- package/dist/schema/@types/gamejson.js +1 -0
- package/dist/schema/@types/pagejson.js +1 -0
- package/dist/schema/@types/pluginjson.js +1 -0
- package/dist/schema/@types/pluginpagejson.js +1 -0
- package/dist/schema/@types/projectconfigjson.js +1 -0
- package/dist/schema/@types/projectprivateconfigjson.js +1 -0
- package/dist/schema/@types/sitemapjson.js +1 -0
- package/dist/schema/@types/themejson.js +1 -0
- package/dist/schema/dist/app.js +1 -1
- package/dist/schema/dist/ext.js +1 -1
- package/dist/schema/dist/game.js +1 -1
- package/dist/schema/dist/page.js +1 -1
- package/dist/schema/dist/plugin.js +1 -1
- package/dist/schema/dist/pluginpage.js +1 -1
- package/dist/schema/dist/projectconfig.js +37 -1
- package/dist/schema/dist/projectprivateconfig.js +1 -1
- package/dist/schema/dist/sitemap.js +1 -1
- package/dist/schema/dist/theme.js +1 -1
- package/dist/schema/src/index.js +1 -0
- package/dist/utils/codesign.js +1 -1
- package/dist/utils/cp.js +1 -1
- package/dist/utils/miniapp-builder.js +1 -1
- package/dist/utils/miniappJson.js +1 -1
- package/dist/utils/progressRecorder.js +1 -1
- package/dist/utils/subprocess/processManager.js +1 -1
- package/dist/utils/taskstatus.js +1 -1
- package/dist/utils/tools.js +1 -1
- package/dist/utils/usbProcess.js +1 -0
- package/package.json +1 -1
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { MiniProgramCore } from './core';
|
|
3
3
|
import { MiniProgramSummer, IBasicCodeExt } from './summer';
|
|
4
4
|
export declare namespace MiniProgramDevtools {
|
|
5
|
-
type IBuildLogType = 'doing' | 'success' | 'error' | 'info';
|
|
5
|
+
type IBuildLogType = 'doing' | 'success' | 'error' | 'info' | 'warn';
|
|
6
6
|
interface IAppConf {
|
|
7
7
|
app: any;
|
|
8
8
|
packages: Record<string, any>;
|
|
@@ -25,7 +25,7 @@ export declare namespace MiniProgramDevtools {
|
|
|
25
25
|
plugin: any;
|
|
26
26
|
}
|
|
27
27
|
type IShowBuildLog = (msgId: string, type: IBuildLogType, text: string) => void;
|
|
28
|
-
type ProgressUpdate = (id: number | string, status:
|
|
28
|
+
type ProgressUpdate = (id: number | string, status: IBuildLogType, message: string) => void;
|
|
29
29
|
type ISummerPluginConfig = Array<string | [string, MiniProgramSummer.SummerPluginOptions]>;
|
|
30
30
|
type IBabelSetting = {
|
|
31
31
|
outputPath?: string;
|
|
@@ -86,7 +86,7 @@ export declare namespace MiniProgramDevtools {
|
|
|
86
86
|
type: 'progress';
|
|
87
87
|
id: number;
|
|
88
88
|
taskId: number;
|
|
89
|
-
status: 'doing' | '
|
|
89
|
+
status: 'doing' | 'success';
|
|
90
90
|
message: string;
|
|
91
91
|
}
|
|
92
92
|
interface RequestMsg {
|
|
@@ -95,6 +95,12 @@ export declare namespace MiniProgramDevtools {
|
|
|
95
95
|
name: string;
|
|
96
96
|
data: any;
|
|
97
97
|
}
|
|
98
|
+
interface LogMsg {
|
|
99
|
+
type: 'log';
|
|
100
|
+
id: string;
|
|
101
|
+
status: IBuildLogType;
|
|
102
|
+
text: string;
|
|
103
|
+
}
|
|
98
104
|
interface ResponseMsg {
|
|
99
105
|
type: 'response';
|
|
100
106
|
id: number;
|
|
@@ -120,6 +126,7 @@ export declare namespace MiniProgramDevtools {
|
|
|
120
126
|
md5: string;
|
|
121
127
|
code: string;
|
|
122
128
|
map?: MiniProgramSummer.SourceMap | string;
|
|
129
|
+
mtime?: number;
|
|
123
130
|
jsTag?: {
|
|
124
131
|
isLargeFile: boolean;
|
|
125
132
|
isBabelIgnore: boolean;
|
|
@@ -187,6 +194,18 @@ export declare namespace MiniProgramDevtools {
|
|
|
187
194
|
disablePlugins: string[];
|
|
188
195
|
outputPath: string;
|
|
189
196
|
};
|
|
197
|
+
minifyWXMLSetting?: {
|
|
198
|
+
global: {
|
|
199
|
+
collapseWhitespace?: boolean;
|
|
200
|
+
conservativeCollapse?: boolean;
|
|
201
|
+
preserveLineBreaks?: boolean;
|
|
202
|
+
};
|
|
203
|
+
[filePath: string]: {
|
|
204
|
+
collapseWhitespace?: boolean;
|
|
205
|
+
conservativeCollapse?: boolean;
|
|
206
|
+
preserveLineBreaks?: boolean;
|
|
207
|
+
};
|
|
208
|
+
};
|
|
190
209
|
bundle?: boolean;
|
|
191
210
|
userConfirmedBundleSwitch?: boolean;
|
|
192
211
|
useIsolateContext?: boolean;
|
|
@@ -98,6 +98,7 @@ export declare namespace IMiniApp {
|
|
|
98
98
|
pluginDirList: IIOSPluginDir[];
|
|
99
99
|
theme: ITheme;
|
|
100
100
|
i18nInfo: II18NInfo;
|
|
101
|
+
debugInfo?: IDebugInfo;
|
|
101
102
|
}
|
|
102
103
|
type IIOSRunCloudArgs = IIOSRunCloudSimpleArgs & {
|
|
103
104
|
projectPath: string;
|
|
@@ -132,6 +133,9 @@ export declare namespace IMiniApp {
|
|
|
132
133
|
android?: Record<string, string>;
|
|
133
134
|
};
|
|
134
135
|
type II18NInfo = Record<string, ITranslations>;
|
|
136
|
+
type IDebugInfo = {
|
|
137
|
+
debugType: 'HotReload' | 'Release' | 'RemoteDebug' | 'Debug';
|
|
138
|
+
};
|
|
135
139
|
type IIOSBuildCloudSimpleArgs = {
|
|
136
140
|
buildType: IBuileType;
|
|
137
141
|
output: string;
|
|
@@ -144,6 +148,7 @@ export declare namespace IMiniApp {
|
|
|
144
148
|
pluginDirList: IIOSPluginDir[];
|
|
145
149
|
theme: ITheme;
|
|
146
150
|
i18nInfo: II18NInfo;
|
|
151
|
+
debugInfo?: IDebugInfo;
|
|
147
152
|
};
|
|
148
153
|
type IIOSBuildCloudArgs = IIOSBuildCloudSimpleArgs & {
|
|
149
154
|
projectPath: string;
|
|
@@ -48,6 +48,7 @@ export declare namespace MiniProgramSummer {
|
|
|
48
48
|
inputMap?: SourceMap;
|
|
49
49
|
astInfo?: AstInfo;
|
|
50
50
|
largeFile?: boolean;
|
|
51
|
+
mtime?: number;
|
|
51
52
|
};
|
|
52
53
|
type GenerateDescription = {
|
|
53
54
|
code: string;
|
|
@@ -57,6 +58,7 @@ export declare namespace MiniProgramSummer {
|
|
|
57
58
|
resultType?: MiniProgramCore.IResultType;
|
|
58
59
|
};
|
|
59
60
|
interface IPluginProcessInfo {
|
|
61
|
+
cost: number;
|
|
60
62
|
pluginName: string;
|
|
61
63
|
action: AsyncPluginHooks;
|
|
62
64
|
options?: Record<string, any>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { MiniProgramCore } from '../types';
|
|
2
|
-
export type IBuildLogType =
|
|
1
|
+
import { MiniProgramCore, MiniProgramDevtools } from '../types';
|
|
2
|
+
export type IBuildLogType = MiniProgramDevtools.IBuildLogType;
|
|
3
3
|
export interface IMessageHub {
|
|
4
4
|
showStatus?: (id: number, message: string, type?: 'info' | 'success' | 'fail') => void;
|
|
5
5
|
hideStatus?: (id: number) => void;
|
|
@@ -2,6 +2,10 @@ import { IMiniApp } from '../types';
|
|
|
2
2
|
import { Recorder } from './progressRecorder';
|
|
3
3
|
import { IEntitlements } from './codesign';
|
|
4
4
|
export declare const DEFAULT_BUNDLE_ID = "com.tencent.devtoolssaaademo.db";
|
|
5
|
+
type IMiniAppBuildTips = Record<string, {
|
|
6
|
+
code: number;
|
|
7
|
+
msg: string;
|
|
8
|
+
}>;
|
|
5
9
|
export declare const miniappSinTypes: {
|
|
6
10
|
appleId: {
|
|
7
11
|
type: string;
|
|
@@ -39,8 +43,9 @@ interface ICertificateSignAndInstall {
|
|
|
39
43
|
interface ISignAndInstallResult {
|
|
40
44
|
success: boolean;
|
|
41
45
|
errMsg?: string;
|
|
46
|
+
uniqueId?: string;
|
|
42
47
|
}
|
|
43
|
-
interface IGetMiniAppBuilderOts {
|
|
48
|
+
export interface IGetMiniAppBuilderOts {
|
|
44
49
|
miniappDirPath?: string;
|
|
45
50
|
devtoolsVersion?: string;
|
|
46
51
|
recorder?: Recorder;
|
|
@@ -54,10 +59,15 @@ interface IGetDevicesOpts {
|
|
|
54
59
|
type IClearCacheOpts = IGetDevicesOpts & {
|
|
55
60
|
type: 'appleId' | 'certificate';
|
|
56
61
|
};
|
|
62
|
+
export declare function getMiniAppBuilderFromRemoteCore(opts: IGetMiniAppBuilderOts, winExeFileName: string, macExeFileName: string): Promise<{
|
|
63
|
+
builderPath: string;
|
|
64
|
+
exe: string;
|
|
65
|
+
cwd: string;
|
|
66
|
+
}>;
|
|
57
67
|
export declare function getIOSDevices(opts: IGetDevicesOpts): Promise<IMiniApp.IOSDevice[]>;
|
|
58
68
|
export declare function clearCache(opts: IClearCacheOpts): Promise<void>;
|
|
59
|
-
export declare function doAppleIdSignAndInstallOrExport(opts: IAppleIdSignAndInstall, otherOpts: IGetMiniAppBuilderOts): Promise<ISignAndInstallResult>;
|
|
60
|
-
export declare function doCertificateSignAndInstallOrExport(opts: ICertificateSignAndInstall, otherOpts: IGetMiniAppBuilderOts): Promise<ISignAndInstallResult>;
|
|
69
|
+
export declare function doAppleIdSignAndInstallOrExport(opts: IAppleIdSignAndInstall, otherOpts: IGetMiniAppBuilderOts, iosTransformTips: IMiniAppBuildTips): Promise<ISignAndInstallResult>;
|
|
70
|
+
export declare function doCertificateSignAndInstallOrExport(opts: ICertificateSignAndInstall, otherOpts: IGetMiniAppBuilderOts, iosTransformTips: IMiniAppBuildTips): Promise<ISignAndInstallResult>;
|
|
61
71
|
export declare function signAndInstallOrExport(projectPath: string, demoIpaPath: string, miniappCacheDirPath: string, certificateInfo: IMiniApp.ISignCertficateInfo, opts: {
|
|
62
72
|
deviceId?: string;
|
|
63
73
|
install?: boolean;
|
|
@@ -3,7 +3,7 @@ export declare function getPrintTime(): string;
|
|
|
3
3
|
export declare class Recorder {
|
|
4
4
|
private sendProgress;
|
|
5
5
|
progress: (message: string) => void;
|
|
6
|
-
message(type:
|
|
6
|
+
message(type: MiniProgramDevtools.IBuildLogType, message: string): void;
|
|
7
7
|
constructor(sendProgress: MiniProgramDevtools.ProgressUpdate);
|
|
8
8
|
start(message: string): {
|
|
9
9
|
(err?: any, res?: any): void;
|
|
@@ -12,3 +12,5 @@ export declare class Recorder {
|
|
|
12
12
|
run<T>(message: string, runner: () => Promise<T> | T): Promise<T>;
|
|
13
13
|
}
|
|
14
14
|
export declare const silentRecorder: Recorder;
|
|
15
|
+
export declare const TransformTipsURL = "https://web-v2-1g8g0y2x3197301a-1304825656.tcloudbaseapp.com/important_miniapp/MiniAppBuildTips.json?sign=0f07b014a760d699cf2c8a9bb84845bf&t=1724920547";
|
|
16
|
+
export declare const IOSBuildMessageCache: Record<string, string[]>;
|
|
@@ -5,20 +5,23 @@ export declare class SubProcessProxy {
|
|
|
5
5
|
private passData;
|
|
6
6
|
private initOptions;
|
|
7
7
|
private inspectPort;
|
|
8
|
+
private progressUpdate?;
|
|
8
9
|
private process?;
|
|
9
10
|
private taskMap;
|
|
10
11
|
private taskId;
|
|
11
12
|
private _checkReadyTask?;
|
|
13
|
+
private _cpPromise?;
|
|
12
14
|
constructor(project: MiniProgramCore.IPreCompileProject, entryPath: string, passData: {
|
|
13
15
|
cachePath?: string;
|
|
14
16
|
miniappDirPath?: string;
|
|
15
17
|
devtoolsVersion?: string;
|
|
16
|
-
}, initOptions: any, inspectPort?: number);
|
|
18
|
+
}, initOptions: any, inspectPort?: number, progressUpdate?: MiniProgramDevtools.ProgressUpdate | undefined);
|
|
17
19
|
private ready;
|
|
18
20
|
private sendProcessMessage;
|
|
19
21
|
private init;
|
|
20
22
|
destroy(): void;
|
|
21
23
|
private forkProcess;
|
|
24
|
+
private onMessage;
|
|
22
25
|
private onResponse;
|
|
23
26
|
sendEvent(name: string, data: any): Promise<void>;
|
|
24
27
|
runTask<T = any>(name: string, data?: any, progressUpdate?: MiniProgramDevtools.ProgressUpdate): Promise<T>;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { MiniProgramCore } from '../types';
|
|
2
2
|
export declare class TaskStatus implements MiniProgramCore.ITaskStatus {
|
|
3
3
|
private _id;
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
protected _status: 'doing' | 'success';
|
|
5
|
+
protected _msg: string;
|
|
6
6
|
constructor(msg: string);
|
|
7
7
|
get id(): string;
|
|
8
|
-
get status(): "
|
|
8
|
+
get status(): "success" | "doing";
|
|
9
9
|
get message(): string;
|
|
10
10
|
done(): void;
|
|
11
11
|
toString(): string;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { RawSourceMap } from 'source-map';
|
|
3
3
|
import { AppJSON, MiniProgramCI, MiniProgramCore } from '../types';
|
|
4
4
|
export declare function normalizePath(pathName?: string): string;
|
|
5
|
+
export declare function joinPath(basePath?: string, appendPath?: string): string;
|
|
5
6
|
export declare function escapeScript(str: string): string;
|
|
6
7
|
export declare function wrapCodeByEval(code: string): string;
|
|
7
8
|
export declare function getType(object: any): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getCompiledResult=exports.SIGNATURE_FILE_NAME=void 0;const tslib_1=require("tslib"),fs_extra_1=tslib_1.__importDefault(require("fs-extra")),config_1=require("../config/config"),error_1=require("../utils/error"),locales_1=tslib_1.__importDefault(require("../utils/locales/locales")),cache_1=require("../utils/cache"),jszip_1=tslib_1.__importDefault(require("jszip")),path_1=tslib_1.__importDefault(require("path")),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getCompiledResult=exports.SIGNATURE_FILE_NAME=void 0;const tslib_1=require("tslib"),fs_extra_1=tslib_1.__importDefault(require("fs-extra")),config_1=require("../config/config"),error_1=require("../utils/error"),locales_1=tslib_1.__importDefault(require("../utils/locales/locales")),cache_1=require("../utils/cache"),progressupdate_1=require("./utils/progressupdate"),jszip_1=tslib_1.__importDefault(require("jszip")),path_1=tslib_1.__importDefault(require("path")),getcompiler_1=require("./getcompiler"),tools_1=require("./utils/tools");async function getCompiledResult(e,t){const{project:r,setting:o={},onProgressUpdate:s=function(e){console.log(""+e)},threads:i=0,includedMap:a=!1}=e;if(process.env.COMPILE_THREADS=i.toString(),!r)throw new error_1.CodeError(locales_1.default.config.PARAM_ERROR.format("upload","project"),config_1.PARAM_ERROR);cache_1.cacheManager.clean();const l=await(0,getcompiler_1.getCompiler)(r,o),_=await l.compile({setting:(0,tools_1.formatCISetting)(r,o),onProgressUpdate:(0,progressupdate_1.transProgressUpdate)(s),resultType:"prod"}),u={};if(Object.keys(_).sort().forEach(e=>{e.endsWith("js.map")&&!a||(u[e]=_[e])}),t){const e=new jszip_1.default;Object.keys(u).forEach(t=>{e.folder(path_1.default.dirname(t)).file(path_1.default.basename(t),u[t])});const r=await e.generateAsync({type:"nodebuffer"});fs_extra_1.default.ensureDirSync(path_1.default.dirname(t)),fs_extra_1.default.writeFileSync(t,r)}return u}exports.SIGNATURE_FILE_NAME="ci.signature",exports.getCompiledResult=getCompiledResult;
|
package/dist/ci/getcompiler.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getCompiler=exports.getOriginalCompiler=void 0;const tslib_1=require("tslib"),originalCompiler_1=require("../modules/corecompiler/originalCompiler"),locales_1=tslib_1.__importDefault(require("../utils/locales/locales")),index_1=require("../modules/index"),precompileProject_1=require("../project/advance/precompileProject"),precompiler_1=require("../modules/precompiler"),tools_1=require("./utils/tools");let compilerInstance;const getOriginalCompiler=async e=>{if(!compilerInstance||!compilerInstance.project||compilerInstance.project.projectPath!==e.projectPath){const r=new precompiler_1.ConditionCompiler(e),o=new precompileProject_1.PreCompileProject(e,r,{targetPlatform:"mini-weixin"});compilerInstance=new originalCompiler_1.OriginalCompiler(o)}return await compilerInstance.ready(),compilerInstance.setLocale(locales_1.default.getLocale()),compilerInstance};async function getBuilder(e){const r=new index_1.Builder(e,{devtoolMessagehub:{showBuildLog:(e,r,o)=>{console.error("msg-"+e,"compile",r,o)}}});return await r.ready(),r}exports.getOriginalCompiler=getOriginalCompiler;const getCompiler=async(e,r)=>{e.setting=(0,tools_1.formatCISetting)(e,r);return(await getBuilder(e)).getCompiler()};exports.getCompiler=getCompiler;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getCompiler=exports.getOriginalCompiler=void 0;const tslib_1=require("tslib"),originalCompiler_1=require("../modules/corecompiler/originalCompiler"),locales_1=tslib_1.__importDefault(require("../utils/locales/locales")),index_1=require("../modules/index"),precompileProject_1=require("../project/advance/precompileProject"),precompiler_1=require("../modules/precompiler"),tools_1=require("./utils/tools");let compilerInstance;const getOriginalCompiler=async e=>{if(!compilerInstance||!compilerInstance.project||compilerInstance.project.projectPath!==e.projectPath){const r=new precompiler_1.ConditionCompiler(e,void 0,void 0),o=new precompileProject_1.PreCompileProject(e,r,{targetPlatform:"mini-weixin"});compilerInstance=new originalCompiler_1.OriginalCompiler(o)}return await compilerInstance.ready(),compilerInstance.setLocale(locales_1.default.getLocale()),compilerInstance};async function getBuilder(e){const r=new index_1.Builder(e,{devtoolMessagehub:{showBuildLog:(e,r,o)=>{console.error("msg-"+e,"compile",r,o)}}});return await r.ready(),r}exports.getOriginalCompiler=getOriginalCompiler;const getCompiler=async(e,r)=>{e.setting=(0,tools_1.formatCISetting)(e,r);return(await getBuilder(e)).getCompiler()};exports.getCompiler=getCompiler;
|
package/dist/ci/upload.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.innerUpload=exports.upload=exports.SIGNATURE_FILE_NAME=void 0;const tslib_1=require("tslib"),log=tslib_1.__importStar(require("../utils/log")),request_1=require("../utils/request"),pack_1=require("./utils/pack"),zlib_1=tslib_1.__importDefault(require("zlib")),sign_1=require("../utils/sign"),tools_1=require("../utils/tools"),config_1=require("../config/config"),taskstatus_1=require("../utils/taskstatus"),error_1=require("../utils/error"),locales_1=tslib_1.__importDefault(require("../utils/locales/locales")),querystring_1=tslib_1.__importDefault(require("querystring")),url_config_1=require("../config/url.config"),jsonParse_1=require("../utils/jsonParse"),cache_1=require("../utils/cache"),cos_upload_1=require("./cos-upload"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.innerUpload=exports.upload=exports.SIGNATURE_FILE_NAME=void 0;const tslib_1=require("tslib"),log=tslib_1.__importStar(require("../utils/log")),request_1=require("../utils/request"),pack_1=require("./utils/pack"),zlib_1=tslib_1.__importDefault(require("zlib")),sign_1=require("../utils/sign"),tools_1=require("../utils/tools"),config_1=require("../config/config"),taskstatus_1=require("../utils/taskstatus"),error_1=require("../utils/error"),locales_1=tslib_1.__importDefault(require("../utils/locales/locales")),querystring_1=tslib_1.__importDefault(require("querystring")),progressupdate_1=require("./utils/progressupdate"),url_config_1=require("../config/url.config"),jsonParse_1=require("../utils/jsonParse"),cache_1=require("../utils/cache"),cos_upload_1=require("./cos-upload"),getcompiler_1=require("./getcompiler"),tools_2=require("./utils/tools");exports.SIGNATURE_FILE_NAME="ci.signature";const MIN_COS_UPLOAD_SIZE=5242880;async function upload(e){var o;const r=await innerUpload(e);return(null===(o=r.respBody)||void 0===o?void 0:o.dev_plugin_id)&&(log.log("Development Version Plugin ID: "+r.respBody.dev_plugin_id),r.devPluginId=r.respBody.dev_plugin_id),{subPackageInfo:r.subPackageInfo,pluginInfo:r.pluginInfo,devPluginId:r.devPluginId}}async function innerUpload(e){const{project:o,setting:r={useProjectConfig:!1},desc:t=`robot ${e.robot||"1"} use miniprogram-ci to upload at ${(0,tools_1.formatTime)(new Date)}`,version:i="",robot:s="1",test:a,pagePath:n,searchQuery:l,threads:u=0,bigPackageSizeSupport:p}=e,c=(0,progressupdate_1.transProgressUpdate)(e.onProgressUpdate||(e=>{if("object"==typeof e)try{const o=JSON.stringify(e);console.log(o)}catch(e){}console.log(""+e)}));let{useCOS:_}=e;if(process.env.COMPILE_THREADS=u.toString(),!i)throw new error_1.CodeError(locales_1.default.config.PARAM_ERROR.format("upload","version"),config_1.PARAM_ERROR);if(!o)throw new error_1.CodeError(locales_1.default.config.PARAM_ERROR.format("upload","project"),config_1.PARAM_ERROR);cache_1.cacheManager.clean();const d=await(0,getcompiler_1.getCompiler)(o,r),g=(0,tools_2.formatCISetting)(o,r),f=await d.compile({setting:g,onProgressUpdate:c,resultType:"prod"}),b=config_1.CI_VERSION,y={codeprotect:r.codeProtect?1:0,type:o.type,appid:o.appid,version:i,desc:t,robot:s},S={scene:e.scene||1011};let P;n&&(S.path=n,y.path=n),l&&(S.query=querystring_1.default.parse(l)),y.debugLaunchInfo=JSON.stringify(S),n&&l&&(y.path+="?"+l),a&&p&&(y.bigPackageSizeSupport=1);let q={};try{P=await o.getFile(o.miniprogramRoot,"ext.json"),q=JSON.parse(P.toString("utf-8"))}catch(e){}if(q&&(q.extEnable&&(y.extAppId=q.extAppid),q.directCommit)){let e="";e=q.extEnable?"The code will be uploaded into the waiting list of extAppid.":"The code will be uploaded into the draft box of the third-party platform.",log.warn(e)}try{const e=new taskstatus_1.TaskStatus(locales_1.default.config.UPLOAD.toString());c(e);const r=`${a?url_config_1.TEST_SOURCE_URL:url_config_1.UPLOAD_URL}?${querystring_1.default.stringify(y)}`;let t,i=!1,n=0;const l=(0,pack_1.pack)(f),u=zlib_1.default.gzipSync(l.buffer);if(log.info("useCOS parameter: ",_),log.info("upload zip buffer size: ",u.length),void 0===_&&(_=u.length>5242880),_){log.info("upload by COS: ",_);const e=await(0,cos_upload_1.uploadByCos)(u,r,o,s);e.fallback?(i=e.fallback,log.info("upload by COS failed, fallback to http way")):(t={body:e.body},n=e.uploadCOSCostTime)}if(!_||i){const e=await(0,sign_1.getSignature)(o.privateKey,o.appid);f[exports.SIGNATURE_FILE_NAME]=JSON.stringify({signature:e,version:b});const i=(0,pack_1.pack)(f),s=zlib_1.default.gzipSync(i.buffer);log.info("request url:",r);const a=(await(0,request_1.request)({url:r,method:"post",body:s})).body.toString();if(t=(0,jsonParse_1.jsonRespParse)(a,r),0!==t.errCode)throw new Error(a)}e.done(),c(e);const p={respBody:t.body};if(Array.isArray(t.body.subpackage_info)){const e=t.body.subpackage_info;p.subPackageInfo=e}if(Array.isArray(t.body.ext_plugin_info)){const e=t.body.ext_plugin_info;p.pluginInfo=e.map(e=>({pluginProviderAppid:e.provider,version:e.version,size:e.size}))}return p}catch(e){throw new error_1.CodeError(e.toString(),config_1.UPLOAD_CGI_ERR)}}exports.upload=upload,exports.innerUpload=innerUpload;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.transProgressUpdate=void 0;const transProgressUpdate=s=>e=>{const r=e.status,t={id:e.id,message:e.message,status:{success:"done",error:"fail",doing:"doing",warn:"warn",info:"info"}[r]||"info"};s(t)};exports.transProgressUpdate=transProgressUpdate;
|