miniprogram-ci 2.0.8 → 2.0.9
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 +2 -0
- package/README.md +2 -0
- package/dist/@types/ci/utils/tools.d.ts +1 -0
- package/dist/@types/common/code-analyse/index.d.ts +16 -1
- package/dist/@types/config/config.d.ts +8 -1
- package/dist/@types/index.d.ts +2 -1
- package/dist/@types/modules/corecompiler/baseCompiler.d.ts +6 -0
- package/dist/@types/modules/corecompiler/originalCompiler.d.ts +1 -0
- package/dist/@types/modules/corecompiler/processHandler.d.ts +4 -3
- package/dist/@types/modules/corecompiler/summer/graph/appconf.d.ts +4 -0
- package/dist/@types/modules/corecompiler/summer/graph/appgraph.d.ts +6 -3
- package/dist/@types/modules/corecompiler/summer/graph/basegraph.d.ts +12 -3
- package/dist/@types/modules/corecompiler/summer/graph/gamegraph.d.ts +6 -3
- package/dist/@types/modules/corecompiler/summer/graph/gameplugingraph.d.ts +5 -4
- package/dist/@types/modules/corecompiler/summer/graph/plugingraph.d.ts +5 -4
- package/dist/@types/modules/corecompiler/summer/plugins/base/javascript.d.ts +1 -1
- package/dist/@types/modules/corecompiler/summer/plugins/base/swc.d.ts +1 -1
- package/dist/@types/modules/corecompiler/summer/summer.d.ts +5 -1
- package/dist/@types/modules/corecompiler/summerCompiler.d.ts +15 -2
- package/dist/@types/modules/createSummer.d.ts +3 -2
- package/dist/@types/modules/index.d.ts +4 -0
- package/dist/@types/types/ci.d.ts +2 -1
- package/dist/@types/types/core.d.ts +21 -2
- package/dist/@types/types/devtools.d.ts +6 -6
- package/dist/@types/types/miniprogram-json/app.d.ts +16 -6
- package/dist/@types/utils/locales/locales.d.ts +5 -0
- package/dist/@types/utils/locales/zh.d.ts +5 -0
- package/dist/@types/utils/messageHub.d.ts +1 -1
- package/dist/@types/utils/packOptionsHelper.d.ts +15 -2
- package/dist/@types/utils/progressRecorder.d.ts +1 -1
- package/dist/@types/utils/tools.d.ts +4 -0
- package/dist/ci/utils/filterUnusedFile.js +1 -1
- package/dist/ci/utils/tools.js +1 -1
- package/dist/common/code-analyse/index.js +1 -1
- package/dist/config/config.js +1 -1
- package/dist/index.js +1 -1
- package/dist/modules/corecompiler/baseCompiler.js +1 -1
- package/dist/modules/corecompiler/original/compile/common.js +1 -1
- package/dist/modules/corecompiler/original/workerThread/task/compilejs.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/appconf.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/graph/gamegraph.js +1 -1
- package/dist/modules/corecompiler/summer/graph/gameplugingraph.js +1 -1
- package/dist/modules/corecompiler/summer/graph/plugingraph.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/summer.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/project/advance/precompileProject.js +1 -1
- package/dist/project/baseProject.js +1 -1
- package/dist/utils/locales/en.js +1 -1
- package/dist/utils/locales/zh.js +1 -1
- package/dist/utils/packOptionsHelper.js +1 -1
- package/dist/utils/progressRecorder.js +1 -1
- package/dist/utils/subprocess/processManager.js +1 -1
- package/dist/utils/tools.js +1 -1
- package/package.json +1 -1
|
@@ -106,5 +106,10 @@ declare const _default: {
|
|
|
106
106
|
RELATED_NODE_MODULES_NOT_FOUND: FormatableString;
|
|
107
107
|
PACKAGE_JSON_PATH_IN_VALID: FormatableString;
|
|
108
108
|
ACCOUNT_CARD_PACKAPGE_IN_VALID: FormatableString;
|
|
109
|
+
UNUSE_FILE_LIST: FormatableString;
|
|
110
|
+
PACK_OPTIONS_IGNORE_LIST: FormatableString;
|
|
111
|
+
PARTIAL_COMPILE_IGNORE_LIST: FormatableString;
|
|
112
|
+
UNKNOWN_REASON_INGORE_LIST: FormatableString;
|
|
113
|
+
LARGEFILE_WARNING: FormatableString;
|
|
109
114
|
};
|
|
110
115
|
export default _default;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MiniProgramCore } from '../types';
|
|
2
|
-
export type IBuildLogType = 'doing' | 'success' | 'error';
|
|
2
|
+
export type IBuildLogType = 'doing' | 'success' | 'error' | 'warn';
|
|
3
3
|
export interface IMessageHub {
|
|
4
4
|
showStatus?: (id: number, message: string, type?: 'info' | 'success' | 'fail') => void;
|
|
5
5
|
hideStatus?: (id: number) => void;
|
|
@@ -1,9 +1,18 @@
|
|
|
1
1
|
import { MiniProgramCore, MiniProgramDevtools } from '../types';
|
|
2
|
+
import { Analyzer } from '../common/code-analyse';
|
|
2
3
|
declare class PackOptionsHelper {
|
|
3
4
|
private packOptionIgnores;
|
|
4
5
|
private packOptionIncludes;
|
|
6
|
+
private ignoreUploadUnusedFiles;
|
|
7
|
+
private ignoreDevUnusedFiles;
|
|
8
|
+
private unusedFiles;
|
|
9
|
+
private extOpts;
|
|
10
|
+
setExtOpts(options?: {
|
|
11
|
+
include?: MiniProgramDevtools.IProjectConfigPackOption[];
|
|
12
|
+
ignore?: MiniProgramDevtools.IProjectConfigPackOption[];
|
|
13
|
+
}): void;
|
|
5
14
|
updateState(project: MiniProgramCore.IPreCompileProject): void;
|
|
6
|
-
isUnuserFilesEnable():
|
|
15
|
+
isUnuserFilesEnable(production?: boolean): boolean;
|
|
7
16
|
filter(fileList: string[], production?: boolean): string[];
|
|
8
17
|
isIgnored(file: string, production?: boolean): any;
|
|
9
18
|
isNotIgnored(file: string, production?: boolean): boolean;
|
|
@@ -11,7 +20,11 @@ declare class PackOptionsHelper {
|
|
|
11
20
|
ignore?: MiniProgramDevtools.IProjectConfigPackOption[];
|
|
12
21
|
include?: MiniProgramDevtools.IProjectConfigPackOption[];
|
|
13
22
|
}): any;
|
|
14
|
-
|
|
23
|
+
isFileIgnored(file: string, ignores?: MiniProgramDevtools.IProjectConfigPackOption[]): any;
|
|
24
|
+
isFileIncluded(file: string, includes?: MiniProgramDevtools.IProjectConfigPackOption[]): any;
|
|
25
|
+
isIgnoreByUnusedFiles(file: string, production?: boolean): boolean;
|
|
26
|
+
getUnusedFiles(): Set<string>;
|
|
27
|
+
initUnusedFiles(project: MiniProgramCore.IPreCompileProject, analyzer: Analyzer, production?: boolean): Promise<void>;
|
|
15
28
|
}
|
|
16
29
|
declare const _default: PackOptionsHelper;
|
|
17
30
|
export default _default;
|
|
@@ -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
|
|
6
|
+
message(type: 'doing' | 'fail' | 'done' | 'warn', message: string): void;
|
|
7
7
|
constructor(sendProgress: MiniProgramDevtools.ProgressUpdate);
|
|
8
8
|
start(message: string): {
|
|
9
9
|
(err?: any, res?: any): void;
|
|
@@ -39,3 +39,7 @@ export declare function isLeftSubPathOfRight(child: string, parent: string): boo
|
|
|
39
39
|
export declare function isGameApp(project: MiniProgramCI.IProject): boolean;
|
|
40
40
|
export declare const checkIsUseCompilerPlugins: () => boolean;
|
|
41
41
|
export declare const sourcePathToTargetPath: (sourcePath: string) => string;
|
|
42
|
+
export declare function getCompilerPlugins(project: MiniProgramCore.IPreCompileProject): ("typescript" | "less" | "sass")[];
|
|
43
|
+
export declare function getSupportCodeFileExtSet(project: MiniProgramCore.IPreCompileProject): Set<string>;
|
|
44
|
+
export declare function isCodeFile(ext: string): boolean;
|
|
45
|
+
export declare function isMiniProgramCodeFile(ext: string): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.filterUnusedFile=void 0;const tslib_1=require("tslib"),projectconfig_1=require("../../modules/corecompiler/original/json/projectconfig"),path=tslib_1.__importStar(require("path")),code_analyse_1=require("../../common/code-analyse"),code_analyse_2=require("../code-analyse"),babel_helper_1=require("../../utils/babel_helper"),tools_1=require("../../utils/tools");class CodeDataFileHelper{constructor(e,t){this.project=e,this.codes=t,this._dirSet=new Set,this._fileSet=new Set,this._cacheFileSize=new Map;for(const e of Object.keys(this.codes))this._fileSet.add(e.startsWith("/")?e.replace(/^\//,""):e),this.cacheDirName(path.posix.dirname(e))}cacheDirName(e){this._dirSet.has(e)||(this._dirSet.add(e),this.cacheDirName(path.posix.dirname(e)))}cacheFileSize(e){if(this._cacheFileSize.has(e))return this._cacheFileSize.get(e);const t=this.codes[e];let i=0;return i="string"==typeof t?Buffer.from(t,"utf-8").length:t.length,this._cacheFileSize.set(e,i),i}stat(e){const t=this._fileSet.has(e),i=this._dirSet.has(e);if(!t&&!i)return;let r=0;return r=i?Object.keys(this.codes).filter(t=>t.startsWith(e)).reduce((e,t)=>e+this.cacheFileSize(t),0):this.cacheFileSize(e),{isFile:t,isDirectory:i,size:r,mtime:0}}mtime(e){return 0}exist(e){return this.existFile(e)||this.existDir(e)}existDir(e){return e.endsWith("/")&&(e=e.replace(/\/$/,"")),this._dirSet.has(e)}existFile(e){return this._fileSet.has(e)}getFileList(e="",t=""){return Array.from(this._fileSet).filter(i=>(!t||path.extname(i)===t)&&!(e&&!i.startsWith(e)))}async getString(e){const t=this.codes[e];if("string"==typeof t)return t;if(Buffer.isBuffer(t))return t.toString("utf-8");throw new Error(e+" is not in codes")}async getLocalFileString(e){return this.project.getFile(this.project.miniprogramRoot,e).toString("utf-8")}async getJSON(e){const t=await this.getString(e);try{return JSON.parse(t)}catch(e){return null}}async readdir(e){e.endsWith("/")||(e+="/");const t=Array.from(this._fileSet).filter(t=>t.startsWith(e));return Array.from(this._dirSet).filter(t=>t.startsWith(e)).concat(t).filter(t=>t.slice(e.length).indexOf("/")<0).map(t=>t.slice(e.length))}watchFileChange(e){
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.filterUnusedFile=void 0;const tslib_1=require("tslib"),projectconfig_1=require("../../modules/corecompiler/original/json/projectconfig"),path=tslib_1.__importStar(require("path")),code_analyse_1=require("../../common/code-analyse"),code_analyse_2=require("../code-analyse"),babel_helper_1=require("../../utils/babel_helper"),tools_1=require("../../utils/tools");class CodeDataFileHelper{constructor(e,t){this.project=e,this.codes=t,this._dirSet=new Set,this._fileSet=new Set,this._cacheFileSize=new Map;for(const e of Object.keys(this.codes))this._fileSet.add(e.startsWith("/")?e.replace(/^\//,""):e),this.cacheDirName(path.posix.dirname(e))}cacheDirName(e){this._dirSet.has(e)||(this._dirSet.add(e),this.cacheDirName(path.posix.dirname(e)))}cacheFileSize(e){if(this._cacheFileSize.has(e))return this._cacheFileSize.get(e);const t=this.codes[e];let i=0;return i="string"==typeof t?Buffer.from(t,"utf-8").length:t.length,this._cacheFileSize.set(e,i),i}stat(e){const t=this._fileSet.has(e),i=this._dirSet.has(e);if(!t&&!i)return;let r=0;return r=i?Object.keys(this.codes).filter(t=>t.startsWith(e)).reduce((e,t)=>e+this.cacheFileSize(t),0):this.cacheFileSize(e),{isFile:t,isDirectory:i,size:r,mtime:0}}mtime(e){return 0}exist(e){return this.existFile(e)||this.existDir(e)}existDir(e){return e.endsWith("/")&&(e=e.replace(/\/$/,"")),this._dirSet.has(e)}existFile(e){return this._fileSet.has(e)}getFileList(e="",t=""){return Array.from(this._fileSet).filter(i=>(!t||path.extname(i)===t)&&!(e&&!i.startsWith(e)))}async getString(e){const t=this.codes[e];if("string"==typeof t)return t;if(Buffer.isBuffer(t))return t.toString("utf-8");throw new Error(e+" is not in codes")}async getLocalFileString(e){return this.project.getFile(this.project.miniprogramRoot,e).toString("utf-8")}async getJSON(e){const t=await this.getString(e);try{return JSON.parse(t)}catch(e){return null}}async readdir(e){e.endsWith("/")||(e+="/");const t=Array.from(this._fileSet).filter(t=>t.startsWith(e));return Array.from(this._dirSet).filter(t=>t.startsWith(e)).concat(t).filter(t=>t.slice(e.length).indexOf("/")<0).map(t=>t.slice(e.length))}watchFileChange(e){e()}destroy(){}}async function filterUnusedFile(e,t,i){var r,s;if("miniProgram"!==t.type)return i;const n=await(0,projectconfig_1.getProjectConfigJSON)(t);let o=!1;return o=e?!1!==(null===(r=n.setting)||void 0===r?void 0:r.ignoreDevUnusedFiles):!1!==(null===(s=n.setting)||void 0===s?void 0:s.ignoreUploadUnusedFiles),o?doFilterUnusedFile(t,i):i}function checkUnusedCodeFiles(e,t){var i;const r=t.fileHelper.getFileList("").filter(e=>{return t=path.posix.extname(e),/\.(json|wxml|wxss|js|wxs|ts|less|sass|scss)/.test(t);var t}),s=new Set;t.graph.modules.forEach(e=>{const t=r.find(t=>t===e.path);t&&s.add(t)});const n=(0,babel_helper_1.getBabelOutputPath)((null===(i=(0,projectconfig_1.getProjectConfigJSON)(e))||void 0===i?void 0:i.setting)||{});return r.forEach(e=>{(function(e){return e.indexOf(n)>=0})(e)&&s.add(e)}),r.filter(e=>!s.has(e))}async function doFilterUnusedFile(e,t){var i;const r=(0,projectconfig_1.getProjectConfigJSON)(e),s=(0,code_analyse_2.transCompileType)(e);if("gamePlugin"===s)throw new Error("gamePlugin is not support yet!");let n="plugin"===s?r.pluginRoot:r.miniprogramRoot;n=n?path.posix.join(e.projectPath,n):e.projectPath;const o=new CodeDataFileHelper(e,t),l=new code_analyse_1.Analyzer({root:n,type:s,fileHelper:o,plugins:[]});await l.analyse();const a=checkUnusedCodeFiles(e,l),c=(null===(i=r.packOptions)||void 0===i?void 0:i.include)||[];return((e,t)=>{const i=Object.keys(e);for(const r of i)t(r)&&delete e[r];return e})(t,e=>(e=>{if((0,tools_1.isFileIncluded)(e,c))return!1;const t=e.startsWith("/")?e:"/"+e;for(const e of a){if(t===(e.startsWith("/")?e:"/"+e))return!0}return!1})(e))}exports.filterUnusedFile=filterUnusedFile;
|
package/dist/ci/utils/tools.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.formatCISetting=exports.isUndefined=exports.checkIsUseCompilerPlugins=exports.isGameApp=void 0;const types_1=require("../../types"),projectconfig_1=require("../../modules/corecompiler/original/json/projectconfig");function isGameApp(i){return i.type===types_1.EProjectType.miniGame||i.type===types_1.EProjectType.miniGamePlugin}exports.isGameApp=isGameApp;const checkIsUseCompilerPlugins=i=>{var e,n,
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.formatCISetting=exports.isUndefined=exports.checkIsUseCompilerPlugins=exports.isGameApp=exports.CompileSettingsKeysInProjectConfig=void 0;const types_1=require("../../types"),projectconfig_1=require("../../modules/corecompiler/original/json/projectconfig");function isGameApp(i){return i.type===types_1.EProjectType.miniGame||i.type===types_1.EProjectType.miniGamePlugin}exports.CompileSettingsKeysInProjectConfig=["es6","es7","enhance","minified","minify","codeProtect","uglifyFileName","postcss","minifyJS","minifyWXML","minifyWXSS","autoPrefixWXSS","disableUseStrict","compileWorklet"],exports.isGameApp=isGameApp;const checkIsUseCompilerPlugins=i=>{var e,n,t;return!isGameApp(i)||(null===(e=i.setting)||void 0===e?void 0:e.condition)||((null===(n=i.setting)||void 0===n?void 0:n.useCompilerPlugins)||[]).length>0||(null===(t=i.setting)||void 0===t?void 0:t.swc)};function isUndefined(i){return void 0===i}function formatCISetting(i,e){var n,t,s,o,d,f,r,l,c;const m=(0,projectconfig_1.getProjectConfigJSON)(i);if(e.useProjectConfig)return Object.assign(Object.assign({},m.setting),{minifyWXSS:!1!==e.minifyWXSS&&(!!e.minify||(isUndefined(e.minifyWXSS)?null===(n=m.setting)||void 0===n?void 0:n.minifyWXSS:!!e.minifyWXSS)),minifyWXML:!1!==e.minifyWXML&&(!!e.minify||(isUndefined(e.minifyWXML)?null===(t=m.setting)||void 0===t?void 0:t.minifyWXML:!!e.minifyWXML)),minified:!1!==e.minifyJS&&(!!e.minify||(isUndefined(e.minifyJS)?null===(s=m.setting)||void 0===s?void 0:s.minified:!!e.minifyJS)),postcss:isUndefined(e.autoPrefixWXSS)?null===(o=m.setting)||void 0===o?void 0:o.postcss:!!e.autoPrefixWXSS,disableUseStrict:isUndefined(e.disableUseStrict)?null===(d=m.setting)||void 0===d?void 0:d.disableUseStrict:!!e.disableUseStrict,compileWorklet:isUndefined(e.compileWorklet)?null===(f=m.setting)||void 0===f?void 0:f.compileWorklet:!!e.compileWorklet,uglifyFileName:isUndefined(e.codeProtect)?null===(r=m.setting)||void 0===r?void 0:r.uglifyFileName:!!e.codeProtect,es6:isUndefined(e.es6)&&isUndefined(e.es7)?null===(l=m.setting)||void 0===l?void 0:l.es6:!!e.es6||!!e.es7,enhance:isUndefined(e.es6)&&isUndefined(e.es7)?null===(c=m.setting)||void 0===c?void 0:c.enhance:!!e.es6||!!e.es7});const p=Object.assign({},m.setting);for(const i in p)exports.CompileSettingsKeysInProjectConfig.indexOf(i)>-1&&delete p[i];return Object.assign(Object.assign({},p),{minifyWXSS:!1!==e.minifyWXSS&&(e.minify||!!e.minifyWXSS),minifyWXML:!1!==e.minifyWXML&&(e.minify||!!e.minifyWXML),minified:!1!==e.minifyJS&&(e.minify||!!e.minifyJS),postcss:!!e.autoPrefixWXSS,disableUseStrict:!!e.disableUseStrict,compileWorklet:!!e.compileWorklet,uglifyFileName:!!e.codeProtect,es6:!!e.es6||!!e.es7,enhance:!!e.es6||!!e.es7})}exports.checkIsUseCompilerPlugins=checkIsUseCompilerPlugins,exports.isUndefined=isUndefined,exports.formatCISetting=formatCISetting;
|