miniprogram-ci 2.0.10 → 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 +3 -0
- package/README.md +3 -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/originalCompiler.d.ts +1 -0
- package/dist/@types/modules/corecompiler/processHandler.d.ts +2 -21
- package/dist/@types/modules/corecompiler/summerCompiler.d.ts +4 -1
- package/dist/@types/modules/precompiler/conditioncompile/index.d.ts +3 -2
- package/dist/@types/modules/precompiler/index.d.ts +3 -2
- package/dist/@types/types/ci.d.ts +1 -1
- package/dist/@types/types/core.d.ts +1 -1
- package/dist/@types/types/devtools.d.ts +10 -3
- package/dist/@types/types/summer.d.ts +1 -0
- package/dist/@types/utils/messageHub.d.ts +2 -2
- package/dist/@types/utils/miniapp-builder.d.ts +7 -2
- 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/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/minifywxml.js +1 -1
- package/dist/modules/corecompiler/processHandler.js +1 -1
- package/dist/modules/corecompiler/summer/module.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/terser.js +1 -1
- package/dist/modules/corecompiler/summer/plugins/typescript.js +1 -1
- package/dist/modules/corecompiler/summer/worker.js +1 -1
- package/dist/modules/corecompiler/summerCompiler.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/precompiler/conditioncompile/index.js +1 -1
- package/dist/modules/precompiler/index.js +1 -1
- package/dist/project/advance/precompileProject.js +1 -1
- 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/progressRecorder.js +1 -1
- package/dist/utils/subprocess/processManager.js +1 -1
- package/dist/utils/taskstatus.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -9,7 +9,6 @@ interface IUploadOptions {
|
|
|
9
9
|
threads?: number;
|
|
10
10
|
useCOS?: boolean;
|
|
11
11
|
onProgressUpdate?: (task: MiniProgramCI.ITaskStatus | string) => void;
|
|
12
|
-
allowIgnoreUnusedFiles?: boolean;
|
|
13
12
|
}
|
|
14
13
|
export interface IInnerUploadOptions extends IUploadOptions {
|
|
15
14
|
test?: boolean;
|
|
@@ -31,6 +31,11 @@ export declare abstract class BaseCoreCompiler {
|
|
|
31
31
|
disableUseStrict?: boolean;
|
|
32
32
|
compileWorklet?: boolean;
|
|
33
33
|
};
|
|
34
|
+
resultType?: MiniProgramCore.IResultType;
|
|
35
|
+
}): Promise<any>;
|
|
36
|
+
compileJSList(options: {
|
|
37
|
+
root: string;
|
|
38
|
+
fileList: string[];
|
|
34
39
|
}): Promise<any>;
|
|
35
40
|
compile(options: MiniProgramCore.ICompileOptions): any;
|
|
36
41
|
clearCache(): void;
|
|
@@ -1,24 +1,5 @@
|
|
|
1
1
|
import { MiniProgramDevtools } from '../../types';
|
|
2
|
-
interface IProcessMsg {
|
|
3
|
-
type: 'progress';
|
|
4
|
-
id: number | string;
|
|
5
|
-
taskId: number;
|
|
6
|
-
status: string;
|
|
7
|
-
message: string;
|
|
8
|
-
}
|
|
9
|
-
interface IResponseMsg {
|
|
10
|
-
type: 'response';
|
|
11
|
-
id: number | string;
|
|
12
|
-
data: any;
|
|
13
|
-
error?: {
|
|
14
|
-
code: number;
|
|
15
|
-
message: string;
|
|
16
|
-
stack: string;
|
|
17
|
-
path: string;
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
type ICallbackMsg = IProcessMsg | IResponseMsg;
|
|
21
2
|
export declare function initHandler(message: MiniProgramDevtools.InitMsg): Promise<void>;
|
|
22
3
|
export declare function destroy(): Promise<void>;
|
|
23
|
-
export declare
|
|
24
|
-
export
|
|
4
|
+
export declare const onMessage: (fn: (...args: any[]) => any) => void;
|
|
5
|
+
export declare function messageHandler(message: MiniProgramDevtools.SummerProcessMessage): Promise<void>;
|
|
@@ -18,6 +18,7 @@ export declare class SummerCompiler extends BaseCoreCompiler {
|
|
|
18
18
|
private promiseCache;
|
|
19
19
|
private _taskCache;
|
|
20
20
|
private messageHub;
|
|
21
|
+
private progressUpdateFromCompileOptions?;
|
|
21
22
|
_status: MiniProgramDevtools.ICompilerStatus | undefined;
|
|
22
23
|
private _eventAdded;
|
|
23
24
|
private _locale;
|
|
@@ -86,7 +87,6 @@ export declare class SummerCompiler extends BaseCoreCompiler {
|
|
|
86
87
|
compileJSList(options: {
|
|
87
88
|
root: string;
|
|
88
89
|
fileList: string[];
|
|
89
|
-
babelRoot: string;
|
|
90
90
|
}): Promise<{
|
|
91
91
|
isLargeFile?: boolean | undefined;
|
|
92
92
|
isBabelIgnore?: boolean | undefined;
|
|
@@ -94,6 +94,7 @@ export declare class SummerCompiler extends BaseCoreCompiler {
|
|
|
94
94
|
filePath: string;
|
|
95
95
|
code: string;
|
|
96
96
|
map: string | import("../../types").MiniProgramSummer.SourceMap | undefined;
|
|
97
|
+
mtime: number | undefined;
|
|
97
98
|
}[]>;
|
|
98
99
|
compileJS(options: {
|
|
99
100
|
root: string;
|
|
@@ -101,6 +102,7 @@ export declare class SummerCompiler extends BaseCoreCompiler {
|
|
|
101
102
|
babelRoot: string;
|
|
102
103
|
sourceCode?: string;
|
|
103
104
|
setting: MiniProgramDevtools.IProjectSetting;
|
|
105
|
+
resultType?: MiniProgramCore.IResultType;
|
|
104
106
|
}): Promise<{
|
|
105
107
|
isLargeFile?: boolean | undefined;
|
|
106
108
|
isBabelIgnore?: boolean | undefined;
|
|
@@ -108,6 +110,7 @@ export declare class SummerCompiler extends BaseCoreCompiler {
|
|
|
108
110
|
filePath: string;
|
|
109
111
|
code: string;
|
|
110
112
|
map: string | import("../../types").MiniProgramSummer.SourceMap | undefined;
|
|
113
|
+
mtime: number | undefined;
|
|
111
114
|
}>;
|
|
112
115
|
compile(options: MiniProgramCore.ICompileOptions): Promise<MiniProgramDevtools.ICompileResult>;
|
|
113
116
|
private compileOther;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { MiniProgramCI, MiniProgramCore } from '../../../types';
|
|
3
3
|
import { BaseConditionCompiler } from './compiler/base';
|
|
4
|
-
import { IMessageHub } from '../../../utils/messageHub';
|
|
4
|
+
import { IConsoleDisplay, IMessageHub } from '../../../utils/messageHub';
|
|
5
5
|
interface IConditionCompiler {
|
|
6
6
|
targetPlatform: MiniProgramCore.ITargetPlatform;
|
|
7
7
|
targetPlatformDefines?: MiniProgramCore.ITargetPlatformDefine;
|
|
@@ -12,7 +12,8 @@ export declare class ConditionCompiler {
|
|
|
12
12
|
};
|
|
13
13
|
project: MiniProgramCI.IProject;
|
|
14
14
|
devtoolMessagehub?: IMessageHub;
|
|
15
|
-
|
|
15
|
+
consoleDisplay?: IConsoleDisplay;
|
|
16
|
+
constructor(project: MiniProgramCI.IProject, devtoolMessagehub: IMessageHub | undefined, consoleDisplay: IConsoleDisplay | undefined);
|
|
16
17
|
getCompiler(extname: string, opts: IConditionCompiler): BaseConditionCompiler;
|
|
17
18
|
shouldCompile(filePath: string): boolean;
|
|
18
19
|
compileFile(filePath: string, opts?: IConditionCompiler): Buffer;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { MiniProgramCI, MiniProgramCore } from '../../types';
|
|
2
2
|
import { PreCompileProject } from '../../project/advance/precompileProject';
|
|
3
|
-
import { IMessageHub } from '../../utils/messageHub';
|
|
3
|
+
import { IConsoleDisplay, IMessageHub } from '../../utils/messageHub';
|
|
4
4
|
export declare class PreCompiler {
|
|
5
5
|
project: MiniProgramCI.IProject;
|
|
6
6
|
devtoolMessagehub?: IMessageHub;
|
|
7
|
-
|
|
7
|
+
consoleDisplay?: IConsoleDisplay;
|
|
8
|
+
constructor(project: MiniProgramCI.IProject, devtoolMessagehub: IMessageHub | undefined, consoleDisplay: IConsoleDisplay | undefined);
|
|
8
9
|
getPreCompileProject(opts?: MiniProgramCore.IConditionCompileInfo): Promise<PreCompileProject>;
|
|
9
10
|
}
|
|
10
11
|
export { ConditionCompiler } from './conditioncompile';
|
|
@@ -105,7 +105,7 @@ export declare namespace MiniProgramCI {
|
|
|
105
105
|
interface ITaskStatus {
|
|
106
106
|
id: string;
|
|
107
107
|
message: string;
|
|
108
|
-
status: 'doing' | 'done' | 'fail' | 'warn';
|
|
108
|
+
status: 'doing' | 'done' | 'fail' | 'warn' | 'info';
|
|
109
109
|
}
|
|
110
110
|
interface IDevToolsCompileCache {
|
|
111
111
|
init: (project: IProject) => Promise<void>;
|
|
@@ -82,7 +82,7 @@ export declare namespace MiniProgramCore {
|
|
|
82
82
|
interface ITaskStatus {
|
|
83
83
|
id: string;
|
|
84
84
|
message: string;
|
|
85
|
-
status:
|
|
85
|
+
status: MiniProgramDevtools.IBuildLogType;
|
|
86
86
|
}
|
|
87
87
|
interface IDevToolsCompileCache {
|
|
88
88
|
init: (project: IProject) => Promise<void>;
|
|
@@ -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;
|
|
@@ -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,6 +43,7 @@ interface ICertificateSignAndInstall {
|
|
|
39
43
|
interface ISignAndInstallResult {
|
|
40
44
|
success: boolean;
|
|
41
45
|
errMsg?: string;
|
|
46
|
+
uniqueId?: string;
|
|
42
47
|
}
|
|
43
48
|
export interface IGetMiniAppBuilderOts {
|
|
44
49
|
miniappDirPath?: string;
|
|
@@ -61,8 +66,8 @@ export declare function getMiniAppBuilderFromRemoteCore(opts: IGetMiniAppBuilder
|
|
|
61
66
|
}>;
|
|
62
67
|
export declare function getIOSDevices(opts: IGetDevicesOpts): Promise<IMiniApp.IOSDevice[]>;
|
|
63
68
|
export declare function clearCache(opts: IClearCacheOpts): Promise<void>;
|
|
64
|
-
export declare function doAppleIdSignAndInstallOrExport(opts: IAppleIdSignAndInstall, otherOpts: IGetMiniAppBuilderOts): Promise<ISignAndInstallResult>;
|
|
65
|
-
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>;
|
|
66
71
|
export declare function signAndInstallOrExport(projectPath: string, demoIpaPath: string, miniappCacheDirPath: string, certificateInfo: IMiniApp.ISignCertficateInfo, opts: {
|
|
67
72
|
deviceId?: string;
|
|
68
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;
|
|
@@ -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;
|