miniprogram-ci 1.6.10 → 1.8.18
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 +8 -0
- package/README.md +1 -1
- package/dist/@types/ci/cos-upload.d.ts +1 -3
- package/dist/@types/config.d.ts +1 -3
- package/dist/@types/core/json/app/checkAppFields.d.ts +2 -0
- package/dist/@types/index.d.ts +2 -0
- package/dist/@types/summer/devtool.d.ts +5 -0
- package/dist/@types/summer/graph/basegraph.d.ts +2 -0
- package/dist/@types/summer/summer.d.ts +1 -0
- package/dist/@types/summer/types.d.ts +13 -3
- package/dist/@types/types/miniprogram-json/app.d.ts +5 -1
- package/dist/@types/types/miniprogram-json/page.d.ts +1 -0
- package/dist/@types/utils/locales/locales.d.ts +7 -0
- package/dist/@types/utils/locales/zh.d.ts +7 -0
- package/dist/@types/utils/tools.d.ts +1 -0
- package/dist/@types/vendor/code-analyse/index.d.ts +58 -1
- package/dist/ci/code-analyse.js +3 -1
- package/dist/ci/cos-upload.js +3 -1
- package/dist/ci/getCompiledResult.js +3 -1
- package/dist/ci/getDevSourceMap.js +3 -1
- package/dist/ci/getLatestVersion.js +3 -1
- package/dist/ci/jsserver.js +3 -1
- package/dist/ci/preview.js +3 -1
- package/dist/ci/project.js +3 -1
- package/dist/ci/projectattr.js +3 -1
- package/dist/ci/upload.js +3 -1
- package/dist/ci/utils/pack.js +3 -1
- package/dist/ci/utils/packfile.js +3 -1
- package/dist/ci/utils/terminalQrcode.js +3 -1
- package/dist/cli.js +3 -1
- package/dist/cloud/cloudapi.js +3 -1
- package/dist/cloud/createTimeTrigger.js +3 -1
- package/dist/cloud/uploadContainer.js +3 -1
- package/dist/cloud/uploadFile.js +3 -1
- package/dist/cloud/uploadFunction.js +3 -1
- package/dist/cloud/utils.js +3 -1
- package/dist/config.js +3 -1
- package/dist/core/analyse/partial.js +3 -1
- package/dist/core/compile/common.js +3 -1
- package/dist/core/compile/game.js +3 -1
- package/dist/core/compile/game_plugin.js +3 -1
- package/dist/core/compile/handler/js.js +3 -1
- package/dist/core/compile/handler/mpjson.js +3 -1
- package/dist/core/compile/handler/wxml.js +3 -1
- package/dist/core/compile/handler/wxss.js +3 -1
- package/dist/core/compile/index.js +3 -1
- package/dist/core/compile/mini_program.js +3 -1
- package/dist/core/compile/mini_program_plugin.js +3 -1
- package/dist/core/js/minifyjs.js +1 -1
- package/dist/core/json/app/checkAppFields.js +3 -1
- package/dist/core/json/app/getAppJSON.js +3 -1
- package/dist/core/json/app/getExtJSON.js +3 -1
- package/dist/core/json/app/index.js +3 -1
- package/dist/core/json/common.js +3 -1
- package/dist/core/json/game.js +3 -1
- package/dist/core/json/page/checkPageJSON.js +3 -1
- package/dist/core/json/page/getPageJSON.js +3 -1
- package/dist/core/json/plugin/plugin.js +3 -1
- package/dist/core/json/plugin/plugin_page.js +3 -1
- package/dist/core/json/projectWithMockBuffer.js +3 -1
- package/dist/core/json/projectconfig.js +3 -1
- package/dist/core/json/reactiveCache.js +3 -1
- package/dist/core/json/signaturejson.js +3 -1
- package/dist/core/json/sitemap.js +3 -1
- package/dist/core/json/theme.js +3 -1
- package/dist/core/npm/filterdeps.js +3 -1
- package/dist/core/npm/packnpm.js +3 -1
- package/dist/core/protect/file_flatter.js +3 -1
- package/dist/core/protect/uglifyfilenames.js +3 -1
- package/dist/core/utils/env.js +3 -1
- package/dist/core/utils/logger.js +3 -1
- package/dist/core/worker_thread/task/compilejs.js +1 -1
- package/dist/core.js +3 -1
- package/dist/index.js +3 -1
- package/dist/manifest.json +2 -2
- package/dist/schema/dist/index.d.ts +1 -1
- package/dist/summer/ci.js +3 -1
- package/dist/summer/devtool.js +3 -1
- package/dist/summer/error.js +3 -1
- package/dist/summer/graph/appconf.js +3 -1
- package/dist/summer/graph/appgraph.js +3 -1
- package/dist/summer/graph/basegraph.js +3 -1
- package/dist/summer/graph/pluginconf.js +3 -1
- package/dist/summer/graph/plugingraph.js +3 -1
- package/dist/summer/index.js +3 -1
- package/dist/summer/initPlugin.js +3 -1
- package/dist/summer/module.js +3 -1
- package/dist/summer/persist_cache.js +3 -1
- package/dist/summer/plugin_driver.js +3 -1
- package/dist/summer/plugins/base/es6module.js +1 -1
- package/dist/summer/plugins/enhance.js +1 -1
- package/dist/summer/plugins/less.js +1 -1
- package/dist/summer/plugins/sass.js +1 -1
- package/dist/summer/plugins/terser.js +1 -1
- package/dist/summer/project.js +3 -1
- package/dist/summer/recorder.js +3 -1
- package/dist/summer/resolver.js +3 -1
- package/dist/summer/summer.js +3 -1
- package/dist/summer/types.js +3 -1
- package/dist/summer/utils/async.js +3 -1
- package/dist/summer/utils/ensureArray.js +3 -1
- package/dist/summer/worker.js +3 -1
- package/dist/types/index.js +3 -1
- package/dist/types/miniprogram-json/app.js +3 -1
- package/dist/types/miniprogram-json/base.js +3 -1
- package/dist/types/miniprogram-json/ext.js +3 -1
- package/dist/types/miniprogram-json/game.js +3 -1
- package/dist/types/miniprogram-json/index.js +3 -1
- package/dist/types/miniprogram-json/page.js +3 -1
- package/dist/types/miniprogram-json/plugin.js +3 -1
- package/dist/types/miniprogram-json/projectconfig.js +3 -1
- package/dist/types/miniprogram-json/sitemap.js +3 -1
- package/dist/types/miniprogram-json/theme.js +3 -1
- package/dist/utils/babel_helper.js +3 -1
- package/dist/utils/babel_transform_plugin.js +3 -1
- package/dist/utils/cache.js +3 -1
- package/dist/utils/common.js +3 -1
- package/dist/utils/error.js +3 -1
- package/dist/utils/fs.js +3 -1
- package/dist/utils/fsagent.js +3 -1
- package/dist/utils/glob.js +3 -1
- package/dist/utils/interruptibletask.js +3 -1
- package/dist/utils/jsonParse.js +3 -1
- package/dist/utils/jsonlint.js +3 -1
- package/dist/utils/locales/en.js +3 -1
- package/dist/utils/locales/fomatable_string.js +3 -1
- package/dist/utils/locales/locales.js +3 -1
- package/dist/utils/locales/zh.js +3 -1
- package/dist/utils/log.js +3 -1
- package/dist/utils/report.js +3 -1
- package/dist/utils/request.js +3 -1
- package/dist/utils/sign.js +3 -1
- package/dist/utils/taskstatus.js +3 -1
- package/dist/utils/tools.js +3 -1
- package/dist/utils/url_config.js +3 -1
- package/dist/utils/white_ext_list.js +3 -1
- package/dist/vendor/cloud-api/src/apis/apis.js +3 -1
- package/dist/vendor/cloud-api/src/apis/cdn/cdn.apis.js +3 -1
- package/dist/vendor/cloud-api/src/apis/cdn/index.js +3 -1
- package/dist/vendor/cloud-api/src/apis/flexdb/flexdb.apis.js +3 -1
- package/dist/vendor/cloud-api/src/apis/flexdb/index.js +3 -1
- package/dist/vendor/cloud-api/src/apis/scf/index.js +3 -1
- package/dist/vendor/cloud-api/src/apis/scf/scf.apis.js +3 -1
- package/dist/vendor/cloud-api/src/apis/ssl/index.js +3 -1
- package/dist/vendor/cloud-api/src/apis/ssl/ssl.apis.js +3 -1
- package/dist/vendor/cloud-api/src/apis/tcb/general.apis.js +3 -1
- package/dist/vendor/cloud-api/src/apis/tcb/index.js +3 -1
- package/dist/vendor/cloud-api/src/apis/tcb/tcb.apis.js +3 -1
- package/dist/vendor/cloud-api/src/index.js +3 -1
- package/dist/vendor/cloud-api/src/transaction/contracts/cdn.contracts.js +3 -1
- package/dist/vendor/cloud-api/src/transaction/contracts/contracts.js +3 -1
- package/dist/vendor/cloud-api/src/transaction/contracts/factory.js +3 -1
- package/dist/vendor/cloud-api/src/transaction/contracts/flexdb.contracts.js +3 -1
- package/dist/vendor/cloud-api/src/transaction/contracts/scf.contracts.js +3 -1
- package/dist/vendor/cloud-api/src/transaction/contracts/ssl.contracts.js +3 -1
- package/dist/vendor/cloud-api/src/transaction/contracts/tcb.contracts.js +3 -1
- package/dist/vendor/cloud-api/src/transaction/transactor.js +3 -1
- package/dist/vendor/cloud-api/src/transaction/validations/cdn.validations.js +3 -1
- package/dist/vendor/cloud-api/src/transaction/validations/common.validations.js +3 -1
- package/dist/vendor/cloud-api/src/transaction/validations/flexdb.validations.js +3 -1
- package/dist/vendor/cloud-api/src/transaction/validations/scf.validations.js +3 -1
- package/dist/vendor/cloud-api/src/transaction/validations/ssl.validations.js +3 -1
- package/dist/vendor/cloud-api/src/transaction/validations/tcb.validations.js +3 -1
- package/dist/vendor/cloud-api/src/transaction/validations/validations.js +3 -1
- package/dist/vendor/cloud-api/src/utils/common.js +3 -1
- package/dist/vendor/cloud-api/src/utils/validator.js +3 -1
- package/dist/vendor/code-analyse/index.js +1 -1
- package/dist/vendor/schema/dist/app.js +47 -1
- package/dist/vendor/schema/dist/ext.js +46 -1
- package/dist/vendor/schema/dist/game.js +1 -1
- package/dist/vendor/schema/dist/index.js +2 -1
- package/dist/vendor/schema/dist/page.js +38 -1
- package/dist/vendor/schema/dist/plugin.js +1 -1
- package/dist/vendor/schema/dist/pluginpage.js +1 -1
- package/dist/vendor/schema/dist/projectconfig.js +423 -9
- package/dist/vendor/schema/dist/projectprivateconfig.js +351 -0
- package/dist/vendor/schema/dist/sitemap.js +1 -1
- package/dist/vendor/schema/dist/theme.js +1 -1
- package/package.json +19 -17
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
## 1.8.18
|
|
2
|
+
- `new` 更新 `analyseCode` 代码依赖分析能力。
|
|
3
|
+
## 1.8.12
|
|
4
|
+
- `new` app.json 配置支持 halfPage
|
|
5
|
+
- `new` 更新 上传时忽略 project.private.config.json 文件
|
|
6
|
+
- `new` 更新 代码包超过 5MB 后,默认通过异步方式上传代码,详情可查看 useCOS 参数
|
|
7
|
+
- `fix` 修复 ts 项目支持 babelSetting ignore 配置
|
|
8
|
+
- `fix` 修复 windows 编译 less 或 sass 文件提示路径出错的 bug [相关反馈](https://developers.weixin.qq.com/community/develop/doc/000ecc927587e0aca69df553851400)
|
|
1
9
|
## 1.6.1
|
|
2
10
|
- `new` 新增 支持编译工具上对应的 Typescript 模板项目。
|
|
3
11
|
- `fix` 更新 wxml压缩逻辑,可通过 minifyWXML 参数开启 wxml 压缩。
|
package/README.md
CHANGED
|
@@ -122,7 +122,7 @@ const ci = require('miniprogram-ci')
|
|
|
122
122
|
| onProgressUpdate | function | 否 | 进度更新监听函数 |
|
|
123
123
|
| robot | number | 否 | 指定使用哪一个 ci 机器人,可选值:1 ~ 30 |
|
|
124
124
|
| threads | number | 否 | 指定本地编译过程中开启的线程数 |
|
|
125
|
-
| useCOS | boolean | 否 |
|
|
125
|
+
| useCOS | boolean | 否 | 使用异步方式上传,当代码包大于 5MB 时,默认开启 |
|
|
126
126
|
|
|
127
127
|
#### 返回
|
|
128
128
|
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { IProject } from '../types';
|
|
3
|
-
export declare function uploadByCos(
|
|
4
|
-
[key: string]: string | Buffer;
|
|
5
|
-
}, commitUrl: string, project: IProject, robot: any): Promise<{
|
|
3
|
+
export declare function uploadByCos(gzipBuffer: Buffer, commitUrl: string, project: IProject, robot: any): Promise<{
|
|
6
4
|
fallback: boolean;
|
|
7
5
|
body?: any;
|
|
8
6
|
uploadCOSCostTime?: number;
|
package/dist/@types/config.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const CI_VERSION = "1.
|
|
1
|
+
export declare const CI_VERSION = "1.8.18";
|
|
2
2
|
export declare const PARAM_ERROR = 10000;
|
|
3
3
|
export declare const WXML_NOT_FOUND = 10007;
|
|
4
4
|
export declare const JS_NOT_FOUND = 10008;
|
|
@@ -44,8 +44,6 @@ export declare enum COMPILE_TYPE {
|
|
|
44
44
|
miniGame = "miniGame",
|
|
45
45
|
miniGamePlugin = "miniGamePlugin"
|
|
46
46
|
}
|
|
47
|
-
export declare const MiniProgramWhiteList: Record<string, true>;
|
|
48
|
-
export declare const GameWhiteList: Record<string, true>;
|
|
49
47
|
export declare const TABBAR_ICON_WHITE_LIST: string[];
|
|
50
48
|
export declare const DefaultProjectAttr: {
|
|
51
49
|
platform: boolean;
|
|
@@ -36,4 +36,6 @@ interface IVariableDeclareProperty {
|
|
|
36
36
|
}
|
|
37
37
|
export declare function getAppJSONVariableDecalearProperty(appJSON: AppJSON.IAppJSON): Array<IVariableDeclareProperty>;
|
|
38
38
|
export declare function checkOpenDataContext(options: IInnerAppJSONCheckOptions, appJSON: AppJSON.IAppJSON): void;
|
|
39
|
+
export declare function checkRenderer(options: IInnerAppJSONCheckOptions): void;
|
|
40
|
+
export declare function checkResolveAlias(options: IInnerAppJSONCheckOptions): void;
|
|
39
41
|
export {};
|
package/dist/@types/index.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ import { uploadJsServer } from './ci/jsserver';
|
|
|
12
12
|
import { analyseCode } from './ci/code-analyse';
|
|
13
13
|
import { getCompiledResult } from './ci/getCompiledResult';
|
|
14
14
|
import { getLatestVersion } from './ci/getLatestVersion';
|
|
15
|
+
import { getWhiteExtList } from './utils/white_ext_list';
|
|
15
16
|
export { Project };
|
|
16
17
|
export type { IUploadOptions };
|
|
17
18
|
export declare const upload: typeof _upload;
|
|
@@ -31,5 +32,6 @@ export declare const cloud: {
|
|
|
31
32
|
export { uploadJsServer };
|
|
32
33
|
export { getLatestVersion };
|
|
33
34
|
export { analyseCode };
|
|
35
|
+
export { getWhiteExtList };
|
|
34
36
|
export * from './core';
|
|
35
37
|
export * from './summer';
|
|
@@ -111,6 +111,10 @@ export interface IPluginConf {
|
|
|
111
111
|
comps: Record<string, any>;
|
|
112
112
|
}
|
|
113
113
|
declare type ISummerPluginConfig = Array<string | [string, SummerPluginOptions]>;
|
|
114
|
+
export declare type IBabelSetting = {
|
|
115
|
+
outputPath?: string;
|
|
116
|
+
ignore?: any[];
|
|
117
|
+
};
|
|
114
118
|
export interface ICompilerOptions {
|
|
115
119
|
appid: string;
|
|
116
120
|
attr: any;
|
|
@@ -118,6 +122,7 @@ export interface ICompilerOptions {
|
|
|
118
122
|
miniprogramRoot: string;
|
|
119
123
|
pluginRoot: string;
|
|
120
124
|
summerPlugins: ISummerPluginConfig;
|
|
125
|
+
babelSetting?: IBabelSetting;
|
|
121
126
|
}
|
|
122
127
|
export declare class SummerCompiler {
|
|
123
128
|
projectPath: string;
|
|
@@ -10,6 +10,7 @@ import PersistCache from '../persist_cache';
|
|
|
10
10
|
declare type GraphType = 'miniprogram' | 'plugin' | 'other';
|
|
11
11
|
export declare type FileInfo = ResolveFileInfo & {
|
|
12
12
|
independentRoot: string;
|
|
13
|
+
isBabelIgnore: boolean;
|
|
13
14
|
};
|
|
14
15
|
export interface IGraphOptions {
|
|
15
16
|
type: GraphType;
|
|
@@ -49,6 +50,7 @@ export declare abstract class BaseGraph {
|
|
|
49
50
|
}>>;
|
|
50
51
|
private compileOther;
|
|
51
52
|
private compileCodeWithoutJSON;
|
|
53
|
+
protected isBabelSettingIgnore(fileInfo: ResolveFileInfo): boolean;
|
|
52
54
|
protected abstract onFileChangeForGraph(type: 'unlink' | 'unlinkDir' | 'add' | 'addDir' | 'change', path: string): void;
|
|
53
55
|
protected abstract getConf(recorder: Recorder): Promise<IAppConf | IPluginConf>;
|
|
54
56
|
protected abstract getDevCode(recorder: Recorder, options?: IPackageCodeOptions): Promise<CodeFiles>;
|
|
@@ -16,6 +16,7 @@ export declare class SummerCompiler {
|
|
|
16
16
|
proxyProject: any;
|
|
17
17
|
persistCache: PersistCache;
|
|
18
18
|
constructor(project: Project, cachePath: string, options: ICompilerOptions);
|
|
19
|
+
getBabelSetting(): import("./devtool").IBabelSetting | undefined;
|
|
19
20
|
private initPlugins;
|
|
20
21
|
private initAppGraph;
|
|
21
22
|
private initPluginGraph;
|
|
@@ -40,6 +40,7 @@ export interface PluginContext {
|
|
|
40
40
|
addWatchFile: (absFilePath: string) => void;
|
|
41
41
|
error: (err: any) => never;
|
|
42
42
|
runWorkerMethod: (method: string, ...args: any[]) => Promise<any>;
|
|
43
|
+
rootPath?: string;
|
|
43
44
|
}
|
|
44
45
|
export declare type SourceMap = Omit<RawSourceMap, 'version'> & {
|
|
45
46
|
version: number | string;
|
|
@@ -72,10 +73,19 @@ export declare type AsyncPluginHooks = 'load' | 'transform' | 'optimize' | 'gene
|
|
|
72
73
|
export declare type FirstPluginHooks = 'load' | 'generate';
|
|
73
74
|
export declare type SequentialPluginHooks = 'transform' | 'optimize' | 'compress';
|
|
74
75
|
export declare type ParallelPluginHooks = 'sealed';
|
|
75
|
-
export declare type LoadHook = (this: PluginContext, targetPath: string, sourcePath: string,
|
|
76
|
-
|
|
76
|
+
export declare type LoadHook = (this: PluginContext, targetPath: string, sourcePath: string, options: {
|
|
77
|
+
independentRoot: string;
|
|
78
|
+
isBabelIgnore: boolean;
|
|
79
|
+
}) => Promise<LoadResult> | LoadResult;
|
|
80
|
+
export declare type TransformHook = (this: PluginContext, source: SourceDescription, targetPath: string, sourcePath: string, options: {
|
|
81
|
+
independentRoot: string;
|
|
82
|
+
isBabelIgnore: boolean;
|
|
83
|
+
}) => Promise<SourceDescription> | SourceDescription;
|
|
77
84
|
declare type GenerateResult = GenerateDescription | string | null | undefined;
|
|
78
|
-
export declare type GenerateHook = (this: PluginContext, source: SourceDescription, targetPath: string, sourcePath: string,
|
|
85
|
+
export declare type GenerateHook = (this: PluginContext, source: SourceDescription, targetPath: string, sourcePath: string, options: {
|
|
86
|
+
independentRoot: string;
|
|
87
|
+
isBabelIgnore: boolean;
|
|
88
|
+
}) => Promise<GenerateResult> | GenerateResult;
|
|
79
89
|
export declare type OptimizeHook = (this: PluginContext, codes: Record<string, string>, appConf: IAppConf) => Promise<Record<string, string>>;
|
|
80
90
|
export declare type CompressHook = (this: PluginContext, content: Record<string, string | Buffer>) => Promise<Record<string, string | Buffer>>;
|
|
81
91
|
export declare type SealedHook = (this: PluginContext, content: Record<string, string | Buffer>) => Promise<void>;
|
|
@@ -89,7 +89,11 @@ export declare namespace AppJSON {
|
|
|
89
89
|
darkmode?: boolean;
|
|
90
90
|
themeLocation?: string;
|
|
91
91
|
theme?: string;
|
|
92
|
-
lazyCodeLoading?:
|
|
92
|
+
lazyCodeLoading?: 'requiredComponents';
|
|
93
|
+
renderer?: 'skyline' | 'webview';
|
|
94
|
+
resolveAlias?: {
|
|
95
|
+
[key: string]: string;
|
|
96
|
+
};
|
|
93
97
|
}
|
|
94
98
|
interface IPluginConfig {
|
|
95
99
|
provider: string;
|
|
@@ -15,6 +15,7 @@ declare const _default: {
|
|
|
15
15
|
NOT_FOUND: import("./fomatable_string").FormatableString;
|
|
16
16
|
MINIPROGRAM_APP_JSON_NOT_FOUND: import("./fomatable_string").FormatableString;
|
|
17
17
|
PLUGIN_JSON_NOT_FOUND: import("./fomatable_string").FormatableString;
|
|
18
|
+
PLUGIN_PATH_SAME_WITH_MINIPROGRAM: import("./fomatable_string").FormatableString;
|
|
18
19
|
FILE_NOT_FOUND: import("./fomatable_string").FormatableString;
|
|
19
20
|
JSON_PARSE_ERROR: import("./fomatable_string").FormatableString;
|
|
20
21
|
ENTRANCE_NOT_FOUND: import("./fomatable_string").FormatableString;
|
|
@@ -26,9 +27,15 @@ declare const _default: {
|
|
|
26
27
|
JSON_TABBAR_AT_LEAST: import("./fomatable_string").FormatableString;
|
|
27
28
|
JSON_TABBAR_AT_MOST: import("./fomatable_string").FormatableString;
|
|
28
29
|
JSON_TABBAR_PATH_EMPTY: import("./fomatable_string").FormatableString;
|
|
30
|
+
JSON_TABBAR_PATH_SAME_WITH_OTHER: import("./fomatable_string").FormatableString;
|
|
29
31
|
JSON_TABBAR_ICON_MAX_SIZE: import("./fomatable_string").FormatableString;
|
|
30
32
|
JSON_TABBAR_ICON_EXT: import("./fomatable_string").FormatableString;
|
|
31
33
|
JSON_CONTENT_SHOULD_NOT_BE: import("./fomatable_string").FormatableString;
|
|
34
|
+
JSON_RESOLVE_ALIAS_ILLEGAL: import("./fomatable_string").FormatableString;
|
|
35
|
+
JSON_RESOLVE_ALIAS_INCLUDE_STAR: import("./fomatable_string").FormatableString;
|
|
36
|
+
APP_JSON_SHOULD_SET_LAZYCODELOADING: import("./fomatable_string").FormatableString;
|
|
37
|
+
PAGE_JSON_SHOULD_SET_DISABLESCROLL_TRUE: import("./fomatable_string").FormatableString;
|
|
38
|
+
PAGE_JSON_SHOULD_SET_NAVIGATIONSTYLE_CUSTOM: import("./fomatable_string").FormatableString;
|
|
32
39
|
CONTENT_EXIST: import("./fomatable_string").FormatableString;
|
|
33
40
|
JSON_CONTENT_EXISTED: import("./fomatable_string").FormatableString;
|
|
34
41
|
JSON_CONTENT_NOT_FOUND: import("./fomatable_string").FormatableString;
|
|
@@ -15,6 +15,7 @@ declare const _default: {
|
|
|
15
15
|
NOT_FOUND: FormatableString;
|
|
16
16
|
MINIPROGRAM_APP_JSON_NOT_FOUND: FormatableString;
|
|
17
17
|
PLUGIN_JSON_NOT_FOUND: FormatableString;
|
|
18
|
+
PLUGIN_PATH_SAME_WITH_MINIPROGRAM: FormatableString;
|
|
18
19
|
FILE_NOT_FOUND: FormatableString;
|
|
19
20
|
JSON_PARSE_ERROR: FormatableString;
|
|
20
21
|
ENTRANCE_NOT_FOUND: FormatableString;
|
|
@@ -26,9 +27,15 @@ declare const _default: {
|
|
|
26
27
|
JSON_TABBAR_AT_LEAST: FormatableString;
|
|
27
28
|
JSON_TABBAR_AT_MOST: FormatableString;
|
|
28
29
|
JSON_TABBAR_PATH_EMPTY: FormatableString;
|
|
30
|
+
JSON_TABBAR_PATH_SAME_WITH_OTHER: FormatableString;
|
|
29
31
|
JSON_TABBAR_ICON_MAX_SIZE: FormatableString;
|
|
30
32
|
JSON_TABBAR_ICON_EXT: FormatableString;
|
|
31
33
|
JSON_CONTENT_SHOULD_NOT_BE: FormatableString;
|
|
34
|
+
JSON_RESOLVE_ALIAS_ILLEGAL: FormatableString;
|
|
35
|
+
JSON_RESOLVE_ALIAS_INCLUDE_STAR: FormatableString;
|
|
36
|
+
APP_JSON_SHOULD_SET_LAZYCODELOADING: FormatableString;
|
|
37
|
+
PAGE_JSON_SHOULD_SET_DISABLESCROLL_TRUE: FormatableString;
|
|
38
|
+
PAGE_JSON_SHOULD_SET_NAVIGATIONSTYLE_CUSTOM: FormatableString;
|
|
32
39
|
CONTENT_EXIST: FormatableString;
|
|
33
40
|
JSON_CONTENT_EXISTED: FormatableString;
|
|
34
41
|
JSON_CONTENT_NOT_FOUND: FormatableString;
|
|
@@ -15,6 +15,7 @@ export declare function escapeQuot(str: string, type?: string): string;
|
|
|
15
15
|
export declare function trailing(str: string, char: string, reversed?: boolean): string;
|
|
16
16
|
export declare function leading(str: string, char: string, reversed?: boolean): string;
|
|
17
17
|
export declare const isFileIgnored: (file: string, ignoreRule: any) => any;
|
|
18
|
+
export declare const isFileIncluded: (file: string, ignoreRule: any) => any;
|
|
18
19
|
export declare function formatSourceMap(map: string | RawSourceMap): string | undefined;
|
|
19
20
|
export declare function generateMD5(buffer: Buffer | string): string;
|
|
20
21
|
export declare const formatNumber: (n: number) => string;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
1
|
/**
|
|
3
2
|
* 根据入口JS文件路径,分析出所有依赖的js文件
|
|
4
3
|
* @public
|
|
@@ -64,6 +63,7 @@ export declare interface AnalyzerPlugin {
|
|
|
64
63
|
onModuleBuildFailed?(module: IModule, cost: number, error: Error): void;
|
|
65
64
|
afterModuleBuild?(module: IModule, cost: number, error: Error | null): void;
|
|
66
65
|
onModuleReuse?(module: IModule): void;
|
|
66
|
+
onModuleReuseFailed?(module: IModule, error: Error): void;
|
|
67
67
|
onModuleSerialize?(module: IModule, data: Record<string, any>): void;
|
|
68
68
|
onSerialize?(data: Record<string, any>): void;
|
|
69
69
|
}
|
|
@@ -141,6 +141,10 @@ export declare class Graph {
|
|
|
141
141
|
|
|
142
142
|
declare class GraphContext {
|
|
143
143
|
fileHelper: IFileHelper;
|
|
144
|
+
resolveAliasConf?: Array<{
|
|
145
|
+
key: string;
|
|
146
|
+
value: string;
|
|
147
|
+
}>;
|
|
144
148
|
es6Parser: {
|
|
145
149
|
isLayaGame: boolean;
|
|
146
150
|
};
|
|
@@ -149,6 +153,8 @@ declare class GraphContext {
|
|
|
149
153
|
};
|
|
150
154
|
constructor(options: GraphOptions);
|
|
151
155
|
private initMiniprogram;
|
|
156
|
+
setResolveAlias(resolveAlias: IAppJSON['resolveAlias']): void;
|
|
157
|
+
resolveJsFromAlias(request: string): string | undefined;
|
|
152
158
|
}
|
|
153
159
|
|
|
154
160
|
declare interface GraphOptions {
|
|
@@ -164,6 +170,31 @@ export declare interface IAnalyseResult {
|
|
|
164
170
|
modules: IModuleSerialize[];
|
|
165
171
|
}
|
|
166
172
|
|
|
173
|
+
declare interface IAppJSON {
|
|
174
|
+
pages?: string[];
|
|
175
|
+
workers?: string;
|
|
176
|
+
subPackages?: ISubpackageItem[];
|
|
177
|
+
subpackages?: ISubpackageItem[];
|
|
178
|
+
usingComponents?: IStringKeyMap;
|
|
179
|
+
plugins?: {
|
|
180
|
+
[alias: string]: IPluginConfig;
|
|
181
|
+
};
|
|
182
|
+
functionalPages?: boolean | {
|
|
183
|
+
independent?: boolean;
|
|
184
|
+
};
|
|
185
|
+
useExtendedLib?: {
|
|
186
|
+
[index: string]: boolean | string;
|
|
187
|
+
};
|
|
188
|
+
sitemapLocation?: string;
|
|
189
|
+
themeLocation?: string;
|
|
190
|
+
tabBar?: {
|
|
191
|
+
custom?: boolean;
|
|
192
|
+
};
|
|
193
|
+
resolveAlias?: {
|
|
194
|
+
[key: string]: string;
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
|
|
167
198
|
/**
|
|
168
199
|
* @public
|
|
169
200
|
*/
|
|
@@ -206,6 +237,7 @@ export declare interface IFileHelper {
|
|
|
206
237
|
getJSON(filePath: string): Promise<unknown>;
|
|
207
238
|
readdir(dirPath: string): Promise<string[]>;
|
|
208
239
|
watchFileChange(callback: () => void): void;
|
|
240
|
+
getLocalFileString?(filePath: string): Promise<string>;
|
|
209
241
|
}
|
|
210
242
|
|
|
211
243
|
/**
|
|
@@ -222,6 +254,8 @@ export declare interface IModule {
|
|
|
222
254
|
type: ModuleErrorType;
|
|
223
255
|
error: any;
|
|
224
256
|
}>;
|
|
257
|
+
usePlugins?: Set<string>;
|
|
258
|
+
useTags?: Set<string>;
|
|
225
259
|
build(graphContext: GraphContext): Promise<IDep[]>;
|
|
226
260
|
reuse?(graphContext: GraphContext): Promise<void>;
|
|
227
261
|
isValid(): boolean;
|
|
@@ -258,6 +292,12 @@ export declare interface IPackageFile {
|
|
|
258
292
|
subPackage: string | null;
|
|
259
293
|
}
|
|
260
294
|
|
|
295
|
+
declare interface IPluginConfig {
|
|
296
|
+
version: string;
|
|
297
|
+
provider: string;
|
|
298
|
+
export?: string;
|
|
299
|
+
}
|
|
300
|
+
|
|
261
301
|
/**
|
|
262
302
|
* @public
|
|
263
303
|
*/
|
|
@@ -268,6 +308,23 @@ export declare interface IStat {
|
|
|
268
308
|
size?: number;
|
|
269
309
|
}
|
|
270
310
|
|
|
311
|
+
declare interface IStringKeyMap<T = any> {
|
|
312
|
+
[propName: string]: T;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
declare interface ISubpackageItem {
|
|
316
|
+
name?: string;
|
|
317
|
+
root: string;
|
|
318
|
+
pages: string[];
|
|
319
|
+
plugins: {
|
|
320
|
+
[alias: string]: IPluginConfig;
|
|
321
|
+
};
|
|
322
|
+
independent: boolean;
|
|
323
|
+
useExtendedLib: {
|
|
324
|
+
[index: string]: boolean | string;
|
|
325
|
+
};
|
|
326
|
+
}
|
|
327
|
+
|
|
271
328
|
/**
|
|
272
329
|
* @public
|
|
273
330
|
*/
|
package/dist/ci/code-analyse.js
CHANGED
|
@@ -1 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
!function(require, directRequire){
|
|
2
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.analyseCode=void 0;const tslib_1=require("tslib"),projectconfig_1=require("../core/json/projectconfig"),code_analyse_1=require("../vendor/code-analyse"),path_1=(0,tslib_1.__importDefault)(require("path"));function transCompileType(e){if("miniProgram"===e.type)return"miniprogram";if("miniProgramPlugin"===e.type)return"plugin";if("miniGame"===e.type)return"game";if("miniGamePlugin"===e.type)return"gamePlugin";throw new Error("unknown compile type "+e.type)}class LogPlugin{constructor(){this.name="LogPlugin"}onDepResolveFailed(e,o){var n,i;console.warn(`${null===(n=e.originModule)||void 0===n?void 0:n.type} module ${null===(i=e.originModule)||void 0===i?void 0:i.path} resolve dep failed`),console.warn(o)}onModuleBuildFailed(e,o,n){console.warn(`${e.type} module ${e.path} build failed`),console.warn(n)}}async function analyseCode(e,o){const n=(0,projectconfig_1.getProjectConfigJSON)(e),i=transCompileType(e);if("gamePlugin"===i)throw new Error("gamePlugin is not support yet!");let r="plugin"===i?n.pluginRoot:n.miniprogramRoot;r=r?path_1.default.posix.join(e.projectPath,r):e.projectPath;const t=new code_analyse_1.Analyzer({root:r,type:i,plugins:(null==o?void 0:o.silent)?[]:[new LogPlugin]});return await t.analyse(),t.serialize()}exports.analyseCode=analyseCode;
|
|
3
|
+
}(require("licia/lazyImport")(require), require)
|
package/dist/ci/cos-upload.js
CHANGED
|
@@ -1 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
!function(require, directRequire){
|
|
2
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.uploadByCos=void 0;const tslib_1=require("tslib"),url_config_1=require("../utils/url_config"),tools_1=require("../utils/tools"),request_1=require("../utils/request"),sign_1=require("../utils/sign"),pack_1=require("./utils/pack"),zlib=require("zlib"),crypto=require("crypto"),config_1=require("../config"),upload_1=require("./upload"),log_1=(0,tslib_1.__importDefault)(require("../utils/log")),jsonParse_1=require("../utils/jsonParse"),COS=require("cos-nodejs-sdk-v5");async function putBufferToCos(e,t){const r=new COS({Proxy:(0,request_1.getCiProxy)(),getAuthorization(e,r){r({TmpSecretId:t.secret_id,TmpSecretKey:t.secret_key,XCosSecurityToken:t.token,ExpiredTime:t.expired_time})}});try{return await new Promise((o,i)=>{r.putObject({Bucket:t.bucket,Region:"ap-shanghai",Key:t.object,Body:e,onProgress(e){}},(e,t)=>{if(e)return console.error(e),i(e.error);o(t)})})}catch(e){throw new Error("upload to cos failed: "+e.message)}}async function innerRequest(e,t){const r=await(0,request_1.request)({url:e,method:"post",body:t,headers:{"content-type":"application/json"}});let o;try{o=JSON.parse(r.body)}catch(t){const r=`request ${e} failed: resp body is not a valid json`;throw log_1.default.error(r),new Error(r)}if(0!==o.errCode)throw new Error(`request failed, errCode: ${o.errCode}, errMsg: ${o.errMsg}`);return o.data}async function uploadByCos(e,t,r,o){let i;try{const e=await(0,sign_1.getSignature)(r.privateKey,r.appid);i=await innerRequest(url_config_1.GET_UPLOAD_TOKEN,JSON.stringify({appid:r.appid,signature:e,robot:o}))}catch(e){return console.error("uploadToken error",e),{fallback:!0}}const s=e,a=crypto.randomBytes(12),n=crypto.createCipheriv("aes-256-gcm",Buffer.from(i.crypt_key,"base64"),a),u=Buffer.concat([n.update(s),n.final()]),c=n.getAuthTag(),l=Buffer.alloc(1);l.writeUInt8(c.length+a.length,0);const p=Buffer.concat([l,c,a,u]),d=Date.now();await putBufferToCos(p,i);const _=Date.now()-d,f=(0,tools_1.generateMD5)(s),g=await(0,sign_1.getSignature)(r.privateKey,r.appid),y=`${t}&task_id=${i.task_id}&new_hash=${f}&upload_cos_cost_time=${_}`;log_1.default.info("request url:",y);let w=await(0,request_1.request)({url:y,method:"post",body:zlib.gzipSync((0,pack_1.pack)({[upload_1.SIGNATURE_FILE_NAME]:JSON.stringify({signature:g,version:config_1.CI_VERSION})}).buffer)});if(0!==(0,jsonParse_1.jsonRespParse)(w.body.toString(),t).errCode)throw new Error(w.body.toString());for(;;){const e=await(0,sign_1.getSignature)(r.privateKey,r.appid),t=await innerRequest(`${url_config_1.GET_ASYNC_RESULT}?task_id=${i.task_id}`,JSON.stringify({appid:r.appid,signature:e,robot:o}));if(1!==t.status){if(0===t.status)return{fallback:!1,body:t,uploadCOSCostTime:_};if(3===t.status)throw new Error(`upload failed with status ${t.status}, task not found`);throw new Error("upload failed with status "+t.status)}await new Promise(e=>{setTimeout(e,1e3)})}}exports.uploadByCos=uploadByCos;
|
|
3
|
+
}(require("licia/lazyImport")(require), require)
|
|
@@ -1 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
!function(require, directRequire){
|
|
2
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getCompiledResult=exports.SIGNATURE_FILE_NAME=void 0;const tslib_1=require("tslib"),fs_extra_1=(0,tslib_1.__importDefault)(require("fs-extra")),compile_1=require("../core/compile"),config_1=require("../config"),error_1=require("../utils/error"),locales_1=(0,tslib_1.__importDefault)(require("../utils/locales/locales")),cache_1=require("../utils/cache"),jszip_1=(0,tslib_1.__importDefault)(require("jszip")),path_1=(0,tslib_1.__importDefault)(require("path"));async function getCompiledResult(e,t){const{project:r,setting:o={},version:i="",onProgressUpdate:s=function(e){console.log(""+e)},threads:a=0,includedMap:l=!1}=e;if(process.env.COMPILE_THREADS=a.toString(),!i)throw new error_1.CodeError(locales_1.default.config.PARAM_ERROR.format("upload","version"),config_1.PARAM_ERROR);if(!r)throw new error_1.CodeError(locales_1.default.config.PARAM_ERROR.format("upload","project"),config_1.PARAM_ERROR);cache_1.cacheManager.clean();const _=await(0,compile_1.compile)(r,{setting:o,onProgressUpdate:s}),c={};if(Object.keys(_).sort().forEach(e=>{e.endsWith("js.map")&&!l||(c[e]=_[e])}),t){const e=new jszip_1.default;Object.keys(c).forEach(t=>{e.folder(path_1.default.dirname(t)).file(path_1.default.basename(t),c[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 c}exports.SIGNATURE_FILE_NAME="ci.signature",exports.getCompiledResult=getCompiledResult;
|
|
3
|
+
}(require("licia/lazyImport")(require), require)
|
|
@@ -1 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
!function(require, directRequire){
|
|
2
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getDevSourceMap=void 0;const tslib_1=require("tslib"),fs_1=(0,tslib_1.__importDefault)(require("fs")),path_1=(0,tslib_1.__importDefault)(require("path")),log_1=(0,tslib_1.__importDefault)(require("../utils/log")),request_1=require("../utils/request"),url_config_1=require("../utils/url_config"),sign_1=require("../utils/sign"),JsZip=require("jszip"),ERR_MSG_PREFIX="download source map failed:";async function getDevSourceMap(e){return new Promise(async(r,t)=>{const{project:o,robot:a}=e;let{sourceMapSavePath:i}=e;if(!o){const e="params project is requried";return log_1.default.error(e),void t(e)}if("number"!=typeof a||Math.round(a)>30||Math.round(a)<=0){const e="params robot is invalid";return log_1.default.error(e),void t(e)}if(!i){const e="params sourceMapSavePath is invalid";return log_1.default.error(e),void t(e)}path_1.default.isAbsolute(i)||(i=path_1.default.join(process.cwd(),i));const s=await(0,sign_1.getSignature)(o.privateKey,o.appid),{body:u}=await(0,request_1.request)({url:url_config_1.GET_DEV_SOURCE_MAP,method:"post",gzip:!0,body:JSON.stringify({appid:o.appid,signature:s,robot:a}),headers:{"content-type":"application/json"}});let l;try{l=JSON.parse(u)}catch(e){const r=ERR_MSG_PREFIX+" resp body is not a valid json";return log_1.default.error(r),void t(r)}const n=l.data;if(!Array.isArray(n.sourcemap_list)){const e=`${ERR_MSG_PREFIX} respData.sourcemap_list, respData: ${JSON.stringify(n)}`;return log_1.default.error(e),void t(e)}const p=n.sourcemap_list,_=new JsZip;try{p.forEach(e=>{_.folder(path_1.default.dirname(e.fullpath)).file(path_1.default.basename(e.fullpath),e.sourcemap)})}catch(e){const r=ERR_MSG_PREFIX+" source map add folder or add file error";return log_1.default.error(r),void t(r)}_.generateAsync({type:"nodebuffer"}).then(e=>{try{fs_1.default.writeFileSync(i,e),r(void 0)}catch(e){const r=`${ERR_MSG_PREFIX} save source map to ${i} failed. Error detail: ${JSON.stringify(e)}`;return log_1.default.error(r),void t(r)}r(e)}).catch(()=>{const e=ERR_MSG_PREFIX+" source map generate zip error";log_1.default.error(e),t(e)})})}exports.getDevSourceMap=getDevSourceMap;
|
|
3
|
+
}(require("licia/lazyImport")(require), require)
|
|
@@ -1 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
!function(require, directRequire){
|
|
2
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getLatestVersion=void 0;const tslib_1=require("tslib"),request_1=require("../utils/request"),sign_1=require("../utils/sign"),config_1=require("../config"),error_1=require("../utils/error"),locales_1=(0,tslib_1.__importDefault)(require("../utils/locales/locales")),querystring_1=(0,tslib_1.__importDefault)(require("querystring")),url_config_1=require("../utils/url_config"),jsonParse_1=require("../utils/jsonParse");async function getLatestVersion(e){const{project:r}=e;if(!r)throw new error_1.CodeError(locales_1.default.config.PARAM_ERROR.format("getLatestVersion","project"),config_1.PARAM_ERROR);if("miniProgramPlugin"!==r.type&&"miniGamePlugin"!==r.type)throw new Error("getLatestVersion only support plugin type project");const t=await(0,sign_1.getSignature)(r.privateKey,r.appid),i={appid:r.appid,signature:t};try{const e=`${url_config_1.GET_LATEST_VERSION}?${querystring_1.default.stringify(i)}`,r=(await(0,request_1.request)({url:e,method:"get"})).body.toString(),t=(0,jsonParse_1.jsonRespParse)(r,e);if(0!==t.errCode)throw new Error(r);return t.data}catch(e){throw new error_1.CodeError(e.toString(),config_1.GET_LATEST_VERSION_CGI_ERR)}}exports.getLatestVersion=getLatestVersion;
|
|
3
|
+
}(require("licia/lazyImport")(require), require)
|
package/dist/ci/jsserver.js
CHANGED
|
@@ -1 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
!function(require, directRequire){
|
|
2
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.uploadJsServer=exports.SIGNATURE_FILE_NAME=void 0;const tslib_1=require("tslib"),path_1=(0,tslib_1.__importDefault)(require("path")),request_1=require("../utils/request"),packfile_1=require("./utils/packfile"),zlib_1=(0,tslib_1.__importDefault)(require("zlib")),sign_1=require("../utils/sign"),config_1=require("../config"),log_1=(0,tslib_1.__importDefault)(require("../utils/log")),error_1=require("../utils/error"),locales_1=(0,tslib_1.__importDefault)(require("../utils/locales/locales")),querystring_1=(0,tslib_1.__importDefault)(require("querystring")),url_config_1=require("../utils/url_config"),jsonParse_1=require("../utils/jsonParse"),projectconfig_1=require("../core/json/projectconfig");async function uploadJsServer(e){var r;const{project:o,env:t}=e;if(!t||"test"!==t&&"release"!==t)throw new error_1.CodeError(locales_1.default.config.PARAM_ERROR.format("uploadJsServer","env"),config_1.PARAM_ERROR);if(!o)throw new error_1.CodeError(locales_1.default.config.PARAM_ERROR.format("uploadJsServer","project"),config_1.PARAM_ERROR);const i=(0,projectconfig_1.getProjectConfigJSON)(o);if("string"!=typeof i.jsserverRoot||!(null===(r=o.stat("",i.jsserverRoot))||void 0===r?void 0:r.isDirectory))throw new error_1.CodeError("please set a correct jsserverRoot value in project.config.json",config_1.PARAM_ERROR);const s=await(0,packfile_1.packFiledir)(path_1.default.posix.join(o.projectPath,i.jsserverRoot)),_=await(0,sign_1.getSignature)(o.privateKey,o.appid),l={type:"release"===t?0:1,appid:o.appid,signature:_};try{const e=`${url_config_1.UPLOAD_JS_SERVER}?${querystring_1.default.stringify(l)}`;log_1.default.info("request url:",e);const r=zlib_1.default.gzipSync(s.data),o=(await(0,request_1.request)({url:e,method:"post",body:r})).body.toString();if(0!==(0,jsonParse_1.jsonRespParse)(o,e).errCode)throw new Error(o);return!0}catch(e){throw new error_1.CodeError(e.toString(),config_1.UPLOAD_JS_SERVER_CGI_ERR)}}exports.SIGNATURE_FILE_NAME="ci.signature",exports.uploadJsServer=uploadJsServer;
|
|
3
|
+
}(require("licia/lazyImport")(require), require)
|
package/dist/ci/preview.js
CHANGED
|
@@ -1 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
!function(require, directRequire){
|
|
2
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.preview=void 0;const tslib_1=require("tslib"),upload_1=require("./upload"),terminalQrcode_1=require("./utils/terminalQrcode"),fs_1=(0,tslib_1.__importDefault)(require("fs")),config_1=require("../config"),error_1=require("../utils/error"),locales_1=(0,tslib_1.__importDefault)(require("../utils/locales/locales")),log_1=(0,tslib_1.__importDefault)(require("../utils/log"));async function preview(e){const r=Object.assign({},e);if(r.test=!0,r.version="0.0.1",r.qrcodeFormat||(r.qrcodeFormat="terminal"),!["base64","image","terminal"].includes(r.qrcodeFormat))throw new error_1.CodeError(locales_1.default.config.INVALID.format("qrcodeFormat"),config_1.PARAM_ERROR);if(["base64","image"].includes(r.qrcodeFormat)&&("string"!=typeof r.qrcodeOutputDest||"."===r.qrcodeOutputDest.trim()))throw new error_1.CodeError(locales_1.default.config.INVALID.format("qrcodeOutputDest"),config_1.PARAM_ERROR);const o=await(0,upload_1.innerUpload)(r);if(!o.respBody.qrcode_img)throw new Error("No `qrcode_img` in response.");if("terminal"===r.qrcodeFormat)try{const e=await(0,terminalQrcode_1.generateTerminalQrcode)(o.respBody.qrcode_img);log_1.default.log(e),log_1.default.log("terminal qrcode shown above")}catch(e){log_1.default.error("Termianl qrcode generate failed, but you can still visit the dev version on your cell phone.")}else if(r.qrcodeOutputDest)if("image"===r.qrcodeFormat)try{fs_1.default.writeFileSync(r.qrcodeOutputDest,Buffer.from(o.respBody.qrcode_img,"base64")),log_1.default.info(`Qrcode image saved, file path: '${r.qrcodeOutputDest}'`)}catch(e){throw new Error("write qrcode image error: "+JSON.stringify(e))}else if("base64"===r.qrcodeFormat)try{fs_1.default.writeFileSync(r.qrcodeOutputDest,"data:image/jpeg;base64,"+o.respBody.qrcode_img,"utf8"),log_1.default.info(`Qrcode base64 file saved, file path: '${r.qrcodeOutputDest}'`)}catch(e){throw new Error("write qrcode base64 error: "+JSON.stringify(e))}return{subPackageInfo:o.subPackageInfo,pluginInfo:o.pluginInfo}}exports.preview=preview;
|
|
3
|
+
}(require("licia/lazyImport")(require), require)
|
package/dist/ci/project.js
CHANGED
|
@@ -1 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
!function(require, directRequire){
|
|
2
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Project=void 0;const tslib_1=require("tslib"),path_1=(0,tslib_1.__importDefault)(require("path")),glob_1=(0,tslib_1.__importDefault)(require("glob")),fs_1=(0,tslib_1.__importDefault)(require("fs")),projectattr_1=require("./projectattr"),tools_1=require("../utils/tools"),config_1=require("../config"),locales_1=(0,tslib_1.__importDefault)(require("../utils/locales/locales")),error_1=require("../utils/error"),request_1=require("../utils/request"),projectconfig_1=require("../core/json/projectconfig"),defaultIgnores=["node_modules/**/*","**/node_modules/**","**/.git/**",".git/**/*","**/.svn/**",".svn/**/*",".DS_Store","**/.DS_Store"];class Project{constructor(t){this.miniprogramRoot="",this.pluginRoot="",this._appid="",this._projectPath="",this._dirSet=new Set,this._fileSet=new Set,this._fileBufferCache={},this._privateKey="",this._ignores=[];const{appid:e,type:i,projectPath:r,ignores:s,privateKey:o="",privateKeyPath:a=""}=t;if(!e)throw new error_1.CodeError(locales_1.default.config.SHOULD_NOT_BE_EMPTY.format("appid"),config_1.PARAM_ERROR);if(!r)throw new error_1.CodeError(locales_1.default.config.SHOULD_NOT_BE_EMPTY.format("projectPath"),config_1.PARAM_ERROR);if(o)this._privateKey=o;else{if(!a)throw new error_1.CodeError(locales_1.default.config.SHOULD_NOT_BE_EMPTY.format("privateKeyPath"),config_1.PARAM_ERROR);try{this._privateKey=fs_1.default.readFileSync(a).toString("utf8")}catch(t){throw new error_1.CodeError(t.toString(),config_1.PARAM_ERROR)}}this._appid=e,this._type=i||"miniProgram",this._projectPath=r,this.init(s)}init(t=[]){(0,request_1.initGlobalProxy)(),this._ignores=t,this.updateFiles()}cacheDirName(t){this._dirSet.has(t)||(this._dirSet.add(t),this.cacheDirName(path_1.default.posix.dirname(t)))}getTargetPath(t,e){return(0,tools_1.normalizePath)(path_1.default.posix.join(t,e)).replace(/\/$/,"").replace(/^\//,"")}updateFiles(){this._fileBufferCache={};const t=glob_1.default.sync("**",{nodir:!1,ignore:[...defaultIgnores,...this._ignores],nosort:!0,strict:!1,silent:!0,cwd:this.projectPath,absolute:!1,mark:!0,dot:!0});for(const e of t){const t=e.replace(/\\/g,path_1.default.posix.sep),i=fs_1.default.statSync(path_1.default.posix.join(this.projectPath,e));i.isDirectory()&&this.cacheDirName(t.replace(/\/$/,"")),i.isFile()&&(this._fileSet.add(t),this.cacheDirName(path_1.default.posix.dirname(t)))}}async attr(){return this._attr||(this._attr=await(0,projectattr_1.getProjectAttr)(this._privateKey,this._appid)),this._attr}get projectPath(){return this._projectPath}get appid(){return this._appid}get type(){return this._type}get privateKey(){return this._privateKey||""}getFilesAndDirs(){return{files:Array.from(this._fileSet),dirs:Array.from(this._dirSet)}}async getExtAppid(){if(this._extAppid)return this._extAppid;if(null!==this._extAppid)try{const t=await(0,projectconfig_1.getProjectConfigJSON)(this),{miniprogramRoot:e=""}=t,i=await this.getFile(e,"ext.json"),r=JSON.parse(i.toString("utf-8"));return r.extEnable&&r.extAppid?this._extAppid=r.extAppid:this._extAppid=null,this._extAppid}catch(t){this._extAppid=null}}stat(t,e){const i=this.getTargetPath(t,e);if(this._fileSet.has(i)){return{isFile:!0,isDirectory:!1,size:fs_1.default.statSync(path_1.default.posix.join(this.projectPath,i)).size}}if(this._dirSet.has(i))return{isFile:!1,isDirectory:!0}}getFile(t,e){const i=this.getTargetPath(t,e),r=(0,tools_1.normalizePath)(path_1.default.posix.join(this.projectPath,i));return this._fileBufferCache[i]?this._fileBufferCache[i]:fs_1.default.readFileSync(r,null)}getFileList(t,e=""){return Array.from(this._fileSet).filter(i=>(!e||path_1.default.posix.extname(i)===e)&&(!t||0===i.indexOf(t)))}async onFileChange(t,e){if(e=(0,tools_1.normalizePath)(e).replace(/\/$/,"").replace(/^\//,""),"add"!==t&&"addDir"!==t||(this.cacheDirName(path_1.default.posix.dirname(e)),this._fileSet.add(e)),"addDir"===t&&this.cacheDirName(e),"unlink"===t&&this._fileSet.has(e)&&this._fileSet.delete(e),"unlinkDir"===t&&this._dirSet.has(e)){this._dirSet.delete(e);const t=e+"/",i=Array.from(this._dirSet);for(const e of i)0===e.indexOf(t)&&this._dirSet.delete(e);const r=Array.from(this._fileSet);for(const e of r)0===e.indexOf(t)&&this._fileSet.delete(e)}"change"===t&&this._fileSet.has(e)&&delete this._fileBufferCache[e]}}exports.Project=Project;
|
|
3
|
+
}(require("licia/lazyImport")(require), require)
|
package/dist/ci/projectattr.js
CHANGED
|
@@ -1 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
!function(require, directRequire){
|
|
2
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getProjectAttr=void 0;const tslib_1=require("tslib"),request_1=require("../utils/request"),sign_1=require("../utils/sign"),log_1=(0,tslib_1.__importDefault)(require("../utils/log")),config_1=require("../config"),url_config_1=require("../utils/url_config"),jsonParse_1=require("../utils/jsonParse"),testCache={};async function getProjectAttr(e,t){try{if(global.useAttrCache&&testCache[t])return testCache[t];const r=await(0,sign_1.getSignature)(e,t),{body:o}=await(0,request_1.request)({url:url_config_1.GET_ATTR_URL,method:"post",body:JSON.stringify({appid:t,signature:r}),headers:{"content-type":"application/json"}}),s=(0,jsonParse_1.jsonRespParse)(o,url_config_1.GET_ATTR_URL);if(0===s.errCode)return global.useAttrCache&&(testCache[t]=s.data),s.data;log_1.default.error(`get ${t} project attr fail errCode: ${s.errCode}, errMsg: ${s.errMsg}`)}catch(e){log_1.default.error(`get ${t} project attr fail ${e}`)}return config_1.DefaultProjectAttr}exports.getProjectAttr=getProjectAttr;
|
|
3
|
+
}(require("licia/lazyImport")(require), require)
|
package/dist/ci/upload.js
CHANGED
|
@@ -1 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
!function(require, directRequire){
|
|
2
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.innerUpload=exports.upload=exports.SIGNATURE_FILE_NAME=void 0;const tslib_1=require("tslib"),request_1=require("../utils/request"),compile_1=require("../core/compile"),pack_1=require("./utils/pack"),zlib_1=(0,tslib_1.__importDefault)(require("zlib")),sign_1=require("../utils/sign"),tools_1=require("../utils/tools"),config_1=require("../config"),taskstatus_1=require("../utils/taskstatus"),log_1=(0,tslib_1.__importDefault)(require("../utils/log")),error_1=require("../utils/error"),locales_1=(0,tslib_1.__importDefault)(require("../utils/locales/locales")),querystring_1=(0,tslib_1.__importDefault)(require("querystring")),url_config_1=require("../utils/url_config"),jsonParse_1=require("../utils/jsonParse"),cache_1=require("../utils/cache"),cos_upload_1=require("./cos-upload");exports.SIGNATURE_FILE_NAME="ci.signature";const MIN_COS_UPLOAD_SIZE=5242880;async function upload(e){var o;const t=await innerUpload(e);return(null===(o=t.respBody)||void 0===o?void 0:o.dev_plugin_id)&&(log_1.default.log("Development Version Plugin ID: "+t.respBody.dev_plugin_id),t.devPluginId=t.respBody.dev_plugin_id),{subPackageInfo:t.subPackageInfo,pluginInfo:t.pluginInfo,devPluginId:t.devPluginId}}async function innerUpload(e){const{project:o,setting:t={},desc:r=`robot ${e.robot||"1"} use miniprogram-ci to upload at ${(0,tools_1.formatTime)(new Date)}`,version:i="",robot:a="1",onProgressUpdate:l=function(e){console.log(""+e)},test:s,pagePath:n,searchQuery:u,threads:p=0}=e;let{useCOS:_}=e;if(process.env.COMPILE_THREADS=p.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();let d=await(0,compile_1.compile)(o,{setting:t,onProgressUpdate:l}),c=config_1.CI_VERSION;const f={codeprotect:t.codeProtect?1:0,type:o.type,appid:o.appid,version:i,desc:r,robot:a},g={scene:e.scene||1011};let b;n&&(g.path=n,f.path=n),u&&(g.query=querystring_1.default.parse(u)),f.debugLaunchInfo=JSON.stringify(g),n&&u&&(f.path+="?"+u);let y={};try{b=await o.getFile(o.miniprogramRoot,"ext.json"),y=JSON.parse(b.toString("utf-8"))}catch(e){}if(y&&(y.extEnable&&(f.extAppId=y.extAppid),y.directCommit)){let e="";e=y.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_1.default.warn(e)}try{const e=new taskstatus_1.TaskStatus(locales_1.default.config.UPLOAD.toString());l(e);const t=`${s?url_config_1.TEST_SOURCE_URL:url_config_1.UPLOAD_URL}?${querystring_1.default.stringify(f)}`;let r,i=!1,n=0;const u=(0,pack_1.pack)(d),p=zlib_1.default.gzipSync(u.buffer);if(log_1.default.info("useCOS parameter: ",_),log_1.default.info("upload zip buffer size: ",p.length),void 0===_&&(_=p.length>5242880),_){log_1.default.info("upload by COS: ",_);const e=await(0,cos_upload_1.uploadByCos)(p,t,o,a);e.fallback?(i=e.fallback,log_1.default.info("upload by COS failed, fallback to http way")):(r={body:e.body},n=e.uploadCOSCostTime)}if(!_||i){const e=await(0,sign_1.getSignature)(o.privateKey,o.appid);d[exports.SIGNATURE_FILE_NAME]=JSON.stringify({signature:e,version:c});const i=(0,pack_1.pack)(d),a=zlib_1.default.gzipSync(i.buffer);log_1.default.info("request url:",t);let l=(await(0,request_1.request)({url:t,method:"post",body:a})).body.toString();if(r=(0,jsonParse_1.jsonRespParse)(l,t),0!==r.errCode)throw new Error(l)}e.done(),l(e);const g={respBody:r.body};if(Array.isArray(r.body.subpackage_info)){const e=r.body.subpackage_info;g.subPackageInfo=e}if(Array.isArray(r.body.ext_plugin_info)){const e=r.body.ext_plugin_info;g.pluginInfo=e.map(e=>({pluginProviderAppid:e.provider,version:e.version,size:e.size}))}return g}catch(e){throw new error_1.CodeError(e.toString(),config_1.UPLOAD_CGI_ERR)}}exports.upload=upload,exports.innerUpload=innerUpload;
|
|
3
|
+
}(require("licia/lazyImport")(require), require)
|
package/dist/ci/utils/pack.js
CHANGED
|
@@ -1 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
!function(require, directRequire){
|
|
2
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.pack=void 0;const B_PROTOCOL=0,B_PROTOCOL_VERSION=1,B_FILEINFO_LEN=2,B_FILEDATA_LEN=3,B_PROTOCOL_END=4;function pack(t){const e=[Buffer.alloc(1),Buffer.alloc(4),Buffer.alloc(4),Buffer.alloc(4),Buffer.alloc(1)];e[0][0]=190,e[1].writeInt32BE(0,0),e[4][0]=237;const f=Object.keys(t),r=f.length,c=[],n=[];let o=0;for(const e of f){const f=e.replace(/\\/g,"/"),r=f.startsWith("/")?f:"/"+f,l=Buffer.from(r);c.push(l);const a=t[e];let B;if(a instanceof Buffer)B=a;else{if("string"!=typeof a)throw new Error("pack invalid data: "+e);B=Buffer.from(a,"utf8")}n.push(B),/\.js\.map$/.test(e)||(o+=B.length,o+=l.length)}let l=18+12*r+Buffer.concat(c).length;const a=c.map((t,e)=>{const f=Buffer.alloc(4);f.writeInt32BE(t.length,0);const r=Buffer.alloc(4),c=n[e].length,o=l;r.writeInt32BE(o,0),l+=c;const a=Buffer.alloc(4);return a.writeInt32BE(c,0),Buffer.concat([f,t,r,a])}),B=Buffer.alloc(4);B.writeInt32BE(r,0),a.unshift(B);const s=Buffer.concat(a),u=Buffer.concat(n);e[2].writeInt32BE(s.length,0),e[3].writeInt32BE(u.length,0);const i=Buffer.concat(e);return{validSize:o,buffer:Buffer.concat([i,s,u])}}exports.pack=pack;
|
|
3
|
+
}(require("licia/lazyImport")(require), require)
|
|
@@ -1 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
!function(require, directRequire){
|
|
2
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.packFiledir=exports.packFileMap=void 0;const tslib_1=require("tslib"),fs_1=(0,tslib_1.__importDefault)(require("fs")),path_1=(0,tslib_1.__importDefault)(require("path")),crypto_1=(0,tslib_1.__importDefault)(require("crypto")),glob_1=(0,tslib_1.__importDefault)(require("glob")),packFileMap=(e,t={})=>{const r=[Buffer.alloc(1),Buffer.alloc(4),Buffer.alloc(4),Buffer.alloc(4),Buffer.alloc(1)];r[0][0]=190,r[1].writeInt32BE(0,0),r[4][0]=237;let o=0;const l=[],c=[],f={};let i=0;for(const r in e){const n=Buffer.isBuffer(e[r])?e[r]:Buffer.from(e[r]);if(t.needMd5){const e=crypto_1.default.createHash("md5");e.update(n);const o=e.digest("hex");if(f[r]=o,t.ignoreFileMd5&&t.ignoreFileMd5[r]===o)continue}const a=Buffer.from("/"+r.replace(/\\/g,"/"));o++,l.push(a),c.push(n),/\.js\.map$/.test(r)||(i+=n.length,i+=a.length,i+=12)}let n=18+12*o+Buffer.concat(l).length;const a=l.map((e,t)=>{const r=Buffer.alloc(4);r.writeInt32BE(e.length,0);const o=Buffer.alloc(4),l=c[t].length,f=n;o.writeInt32BE(f,0),n+=l;const i=Buffer.alloc(4);return i.writeInt32BE(l,0),Buffer.concat([r,e,o,i])}),s=Buffer.alloc(4);s.writeInt32BE(o,0),a.unshift(s);const u=Buffer.concat(a),p=Buffer.concat(c);r[2].writeInt32BE(u.length,0),r[3].writeInt32BE(p.length,0);const B=Buffer.concat(r);return i+=18,{data:Buffer.concat([B,u,p]),totalSize:i,fileMd5Info:f}};exports.packFileMap=packFileMap;const packFiledir=(e,t={})=>new Promise((r,o)=>{const l=Object.assign({nodir:!0},t);(0,glob_1.default)(e+"/**",l,(l,c)=>{if(l)return o(l);const f={};c.forEach(t=>{const r=fs_1.default.readFileSync(t),o=path_1.default.relative(e,t);f[o]=r});const i=(0,exports.packFileMap)(f,t);r(i)})});exports.packFiledir=packFiledir;
|
|
3
|
+
}(require("licia/lazyImport")(require), require)
|
|
@@ -1 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
!function(require, directRequire){
|
|
2
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.generateTerminalQrcode=void 0;const qrcodeTerminal=require("qrcode-terminal"),QrCode=require("qrcode-reader"),Jimp=require("jimp");async function generateTerminalQrcode(e){return new Promise((r,o)=>{const n=Buffer.from(e,"base64");Jimp.read(n,(function(n,t){n&&o(n);const c=new QrCode;c.callback=function(n,t){n&&o(n),t&&t.result?qrcodeTerminal.generate(t.result,e=>{r(e)}):o("qrcode decode error, no result, qrcodeDataURI: "+e)},c.decode(t.bitmap)}))})}exports.generateTerminalQrcode=generateTerminalQrcode;
|
|
3
|
+
}(require("licia/lazyImport")(require), require)
|