miniprogram-ci 2.0.2 → 2.0.3

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.
Files changed (115) hide show
  1. package/CHANGELOG.md +3 -1
  2. package/README.md +3 -1
  3. package/dist/@types/config/config.d.ts +1 -1
  4. package/dist/@types/index.d.ts +1 -3
  5. package/dist/@types/modules/index.d.ts +0 -3
  6. package/dist/@types/types/miniprogram-json/app.d.ts +3 -0
  7. package/dist/@types/utils/filerules.d.ts +5 -0
  8. package/dist/config/config.js +1 -1
  9. package/dist/index.js +1 -1
  10. package/dist/modules/corecompiler/summer/graph/appconf.js +1 -1
  11. package/dist/modules/index.js +1 -1
  12. package/dist/utils/filerules.js +1 -1
  13. package/dist/utils/packOptionsHelper.js +1 -1
  14. package/package.json +3 -2
  15. package/dist/@types/cli/cmdForDonutH5.d.ts +0 -22
  16. package/dist/@types/modules/fullcompiler/app/app.d.ts +0 -74
  17. package/dist/@types/modules/fullcompiler/app/contactandlaunch/originalcontactbase64.d.ts +0 -2
  18. package/dist/@types/modules/fullcompiler/app/contactandlaunch/originallaunchbase64.d.ts +0 -2
  19. package/dist/@types/modules/fullcompiler/app/contactandlaunch/updateContactForSubpkg.d.ts +0 -2
  20. package/dist/@types/modules/fullcompiler/app/contactandlaunch/updatecontactandlaunch.d.ts +0 -3
  21. package/dist/@types/modules/fullcompiler/appservice/appservice.config.d.ts +0 -4
  22. package/dist/@types/modules/fullcompiler/appservice/generatecode.utils.d.ts +0 -12
  23. package/dist/@types/modules/fullcompiler/appservice/getappservice.d.ts +0 -9
  24. package/dist/@types/modules/fullcompiler/appservice/getcompiledjs.d.ts +0 -32
  25. package/dist/@types/modules/fullcompiler/appservice/getjsfile.d.ts +0 -18
  26. package/dist/@types/modules/fullcompiler/appservice/getmainpkgsortedjsfiles.d.ts +0 -12
  27. package/dist/@types/modules/fullcompiler/appservice/getsubpackage.d.ts +0 -7
  28. package/dist/@types/modules/fullcompiler/appservice/getsubpkgsortedjsfiles.d.ts +0 -10
  29. package/dist/@types/modules/fullcompiler/appservice/getwxappcode.d.ts +0 -13
  30. package/dist/@types/modules/fullcompiler/config/apperrcode.config.d.ts +0 -48
  31. package/dist/@types/modules/fullcompiler/filerules.d.ts +0 -5
  32. package/dist/@types/modules/fullcompiler/getallrawfiles.d.ts +0 -11
  33. package/dist/@types/modules/fullcompiler/getallwmltohtmlmap.d.ts +0 -11
  34. package/dist/@types/modules/fullcompiler/index.d.ts +0 -28
  35. package/dist/@types/modules/fullcompiler/pageframe/getsubpackage.d.ts +0 -10
  36. package/dist/@types/modules/fullcompiler/pageframe/getwxappcode.d.ts +0 -13
  37. package/dist/@types/modules/fullcompiler/pageframe/index.d.ts +0 -10
  38. package/dist/@types/modules/fullcompiler/trans/transwxmltojs.d.ts +0 -11
  39. package/dist/@types/modules/fullcompiler/trans/transwxsstojs.d.ts +0 -21
  40. package/dist/@types/modules/fullcompiler/trans/wcc/index.d.ts +0 -2
  41. package/dist/@types/modules/fullcompiler/trans/wxml/compilewxml.d.ts +0 -18
  42. package/dist/@types/modules/fullcompiler/trans/wxss/compilewxss.d.ts +0 -11
  43. package/dist/@types/modules/fullcompiler/utils/appconfig/appconfig.d.ts +0 -12
  44. package/dist/@types/modules/fullcompiler/utils/appconfig/appjson.d.ts +0 -3
  45. package/dist/@types/modules/fullcompiler/utils/appconfig/checkcustomcomponent.d.ts +0 -14
  46. package/dist/@types/modules/fullcompiler/utils/appconfig/pagejson.d.ts +0 -3
  47. package/dist/@types/modules/fullcompiler/utils/appconfig/wxappcodejson.d.ts +0 -3
  48. package/dist/@types/modules/fullcompiler/utils/filewriter/index.d.ts +0 -14
  49. package/dist/@types/modules/fullcompiler/utils/handleerror/errorconfig.d.ts +0 -9
  50. package/dist/@types/modules/fullcompiler/utils/handleerror/handleerror.d.ts +0 -3
  51. package/dist/@types/modules/fullcompiler/utils/handleerror/parseerr.d.ts +0 -41
  52. package/dist/@types/modules/fullcompiler/utils/index.d.ts +0 -4
  53. package/dist/@types/modules/fullcompiler/utils/taskmanager.d.ts +0 -23
  54. package/dist/@types/modules/fullcompiler/utils/theme/index.d.ts +0 -40
  55. package/dist/@types/modules/fullcompiler/utils/tools.d.ts +0 -15
  56. package/dist/@types/modules/fullcompiler/utils/transformsourcemap.d.ts +0 -1
  57. package/dist/manifest.json +0 -4
  58. package/dist/modules/fullcompiler/app/app.js +0 -1
  59. package/dist/modules/fullcompiler/app/contactandlaunch/originalcontactbase64.js +0 -1
  60. package/dist/modules/fullcompiler/app/contactandlaunch/originallaunchbase64.js +0 -1
  61. package/dist/modules/fullcompiler/app/contactandlaunch/updateContactForSubpkg.js +0 -1
  62. package/dist/modules/fullcompiler/app/contactandlaunch/updatecontactandlaunch.js +0 -1
  63. package/dist/modules/fullcompiler/appservice/appservice.config.js +0 -1
  64. package/dist/modules/fullcompiler/appservice/generatecode.utils.js +0 -1
  65. package/dist/modules/fullcompiler/appservice/getappservice.js +0 -1
  66. package/dist/modules/fullcompiler/appservice/getcompiledjs.js +0 -1
  67. package/dist/modules/fullcompiler/appservice/getjsfile.js +0 -1
  68. package/dist/modules/fullcompiler/appservice/getmainpkgsortedjsfiles.js +0 -1
  69. package/dist/modules/fullcompiler/appservice/getsubpackage.js +0 -1
  70. package/dist/modules/fullcompiler/appservice/getsubpkgsortedjsfiles.js +0 -1
  71. package/dist/modules/fullcompiler/appservice/getwxappcode.js +0 -1
  72. package/dist/modules/fullcompiler/config/apperrcode.config.js +0 -1
  73. package/dist/modules/fullcompiler/filerules.js +0 -1
  74. package/dist/modules/fullcompiler/getallrawfiles.js +0 -1
  75. package/dist/modules/fullcompiler/getallwmltohtmlmap.js +0 -1
  76. package/dist/modules/fullcompiler/index.js +0 -1
  77. package/dist/modules/fullcompiler/pageframe/getsubpackage.js +0 -1
  78. package/dist/modules/fullcompiler/pageframe/getwxappcode.js +0 -1
  79. package/dist/modules/fullcompiler/pageframe/index.js +0 -1
  80. package/dist/modules/fullcompiler/trans/transwxmltojs.js +0 -1
  81. package/dist/modules/fullcompiler/trans/transwxsstojs.js +0 -1
  82. package/dist/modules/fullcompiler/trans/wcc/build/darwin_arm64/wcc.node +0 -0
  83. package/dist/modules/fullcompiler/trans/wcc/build/darwin_arm64/wcsc.node +0 -0
  84. package/dist/modules/fullcompiler/trans/wcc/build/darwin_x64/wcc.node +0 -0
  85. package/dist/modules/fullcompiler/trans/wcc/build/darwin_x64/wcsc.node +0 -0
  86. package/dist/modules/fullcompiler/trans/wcc/build/node_16.1.0_darwin_arm64_release/wcc.node +0 -0
  87. package/dist/modules/fullcompiler/trans/wcc/build/node_16.1.0_darwin_arm64_release/wcsc.node +0 -0
  88. package/dist/modules/fullcompiler/trans/wcc/build/node_16.1.0_darwin_x64_release/wcc.node +0 -0
  89. package/dist/modules/fullcompiler/trans/wcc/build/node_16.1.0_darwin_x64_release/wcsc.node +0 -0
  90. package/dist/modules/fullcompiler/trans/wcc/build/win32_ia32/wcc.node +0 -0
  91. package/dist/modules/fullcompiler/trans/wcc/build/win32_ia32/wcsc.node +0 -0
  92. package/dist/modules/fullcompiler/trans/wcc/build/win32_x64/wcc.node +0 -0
  93. package/dist/modules/fullcompiler/trans/wcc/build/win32_x64/wcsc.node +0 -0
  94. package/dist/modules/fullcompiler/trans/wcc/index.js +0 -1
  95. package/dist/modules/fullcompiler/trans/wcc/lib/addonVersion.js +0 -19
  96. package/dist/modules/fullcompiler/trans/wcc/lib/index.js +0 -4
  97. package/dist/modules/fullcompiler/trans/wcc/lib/util.js +0 -1134
  98. package/dist/modules/fullcompiler/trans/wcc/lib/wcc.js +0 -94
  99. package/dist/modules/fullcompiler/trans/wcc/lib/wcsc.js +0 -93
  100. package/dist/modules/fullcompiler/trans/wxml/compilewxml.js +0 -1
  101. package/dist/modules/fullcompiler/trans/wxss/compilewxss.js +0 -1
  102. package/dist/modules/fullcompiler/utils/appconfig/appconfig.js +0 -1
  103. package/dist/modules/fullcompiler/utils/appconfig/appjson.js +0 -1
  104. package/dist/modules/fullcompiler/utils/appconfig/checkcustomcomponent.js +0 -1
  105. package/dist/modules/fullcompiler/utils/appconfig/pagejson.js +0 -1
  106. package/dist/modules/fullcompiler/utils/appconfig/wxappcodejson.js +0 -1
  107. package/dist/modules/fullcompiler/utils/filewriter/index.js +0 -1
  108. package/dist/modules/fullcompiler/utils/handleerror/errorconfig.js +0 -1
  109. package/dist/modules/fullcompiler/utils/handleerror/handleerror.js +0 -1
  110. package/dist/modules/fullcompiler/utils/handleerror/parseerr.js +0 -1
  111. package/dist/modules/fullcompiler/utils/index.js +0 -1
  112. package/dist/modules/fullcompiler/utils/taskmanager.js +0 -1
  113. package/dist/modules/fullcompiler/utils/theme/index.js +0 -1
  114. package/dist/modules/fullcompiler/utils/tools.js +0 -1
  115. package/dist/modules/fullcompiler/utils/transformsourcemap.js +0 -1
@@ -1,94 +0,0 @@
1
- /* eslint-disable @typescript-eslint/no-misused-promises */
2
- const util = require('./util');
3
- const path = require('path');
4
-
5
- let wcc;
6
-
7
- function loadWccAddon() {
8
- if (wcc) return;
9
- const { getAddonRelativePath } = require('./addonVersion');
10
- const relaPath = getAddonRelativePath('wcc');
11
- wcc = require(relaPath);
12
- }
13
-
14
- const { fs } = util;
15
-
16
- exports = async function (options) {
17
- loadWccAddon();
18
-
19
- if (!options) throw Error('options is required');
20
-
21
- const lazyload = !!options.lazyloadConfig;
22
-
23
- options = Object.assign(
24
- {
25
- files: [],
26
- contents: [],
27
- replaceContent: {},
28
- verbose: false,
29
- debug: false,
30
- debugWXS: false,
31
- showNewTree: false,
32
- isPlugin: false,
33
- addTestAttre: false,
34
- independent: false,
35
- genfuncname: '$gwx',
36
- isCut: false,
37
- cwd: process.cwd,
38
- debug: false,
39
- lazyload,
40
- lazyloadConfig: '',
41
- },
42
- options,
43
- );
44
-
45
- return new Promise(async (resolve, reject) => {
46
- // 获取文件内容
47
- if (!options.contents.length) {
48
- const tasks = options.files.map((file) => {
49
- if (typeof options.replaceContent[file] === 'string') {
50
- return options.replaceContent[file];
51
- }
52
- return fs.readFile(path.resolve(options.cwd, file), 'utf8');
53
- });
54
- options.contents = await Promise.all(tasks) || [];
55
- }
56
- // console.log('wcc get files', Date.now() - st, options.contents)
57
- let result;
58
- try {
59
- result = wcc(options);
60
- } catch (errmsg) {
61
- reject(new Error(errmsg));
62
- return;
63
- }
64
-
65
- // console.log('wcc get compile', Date.now() - st)
66
- if (options.output) {
67
- const output = path.resolve(options.cwd, options.output);
68
- const dir = path.dirname(output);
69
- if (lazyload) {
70
- // lazyload 为 true时,wcc 返回值是个对象, 需要序列化一下
71
- result = JSON.stringify(result);
72
- }
73
- try {
74
- await fs.stat(dir);
75
- } catch (e) {
76
- await fs.mkdir(dir, {
77
- recursive: true,
78
- });
79
- }
80
- await fs.writeFile(output, result, 'utf8');
81
- }
82
- // console.log('wcc get output', Date.now() - st)
83
- resolve(result);
84
- });
85
- };
86
-
87
- Object.defineProperty(exports, 'version', {
88
- get() {
89
- loadWccAddon();
90
- return wcc.version;
91
- },
92
- });
93
-
94
- module.exports = exports;
@@ -1,93 +0,0 @@
1
- const util = require('./util');
2
- const path = require('path');
3
- const { fs } = util;
4
-
5
- let wcsc;
6
-
7
- function loadWcscAddon() {
8
- if (wcsc) return;
9
- const { getAddonRelativePath } = require('./addonVersion');
10
- const relaPath = getAddonRelativePath('wcsc');
11
- wcsc = require(relaPath);
12
- }
13
-
14
- function tranWcscResultToObject(resultStr) {
15
- const resultArr = resultStr.split('=');
16
- const result = {};
17
- for (let i = 0, len = resultArr.length; i < len && resultArr[i + 1]; i += 2) {
18
- result[resultArr[i]] = resultArr[i + 1];
19
- }
20
- return result;
21
- }
22
-
23
- exports = async function (options) {
24
- loadWcscAddon();
25
-
26
- if (!options) throw Error('options is required');
27
-
28
- // avoid undefined or null
29
- if (typeof options.subPackage !== 'string') {
30
- delete options.subPackage;
31
- }
32
-
33
- if (typeof options.lazyload !== 'boolean') {
34
- delete options.lazyload;
35
- }
36
-
37
- options = Object.assign(
38
- {
39
- files: [],
40
- contents: [],
41
- pageCount: 0,
42
- cwd: process.cwd,
43
- replaceContent: {},
44
- debug: false,
45
- classPrefix: '',
46
- lazyload: false,
47
- },
48
- options,
49
- );
50
-
51
- if (!options.contents.length) {
52
- const tasks = options.files.map((file) => {
53
- if (typeof options.replaceContent[file] === 'string') {
54
- return options.replaceContent[file];
55
- }
56
- return fs.readFile(path.resolve(options.cwd, file), 'utf8');
57
- });
58
- options.contents = await Promise.all(tasks) || [];
59
- }
60
-
61
- let wccResult;
62
- try {
63
- wccResult = wcsc(options);
64
- } catch (errmsg) {
65
- throw new Error(errmsg);
66
- }
67
-
68
- const result = options.lazyload ? wccResult : tranWcscResultToObject(wccResult);
69
-
70
- if (options.output) {
71
- const output = path.resolve(options.cwd, options.output);
72
- const dir = path.dirname(output);
73
- try {
74
- await fs.stat(dir);
75
- } catch (e) {
76
- await fs.mkdir(dir, {
77
- recursive: true,
78
- });
79
- }
80
- await fs.writeFile(output, JSON.stringify(result, null, 2), 'utf8');
81
- }
82
-
83
- return result;
84
- };
85
-
86
- Object.defineProperty(exports, 'version', {
87
- get() {
88
- loadWcscAddon();
89
- return wcsc.version;
90
- },
91
- });
92
-
93
- module.exports = exports;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.compileWxml=void 0;const tslib_1=require("tslib"),index_1=tslib_1.__importDefault(require("../wcc/index")),wccnode=index_1.default.wcc;async function compileWxml(e){return compileUseWCCNode(e)}async function compileUseWCCNode(e){var o;const{files:i,configSplit:n,cwd:c,configContent:l,isCut:t,genfuncName:s,hasWxs:r=!0,isPlugin:u,replaceContent:d={}}=e,m=Date.now(),p=await wccnode({files:i,debugWXS:r,debug:!0,genfuncname:s,isPlugin:u,isCut:t,wxmlCompileConfig:l,wxmlCompileConfigSplit:n,replaceContent:d,cwd:c});return(null===(o=process.env)||void 0===o?void 0:o.isDevtools)&&console.warn("[wcc-node] compile cost:",Date.now()-m),{code:p,name:s}}exports.compileWxml=compileWxml;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.compileWxss=void 0;const tslib_1=require("tslib"),index_1=tslib_1.__importDefault(require("../wcc/index")),wcscnode=index_1.default.wcsc;async function compileWxss(e){const{files:s}=e;let{pageCount:o}=e;1===s.length&&s[0].includes("app.wxss")&&(o=1);return compileUseWCSCNode(Object.assign(Object.assign({},e),{pageCount:o}))}async function compileUseWCSCNode(e){var s;const o=Date.now(),c=await wcscnode(Object.assign(Object.assign({},e),{debug:!0}));return(null===(s=process.env)||void 0===s?void 0:s.isDevtools)&&console.warn("[wcsc-node] compile cost:",Date.now()-o),c}exports.compileWxss=compileWxss;
@@ -1 +0,0 @@
1
- "use strict";const tslib_1=require("tslib"),theme_1=require("../theme"),tools=tslib_1.__importStar(require("../tools")),pagejson_1=tslib_1.__importDefault(require("./pagejson")),appjson_1=tslib_1.__importDefault(require("./appjson")),path=require("path"),_=require("lodash");async function mergeThemeJSON(e){var a;const{project:t,isDarkMode:n,themeLocation:i,themeJSON:o,appConfig:s}=e,r=path.join(t.projectPath,t.miniprogramRoot||""),{windowConfigRules:g,tabbarRules:c,tabbarListItemRules:p}=(0,theme_1.checkThemeRules)(r);(0,theme_1.checkVariables)({isDarkMode:n,themeLocation:i,themeJSON:o,filePath:"app.json or ext.json",windowConfig:s.global.window,rules:g,keyPrefix:'["window"]',isPlugin:!1});for(const e in s.page){const a=e.replace(/\.html$/,"");(0,theme_1.checkVariables)({isDarkMode:n,themeLocation:i,themeJSON:o,filePath:a+".json",windowConfig:s.page[e].window||{},rules:g,keyPrefix:"",isPlugin:!1})}if(s.tabBar){(0,theme_1.checkVariables)({isDarkMode:n,themeLocation:i,themeJSON:o,filePath:"app.json or ext.json",windowConfig:s.tabBar||{},rules:c,keyPrefix:'["tabBar"]',isPlugin:!1});for(let e=0;e<(null===(a=s.tabBar)||void 0===a?void 0:a.list.length);e++)(0,theme_1.checkVariables)({isDarkMode:n,themeLocation:i,themeJSON:o,filePath:"app.json or ext.json",windowConfig:s.tabBar.list[e],rules:p,keyPrefix:`["tabBar"]["list"][${e}]`,isPlugin:!1})}}function getAppConfigJSON(e,a){return{pages:e.pages||[],resizable:!!e.resizable,subPackages:e.subPackages,debug:!!e.debug,widgets:e.widgets||[],customClose:!!e.customClose,workers:e.workers||"",cloud:!!e.cloud,global:{window:Object.assign(Object.assign({},(0,theme_1.getDefaultWindowConfig)(e.darkmode&&a)),e.window)},page:{},networkTimeout:Object.assign({request:6e4,uploadFile:6e4,connectSocket:6e4,downloadFile:6e4},e.networkTimeout),ext:e.ext||{},extAppid:e.extAppid||"",plugins:e.plugins||{},mainPlugins:Object.assign({},e.plugins),preloadRule:e.preloadRule,permission:e.permission,requiredBackgroundModes:e.requiredBackgroundModes,functionalPages:e.functionalPages,style:e.style,useExtendedLib:e.useExtendedLib||{},supportedMaterials:e.supportedMaterials||[],usingShopPlugin:e.usingShopPlugin||void 0,embeddedAppIdList:e.embeddedAppIdList,halfPage:e.halfPage,resolveAlias:e.resolveAlias,renderer:e.renderer,enablePassiveEvent:e.enablePassiveEvent,debugOptions:e.debugOptions,__warning__:e.__warning__||""}}async function checkAppConfig(e,a,t){const n=await(0,appjson_1.default)(e,a),i=getAppConfigJSON(n,t),o=e=>{e.__warning__&&(i.__warning__&&(i.__warning__+="、"),i.__warning__+=""+e.__warning__)},{pages:s}=i;i.entryPagePath=n.entryPagePath?n.entryPagePath+".html":s[0]+".html";for(const t of s){const n=await(0,pagejson_1.default)(e,a,""+t)||{};o(n);const{singlePage:s}=n,r=tslib_1.__rest(n,["singlePage"]);i.page[t+".html"]={window:r||{},singlePage:s,renderer:n.renderer}}if(i.subPackages){let t={};for(const n of i.subPackages){for(const t of n.pages){const s=path.posix.join(n.root,t),r=await(0,pagejson_1.default)(e,a,""+s)||{};o(r);const{singlePage:g}=r,c=tslib_1.__rest(r,["singlePage"]);i.page[s+".html"]={window:c||{},singlePage:g,renderer:r.renderer}}t=Object.assign(Object.assign({},t),n.plugins)}i.plugins=Object.assign(Object.assign({},i.plugins),t)}i.page=Object.assign({},i.page);const r=Object.assign({},n.tabBar),g=[].concat(r.list||[]),c=[];for(const e of g){const a=Object.assign({},e);a.pagePath+=".html",c.push(a)}r.list=c,i.tabBar=r,n.darkmode&&(i.supportDarkmode=!0);let p={};const{themeLocation:l}=n;return void 0!==l&&""!==l.trim().replace(/^\.\//,"")&&(p=await a.checkThemeJSON({themeLocation:l})),await mergeThemeJSON({project:e,summerCompiler:a,themeJSON:p,themeLocation:l,isDarkMode:!(!n.darkmode||!t),appConfig:i}),i}let appConfigCache=null;async function checkLightAppConfig(e,a,t=!0){let n;return appConfigCache?n=appConfigCache:(n=await checkAppConfig(e,a,!1),appConfigCache=n),t?_.cloneDeep(n):n}let appDarkConfigCache=null;async function checkDarkmodeAppConfig(e,a,t=!0){let n;return appDarkConfigCache?n=appDarkConfigCache:(n=await checkAppConfig(e,a,!0),appDarkConfigCache=n),t?_.cloneDeep(n):n}const getAppConfig=async(e,a,t=!0)=>{const n=await checkLightAppConfig(e,a,t);return t?_.cloneDeep(n):n},checkIsInSubPackage=async(e,a,t)=>{const n=await getAppConfig(e,a,!1);return tools.checkIsInSubPackage(n,t)},DealSubPackages=e=>{if(Array.isArray(e.subPackages||e.subpackages)&&Array.isArray(e.pages)){const a=_.cloneDeep(e);return(a.subPackages||a.subpackages).forEach(e=>{const t=[];e.pages.forEach(n=>{const i=path.join(e.root,n);t.push(i),a.pages.includes(i)||a.pages.push(i)}),e.pages=t}),a}return e};module.exports={checkLightAppConfig:checkLightAppConfig,checkDarkmodeAppConfig:checkDarkmodeAppConfig,getAppConfig:getAppConfig,checkIsInSubPackage:checkIsInSubPackage,DealSubPackages:DealSubPackages};
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});const _=require("lodash");async function getCompiledAppJSON(e,t){try{const e=await t.getAppJSON();return _.cloneDeep(e)}catch(e){throw console.log("getCompiledAppJSON error:",e),e}}exports.default=getCompiledAppJSON;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getCustomComponentsConfig=exports.getFileListJustInPack=exports.getWxssCompileConfig=exports.getWxmlCompileConfig=void 0;const tslib_1=require("tslib"),tools_1=require("../../../../utils/tools"),packOptionsHelper_1=tslib_1.__importDefault(require("../../../../utils/packOptionsHelper")),pagejson_1=tslib_1.__importDefault(require("./pagejson")),path=require("path"),friendlyPathMake=(t,o)=>path.posix.normalize(path.join(t,o).replace(/^\/+/,"")).replace(/\\/g,"/"),trailing=(t,o)=>t.endsWith(o)?t:t+o;async function getWxmlCompileConfig(t,o,e,n){let s=[],i=0;const a=await getCustomComponentsConfig(t,o,e);for(const t in a){const o=a[t];if(!o)continue;if(!n&&o.config||n&&!o.config||n&&o.config&&n.root!==o.config.root)continue;const{pageJSON:e}=o;if(e&&(e.usingComponents||e.componentGenerics)){s.push(`./${t}.wxml`);const o=Object.assign(Object.assign({},e.usingComponents),e.componentGenerics);i++,s.push(Object.keys(o).length),s=s.concat(Object.keys(o))}}return s.unshift(i),s}async function getWxssCompileConfig(t,o,e,n){return await getFileListJustInPack(t,o,e,n)}async function getFileListJustInPack(t,o,e,n){const s=await getCustomComponentsConfig(t,o,e),i=[];for(const t in s){const o=s[t];n?o.config&&o.config.root===n.root&&i.push(t):o.config||i.push(t)}return[...i]}async function getCustomComponentsConfig(t,o,e){const n=await getAllJSON(t,o);if(e.pages){const t=new Set(n);for(const o of e.pages)t.has(o+".json")||n.push(o+".json")}const s=e.subPackages||e.subpackages;if(Array.isArray(s))for(const t of s)if(t&&"string"==typeof t.root&&Array.isArray(t.pages))for(const o of t.pages){const e=new Set(n),s=(i=t.root,a=String(o),path.posix.normalize(path.join(i,a).replace(/^\/+/,"")).replace(/\\/g,"/"));e.has(s+".json")||n.push(s+".json")}var i,a;const r={};for(const s of n){const n=s.replace(/\.json$/,"");if("app"===(0,tools_1.normalizePath)(n))continue;const i=await(0,pagejson_1.default)(t,o,n);if(i.usingComponents||i.componentGenerics||!0===i.component){const t=findSubpackageForFile(n,e);r[n]={config:t,file:s,pageJSON:i}}}return r}async function getAllJSON(t,o){let e=[];return e=await o.getAllPageAndComponent(),packOptionsHelper_1.default.updateState(t),e=packOptionsHelper_1.default.filter(e.map(t=>t+".json")),e}exports.getWxmlCompileConfig=getWxmlCompileConfig,exports.getWxssCompileConfig=getWxssCompileConfig,exports.getFileListJustInPack=getFileListJustInPack,exports.getCustomComponentsConfig=getCustomComponentsConfig;const findSubpackageForFile=(t,o)=>{let e;const n=o.subPackages||o.subpackages;if(Array.isArray(n))for(const o of n)if(o&&"string"==typeof o.root&&t.startsWith((s=o.root,i="/",s.endsWith(i)?s:s+i))){e=o;break}var s,i;return e};
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});const tslib_1=require("tslib"),lodash_1=tslib_1.__importDefault(require("lodash"));async function getCompiledPageJSON(e,t,l){const o=await t.getPageJSON(l);return lodash_1.default.cloneDeep(o)}exports.default=getCompiledPageJSON;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});const tslib_1=require("tslib"),tools_1=require("../../../../utils/tools"),pagejson_1=tslib_1.__importDefault(require("./pagejson")),_=require("lodash"),appConfigHelper=require("./appconfig");async function getWXAppCodeJSON(e,n,o){const i=await appConfigHelper.getAppConfig(e,n,!1),s=(0,tools_1.checkIsInSubPackage)(i,o),t=await(0,pagejson_1.default)(e,n,o);if(t.usingComponents&&Object.keys(t.usingComponents).length>0){const e={};for(const n in t.usingComponents){const o=t.usingComponents[n]||"";i.plugins||(null==s?void 0:s.plugins)?e[n]=o.replace(/^plugin:\/\/([^/]*)\/(.*)/,(e,n,o,t,p)=>{var l,u;const r=(null===(l=i.plugins)||void 0===l?void 0:l[n])||(null===(u=null==s?void 0:s.plugins)||void 0===u?void 0:u[n]);return r?`plugin://${r.provider}/${o}`:p}):e[n]=o}t.usingComponents=e}return _.cloneDeep(t)}exports.default=getWXAppCodeJSON;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});const tslib_1=require("tslib"),path_1=tslib_1.__importDefault(require("path")),fs_extra_1=tslib_1.__importDefault(require("fs-extra"));class FileWriter{constructor(t){if(this.projectPath="",this.dist="",this.projectPath=t.projectPath||"",this.dist=t.dist,fs_extra_1.default.ensureDirSync(this.dist),!0===t.clearDist&&fs_extra_1.default.emptyDirSync(this.dist),!fs_extra_1.default.existsSync(this.projectPath))throw new Error("目标地址不存在")}getFinalPath(t){return path_1.default.join(this.dist,t)}writeFile(t,e){const i=this.getFinalPath(t);fs_extra_1.default.ensureDirSync(path_1.default.dirname(i)),fs_extra_1.default.writeFileSync(i,e)}copyFile(t,e=""){const i=path_1.default.join(this.projectPath,t),r=this.getFinalPath(path_1.default.join(e,t));fs_extra_1.default.ensureDirSync(path_1.default.dirname(r)),fs_extra_1.default.copyFileSync(i,r)}}exports.default=FileWriter;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.errorPrefix=void 0,exports.errorPrefix={COMPONENT_FOR_DEVELOPER:"For developer:",WXML_RUNTIME_ERROR:"WXMLRT",WXML_RUNTIME_ERROR_REG:/^WXMLRT_[^:]*:/,WXML_PLUGIN_RUNTIME_ERROR_REG:/^WXMLRT_\$gwx_(wx[0-9a-zA-Z]{16}):/,WXS_RUNTIME_ERROR:"WXSRT:",WEBVIEW_ERROR:"WEBVIEW_ERROR",CODE_ERROR:"CODE_ERROR"};
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.handleError=void 0;const apperrcode_config_1=require("../../config/apperrcode.config"),tools_1=require("../../../../utils/tools"),parseErr=require("./parseerr"),errorTpl="\n <p>{{error}}</p>\n";function displayInConsole(e){var r;const o=`\n\n${e.title?`title: ${e.title}\n`:""}${e.file?`file: ${e.file}\n`:""}${e.msg?`msg: ${e.msg} \n`:""}${e.message?e.message:""}`;null===(r=(0,tools_1.getTerm)())||void 0===r||r.error.red(o)}async function handleError(e,r,o,s=!0){let n;if(o.code===apperrcode_config_1.appErrCode.TRANS_WXML_JS_ERR?n=await parseErr.parseWxmlErr(e,r,o.msgForConsole):o.code===apperrcode_config_1.appErrCode.TRANS_WXSS_JS_ERR&&(n=await parseErr.parseWxssErr(e,r,o)),n){const e=errorTpl.replace("{{error}}",(n.title?""+n.title:"")+(n.file?"in File: "+n.file:"")+(n.msg?`<pre style="white-space:pre-wrap; font-family: monospace;">${n.msg.replace(/</g,"&lt;").replace(/>/g,"&gt;")}</pre>`:"")+(o.message?`<p>${o.message}</p>`:""));if(s){const r=unescape(decodeURI(encodeURIComponent(e)));return displayInConsole(n),r}}else if(s){const e=unescape(decodeURI(o.message));return displayInConsole(o),e}return o.msg}exports.handleError=handleError;
@@ -1 +0,0 @@
1
- "use strict";const tslib_1=require("tslib"),locales_1=tslib_1.__importDefault(require("../../../../utils/locales/locales")),errorconfig_1=require("./errorconfig"),path=require("path"),babelCodeFrame=require("babel-code-frame"),jsonlint=require("../../../../utils/jsonlint"),jsonParse=jsonlint.parser;function getErrLine(r,e,s,n){return`${n}\n${babelCodeFrame(r,e,s=s>0?s:1)}`}const parseWXMLRuntimeErr=async(r,e,s)=>{let n=s.message,i=[],t="",a="";n=n.replace(errorconfig_1.errorPrefix.WXML_RUNTIME_ERROR_REG,""),n=n.replace("WXMLRT:",""),i=n.split(":"),t=i[0];try{a=e.getFileString(r.miniprogramRoot,t)}catch(r){return{file:t,msg:n}}const l=parseInt(i[2],10),o=parseInt(i[3],10);if(-1!==l)try{const r=n.replace(`${i[0]}:${i[1]}:${i[2]}:${i[3]}:`,"");n=getErrLine(a,l,o,r)}catch(r){}return{file:t,msg:n}},parseJsonFileErr=r=>({file:r.file,msg:locales_1.default.config.PARSEERR_ENTRANCE_FILE_ERROR.format(r.file)}),parseJsonParseErr=(r,e)=>{const s=e.data||"";try{jsonParse.parse(s)}catch(n){try{const i=`Expecting ${n.expected}, got ${n.token}`;let t=getErrLine(s,n.line,n.loc.first_column,i);if(e.fileName){const a=getErrorFileInfo(r,{fileName:e.fileName,line:n.line,isPlugin:e.isPlugin});t=`${getErrLine(s,n.line,n.loc.first_column,i)}\n${a}`}return`${e.fileName}\n${t}`}catch(r){}}return`${e.fileName}\n${e.error}`},_parseWxmlErr=async(r,e,s,n)=>{const i=(s||"").trim().split(":");try{if(i.length){const s=parseInt(i[1].trim(),10),t=parseInt(i[2].trim(),10)-1,a=getErrorFileInfo(r,{fileName:i[0],line:s,isPlugin:n}),l=e.getFileString(r.miniprogramRoot,i[0]),o=`${getErrLine(l,s,t,i[3])}\n${a}`;return{file:i[0],msg:o}}}catch(r){}return{file:"",msg:s}},parsePluginWxmlErr=async(r,e,s)=>await _parseWxmlErr(r,e,s,!0),parseWxmlErr=async(r,e,s)=>await _parseWxmlErr(r,e,s,!1),getErrorFileInfo=(r,e)=>{const{fileName:s,line:n,isPlugin:i=!1}=e;if(!s)return"";const t=i?r.pluginRoot:r.miniprogramRoot;return`at files://${t?path.join(t,s):s.replace(/^\.\//,"")}#${n}`},_parseWxssErr=async(r,e,s,n)=>{let i="string"==typeof s?s:s.msgForConsole||"";i=i.split("\n")[0];try{if(/not found from/.test(i)){const r=i.match(/ERR:.+?`(.+)`.+?`(.+)`/);if(!r)return{file:"",msg:i};const e=r[1],s=r[2];return{file:s,msg:"File not found: "+e}}const s=i.match(/ERR:\s(.+)\((\d*):(\d*)\):\s*?(.+)/);if(!s)return{file:"",msg:i};const t=parseInt(s[2],10),a=parseInt(s[3],10)-1,l=s[4].replace(/`/g,'"'),o=s[1],c=e.getFileString(r.miniprogramRoot,o),p=getErrorFileInfo(r,{fileName:o,line:t,isPlugin:n}),m=`${getErrLine(c,t,a,l)}\n${p}`;return{file:o,reason:l,msg:m}}catch(r){return{file:"",msg:i}}},parsePluginWxssErr=async(r,e,s)=>await _parseWxssErr(r,e,s,!0),parseWxssErr=async(r,e,s)=>await _parseWxssErr(r,e,s,!1);module.exports={parseWXMLRuntimeErr:parseWXMLRuntimeErr,parseJsonFileErr:parseJsonFileErr,parseJsonParseErr:parseJsonParseErr,parsePluginWxmlErr:parsePluginWxmlErr,parsePluginWxssErr:parsePluginWxssErr,parseWxmlErr:parseWxmlErr,parseWxssErr:parseWxssErr};
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.escapeByEval=exports.wrapCodeByEval=exports.flatSubPackage=void 0;const tslib_1=require("tslib"),path_1=tslib_1.__importDefault(require("path")),lodash_1=tslib_1.__importDefault(require("lodash"));function flatSubPackage(e){const a=lodash_1.default.cloneDeep(e);if(a.subpackages||a.subPackages){a.pages||(a.pages=[]);return(a.subpackages||a.subPackages).forEach(e=>{e.pages.forEach(t=>{a.pages.push(path_1.default.join(e.root,t))})}),delete a.subpackages,delete a.subPackages,a}return!1}function wrapCodeByEval(e){return`;(window.eval)('${e}')`}function escapeByEval(code){const str="",evalStr=`eval('str = \`${code}\`')`;return eval(evalStr),str}exports.flatSubPackage=flatSubPackage,exports.wrapCodeByEval=wrapCodeByEval,exports.escapeByEval=escapeByEval;
@@ -1 +0,0 @@
1
- "use strict";async function taskTool(t,s,i){const n=[],r=[];let e=0;const a=function(){if(e===i.length)return Promise.resolve();const h=i[e],o=Promise.resolve().then(()=>h());return n.push(o),r.push(o),e+=1,r.length>=t?Promise.race(r).then(()=>(r.splice(r.indexOf(o),1),a())).catch(t=>{if(s)throw t;return r.splice(r.indexOf(o),1),a()}):a()};return a().then(()=>Promise.all(n))}class TaskManager{constructor(t={}){this.breakWhenError=!0;const{poolLimit:s=50,breakWhenError:i=!0}=t;this._tasks=[],this.poolLimit=s,this.breakWhenError=i,this.isRuning=!1,this.taskPool=null}static get shared(){return this._instance||(this._instance=new this),this._instance}addTask(t,...s){this._tasks.push(t.bind(null,...s))}async runAllAsync(t){if(!this._tasks.length)return[];if(this.isRuning)return this.taskPool;let s;try{this.isRuning=!0,this.taskPool=taskTool(t||this.poolLimit,this.breakWhenError,this._tasks),s=await this.taskPool}catch(t){throw t}finally{this.isRuning=!1,this.taskPool=null,this._tasks=[]}return s}async runAllSerial(){const t=[];try{for(let s=0,i=this._tasks.length;s<i;s++){const i=await this._tasks[s]();t.push(i)}}catch(t){}finally{this._tasks=[]}return t}}module.exports=TaskManager;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.checkVariables=exports.getDefaultWindowConfig=exports.checkThemeRules=exports.checkTabbarListItemIconPath=void 0;const tslib_1=require("tslib"),locales_1=tslib_1.__importDefault(require("../../../../utils/locales/locales")),tools_1=require("../../../../utils/tools"),config_1=require("../../../../config/config"),path=require("path"),fs=require("fs"),TABBAR_ICON_WHITE_LIST=[".png",".jpg",".jpeg"];function checkTabbarListItemIconPath(e,o){const t=config_1.DefaultProjectAttr,{setting:r}=t,a=[];if(!fs.existsSync(o))return a.push(locales_1.default.config.NOT_FOUND.format(e)),a;const i=fs.statSync(o);if(i.isDirectory())return a.push(locales_1.default.config.JSON_CONTENT_SHOULD_NOT_BE.format(e,locales_1.default.config.DIRECTORY)),a;i.size>1024*r.MaxTabbarIconSize&&a.push(locales_1.default.config.EXCEED_LIMIT.format(e,r.MaxTabbarIconSize+"kb"));const l=path.extname(o);return TABBAR_ICON_WHITE_LIST.indexOf(l)<0&&a.push(locales_1.default.config.FILE_EXT_FORMAT_ERROR.format(e,TABBAR_ICON_WHITE_LIST.join("、"))),a}function throwError(e={msg:"",filePath:"app.json"}){const{msg:o,filePath:t}=e,r=new Error(o);throw r.code=config_1.JSON_CONTENT_ERR,r.path=t,r}function checkThemeRules(e){const o=(o,t)=>{const r=checkTabbarListItemIconPath(o,path.join(e,t));r.length>0&&throwError({msg:r.join("\n"),filePath:"app.json or ext.json"})};return{windowConfigRules:[{key:"navigationBarTextStyle",valids:["black","white"]},{key:"backgroundTextStyle",valids:["dark","light"]},{key:"navigationBarBackgroundColor",hexColor:!0},{key:"backgroundColor",hexColor:!0},{key:"backgroundColorTop",hexColor:!0},{key:"backgroundColorBottom",hexColor:!0}],tabbarRules:[{key:"selectedColor",hexColor:!0},{key:"color",hexColor:!0},{key:"backgroundColor",hexColor:!0},{key:"borderStyle",valids:["black","white"]}],tabbarListItemRules:[{key:"iconPath",validate:o},{key:"selectedIconPath",validate:o}]}}function getDefaultWindowConfig(e){return e?{backgroundColor:"#232323",backgroundTextStyle:"light"}:{backgroundColor:"#ffffff",backgroundTextStyle:"dark"}}function checkVariables(e){var o;const{windowConfig:t,themeLocation:r,filePath:a,isDarkMode:i,themeJSON:l,rules:c,keyPrefix:n,isPlugin:s=!1}=e,f=i?l.dark||{}:l.light||{},h=i?"dark":"light";for(const e of c)if((t[e.key]||"").startsWith("@")){const i=(null===(o=t[e.key])||void 0===o?void 0:o.slice(1))||"";if(i&&void 0===r){if(s)continue;throwError({msg:locales_1.default.config.THEME_JSON_SHOULD_EXIST.format(`${n}["${e.key}"]`,`"@${i}"`,'appJSON["themeLocation"]'),filePath:a})}const l=f[i];if(void 0===l){if(s)continue;throwError({msg:locales_1.default.config.JSON_VARIABLE_VALUE_NOT_FOUND.format(`${n}["${e.key}"]: "@${i}"`,`${r}["${h}"]`),filePath:a})}void 0!==l&&(Array.isArray(e.valids)&&e.valids.indexOf(l)<0&&throwError({msg:locales_1.default.config.THEME_JSON_VALUE_SHOULD_BE.format(`${r}["${h}"]["${i}"]`,`${a} ${n}["${e.key}"]`,""+JSON.stringify(e.valids)),filePath:r}),e.hexColor&&!(0,tools_1.isHexColor)(l)&&throwError({msg:locales_1.default.config.THEME_JSON_VALUE_SHOULD_BE.format(`${r}["${h}"]["${i}"]`,`${a} ${n}["${e.key}"]`,"hexColor"),filePath:r}),e.validate&&e.validate(`${n}["${e.key}"]`,l),t[e.key]=l)}}exports.checkTabbarListItemIconPath=checkTabbarListItemIconPath,exports.checkThemeRules=checkThemeRules,exports.getDefaultWindowConfig=getDefaultWindowConfig,exports.checkVariables=checkVariables;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getPluginByAliasOrProvider=exports.checkPluginByAliasOrProvider=exports.checkIsInSubPackage=void 0;const startWith=require("licia/startWith");function checkIsInSubPackage(r,i=""){let e;if(startWith(i,"plugin://")){const e=i.match(/^plugin:\/\/([^/]*)\/(.*)/),s=null==e?void 0:e[1];if(!s)return;const t=checkPluginByAliasOrProvider(r,s);return null==t?void 0:t.config}if(r.subPackages)for(let s=0,t=r.subPackages.length;s<t;s++){const t=r.subPackages[s];if(i.startsWith(t.root)){e=t;break}}return e}function checkPluginByAliasOrProvider(r,i){let e;if(r.subPackages)for(const s of r.subPackages)if(e=getPluginByAliasOrProvider(s.plugins,i),e)return Object.assign(Object.assign({},e),{config:s});if(e=getPluginByAliasOrProvider(r.plugins,i),e)return e}function getPluginByAliasOrProvider(r,i){if(r){const e=r[i];if(e)return{alias:i,provider:e.provider,version:e.version};for(const e in r){const s=r[e];if(s.provider===i)return{alias:e,provider:s.provider,version:s.version}}}}exports.checkIsInSubPackage=checkIsInSubPackage,exports.checkPluginByAliasOrProvider=checkPluginByAliasOrProvider,exports.getPluginByAliasOrProvider=getPluginByAliasOrProvider;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.transformSourceMapSources=void 0;const url=require("url"),path=require("path");function transformSourceMapSources(r=[]){return r?r.map(transformSourceFilePath):[]}function transformSourceFilePath(r){if(!r)return r;try{return new url.URL(r),r}catch(r){}return path.basename(r)}exports.transformSourceMapSources=transformSourceMapSources;