miniprogram-ci 2.1.31 → 2.1.33

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 (609) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/README.md +5 -0
  3. package/dist/@types/ci/checkCodeQuality.d.ts +1 -1
  4. package/dist/@types/ci/cloud/utils.d.ts +1 -1
  5. package/dist/@types/ci/code-analyse.d.ts +1 -1
  6. package/dist/@types/ci/cos-upload.d.ts +0 -1
  7. package/dist/@types/ci/getCompiledResult.d.ts +0 -1
  8. package/dist/@types/ci/utils/filterUnusedFile.d.ts +0 -1
  9. package/dist/@types/ci/utils/pack.d.ts +0 -1
  10. package/dist/@types/ci/utils/packfile.d.ts +0 -1
  11. package/dist/@types/ci/utils/tools.d.ts +1 -1
  12. package/dist/@types/ci/utils/wxvpkg/unpack/version0.d.ts +0 -1
  13. package/dist/@types/ci/utils/wxvpkg/unpack/version10.d.ts +0 -1
  14. package/dist/@types/common/code-analyse/index.d.ts +16 -1
  15. package/dist/@types/config/compiletype.config.d.ts +4 -4
  16. package/dist/@types/config/config.d.ts +1 -1
  17. package/dist/@types/config/dir.config.d.ts +17 -0
  18. package/dist/@types/config/url.config.d.ts +42 -42
  19. package/dist/@types/index.d.ts +6 -2
  20. package/dist/@types/modules/corecompiler/baseCompiler.d.ts +3 -4
  21. package/dist/@types/modules/corecompiler/original/compile/common.d.ts +0 -1
  22. package/dist/@types/modules/corecompiler/original/compile/game.d.ts +1 -1
  23. package/dist/@types/modules/corecompiler/original/compile/gamePlugin.d.ts +0 -1
  24. package/dist/@types/modules/corecompiler/original/compile/handler/mpjson.d.ts +0 -1
  25. package/dist/@types/modules/corecompiler/original/compile/index.d.ts +1 -1
  26. package/dist/@types/modules/corecompiler/original/compile/miniprogram.d.ts +0 -1
  27. package/dist/@types/modules/corecompiler/original/compile/miniprogramPlugin.d.ts +0 -1
  28. package/dist/@types/modules/corecompiler/original/index.d.ts +1 -1
  29. package/dist/@types/modules/corecompiler/original/js/index.d.ts +0 -1
  30. package/dist/@types/modules/corecompiler/original/protect/uglifyfilenames.d.ts +0 -1
  31. package/dist/@types/modules/corecompiler/original/webWorker/webWorkerManager.d.ts +0 -1
  32. package/dist/@types/modules/corecompiler/original/workerThread/childprocessManager.d.ts +1 -1
  33. package/dist/@types/modules/corecompiler/original/workerThread/config.d.ts +3 -0
  34. package/dist/@types/modules/corecompiler/original/workerThread/task/compilejs.d.ts +4 -2
  35. package/dist/@types/modules/corecompiler/original/workerThread/task/compilewxss.d.ts +0 -1
  36. package/dist/@types/modules/corecompiler/original/workerThread/task/func.d.ts +4 -0
  37. package/dist/@types/modules/corecompiler/original/workerThread/task/minifywxml.d.ts +0 -1
  38. package/dist/@types/modules/corecompiler/original/workerThread/workerManager.d.ts +8 -0
  39. package/dist/@types/modules/corecompiler/originalCompiler.d.ts +1 -1
  40. package/dist/@types/modules/corecompiler/summer/graph/appconf.d.ts +1 -1
  41. package/dist/@types/modules/corecompiler/summer/graph/gameconf.d.ts +1 -1
  42. package/dist/@types/modules/corecompiler/summer/pipeManager/index.d.ts +6 -0
  43. package/dist/@types/modules/corecompiler/summer/pipeManager/pipeCPProject.d.ts +17 -0
  44. package/dist/@types/modules/corecompiler/summer/pipeManager/pipeContext.d.ts +10 -0
  45. package/dist/@types/modules/corecompiler/summer/pipeManager/pipeManager.d.ts +12 -0
  46. package/dist/@types/modules/corecompiler/summer/pipeManager/pipeWorker.d.ts +2 -0
  47. package/dist/@types/modules/corecompiler/summer/pipeManager/pipes/appservicePipe/index.d.ts +3 -0
  48. package/dist/@types/modules/corecompiler/summer/pipeManager/pipes/compileWxmlToGlassEaselPipe.d.ts +3 -0
  49. package/dist/@types/modules/corecompiler/summer/pipeManager/pipes/compileWxssPipe.d.ts +3 -0
  50. package/dist/@types/modules/corecompiler/summer/pipeManager/pipes/index.d.ts +2 -0
  51. package/dist/@types/modules/corecompiler/summer/pipeManager/pipes/pageInitSourcePipe/index.d.ts +4 -0
  52. package/dist/@types/modules/corecompiler/summer/pipeManager/pipes/pageframePipe/index.d.ts +3 -0
  53. package/dist/@types/modules/corecompiler/summer/pipeManager/pipes/utils/appdevserver/getAppService.d.ts +6 -0
  54. package/dist/@types/modules/corecompiler/summer/pipeManager/pipes/utils/appdevserver/getwxappcode.d.ts +9 -0
  55. package/dist/@types/modules/corecompiler/summer/pipeManager/pipes/utils/appservice/getjsfile.d.ts +12 -0
  56. package/dist/@types/modules/corecompiler/summer/pipeManager/pipes/utils/appservice/getmainpkgsortedjsfiles.d.ts +11 -0
  57. package/dist/@types/modules/corecompiler/summer/pipeManager/pipes/utils/appservice/getwxappcode.d.ts +8 -0
  58. package/dist/@types/modules/corecompiler/summer/pipeManager/pipes/utils/common/apperrcode.config.d.ts +92 -0
  59. package/dist/@types/modules/corecompiler/summer/pipeManager/pipes/utils/common/tools.d.ts +1 -0
  60. package/dist/@types/modules/corecompiler/summer/pipeManager/pipes/utils/project/appconfig.d.ts +6 -0
  61. package/dist/@types/modules/corecompiler/summer/pipeManager/pipes/utils/project/appjson.d.ts +3 -0
  62. package/dist/@types/modules/corecompiler/summer/pipeManager/pipes/utils/project/customcomponent.d.ts +21 -0
  63. package/dist/@types/modules/corecompiler/summer/pipeManager/pipes/utils/project/helper/theme.d.ts +40 -0
  64. package/dist/@types/modules/corecompiler/summer/pipeManager/pipes/utils/project/pagejson.d.ts +3 -0
  65. package/dist/@types/modules/corecompiler/summer/pipeManager/pipes/utils/project/wxappcodejson.d.ts +3 -0
  66. package/dist/@types/modules/corecompiler/summer/pipeManager/pipes/utils/trans/transwxmltojs.d.ts +19 -0
  67. package/dist/@types/modules/corecompiler/summer/pipeManager/pipes/utils/trans/transwxsstojs.d.ts +15 -0
  68. package/dist/@types/modules/corecompiler/summer/pipeManager/pipes/utils/web/processPath.d.ts +9 -0
  69. package/dist/@types/modules/corecompiler/summer/pipeManager/pipes/wccPipe.d.ts +3 -0
  70. package/dist/@types/modules/corecompiler/summer/pipeManager/types.d.ts +100 -0
  71. package/dist/@types/modules/corecompiler/summer/plugins/less.d.ts +0 -1
  72. package/dist/@types/modules/corecompiler/summer/plugins/script_task/minify_script_task.d.ts +1 -1
  73. package/dist/@types/modules/corecompiler/summer/resolver.d.ts +1 -1
  74. package/dist/@types/modules/corecompiler/summerCompiler.d.ts +12 -3
  75. package/dist/@types/modules/index.d.ts +1 -1
  76. package/dist/@types/modules/nativecompiler/ios/buildCloud.d.ts +2 -2
  77. package/dist/@types/modules/nativecompiler/processHandler.d.ts +1 -1
  78. package/dist/@types/modules/precompiler/conditioncompile/compiler/base.d.ts +0 -1
  79. package/dist/@types/modules/precompiler/conditioncompile/compiler/json.d.ts +0 -1
  80. package/dist/@types/modules/precompiler/conditioncompile/compiler/macro.d.ts +0 -1
  81. package/dist/@types/modules/precompiler/conditioncompile/compiler/plant.d.ts +1 -2
  82. package/dist/@types/modules/precompiler/conditioncompile/index.d.ts +1 -2
  83. package/dist/@types/project/advance/precompileProject.d.ts +1 -2
  84. package/dist/@types/project/advance/reactiveProject.d.ts +1 -2
  85. package/dist/@types/project/baseProject.d.ts +4 -3
  86. package/dist/@types/project/ciProjectWithMockBuffer.d.ts +0 -1
  87. package/dist/@types/services/accountcard/accountcard.d.ts +18 -0
  88. package/dist/@types/services/accountcard/accountcardService.d.ts +0 -0
  89. package/dist/@types/services/app/ci/appDirService.d.ts +6 -0
  90. package/dist/@types/services/app/common/appDirService.d.ts +10 -0
  91. package/dist/@types/services/app/common/appDirService.devtools.d.ts +7 -0
  92. package/dist/@types/services/app/electron/appDirService.d.ts +3 -0
  93. package/dist/@types/services/app/node/appDirService.d.ts +6 -0
  94. package/dist/@types/services/app/nw/appDirService.d.ts +3 -0
  95. package/dist/@types/services/builder/common/builder.d.ts +22 -0
  96. package/dist/@types/services/builder/nw/builder.d.ts +15 -0
  97. package/dist/@types/services/builder/webide/builder.d.ts +4 -0
  98. package/dist/@types/services/common/extensions.d.ts +8 -0
  99. package/dist/@types/services/common/getservice.d.ts +27 -0
  100. package/dist/@types/services/common/librarybase.d.ts +2063 -0
  101. package/dist/@types/services/common/vsbase.d.ts +3 -0
  102. package/dist/@types/services/compilewxml/common/compilewxmlService.d.ts +41 -0
  103. package/dist/@types/services/compilewxml/electron/compilewxmlService.d.ts +5 -0
  104. package/dist/@types/services/compilewxml/node/compileUtils.d.ts +3 -0
  105. package/dist/@types/services/compilewxml/node/compileglasseasel.d.ts +14 -0
  106. package/dist/@types/services/compilewxml/nw/compilewxmlService.d.ts +5 -0
  107. package/dist/@types/services/compilewxml/webide/compilewxmlService.d.ts +5 -0
  108. package/dist/@types/services/compilewxml/webide/pageFrameWasm/wcc/runWcc.d.ts +3 -0
  109. package/dist/@types/services/compilewxss/common/compilewxssService.d.ts +15 -0
  110. package/dist/@types/services/compilewxss/electron/compilewxssService.d.ts +4 -0
  111. package/dist/@types/services/compilewxss/node/compileUtils.d.ts +2 -0
  112. package/dist/@types/services/compilewxss/nw/compilewxssService.d.ts +4 -0
  113. package/dist/@types/services/compilewxss/webide/compilewxssService.d.ts +4 -0
  114. package/dist/@types/services/compilewxss/webide/pageFrameWasm/wcsc/runWcsc.d.ts +3 -0
  115. package/dist/@types/services/consoledisplay/common/consoledisplay.d.ts +5 -0
  116. package/dist/@types/services/consoledisplay/nw/consoledisplay.d.ts +6 -0
  117. package/dist/@types/services/fileUtilsManager/common/fileUtilsManager.d.ts +5 -0
  118. package/dist/@types/services/fileUtilsManager/nw/fileUtilsManager.d.ts +6 -0
  119. package/dist/@types/services/fs/common/fileService.d.ts +28 -0
  120. package/dist/@types/services/genTempFile/common/genTempFile.devtools.d.ts +4 -0
  121. package/dist/@types/services/genTempFile/common/genTempFile.node.d.ts +4 -0
  122. package/dist/@types/services/genTempFile/common/genTempFileService.d.ts +4 -0
  123. package/dist/@types/services/genTempFile/electron/genTempFileService.d.ts +3 -0
  124. package/dist/@types/services/genTempFile/node/genTempFileService.d.ts +3 -0
  125. package/dist/@types/services/genTempFile/nw/genTempFileService.d.ts +3 -0
  126. package/dist/@types/services/global/common/global.d.ts +10 -0
  127. package/dist/@types/services/global/nw/global.d.ts +12 -0
  128. package/dist/@types/services/initializeCheck/common/initializeCheck.d.ts +21 -0
  129. package/dist/@types/services/initializeCheck/nw/initializeCheck.d.ts +4 -0
  130. package/dist/@types/services/initializeCheck/webide/initializeCheck.d.ts +0 -0
  131. package/dist/@types/services/locales/common/locales.d.ts +7 -0
  132. package/dist/@types/services/locales/nw/locales.d.ts +9 -0
  133. package/dist/@types/services/log/common/logService.d.ts +9 -0
  134. package/dist/@types/services/miniappjson/common/miniappjson.d.ts +5 -0
  135. package/dist/@types/services/miniappjson/electron/miniappjson.d.ts +6 -0
  136. package/dist/@types/services/miniappjson/nw/miniappjson.d.ts +6 -0
  137. package/dist/@types/services/miniappjson/webide/miniappjson.d.ts +4 -0
  138. package/dist/@types/services/multiTaskManager/ci/multiTaskManager.d.ts +5 -0
  139. package/dist/@types/services/multiTaskManager/common/multiTaskManager.d.ts +5 -0
  140. package/dist/@types/services/multiTaskManager/electron/multiTaskManager.d.ts +5 -0
  141. package/dist/@types/services/multiTaskManager/webide/multiTaskManager.d.ts +5 -0
  142. package/dist/@types/services/nativeModule/ci/nativeModule.d.ts +3 -0
  143. package/dist/@types/services/nativeModule/common/nativeModule.d.ts +9 -0
  144. package/dist/@types/services/nativeModule/common/nativeModule.impl.d.ts +13 -0
  145. package/dist/@types/services/nativeModule/electron/nativeModule.d.ts +3 -0
  146. package/dist/@types/services/nativeModule/nw/nativeModule.d.ts +3 -0
  147. package/dist/@types/services/partialcompile/common/parialcompile.impl.d.ts +0 -0
  148. package/dist/@types/services/partialcompile/common/partialcompile.d.ts +0 -0
  149. package/dist/@types/services/partialcompile/nw/partialcompile.d.ts +0 -0
  150. package/dist/@types/services/partialcompile/webide/partialcompile.d.ts +0 -0
  151. package/dist/@types/services/performance/common/performance.d.ts +9 -0
  152. package/dist/@types/services/performance/nw/performance.d.ts +9 -0
  153. package/dist/@types/services/performance/webide/performance.d.ts +7 -0
  154. package/dist/@types/services/pluginFileReader/ci/pluginFileReader.d.ts +3 -0
  155. package/dist/@types/services/pluginFileReader/common/pluginFileReader.base.d.ts +9 -0
  156. package/dist/@types/services/pluginFileReader/common/pluginFileReader.d.ts +12 -0
  157. package/dist/@types/services/pluginFileReader/electron/pluginFileReader.d.ts +3 -0
  158. package/dist/@types/services/pluginFileReader/webide/pluginFileReader.d.ts +9 -0
  159. package/dist/@types/services/project/common/cloudProjectService.d.ts +0 -0
  160. package/dist/@types/services/project/common/createProjectService.d.ts +0 -0
  161. package/dist/@types/services/project/common/project.helper.d.ts +0 -0
  162. package/dist/@types/services/project/common/projectConfigService.d.ts +0 -0
  163. package/dist/@types/services/project/common/projectFileService.d.ts +0 -0
  164. package/dist/@types/services/project/common/projectconfigjsonutils.d.ts +0 -0
  165. package/dist/@types/services/project/electron-backend/projectManagerService.d.ts +0 -0
  166. package/dist/@types/services/project/node/createProjectService.d.ts +0 -0
  167. package/dist/@types/services/project/node/projectConfigService.d.ts +0 -0
  168. package/dist/@types/services/project/node/projectManagerService.d.ts +0 -0
  169. package/dist/@types/services/project/web/projectManagerService.d.ts +0 -0
  170. package/dist/@types/services/project/webide/projectConfigService.d.ts +0 -0
  171. package/dist/@types/services/project/webide/projectFileService.d.ts +0 -0
  172. package/dist/@types/services/project/webide/projectManagerService.d.ts +0 -0
  173. package/dist/@types/services/projectManager/common/buildServerProjectManager.d.ts +5 -0
  174. package/dist/@types/services/projectManager/common/projectManager.d.ts +7 -0
  175. package/dist/@types/services/projectManager/nw/projectManager.d.ts +9 -0
  176. package/dist/@types/services/root/ci/root.d.ts +11 -0
  177. package/dist/@types/services/root/ci/rootService.d.ts +2 -0
  178. package/dist/@types/services/root/common/createService.d.ts +12 -0
  179. package/dist/@types/services/root/electron/root.d.ts +11 -0
  180. package/dist/@types/services/root/electron/rootService.d.ts +2 -0
  181. package/dist/@types/services/root/nw/root.d.ts +11 -0
  182. package/dist/@types/services/root/nw/rootService.d.ts +0 -0
  183. package/dist/@types/services/root/webide/root.d.ts +11 -0
  184. package/dist/@types/services/root/webide/rootService.d.ts +2 -0
  185. package/dist/@types/services/staticConfig/common/staticConfigService.d.ts +5 -0
  186. package/dist/@types/services/staticConfig/nw/staticConfigService.d.ts +6 -0
  187. package/dist/@types/services/store/common/storeService.d.ts +17 -0
  188. package/dist/@types/services/uniapp/common/uniapp.d.ts +5 -0
  189. package/dist/@types/services/uniapp/nw/uniapp.d.ts +9 -0
  190. package/dist/@types/services/uniapp/webide/uniapp.d.ts +4 -0
  191. package/dist/@types/services/vendor/common/utils.d.ts +0 -0
  192. package/dist/@types/services/vendor/common/vendorService.d.ts +0 -0
  193. package/dist/@types/services/vendor/node/vendorService.d.ts +0 -0
  194. package/dist/@types/services/vendor/webide/vendorService.d.ts +0 -0
  195. package/dist/@types/types/ci.d.ts +1 -2
  196. package/dist/@types/types/core.d.ts +1 -2
  197. package/dist/@types/types/devtools.d.ts +0 -1
  198. package/dist/@types/types/summer.d.ts +0 -1
  199. package/dist/@types/utils/colorutils.d.ts +4 -0
  200. package/dist/@types/utils/common.d.ts +3 -1
  201. package/dist/@types/utils/cosUpload.d.ts +0 -1
  202. package/dist/@types/utils/debug.d.ts +1 -0
  203. package/dist/@types/utils/error.d.ts +1 -1
  204. package/dist/@types/utils/fsagent.d.ts +4 -4
  205. package/dist/@types/utils/locales/locales.d.ts +2 -114
  206. package/dist/@types/utils/locales/zh.d.ts +114 -113
  207. package/dist/@types/utils/miniappJson.d.ts +1 -1
  208. package/dist/@types/utils/node/common.d.ts +1 -0
  209. package/dist/@types/utils/packOptionsHelper.d.ts +1 -1
  210. package/dist/@types/utils/processBootstrap.d.ts +7 -0
  211. package/dist/@types/utils/signature.d.ts +0 -1
  212. package/dist/@types/utils/singletontask.d.ts +1 -0
  213. package/dist/@types/utils/subprocess/processManager.d.ts +1 -0
  214. package/dist/@types/utils/taskqueue.d.ts +0 -1
  215. package/dist/@types/utils/taskstatus.d.ts +1 -1
  216. package/dist/@types/utils/tools.d.ts +3 -4
  217. package/dist/@types/utils/web/common.d.ts +1 -0
  218. package/dist/@types/utils/wxapkg/pack.d.ts +2 -3
  219. package/dist/@types/utils/wxvpkgreader/wxvpkg/reader/version0.d.ts +0 -1
  220. package/dist/@types/utils/wxvpkgreader/wxvpkg/reader/version10.d.ts +0 -1
  221. package/dist/@types/utils/wxvpkgreader/wxvpkg/unpack/version0.d.ts +0 -1
  222. package/dist/@types/utils/wxvpkgreader/wxvpkg/unpack/version10.d.ts +0 -1
  223. package/dist/@types/utils/wxvpkgreader/wxvpkgreader.d.ts +0 -1
  224. package/dist/ci/android-miniapp-toolkit/dist/index.js +1 -1
  225. package/dist/ci/build-apk.js +1 -1
  226. package/dist/ci/build-ipa.js +1 -1
  227. package/dist/ci/checkCodeQuality.js +1 -1
  228. package/dist/ci/cloud/cloudapi.js +1 -1
  229. package/dist/ci/cloud/createTimeTrigger.js +1 -1
  230. package/dist/ci/cloud/uploadContainer.js +1 -1
  231. package/dist/ci/cloud/uploadFile.js +1 -1
  232. package/dist/ci/cloud/uploadFunction.js +1 -1
  233. package/dist/ci/cloud/utils.js +1 -1
  234. package/dist/ci/code-analyse.js +1 -1
  235. package/dist/ci/cos-upload.js +1 -1
  236. package/dist/ci/gamepkg/apkplug.js +1 -1
  237. package/dist/ci/gamepkg/index.js +1 -1
  238. package/dist/ci/getCompiledResult.js +1 -1
  239. package/dist/ci/getDevSourceMap.js +1 -1
  240. package/dist/ci/getLatestVersion.js +1 -1
  241. package/dist/ci/getcompiler.js +1 -1
  242. package/dist/ci/index.js +1 -1
  243. package/dist/ci/jsserver.js +1 -1
  244. package/dist/ci/miniapp/androidCloudBuild.js +1 -1
  245. package/dist/ci/miniapp/archive.js +1 -1
  246. package/dist/ci/miniapp/checkBuildArgument.js +1 -1
  247. package/dist/ci/miniapp/iosCloudBuild.js +1 -1
  248. package/dist/ci/miniapp/miniappPlugin.js +1 -1
  249. package/dist/ci/miniapp/sdkManager.js +1 -1
  250. package/dist/ci/miniapp/upload.js +1 -1
  251. package/dist/ci/miniapp-cloud-upload.js +1 -1
  252. package/dist/ci/miniappattr.js +1 -1
  253. package/dist/ci/preview.js +1 -1
  254. package/dist/ci/projectattr.js +1 -1
  255. package/dist/ci/upload.js +1 -1
  256. package/dist/ci/utils/ciRequest.js +1 -1
  257. package/dist/ci/utils/codeDenpendencyQualityChecker.js +1 -1
  258. package/dist/ci/utils/filterUnusedFile.js +1 -1
  259. package/dist/ci/utils/pack.js +1 -1
  260. package/dist/ci/utils/packfile.js +1 -1
  261. package/dist/ci/utils/terminalQrcode.js +1 -1
  262. package/dist/ci/utils/tools.js +1 -1
  263. package/dist/ci/utils/unpack.js +1 -1
  264. package/dist/ci/utils/wxvpkg/unpack/version0.js +1 -1
  265. package/dist/ci/utils/wxvpkg/unpack/version10.js +1 -1
  266. package/dist/cli/index.js +1 -1
  267. package/dist/common/code-analyse/index.js +1 -1
  268. package/dist/config/config.js +1 -1
  269. package/dist/config/dir.config.js +1 -0
  270. package/dist/config/url.config.js +1 -1
  271. package/dist/index.js +1 -1
  272. package/dist/modules/corecompiler/baseCompiler.js +1 -1
  273. package/dist/modules/corecompiler/original/analyse/partial.js +1 -1
  274. package/dist/modules/corecompiler/original/compile/common.js +1 -1
  275. package/dist/modules/corecompiler/original/compile/game.js +1 -1
  276. package/dist/modules/corecompiler/original/compile/gamePlugin.js +1 -1
  277. package/dist/modules/corecompiler/original/compile/handler/js.js +1 -1
  278. package/dist/modules/corecompiler/original/compile/handler/mpjson.js +1 -1
  279. package/dist/modules/corecompiler/original/compile/handler/wxml.js +1 -1
  280. package/dist/modules/corecompiler/original/compile/handler/wxss.js +1 -1
  281. package/dist/modules/corecompiler/original/compile/index.js +1 -1
  282. package/dist/modules/corecompiler/original/compile/miniprogram.js +1 -1
  283. package/dist/modules/corecompiler/original/compile/miniprogramPlugin.js +1 -1
  284. package/dist/modules/corecompiler/original/index.js +1 -1
  285. package/dist/modules/corecompiler/original/js/enhance.js +1 -1
  286. package/dist/modules/corecompiler/original/js/es6Transform.js +1 -1
  287. package/dist/modules/corecompiler/original/js/generateMap.js +1 -1
  288. package/dist/modules/corecompiler/original/js/index.js +1 -1
  289. package/dist/modules/corecompiler/original/js/minifyjs.js +1 -1
  290. package/dist/modules/corecompiler/original/js/minifyjsAfterWrap.js +1 -1
  291. package/dist/modules/corecompiler/original/js/workletCompile.js +1 -1
  292. package/dist/modules/corecompiler/original/json/app/appJSON.js +1 -1
  293. package/dist/modules/corecompiler/original/json/app/checkAppFields.js +1 -1
  294. package/dist/modules/corecompiler/original/json/app/extJSON.js +1 -1
  295. package/dist/modules/corecompiler/original/json/app/index.js +1 -1
  296. package/dist/modules/corecompiler/original/json/common.js +1 -1
  297. package/dist/modules/corecompiler/original/json/game.js +1 -1
  298. package/dist/modules/corecompiler/original/json/page/checkPageJSON.js +1 -1
  299. package/dist/modules/corecompiler/original/json/page/getPageJSON.js +1 -1
  300. package/dist/modules/corecompiler/original/json/plugin/plugin.js +1 -1
  301. package/dist/modules/corecompiler/original/json/plugin/pluginPage.js +1 -1
  302. package/dist/modules/corecompiler/original/json/projectconfig.js +1 -1
  303. package/dist/modules/corecompiler/original/json/reactiveCache.js +1 -1
  304. package/dist/modules/corecompiler/original/json/signaturejson.js +1 -1
  305. package/dist/modules/corecompiler/original/json/sitemap.js +1 -1
  306. package/dist/modules/corecompiler/original/json/theme.js +1 -1
  307. package/dist/modules/corecompiler/original/npm/filterdeps.js +1 -1
  308. package/dist/modules/corecompiler/original/npm/packnpm.js +1 -1
  309. package/dist/modules/corecompiler/original/protect/fileFlatter.js +1 -1
  310. package/dist/modules/corecompiler/original/protect/uglifyfilenames.js +1 -1
  311. package/dist/modules/corecompiler/original/utils/logger.js +1 -1
  312. package/dist/modules/corecompiler/original/validate/schemaValidate.js +1 -1
  313. package/dist/modules/corecompiler/original/validate/validate.js +1 -1
  314. package/dist/modules/corecompiler/original/webWorker/configs.js +1 -1
  315. package/dist/modules/corecompiler/original/workerThread/childprocess.js +1 -1
  316. package/dist/modules/corecompiler/original/workerThread/childprocessManager.js +1 -1
  317. package/dist/modules/corecompiler/original/workerThread/config.js +1 -1
  318. package/dist/modules/corecompiler/original/workerThread/fork.js +1 -1
  319. package/dist/modules/corecompiler/original/workerThread/getWorkerPoolSize.js +1 -1
  320. package/dist/modules/corecompiler/original/workerThread/index.js +1 -1
  321. package/dist/modules/corecompiler/original/workerThread/task/call_func.js +1 -1
  322. package/dist/modules/corecompiler/original/workerThread/task/compilejs.js +1 -1
  323. package/dist/modules/corecompiler/original/workerThread/task/compilewxss.js +1 -1
  324. package/dist/modules/corecompiler/original/workerThread/task/func.js +1 -1
  325. package/dist/modules/corecompiler/original/workerThread/task/index.js +1 -1
  326. package/dist/modules/corecompiler/original/workerThread/task/minifywxml.js +1 -1
  327. package/dist/modules/corecompiler/original/workerThread/worker.js +1 -1
  328. package/dist/modules/corecompiler/original/workerThread/workerManager.js +1 -1
  329. package/dist/modules/corecompiler/originalCompiler.js +1 -1
  330. package/dist/modules/corecompiler/processHandler.js +1 -1
  331. package/dist/modules/corecompiler/summer/graph/appconf.js +1 -1
  332. package/dist/modules/corecompiler/summer/graph/appgraph.js +1 -1
  333. package/dist/modules/corecompiler/summer/graph/basegraph.js +1 -1
  334. package/dist/modules/corecompiler/summer/graph/gameconf.js +1 -1
  335. package/dist/modules/corecompiler/summer/graph/gamegraph.js +1 -1
  336. package/dist/modules/corecompiler/summer/graph/gamepluginconf.js +1 -1
  337. package/dist/modules/corecompiler/summer/graph/gameplugingraph.js +1 -1
  338. package/dist/modules/corecompiler/summer/graph/pluginconf.js +1 -1
  339. package/dist/modules/corecompiler/summer/graph/plugingraph.js +1 -1
  340. package/dist/modules/corecompiler/summer/graph/util.js +1 -1
  341. package/dist/modules/corecompiler/summer/index.js +1 -1
  342. package/dist/modules/corecompiler/summer/initPlugin.js +1 -1
  343. package/dist/modules/corecompiler/summer/module.js +1 -1
  344. package/dist/modules/corecompiler/summer/persistCache.js +1 -1
  345. package/dist/modules/corecompiler/summer/pipeManager/index.js +1 -0
  346. package/dist/modules/corecompiler/summer/pipeManager/pipeCPProject.js +1 -0
  347. package/dist/modules/corecompiler/summer/pipeManager/pipeContext.js +1 -0
  348. package/dist/modules/corecompiler/summer/pipeManager/pipeManager.js +1 -0
  349. package/dist/modules/corecompiler/summer/pipeManager/pipeWorker.js +1 -0
  350. package/dist/modules/corecompiler/summer/pipeManager/pipes/appservicePipe/index.js +1 -0
  351. package/dist/modules/corecompiler/summer/pipeManager/pipes/compileWxmlToGlassEaselPipe.js +1 -0
  352. package/dist/modules/corecompiler/summer/pipeManager/pipes/compileWxssPipe.js +1 -0
  353. package/dist/modules/corecompiler/summer/pipeManager/pipes/index.js +1 -0
  354. package/dist/modules/corecompiler/summer/pipeManager/pipes/pageInitSourcePipe/index.js +1 -0
  355. package/dist/modules/corecompiler/summer/pipeManager/pipes/pageframePipe/index.js +1 -0
  356. package/dist/modules/corecompiler/summer/pipeManager/pipes/utils/appdevserver/getAppService.js +1 -0
  357. package/dist/modules/corecompiler/summer/pipeManager/pipes/utils/appdevserver/getwxappcode.js +1 -0
  358. package/dist/modules/corecompiler/summer/pipeManager/pipes/utils/appservice/getjsfile.js +1 -0
  359. package/dist/modules/corecompiler/summer/pipeManager/pipes/utils/appservice/getmainpkgsortedjsfiles.js +1 -0
  360. package/dist/modules/corecompiler/summer/pipeManager/pipes/utils/appservice/getwxappcode.js +1 -0
  361. package/dist/modules/corecompiler/summer/pipeManager/pipes/utils/common/apperrcode.config.js +1 -0
  362. package/dist/modules/corecompiler/summer/pipeManager/pipes/utils/common/tools.js +1 -0
  363. package/dist/modules/corecompiler/summer/pipeManager/pipes/utils/project/appconfig.js +1 -0
  364. package/dist/modules/corecompiler/summer/pipeManager/pipes/utils/project/appjson.js +1 -0
  365. package/dist/modules/corecompiler/summer/pipeManager/pipes/utils/project/customcomponent.js +1 -0
  366. package/dist/modules/corecompiler/summer/pipeManager/pipes/utils/project/helper/theme.js +1 -0
  367. package/dist/modules/corecompiler/summer/pipeManager/pipes/utils/project/pagejson.js +1 -0
  368. package/dist/modules/corecompiler/summer/pipeManager/pipes/utils/project/wxappcodejson.js +1 -0
  369. package/dist/modules/corecompiler/summer/pipeManager/pipes/utils/trans/transwxmltojs.js +1 -0
  370. package/dist/modules/corecompiler/summer/pipeManager/pipes/utils/trans/transwxsstojs.js +1 -0
  371. package/dist/modules/corecompiler/summer/pipeManager/pipes/utils/web/processPath.js +1 -0
  372. package/dist/modules/corecompiler/summer/pipeManager/pipes/wccPipe.js +1 -0
  373. package/dist/modules/corecompiler/summer/pipeManager/types.js +1 -0
  374. package/dist/modules/corecompiler/summer/pluginDriver.js +1 -1
  375. package/dist/modules/corecompiler/summer/pluginconfig.js +1 -1
  376. package/dist/modules/corecompiler/summer/plugins/base/es6module.js +1 -1
  377. package/dist/modules/corecompiler/summer/plugins/base/javascript.js +1 -1
  378. package/dist/modules/corecompiler/summer/plugins/base/swc.js +1 -1
  379. package/dist/modules/corecompiler/summer/plugins/base/wxss.js +1 -1
  380. package/dist/modules/corecompiler/summer/plugins/enhance.js +1 -1
  381. package/dist/modules/corecompiler/summer/plugins/filetask/script.js +1 -1
  382. package/dist/modules/corecompiler/summer/plugins/less.js +1 -1
  383. package/dist/modules/corecompiler/summer/plugins/minifywxml.js +1 -1
  384. package/dist/modules/corecompiler/summer/plugins/sass.js +1 -1
  385. package/dist/modules/corecompiler/summer/plugins/script_task/babel_script_task.js +1 -1
  386. package/dist/modules/corecompiler/summer/plugins/script_task/load_script_task.js +1 -1
  387. package/dist/modules/corecompiler/summer/plugins/script_task/minify_script_task.js +1 -1
  388. package/dist/modules/corecompiler/summer/plugins/script_task/swc_task.js +1 -1
  389. package/dist/modules/corecompiler/summer/plugins/terser.js +1 -1
  390. package/dist/modules/corecompiler/summer/plugins/typescript.js +1 -1
  391. package/dist/modules/corecompiler/summer/plugins/worklet.js +1 -1
  392. package/dist/modules/corecompiler/summer/resolver.js +1 -1
  393. package/dist/modules/corecompiler/summer/summer.js +1 -1
  394. package/dist/modules/corecompiler/summer/utils/async.js +1 -1
  395. package/dist/modules/corecompiler/summer/utils/ensureArray.js +1 -1
  396. package/dist/modules/corecompiler/summer/utils/inputsourcemap.js +1 -1
  397. package/dist/modules/corecompiler/summer/worker.js +1 -1
  398. package/dist/modules/corecompiler/summerCompiler.js +1 -1
  399. package/dist/modules/corecompiler/summerEntryProcess.js +1 -1
  400. package/dist/modules/createSummer.js +1 -1
  401. package/dist/modules/fullcompiler/app/app.js +1 -1
  402. package/dist/modules/fullcompiler/app/contactandlaunch/updateContactForSubpkg.js +1 -1
  403. package/dist/modules/fullcompiler/app/contactandlaunch/updatecontactandlaunch.js +1 -1
  404. package/dist/modules/index.js +1 -1
  405. package/dist/modules/nativecompiler/android/adb.js +1 -1
  406. package/dist/modules/nativecompiler/android/device.js +1 -1
  407. package/dist/modules/nativecompiler/android/index.js +1 -1
  408. package/dist/modules/nativecompiler/android/projectconfig.js +1 -1
  409. package/dist/modules/nativecompiler/index.js +1 -1
  410. package/dist/modules/nativecompiler/ios/buildCloud.js +1 -1
  411. package/dist/modules/nativecompiler/ios/device.js +1 -1
  412. package/dist/modules/nativecompiler/ios/index.js +1 -1
  413. package/dist/modules/nativecompiler/ios/projectconfig.js +1 -1
  414. package/dist/modules/nativecompiler/nativeEntryProcess.js +1 -1
  415. package/dist/modules/nativecompiler/processHandler.js +1 -1
  416. package/dist/modules/precompiler/conditioncompile/compiler/json.js +1 -1
  417. package/dist/modules/precompiler/conditioncompile/compiler/macro.js +1 -1
  418. package/dist/modules/precompiler/conditioncompile/index.js +1 -1
  419. package/dist/project/advance/precompileProject.js +1 -1
  420. package/dist/project/advance/reactiveProject.js +1 -1
  421. package/dist/project/baseProject.js +1 -1
  422. package/dist/project/ciProjectWithMockBuffer.js +1 -1
  423. package/dist/project/summerCPProject.js +1 -1
  424. package/dist/services/accountcard/accountcard.js +1 -0
  425. package/dist/services/accountcard/accountcardService.js +1 -0
  426. package/dist/services/app/ci/appDirService.js +1 -0
  427. package/dist/services/app/common/appDirService.devtools.js +1 -0
  428. package/dist/services/app/common/appDirService.js +1 -0
  429. package/dist/services/app/electron/appDirService.js +1 -0
  430. package/dist/services/app/node/appDirService.js +1 -0
  431. package/dist/services/app/nw/appDirService.js +1 -0
  432. package/dist/services/builder/common/builder.js +1 -0
  433. package/dist/services/builder/nw/builder.js +1 -0
  434. package/dist/services/builder/webide/builder.js +1 -0
  435. package/dist/services/common/extensions.js +1 -0
  436. package/dist/services/common/getservice.js +1 -0
  437. package/dist/services/common/librarybase.js +1 -0
  438. package/dist/services/common/vsbase.js +1 -0
  439. package/dist/services/compilewxml/common/compilewxmlService.js +1 -0
  440. package/dist/services/compilewxml/electron/compilewxmlService.js +1 -0
  441. package/dist/services/compilewxml/node/compileUtils.js +1 -0
  442. package/dist/services/compilewxml/node/compileglasseasel.js +1 -0
  443. package/dist/services/compilewxml/nw/compilewxmlService.js +1 -0
  444. package/dist/services/compilewxml/webide/compilewxmlService.js +1 -0
  445. package/dist/services/compilewxml/webide/pageFrameWasm/wcc/runWcc.js +1 -0
  446. package/dist/services/compilewxss/common/compilewxssService.js +1 -0
  447. package/dist/services/compilewxss/electron/compilewxssService.js +1 -0
  448. package/dist/services/compilewxss/node/compileUtils.js +1 -0
  449. package/dist/services/compilewxss/nw/compilewxssService.js +1 -0
  450. package/dist/services/compilewxss/webide/compilewxssService.js +1 -0
  451. package/dist/services/compilewxss/webide/pageFrameWasm/wcsc/runWcsc.js +1 -0
  452. package/dist/services/consoledisplay/common/consoledisplay.js +1 -0
  453. package/dist/services/consoledisplay/nw/consoledisplay.js +1 -0
  454. package/dist/services/fileUtilsManager/common/fileUtilsManager.js +1 -0
  455. package/dist/services/fileUtilsManager/nw/fileUtilsManager.js +1 -0
  456. package/dist/services/fs/common/fileService.js +1 -0
  457. package/dist/services/genTempFile/common/genTempFile.devtools.js +1 -0
  458. package/dist/services/genTempFile/common/genTempFile.node.js +1 -0
  459. package/dist/services/genTempFile/common/genTempFileService.js +1 -0
  460. package/dist/services/genTempFile/electron/genTempFileService.js +1 -0
  461. package/dist/services/genTempFile/node/genTempFileService.js +1 -0
  462. package/dist/services/genTempFile/nw/genTempFileService.js +1 -0
  463. package/dist/services/global/common/global.js +1 -0
  464. package/dist/services/global/nw/global.js +1 -0
  465. package/dist/services/initializeCheck/common/initializeCheck.js +1 -0
  466. package/dist/services/initializeCheck/nw/initializeCheck.js +1 -0
  467. package/dist/services/initializeCheck/webide/initializeCheck.js +1 -0
  468. package/dist/services/locales/common/locales.js +1 -0
  469. package/dist/services/locales/nw/locales.js +1 -0
  470. package/dist/services/log/common/logService.js +1 -0
  471. package/dist/services/miniappjson/common/miniappjson.js +1 -0
  472. package/dist/services/miniappjson/electron/miniappjson.js +1 -0
  473. package/dist/services/miniappjson/nw/miniappjson.js +1 -0
  474. package/dist/services/miniappjson/webide/miniappjson.js +1 -0
  475. package/dist/services/multiTaskManager/ci/multiTaskManager.js +1 -0
  476. package/dist/services/multiTaskManager/common/multiTaskManager.js +1 -0
  477. package/dist/services/multiTaskManager/electron/multiTaskManager.js +1 -0
  478. package/dist/services/multiTaskManager/webide/multiTaskManager.js +1 -0
  479. package/dist/services/nativeModule/ci/nativeModule.js +1 -0
  480. package/dist/services/nativeModule/common/nativeModule.impl.js +1 -0
  481. package/dist/services/nativeModule/common/nativeModule.js +1 -0
  482. package/dist/services/nativeModule/electron/nativeModule.js +1 -0
  483. package/dist/services/nativeModule/nw/nativeModule.js +1 -0
  484. package/dist/services/partialcompile/common/parialcompile.impl.js +1 -0
  485. package/dist/services/partialcompile/common/partialcompile.js +1 -0
  486. package/dist/services/partialcompile/nw/partialcompile.js +1 -0
  487. package/dist/services/partialcompile/webide/partialcompile.js +1 -0
  488. package/dist/services/performance/common/performance.js +1 -0
  489. package/dist/services/performance/nw/performance.js +1 -0
  490. package/dist/services/performance/webide/performance.js +1 -0
  491. package/dist/services/pluginFileReader/ci/pluginFileReader.js +1 -0
  492. package/dist/services/pluginFileReader/common/pluginFileReader.base.js +1 -0
  493. package/dist/services/pluginFileReader/common/pluginFileReader.js +1 -0
  494. package/dist/services/pluginFileReader/electron/pluginFileReader.js +1 -0
  495. package/dist/services/pluginFileReader/webide/pluginFileReader.js +1 -0
  496. package/dist/services/project/common/cloudProjectService.js +1 -0
  497. package/dist/services/project/common/createProjectService.js +1 -0
  498. package/dist/services/project/common/project.helper.js +1 -0
  499. package/dist/services/project/common/projectConfigService.js +1 -0
  500. package/dist/services/project/common/projectFileService.js +1 -0
  501. package/dist/services/project/common/projectconfigjsonutils.js +1 -0
  502. package/dist/services/project/electron-backend/projectManagerService.js +1 -0
  503. package/dist/services/project/node/createProjectService.js +1 -0
  504. package/dist/services/project/node/projectConfigService.js +1 -0
  505. package/dist/services/project/node/projectManagerService.js +1 -0
  506. package/dist/services/project/web/projectManagerService.js +1 -0
  507. package/dist/services/project/webide/projectConfigService.js +1 -0
  508. package/dist/services/project/webide/projectFileService.js +1 -0
  509. package/dist/services/project/webide/projectManagerService.js +1 -0
  510. package/dist/services/projectManager/common/buildServerProjectManager.js +1 -0
  511. package/dist/services/projectManager/common/projectManager.js +1 -0
  512. package/dist/services/projectManager/nw/projectManager.js +1 -0
  513. package/dist/services/root/ci/root.js +1 -0
  514. package/dist/services/root/ci/rootService.js +1 -0
  515. package/dist/services/root/common/createService.js +1 -0
  516. package/dist/services/root/electron/root.js +1 -0
  517. package/dist/services/root/electron/rootService.js +1 -0
  518. package/dist/services/root/nw/root.js +1 -0
  519. package/dist/services/root/nw/rootService.js +1 -0
  520. package/dist/services/root/webide/root.js +1 -0
  521. package/dist/services/root/webide/rootService.js +1 -0
  522. package/dist/services/staticConfig/common/staticConfigService.js +1 -0
  523. package/dist/services/staticConfig/nw/staticConfigService.js +1 -0
  524. package/dist/services/store/common/storeService.js +1 -0
  525. package/dist/services/uniapp/common/uniapp.js +1 -0
  526. package/dist/services/uniapp/nw/uniapp.js +1 -0
  527. package/dist/services/uniapp/webide/uniapp.js +1 -0
  528. package/dist/services/vendor/common/utils.js +1 -0
  529. package/dist/services/vendor/common/vendorService.js +1 -0
  530. package/dist/services/vendor/node/vendorService.js +1 -0
  531. package/dist/services/vendor/webide/vendorService.js +1 -0
  532. package/dist/types/ci.js +1 -1
  533. package/dist/utils/asyncTask/index.js +1 -1
  534. package/dist/utils/babel_helper.js +1 -1
  535. package/dist/utils/babel_plugin_worklet.js +1 -1
  536. package/dist/utils/cache.js +1 -1
  537. package/dist/utils/codesign.js +1 -1
  538. package/dist/utils/colorutils.js +1 -0
  539. package/dist/utils/common.js +1 -1
  540. package/dist/utils/cosUpload.js +1 -1
  541. package/dist/utils/cp.js +1 -1
  542. package/dist/utils/customError.js +1 -1
  543. package/dist/utils/debug.js +1 -1
  544. package/dist/utils/download.js +1 -1
  545. package/dist/utils/env.js +1 -1
  546. package/dist/utils/expression.js +1 -1
  547. package/dist/utils/fs.js +1 -1
  548. package/dist/utils/fsagent.js +1 -1
  549. package/dist/utils/genTempFile.js +1 -1
  550. package/dist/utils/generateIpa.js +1 -1
  551. package/dist/utils/glob.js +1 -1
  552. package/dist/utils/hackrequire/wxvpkgreader.js +1 -1
  553. package/dist/utils/helper_util.js +1 -1
  554. package/dist/utils/jsonParse.js +1 -1
  555. package/dist/utils/jsonlint.js +1 -1
  556. package/dist/utils/locales/fomatable_string.js +1 -1
  557. package/dist/utils/locales/locales.js +1 -1
  558. package/dist/utils/log.js +1 -1
  559. package/dist/utils/messageHub.js +1 -1
  560. package/dist/utils/miniAppI18N.js +1 -1
  561. package/dist/utils/miniapp-builder.js +1 -1
  562. package/dist/utils/miniappJson.js +1 -1
  563. package/dist/utils/node/common.js +1 -0
  564. package/dist/utils/officialDonutPlugin.js +1 -1
  565. package/dist/utils/packOptionsHelper.js +1 -1
  566. package/dist/utils/processBootstrap.js +1 -0
  567. package/dist/utils/progressRecorder.js +1 -1
  568. package/dist/utils/report.js +1 -1
  569. package/dist/utils/request.js +1 -1
  570. package/dist/utils/sign.js +1 -1
  571. package/dist/utils/signature.js +1 -1
  572. package/dist/utils/singletontask.js +1 -1
  573. package/dist/utils/subprocess/entryProcess.js +1 -1
  574. package/dist/utils/subprocess/processManager.js +1 -1
  575. package/dist/utils/subprocess/processService.js +1 -1
  576. package/dist/utils/subprocess/stringifyPostMsg.js +1 -1
  577. package/dist/utils/swc_helper.js +1 -1
  578. package/dist/utils/taskmanager.js +1 -1
  579. package/dist/utils/tools.js +1 -1
  580. package/dist/utils/usbProcess.js +1 -1
  581. package/dist/utils/waitable.js +1 -1
  582. package/dist/utils/web/common.js +1 -0
  583. package/dist/utils/white_ext_list.js +1 -1
  584. package/dist/utils/wxapkg/pack.js +1 -1
  585. package/dist/utils/wxvpkgreader/wxvpkg/reader/version0.js +1 -1
  586. package/dist/utils/wxvpkgreader/wxvpkg/reader/version10.js +1 -1
  587. package/dist/utils/wxvpkgreader/wxvpkg/unpack/version0.js +1 -1
  588. package/dist/utils/wxvpkgreader/wxvpkg/unpack/version10.js +1 -1
  589. package/dist/utils/wxvpkgreader/wxvpkgreader.js +1 -1
  590. package/dist/utils/zip.js +1 -1
  591. package/dist/vendor/vslibrary/bundled/base.bundled.js +2 -0
  592. package/package.json +62 -3
  593. package/dist/modules/fullcompiler/trans/wcc/build/darwin_arm64/wcc.node +0 -0
  594. package/dist/modules/fullcompiler/trans/wcc/build/darwin_arm64/wcsc.node +0 -0
  595. package/dist/modules/fullcompiler/trans/wcc/build/darwin_x64/wcc.node +0 -0
  596. package/dist/modules/fullcompiler/trans/wcc/build/darwin_x64/wcsc.node +0 -0
  597. package/dist/modules/fullcompiler/trans/wcc/build/node_16.1.0_darwin_arm64_release/wcc.node +0 -0
  598. package/dist/modules/fullcompiler/trans/wcc/build/node_16.1.0_darwin_arm64_release/wcsc.node +0 -0
  599. package/dist/modules/fullcompiler/trans/wcc/build/node_16.1.0_darwin_x64_release/wcc.node +0 -0
  600. package/dist/modules/fullcompiler/trans/wcc/build/node_16.1.0_darwin_x64_release/wcsc.node +0 -0
  601. package/dist/modules/fullcompiler/trans/wcc/build/win32_ia32/wcc.node +0 -0
  602. package/dist/modules/fullcompiler/trans/wcc/build/win32_ia32/wcsc.node +0 -0
  603. package/dist/modules/fullcompiler/trans/wcc/build/win32_x64/wcc.node +0 -0
  604. package/dist/modules/fullcompiler/trans/wcc/build/win32_x64/wcsc.node +0 -0
  605. package/dist/modules/fullcompiler/trans/wcc/lib/addonVersion.js +0 -19
  606. package/dist/modules/fullcompiler/trans/wcc/lib/index.js +0 -4
  607. package/dist/modules/fullcompiler/trans/wcc/lib/util.js +0 -1134
  608. package/dist/modules/fullcompiler/trans/wcc/lib/wcc.js +0 -94
  609. package/dist/modules/fullcompiler/trans/wcc/lib/wcsc.js +0 -93
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.checkAccountCardPackage=exports.checkRequiredPrivateInfos=exports.checkResolveAlias=exports.checkRenderer=exports.checkOpenDataContext=exports.getAppJSONVariableDecalearProperty=exports.checkEntranceDeclare=exports.checkComponentPath=exports.checkMainPkgPluginIsInSubPkg=exports.checkMainPkgPageIsInSubpkg=exports.checkTabbarPage=exports.checkEntryPagePath=exports.checkPreloadRule=exports.checkFunctionalPages=exports.checkNavigateToMiniProgramAppIdList=exports.checkPlugins=exports.checkSubpackages=exports.checkSitemapLocation=exports.checkMainPkgPages=exports.checkOpenLocationPagePath=exports.checkWorkers=exports.checkTabbar=exports.checkWindow=exports.checkPageExist=void 0;const tslib_1=require("tslib"),path_1=tslib_1.__importDefault(require("path")),lodash_1=tslib_1.__importDefault(require("lodash")),config_1=require("../../../../../config/config"),common_1=require("../common"),common_2=require("../../../../../utils/common"),tools_1=require("../../../../../utils/tools"),locales_1=tslib_1.__importDefault(require("../../../../../utils/locales/locales")),schemaValidate_1=require("../../validate/schemaValidate"),projectconfig_1=require("../projectconfig");function checkPageExist(o,t,e){const{miniprogramRoot:a,project:n,filePath:c}=o;n.stat(a,t+".wxml")||(0,common_2.throwError)({msg:locales_1.default.config.CORRESPONDING_FILE_NOT_FOUND.format(e,t+".wxml"),code:config_1.FILE_NOT_FOUND,filePath:c}),n.stat(a,t+".js")||(0,common_2.throwError)({msg:locales_1.default.config.CORRESPONDING_FILE_NOT_FOUND.format(e,t+".js"),code:config_1.FILE_NOT_FOUND,filePath:c})}function checkWindow(o){const{inputJSON:t,mode:e}=o;let a=""+o.filePath;t.themeLocation&&(a+=` or ${t.themeLocation}["${e}"]`);const n=[],{window:c}=t;c&&(void 0!==c.navigationBarBackgroundColor&&((0,tools_1.isHexColor)(c.navigationBarBackgroundColor)||n.push(`["window"]["navigationBarBackgroundColor"]: "${c.navigationBarBackgroundColor}" is not hexColor`)),void 0!==c.backgroundColor&&((0,tools_1.isHexColor)(c.backgroundColor)||n.push(`["window"]["backgroundColor"]: "${c.backgroundColor}" is not hexColor`)),n.length>0&&(0,common_2.throwError)({msg:n.join("\n"),filePath:a}))}function checkTabbar(o){const{project:t,miniprogramRoot:e,inputJSON:a,mode:n}=o;let c=""+o.filePath;a.themeLocation&&(c+=` or ${a.themeLocation}["${n}"]`);const{tabBar:i}=a,r=t.attrSync(),{setting:s}=r;if(!i)return;const l=[];i.list.length<s.MinTabbarCount&&(0,common_2.throwError)({msg:locales_1.default.config.JSON_TABBAR_AT_LEAST.format(s.MinTabbarCount),filePath:c});const _=i.custom?s.MaxCustomTabbarCount:s.MaxTabbarCount;i.list.length>_&&(0,common_2.throwError)({msg:locales_1.default.config.JSON_TABBAR_AT_MOST.format(_),filePath:c});for(let o=0;o<i.list.length;o++){const a=i.list[o],{pagePath:n}=a;if((0,common_2.checkPath)({value:n,tips:`["tabBar"]["list"][${o}]["pagePath"]`,filePath:c}),!n){l.push(locales_1.default.config.JSON_TABBAR_PATH_EMPTY.format(o));continue}n.indexOf("?")>=0&&l.push(locales_1.default.config.JSON_SHOULD_NOT_CONTAIN.format(`["tabBar"]["list"][${o}]["pagePath"]`,"?")),n.indexOf(".")>=0&&l.push(locales_1.default.config.JSON_SHOULD_NOT_CONTAIN.format(`["tabBar"]["list"][${o}]["pagePath"]`,"."));const r=i.list.slice(0,o).findIndex(o=>o.pagePath===n);r>=0&&l.push(locales_1.default.config.JSON_TABBAR_PATH_SAME_WITH_OTHER.format(o,r));const _=[];a.iconPath&&((0,common_2.checkPath)({value:a.iconPath,tips:`["tabBar"]["list"][${o}]["iconPath"]`,filePath:c,checkPathType:common_2.ECheckPathType.TAB_BAR_ICON}),_.push({name:"iconPath",path:a.iconPath})),a.selectedIconPath&&((0,common_2.checkPath)({value:a.selectedIconPath,tips:`["tabBar"]["list"][${o}]["selectedIconPath"]`,filePath:c,checkPathType:common_2.ECheckPathType.TAB_BAR_ICON}),_.push({name:"selectedIconPath",path:a.selectedIconPath})),_.forEach(a=>{const n=t.stat(e,a.path);if(!n)return void l.push(locales_1.default.config.NOT_FOUND.format(`["tabBar"]["list"][${o}]["${a.name}"]: "${a.path}"`));if(n.isDirectory)return void l.push(locales_1.default.config.JSON_CONTENT_SHOULD_BE.format(`["tabBar"]["list"][${o}]["${a.name}"]`,locales_1.default.config.FILE));n.size>1024*s.MaxTabbarIconSize&&l.push(locales_1.default.config.JSON_TABBAR_ICON_MAX_SIZE.format([o,a.name,s.MaxTabbarIconSize]));const c=path_1.default.posix.extname(a.path);config_1.TABBAR_ICON_WHITE_LIST.indexOf(c)<0&&l.push(locales_1.default.config.JSON_TABBAR_ICON_EXT.format([o,a.name,config_1.TABBAR_ICON_WHITE_LIST.join("、")]))})}l.length>0&&(0,common_2.throwError)({msg:l.join("\n"),filePath:c})}function checkWorkers(o){const{project:t,miniprogramRoot:e,filePath:a,inputJSON:n}=o,{workers:c}=n;if(void 0===c)return;const i='["workers"]';""===c&&(0,common_2.throwError)({msg:locales_1.default.config.JSON_CONTENT_SHOULD_BE.format(i,locales_1.default.config.DIRECTORY),filePath:a});const r=(0,tools_1.getWorkersPath)(c);(0,common_2.checkPath)({value:r,tips:i,filePath:a});const s=t.stat(e,r);s&&s.isDirectory||(0,common_2.throwError)({msg:locales_1.default.config.JSON_CONTENT_SHOULD_BE.format([i,locales_1.default.config.DIRECTORY]),filePath:a}),"string"==typeof n.workers?n.workers=(0,tools_1.normalizePath)(n.workers+"/"):n.workers.path=(0,tools_1.normalizePath)(n.workers.path+"/")}function checkOpenLocationPagePath(o){const{filePath:t,inputJSON:e}=o,{openLocationPagePath:a}=e;if(void 0===a)return;const n='["openLocationPagePath"]';(0,common_2.checkPath)({value:a,tips:n,filePath:t}),checkPageExist(o,a,n)}exports.checkPageExist=checkPageExist,exports.checkWindow=checkWindow,exports.checkTabbar=checkTabbar,exports.checkWorkers=checkWorkers,exports.checkOpenLocationPagePath=checkOpenLocationPagePath;const checkMainPkgPages=o=>{const{filePath:t,inputJSON:e}=o,{pages:a}=e;if(!a)return;const n={};for(let e=0;e<a.length;e++){const c=a[e],i=`["pages"][${e}]`;(0,common_2.checkPath)({value:c,tips:i,filePath:t}),n[c]&&(0,common_2.throwError)({msg:locales_1.default.config.JSON_PAGES_REPEAT.format(`"${c}"`,'["pages"]'),filePath:t}),n[c]=!0,checkPageExist(o,c,i)}};function checkSitemapLocation(o){const{filePath:t,inputJSON:e}=o,{sitemapLocation:a}=e;if(void 0===a)return;const{project:n,miniprogramRoot:c}=o,i='["sitemapLocation"]';(0,common_2.checkPath)({value:a,tips:i,filePath:t});const r=n.stat(c,a);r&&!r.isDirectory||(0,common_2.throwError)({msg:locales_1.default.config.CORRESPONDING_FILE_NOT_FOUND.format(i,a),filePath:t});".json"!==path_1.default.posix.extname(a)&&(0,common_2.throwError)({msg:locales_1.default.config.EXT_SHOULD_BE_ERROR.format(i,".json"),filePath:t});const s=n.getFile(c,a),l=(0,common_2.checkUTF8)(s,a),_=(0,common_1.checkJSONFormat)(l,a),f=(0,schemaValidate_1.schemaValidate)("sitemap",_);(0,schemaValidate_1.transValidateResult)(a,f)}function checkSubpackages(o){const{project:t,miniprogramRoot:e,filePath:a,inputJSON:n}=o;let c='["subPackages"]';n.subpackages&&(c='["subpackages"]',n.subPackages=n.subpackages,delete n.subpackages);const i=[];if(n.subPackages){const r=t.attrSync(),{setting:s}=r;n.subPackages.length>s.MaxSubPackageLimit&&(0,common_2.throwError)({msg:locales_1.default.config.EXCEED_LIMIT.format([c,s.MaxSubPackageLimit]),filePath:a});const l={},_={};for(let r=0;r<n.subPackages.length;r++){const s=n.subPackages[r],f=`${c}[${r}]`;if((0,common_2.checkPath)({value:s.root,tips:`${c}[${r}]["root"]`,filePath:a}),s.root===config_1.MINI_PROGRAM_MAIN_PACKAGE_ROOT){i.push(locales_1.default.config.JSON_CONTENT_SHOULD_NOT_BE.format(`${c}[${r}]["root"]`,config_1.MINI_PROGRAM_MAIN_PACKAGE_ROOT));continue}if(s.name){if(s.name===config_1.MINI_PROGRAM_MAIN_PACKAGE_ROOT){i.push(locales_1.default.config.JSON_CONTENT_SHOULD_NOT_BE.format(`${c}[${r}]["name"]`,config_1.MINI_PROGRAM_MAIN_PACKAGE_ROOT));continue}if(_[s.name]){i.push(locales_1.default.config.SAME_ITEM.format(f,_[s.name],"name"));continue}_[s.name]=f}if(s.root=(0,tools_1.normalizePath)(s.root+"/"),l[s.root]){i.push(locales_1.default.config.SAME_ITEM.format(f,l[s.root],"root"));continue}l[s.root]=f;const h=t.stat(e,s.root);if(!h){i.push(locales_1.default.config.JSON_CONTENT_SHOULD_BE.format([`${c}[${r}]["root"]`,locales_1.default.config.DIRECTORY]));continue}if(!h.isDirectory){i.push(locales_1.default.config.JSON_CONTENT_SHOULD_BE.format([`${c}[${r}]["root"]`,locales_1.default.config.DIRECTORY]));continue}const g={};for(let t=0,e=s.pages.length;t<e;t++){const e=s.pages[t];(0,common_2.checkPath)({value:e,tips:`${c}[${r}]["pages"][${t}]`,filePath:a});const n=(0,tools_1.normalizePath)(path_1.default.posix.join(s.root,e));g[n]?i.push(locales_1.default.config.JSON_PAGES_REPEAT.format([`"${e}"`,`${c}[${r}]`])):(g[n]=!0,checkPageExist(o,n,`${c}[${r}]["pages"][${t}]`))}}i.length>0&&(0,common_2.throwError)({msg:i.join("\n"),filePath:a});for(let o=0;o<n.subPackages.length;o++){const t=n.subPackages[o];let e=-1;const a="/"+t.root;n.subPackages.forEach((t,n)=>{if(n!==o&&t.root){const o="/"+t.root;a.startsWith(o)&&(e=n)}}),-1===e||i.push(locales_1.default.config.JSON_SHOULD_NOT_CONTAIN.format(`${c}[${e}]["root"]`,`${c}[${o}]["root"]`))}i.length>0&&(0,common_2.throwError)({msg:i.join("\n"),filePath:a})}}function checkPlugins(o){const{filePath:t,inputJSON:e,project:a}=o,n=[],c=e.plugins||{},i=(0,projectconfig_1.getProjectConfigJSON)(a),r=(null==i?void 0:i.pluginAppid)||a.appid;function s(o,t){const e=a.type===config_1.COMPILE_TYPE.miniProgramPlugin;if(e||"dev"!==o.version)if(e)"dev"===o.version&&o.provider!==r?n.push(locales_1.default.config.JSON_CONTENT_SHOULD_BE.format(t+'["provider"]',`"${r}"`)):o.provider===r&&"dev"!==o.version&&n.push(locales_1.default.config.JSON_CONTENT_SHOULD_BE.format(t+'["version"]','"dev"'));else{if("dev"===o.version||"latest"===o.version||/^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$/.test(o.version)||/^dev-[A-Za-z0-9]+$/.test(o.version))return!0;n.push(locales_1.default.config.JSON_CONTENT_SHOULD_BE.format([t+'["version"]',locales_1.default.config.TRIPLE_NUMBER_DOT]))}else n.push(`${locales_1.default.config.JSON_CONTENT_SHOULD_NOT_BE.format(t+'["version"]',"dev")}\n${locales_1.default.config.PLEASE_CHOOSE_PLUGIN_MODE}`)}for(const o in c){s(c[o],`["plugins"]["${o}"]`)}e.subPackages&&e.subPackages.forEach((o,t)=>{if(!o.plugins)return;const e=`["subPackages"][${t}]`;for(const t in o.plugins){s(o.plugins[t],`${e}["plugins"]["${t}"]`)}}),n.length>0&&(0,common_2.throwError)({msg:n.join("\n"),filePath:t})}function checkNavigateToMiniProgramAppIdList(o){const{filePath:t,inputJSON:e,project:a}=o,n=[];if(e.navigateToMiniProgramAppIdList){const o=a.attrSync(),{appType:t=config_1.APP_TYPE.NORMAL,setting:c}=o;if(t!==config_1.APP_TYPE.NATIVE){const o=null==c?void 0:c.NavigateMiniprogramLimit;e.navigateToMiniProgramAppIdList.length>o&&n.push(locales_1.default.config.EXCEED_LIMIT.format('["navigateToMiniProgramAppIdList"]',o))}}n.length>0&&(0,common_2.throwError)({msg:n.join("\n"),filePath:t})}function checkFunctionalPages(o){const{inputJSON:t}=o;if(t.functionalPages&&"object"!==(0,tools_1.getType)(t.functionalPages)){const o='["functionalPages"] 配置需要更新,详见文档: https://developers.weixin.qq.com/miniprogram/dev/framework/plugin/functional-pages.html';t.__warning__?t.__warning__=`${t.__warning__}\n${o}`:t.__warning__=o}}function checkPreloadRule(o,t){const{inputJSON:e,filePath:a}=o,{preloadRule:n,subPackages:c}=e;if(!n||!c)return;const i=[],r={},s={},l={};t.forEach(o=>{r[o.root]=!0,l[o.path]=!0,o.name&&(s[o.name]=!0)});for(const o in n){if(!l[o]&&!o.includes("__plugin__/")){i.push(locales_1.default.config.NOT_FOUND.format(`["preloadRule"]["${o}"]: ${locales_1.default.config.PAGE_PATH}`));continue}const t=n[o];for(let e=0,a=t.packages.length;e<a;e++){let a=t.packages[e];a!==config_1.MINI_PROGRAM_MAIN_PACKAGE_ROOT&&(s[a]||(a=(0,tools_1.normalizePath)(a+"/"),r[a]||i.push(locales_1.default.config.NOT_FOUND.format(`["preloadRule"]["${o}"]["packages"][${e}]: ${a}`))))}}i.length>0&&(0,common_2.throwError)({msg:i.join("\n"),filePath:a})}function checkEntryPagePath(o,t){const{inputJSON:e,filePath:a}=o,{entryPagePath:n}=e;if(!n)return;(0,common_2.checkPath)({value:n,tips:'["entryPagePath"]',filePath:a});let c=!1;for(const o of t)if(o.path===n){c=!0;break}c||(0,common_2.throwError)({msg:locales_1.default.config.JSON_ENTRY_PAGE_PATH_NOT_FOUND.format(["pages、subPackages","entryPagePath"]),filePath:a})}function checkTabbarPage(o){const{filePath:t,inputJSON:e}=o,{tabBar:a,pages:n=[]}=e;if(!a)return;const c=[];for(let o=0;o<a.list.length;o++){const t=a.list[o],{pagePath:e}=t;n.indexOf(e)<0&&c.push(`["tabBar"][${o}]["pagePath"]: "${e}" need in ["pages"]`)}c.length>0&&(0,common_2.throwError)({msg:c.join("\n"),filePath:t})}function checkMainPkgPageIsInSubpkg(o){const{filePath:t,inputJSON:e}=o,{subPackages:a,pages:n=[]}=e;if(!a)return;const c=[];for(let o=0;o<a.length;o++){const t=a[o];for(let e=0;e<n.length;e++){const a=n[e];a.startsWith(t.root)&&c.push(locales_1.default.config.SHOULD_NOT_IN.format([`["pages"][${e}]: "${a}"`,`["subPackages"][${o}]`]))}}c.length>0&&(0,common_2.throwError)({msg:c.join("\n"),filePath:t})}function checkMainPkgPluginIsInSubPkg(o){const{filePath:t,inputJSON:e}=o,{plugins:a={},subPackages:n}=e,c={},i={},r=[];for(const o in a){const t=a[o],e=`["plugins"]["${o}"]`;c[t.provider]?r.push(locales_1.default.config.SAME_ITEM.format(`["plugins"]["${o}"]`,c[t.provider].tips,"provider")):c[t.provider]=i[o]={provider:t.provider,version:t.version,alias:o,tips:e}}if(n)for(let o=0;o<n.length;o++){const t=n[o];if(t.plugins)for(const e in t.plugins){const a=`["subPackages"][${o}]["plugins"]`,n=t.plugins[e];c[n.provider]?r.push(locales_1.default.config.SAME_ITEM.format(`${a}["${e}"]`,c[n.provider].tips,"provider")):i[e]?r.push(locales_1.default.config.PLUGINS_SAME_ALIAS.format(`${a}["${e}"]`,i[e].tips)):c[n.provider]=i[e]={provider:n.provider,version:n.version,alias:n,tips:a}}}r.length>0&&(0,common_2.throwError)({msg:r.join("\n"),filePath:t})}function checkComponentPath(o){const{project:t,miniprogramRoot:e,filePath:a,inputJSON:n}=o;(0,common_1.checkComponentPath)({project:t,root:e,relativePath:path_1.default.posix.relative(e,a),inputJSON:n})}function checkEntranceDeclare(o){const t=o.inputJSON;if(!t.entranceDeclare||!t.entranceDeclare.locationMessage)return;let e=t.pages||[];t.subpackages&&(e=e.concat(t.subpackages.map(o=>o.pages.map(t=>o.root+t))),e=lodash_1.default.flattenDeep(e)),t.subPackages&&(e=e.concat(t.subPackages.map(o=>o.pages.map(t=>o.root+t))),e=lodash_1.default.flattenDeep(e));const a=[],n=t.entranceDeclare.locationMessage.path;void 0===n?a.push(locales_1.default.config.JSON_ENTRANCE_DECLARE_PATH_EMPTY.format([])):e.includes(n)||a.push(locales_1.default.config.JSON_ENTRANCE_DECLARE_PATH_ERR.format([n||"undefined"])),a.length>0&&(0,common_2.throwError)({msg:a.join("\n"),filePath:o.filePath})}function getAppJSONVariableDecalearProperty(o){const{windowPropertWhiteList:t,tabBarPropertyWhiteList:e,tabbarListItemPropertyWhiteList:a}=config_1.jsonVariablePropertyWhiteList;let n=[];return"[object Object]"===Object.prototype.toString.call(o.window)&&(n=n.concat(Object.keys(o.window).filter(o=>t.includes(o)).map(t=>({property:`["window"]["${t}"]`,value:o.window[t]})).filter(o=>"string"==typeof o.value&&o.value.startsWith("@")))),"[object Object]"===Object.prototype.toString.call(o.tabBar)&&(n=n.concat(Object.keys(o.tabBar).filter(o=>e.includes(o)).map(t=>({property:`["tabBar"]["${t}"]`,value:o.tabBar[t]})).filter(o=>"string"==typeof o.value&&o.value.startsWith("@"))),Array.isArray(o.tabBar.list)&&o.tabBar.list.forEach((t,e)=>{n=n.concat(Object.keys(t).filter(o=>a.includes(o)).map(t=>({property:`["tabBar"]["list"][${e}]["${t}"]`,value:o.tabBar.list[e][t]})).filter(o=>"string"==typeof o.value&&o.value.startsWith("@")))})),n}function checkOpenDataContext(o,t){const{project:e,miniprogramRoot:a,filePath:n}=o,{openDataContext:c}=t;if(void 0===c)return;(0,common_2.checkPath)({value:c,tips:'["openDataContext"]',filePath:n});const i=e.stat(a,c);i&&i.isDirectory||(0,common_2.throwError)({msg:locales_1.default.config.JSON_CONTENT_SHOULD_BE.format(['["openDataContext"]',locales_1.default.config.DIRECTORY]),filePath:n});const r=path_1.default.posix.join(c,"./index.js"),s=e.stat(a,r);s&&s.isFile||(0,common_2.throwError)({msg:locales_1.default.config.CORRESPONDING_FILE_NOT_FOUND.format('["openDataContext"]',r),filePath:n}),t.openDataContext=(0,tools_1.normalizePath)(c+"/")}function checkRenderer(o){var t,e,a,n;const{filePath:c,inputJSON:i}=o,{renderer:r,lazyCodeLoading:s,rendererOptions:l}=i;if("skyline"===r&&"requiredComponents"!==s&&(0,common_2.throwError)({msg:locales_1.default.config.APP_JSON_SHOULD_SET_LAZYCODELOADING.format("app.json"),filePath:c}),"skyline"===r&&(void 0===l?(0,common_2.throwError)({msg:locales_1.default.config.JSON_SHOULD_SET_RENDEREROPTIONS.format("app.json"),filePath:c}):void 0===l.skyline&&(0,common_2.throwError)({msg:locales_1.default.config.JSON_SHOULD_SET_RENDEREROPTIONS_SKYLINE.format("app.json"),filePath:c})),"skyline"===r||(null==l?void 0:l.skyline)){const o=(null===(t=i.window)||void 0===t?void 0:t.navigationBarTextStyle)||(null===(e=i.window)||void 0===e?void 0:e.navigationBarTitleText)||(null===(a=i.window)||void 0===a?void 0:a.navigationBarBackgroundColor),c="custom"===(null===(n=i.window)||void 0===n?void 0:n.navigationStyle);if(o&&!c){const o=locales_1.default.config.APP_JSON_SKYLINE_WINDOW_TIPS.format("");i.__warning__?i.__warning__=`${i.__warning__}\n${o}`:i.__warning__=o}}}function checkResolveAlias(o){const{filePath:t,inputJSON:e}=o,{resolveAlias:a}=e;if(a){const o=o=>o.includes("//");for(const e in a)(o(e)||o(a[e]))&&(0,common_2.throwError)({msg:locales_1.default.config.JSON_RESOLVE_ALIAS_ILLEGAL.format(e,a[e]),filePath:t}),a[e].startsWith("./")&&(0,common_2.throwError)({msg:locales_1.default.config.JSON_RESOLVE_ALIAS_SHOULD_NOT_START_WITH.format(a[e]),filePath:t}),e.endsWith("/*")&&a[e].endsWith("/*")||(0,common_2.throwError)({msg:locales_1.default.config.JSON_RESOLVE_ALIAS_INCLUDE_STAR.format(e,a[e]),filePath:t})}}exports.checkMainPkgPages=checkMainPkgPages,exports.checkSitemapLocation=checkSitemapLocation,exports.checkSubpackages=checkSubpackages,exports.checkPlugins=checkPlugins,exports.checkNavigateToMiniProgramAppIdList=checkNavigateToMiniProgramAppIdList,exports.checkFunctionalPages=checkFunctionalPages,exports.checkPreloadRule=checkPreloadRule,exports.checkEntryPagePath=checkEntryPagePath,exports.checkTabbarPage=checkTabbarPage,exports.checkMainPkgPageIsInSubpkg=checkMainPkgPageIsInSubpkg,exports.checkMainPkgPluginIsInSubPkg=checkMainPkgPluginIsInSubPkg,exports.checkComponentPath=checkComponentPath,exports.checkEntranceDeclare=checkEntranceDeclare,exports.getAppJSONVariableDecalearProperty=getAppJSONVariableDecalearProperty,exports.checkOpenDataContext=checkOpenDataContext,exports.checkRenderer=checkRenderer,exports.checkResolveAlias=checkResolveAlias;const detailLocationApis={getLocation:!0,onLocationChange:!0,startLocationUpdate:!0,startLocationUpdateBackground:!0};function checkRequiredPrivateInfos(o){const{filePath:t,inputJSON:e}=o,{requiredPrivateInfos:a}=e;if(a){if(a.indexOf("getFuzzyLocation")>=0){const o=[];for(let t=0;t<a.length;t++){const e=a[t];detailLocationApis[e]&&o.push(`'${e}'`)}o.length>0&&(0,common_2.throwError)({msg:locales_1.default.config.JSON_REQUIRED_PRIVATE_INFOS_MUTUALLY_EXCLUSIVE.format("'getFuzzyLocation'",o.join("、")),filePath:t})}}}function checkAccountCardPackage(o){const{project:t,filePath:e,inputJSON:a,miniprogramRoot:n}=o,{accountCardPackage:c}=a;if(c){c.root=(0,tools_1.normalizePath)(c.root+"/");const o=a.subPackages||a.subpackages||[];console.log("subPackages",o),o.find(o=>o.root===c.root&&o.independent)||(0,common_2.throwError)({msg:locales_1.default.config.ACCOUNT_CARD_PACKAPGE_IN_VALID.format(),filePath:e});for(const o of c.cardList){const{componentPath:a}=o,i=path_1.default.posix.join(c.root,a+".js");t.stat(n,path_1.default.posix.join(c.root,a+".js"))||(0,common_2.throwError)({msg:locales_1.default.config.CORRESPONDING_FILE_NOT_FOUND.format('["accountCardPackage"]',i),code:config_1.FILE_NOT_FOUND,filePath:e})}}}exports.checkRequiredPrivateInfos=checkRequiredPrivateInfos,exports.checkAccountCardPackage=checkAccountCardPackage;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.checkMainPkgPages=void 0,exports.checkPageExist=checkPageExist,exports.checkWindow=checkWindow,exports.checkTabbar=checkTabbar,exports.checkWorkers=checkWorkers,exports.checkOpenLocationPagePath=checkOpenLocationPagePath,exports.checkSitemapLocation=checkSitemapLocation,exports.checkSubpackages=checkSubpackages,exports.checkPlugins=checkPlugins,exports.checkNavigateToMiniProgramAppIdList=checkNavigateToMiniProgramAppIdList,exports.checkFunctionalPages=checkFunctionalPages,exports.checkPreloadRule=checkPreloadRule,exports.checkEntryPagePath=checkEntryPagePath,exports.checkTabbarPage=checkTabbarPage,exports.checkMainPkgPageIsInSubpkg=checkMainPkgPageIsInSubpkg,exports.checkMainPkgPluginIsInSubPkg=checkMainPkgPluginIsInSubPkg,exports.checkComponentPath=checkComponentPath,exports.checkEntranceDeclare=checkEntranceDeclare,exports.getAppJSONVariableDecalearProperty=getAppJSONVariableDecalearProperty,exports.checkOpenDataContext=checkOpenDataContext,exports.checkRenderer=checkRenderer,exports.checkResolveAlias=checkResolveAlias,exports.checkRequiredPrivateInfos=checkRequiredPrivateInfos,exports.checkAccountCardPackage=checkAccountCardPackage;const tslib_1=require("tslib"),path_1=tslib_1.__importDefault(require("path")),lodash_1=tslib_1.__importDefault(require("lodash")),config_1=require("../../../../../config/config"),common_1=require("../common"),common_2=require("../../../../../utils/common"),tools_1=require("../../../../../utils/tools"),locales_1=tslib_1.__importDefault(require("../../../../../utils/locales/locales")),schemaValidate_1=require("../../validate/schemaValidate"),projectconfig_1=require("../projectconfig");function checkPageExist(o,t,e){const{miniprogramRoot:a,project:n,filePath:c}=o;n.stat(a,`${t}.wxml`)||(0,common_2.throwError)({msg:locales_1.default.config.CORRESPONDING_FILE_NOT_FOUND.format(e,`${t}.wxml`),code:config_1.FILE_NOT_FOUND,filePath:c}),n.stat(a,`${t}.js`)||(0,common_2.throwError)({msg:locales_1.default.config.CORRESPONDING_FILE_NOT_FOUND.format(e,`${t}.js`),code:config_1.FILE_NOT_FOUND,filePath:c})}function checkWindow(o){const{inputJSON:t,mode:e}=o;let a=`${o.filePath}`;t.themeLocation&&(a+=` or ${t.themeLocation}["${e}"]`);const n=[],c='["window"]',{window:i}=t;i&&(void 0!==i.navigationBarBackgroundColor&&((0,tools_1.isHexColor)(i.navigationBarBackgroundColor)||n.push(`${c}["navigationBarBackgroundColor"]: "${i.navigationBarBackgroundColor}" is not hexColor`)),void 0!==i.backgroundColor&&((0,tools_1.isHexColor)(i.backgroundColor)||n.push(`${c}["backgroundColor"]: "${i.backgroundColor}" is not hexColor`)),n.length>0&&(0,common_2.throwError)({msg:n.join("\n"),filePath:a}))}function checkTabbar(o){const{project:t,miniprogramRoot:e,inputJSON:a,mode:n}=o;let c=`${o.filePath}`;a.themeLocation&&(c+=` or ${a.themeLocation}["${n}"]`);const{tabBar:i}=a,r=t.attrSync(),{setting:s}=r;if(!i)return;const l=[];i.list.length<s.MinTabbarCount&&(0,common_2.throwError)({msg:locales_1.default.config.JSON_TABBAR_AT_LEAST.format(s.MinTabbarCount),filePath:c});const _=i.custom?s.MaxCustomTabbarCount:s.MaxTabbarCount;i.list.length>_&&(0,common_2.throwError)({msg:locales_1.default.config.JSON_TABBAR_AT_MOST.format(_),filePath:c});for(let o=0;o<i.list.length;o++){const a=i.list[o],{pagePath:n}=a;if((0,common_2.checkPath)({value:n,tips:`["tabBar"]["list"][${o}]["pagePath"]`,filePath:c}),!n){l.push(locales_1.default.config.JSON_TABBAR_PATH_EMPTY.format(o));continue}n.indexOf("?")>=0&&l.push(locales_1.default.config.JSON_SHOULD_NOT_CONTAIN.format(`["tabBar"]["list"][${o}]["pagePath"]`,"?")),n.indexOf(".")>=0&&l.push(locales_1.default.config.JSON_SHOULD_NOT_CONTAIN.format(`["tabBar"]["list"][${o}]["pagePath"]`,"."));const r=i.list.slice(0,o).findIndex((o=>o.pagePath===n));r>=0&&l.push(locales_1.default.config.JSON_TABBAR_PATH_SAME_WITH_OTHER.format(o,r));const _=[];a.iconPath&&((0,common_2.checkPath)({value:a.iconPath,tips:`["tabBar"]["list"][${o}]["iconPath"]`,filePath:c,checkPathType:common_2.ECheckPathType.TAB_BAR_ICON}),_.push({name:"iconPath",path:a.iconPath})),a.selectedIconPath&&((0,common_2.checkPath)({value:a.selectedIconPath,tips:`["tabBar"]["list"][${o}]["selectedIconPath"]`,filePath:c,checkPathType:common_2.ECheckPathType.TAB_BAR_ICON}),_.push({name:"selectedIconPath",path:a.selectedIconPath})),_.forEach((a=>{const n=t.stat(e,a.path);if(!n)return void l.push(locales_1.default.config.NOT_FOUND.format(`["tabBar"]["list"][${o}]["${a.name}"]: "${a.path}"`));if(n.isDirectory)return void l.push(locales_1.default.config.JSON_CONTENT_SHOULD_BE.format(`["tabBar"]["list"][${o}]["${a.name}"]`,locales_1.default.config.FILE));n.size>1024*s.MaxTabbarIconSize&&l.push(locales_1.default.config.JSON_TABBAR_ICON_MAX_SIZE.format([o,a.name,s.MaxTabbarIconSize]));const c=path_1.default.posix.extname(a.path);config_1.TABBAR_ICON_WHITE_LIST.indexOf(c)<0&&l.push(locales_1.default.config.JSON_TABBAR_ICON_EXT.format([o,a.name,config_1.TABBAR_ICON_WHITE_LIST.join("、")]))}))}l.length>0&&(0,common_2.throwError)({msg:l.join("\n"),filePath:c})}function checkWorkers(o){const{project:t,miniprogramRoot:e,filePath:a,inputJSON:n}=o,{workers:c}=n;if(void 0===c)return;const i='["workers"]';""===c&&(0,common_2.throwError)({msg:locales_1.default.config.JSON_CONTENT_SHOULD_BE.format(i,locales_1.default.config.DIRECTORY),filePath:a});const r=(0,tools_1.getWorkersPath)(c);(0,common_2.checkPath)({value:r,tips:i,filePath:a});const s=t.stat(e,r);s&&s.isDirectory||(0,common_2.throwError)({msg:locales_1.default.config.JSON_CONTENT_SHOULD_BE.format([i,locales_1.default.config.DIRECTORY]),filePath:a}),"string"==typeof n.workers?n.workers=(0,tools_1.normalizePath)(`${n.workers}/`):n.workers.path=(0,tools_1.normalizePath)(`${n.workers.path}/`)}function checkOpenLocationPagePath(o){const{filePath:t,inputJSON:e}=o,{openLocationPagePath:a}=e;if(void 0===a)return;const n='["openLocationPagePath"]';(0,common_2.checkPath)({value:a,tips:n,filePath:t}),checkPageExist(o,a,n)}const checkMainPkgPages=o=>{const{filePath:t,inputJSON:e}=o,{pages:a}=e;if(!a)return;const n={};for(let e=0;e<a.length;e++){const c=a[e],i=`["pages"][${e}]`;(0,common_2.checkPath)({value:c,tips:i,filePath:t}),n[c]&&(0,common_2.throwError)({msg:locales_1.default.config.JSON_PAGES_REPEAT.format(`"${c}"`,'["pages"]'),filePath:t}),n[c]=!0,checkPageExist(o,c,i)}};function checkSitemapLocation(o){const{filePath:t,inputJSON:e}=o,{sitemapLocation:a}=e;if(void 0===a)return;const{project:n,miniprogramRoot:c}=o,i='["sitemapLocation"]';(0,common_2.checkPath)({value:a,tips:i,filePath:t});const r=n.stat(c,a);r&&!r.isDirectory||(0,common_2.throwError)({msg:locales_1.default.config.CORRESPONDING_FILE_NOT_FOUND.format(i,a),filePath:t});".json"!==path_1.default.posix.extname(a)&&(0,common_2.throwError)({msg:locales_1.default.config.EXT_SHOULD_BE_ERROR.format(i,".json"),filePath:t});const s=n.getFile(c,a),l=(0,common_2.checkUTF8)(s,a),_=(0,common_1.checkJSONFormat)(l,a),f=(0,schemaValidate_1.schemaValidate)("sitemap",_);(0,schemaValidate_1.transValidateResult)(a,f)}function checkSubpackages(o){const{project:t,miniprogramRoot:e,filePath:a,inputJSON:n}=o;let c='["subPackages"]';n.subpackages&&(c='["subpackages"]',n.subPackages=n.subpackages,delete n.subpackages);const i=[];if(n.subPackages){const r=t.attrSync(),{setting:s}=r;n.subPackages.length>s.MaxSubPackageLimit&&(0,common_2.throwError)({msg:locales_1.default.config.EXCEED_LIMIT.format([c,s.MaxSubPackageLimit]),filePath:a});const l={},_={};for(let r=0;r<n.subPackages.length;r++){const s=n.subPackages[r],f=`${c}[${r}]`;if((0,common_2.checkPath)({value:s.root,tips:`${c}[${r}]["root"]`,filePath:a}),s.root===config_1.MINI_PROGRAM_MAIN_PACKAGE_ROOT){i.push(locales_1.default.config.JSON_CONTENT_SHOULD_NOT_BE.format(`${c}[${r}]["root"]`,config_1.MINI_PROGRAM_MAIN_PACKAGE_ROOT));continue}if(s.name){if(s.name===config_1.MINI_PROGRAM_MAIN_PACKAGE_ROOT){i.push(locales_1.default.config.JSON_CONTENT_SHOULD_NOT_BE.format(`${c}[${r}]["name"]`,config_1.MINI_PROGRAM_MAIN_PACKAGE_ROOT));continue}if(_[s.name]){i.push(locales_1.default.config.SAME_ITEM.format(f,_[s.name],"name"));continue}_[s.name]=f}if(s.root=(0,tools_1.normalizePath)(`${s.root}/`),l[s.root]){i.push(locales_1.default.config.SAME_ITEM.format(f,l[s.root],"root"));continue}l[s.root]=f;const h=t.stat(e,s.root);if(!h){i.push(locales_1.default.config.JSON_CONTENT_SHOULD_BE.format([`${c}[${r}]["root"]`,locales_1.default.config.DIRECTORY]));continue}if(!h.isDirectory){i.push(locales_1.default.config.JSON_CONTENT_SHOULD_BE.format([`${c}[${r}]["root"]`,locales_1.default.config.DIRECTORY]));continue}const g={};for(let t=0,e=s.pages.length;t<e;t++){const e=s.pages[t];(0,common_2.checkPath)({value:e,tips:`${c}[${r}]["pages"][${t}]`,filePath:a});const n=(0,tools_1.normalizePath)(path_1.default.posix.join(s.root,e));g[n]?i.push(locales_1.default.config.JSON_PAGES_REPEAT.format([`"${e}"`,`${c}[${r}]`])):(g[n]=!0,checkPageExist(o,n,`${c}[${r}]["pages"][${t}]`))}}i.length>0&&(0,common_2.throwError)({msg:i.join("\n"),filePath:a});for(let o=0;o<n.subPackages.length;o++){const t=n.subPackages[o];let e=-1;const a=`/${t.root}`;n.subPackages.forEach(((t,n)=>{if(n!==o&&t.root){const o=`/${t.root}`;a.startsWith(o)&&(e=n)}})),-1===e||i.push(locales_1.default.config.JSON_SHOULD_NOT_CONTAIN.format(`${c}[${e}]["root"]`,`${c}[${o}]["root"]`))}i.length>0&&(0,common_2.throwError)({msg:i.join("\n"),filePath:a})}}function checkPlugins(o){const{filePath:t,inputJSON:e,project:a}=o,n=[],c=e.plugins||{},i=(0,projectconfig_1.getProjectConfigJSON)(a),r=(null==i?void 0:i.pluginAppid)||a.appid;function s(o,t){const e=a.type===config_1.COMPILE_TYPE.miniProgramPlugin;if(e||"dev"!==o.version)if(e)"dev"===o.version&&o.provider!==r?n.push(locales_1.default.config.JSON_CONTENT_SHOULD_BE.format(`${t}["provider"]`,`"${r}"`)):o.provider===r&&"dev"!==o.version&&n.push(locales_1.default.config.JSON_CONTENT_SHOULD_BE.format(`${t}["version"]`,'"dev"'));else{if("dev"===o.version||"latest"===o.version||/^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$/.test(o.version)||/^dev-[A-Za-z0-9]+$/.test(o.version))return!0;n.push(locales_1.default.config.JSON_CONTENT_SHOULD_BE.format([`${t}["version"]`,locales_1.default.config.TRIPLE_NUMBER_DOT]))}else n.push(`${locales_1.default.config.JSON_CONTENT_SHOULD_NOT_BE.format(`${t}["version"]`,"dev")}\n${locales_1.default.config.PLEASE_CHOOSE_PLUGIN_MODE}`)}for(const o in c){s(c[o],`["plugins"]["${o}"]`)}e.subPackages&&e.subPackages.forEach(((o,t)=>{if(!o.plugins)return;const e=`["subPackages"][${t}]`;for(const t in o.plugins){s(o.plugins[t],`${e}["plugins"]["${t}"]`)}})),n.length>0&&(0,common_2.throwError)({msg:n.join("\n"),filePath:t})}function checkNavigateToMiniProgramAppIdList(o){const{filePath:t,inputJSON:e,project:a}=o,n=[];if(e.navigateToMiniProgramAppIdList){const o=a.attrSync(),{appType:t=config_1.APP_TYPE.NORMAL,setting:c}=o;if(t!==config_1.APP_TYPE.NATIVE){const o=null==c?void 0:c.NavigateMiniprogramLimit;e.navigateToMiniProgramAppIdList.length>o&&n.push(locales_1.default.config.EXCEED_LIMIT.format('["navigateToMiniProgramAppIdList"]',o))}}n.length>0&&(0,common_2.throwError)({msg:n.join("\n"),filePath:t})}function checkFunctionalPages(o){const{inputJSON:t}=o;if(t.functionalPages&&"object"!==(0,tools_1.getType)(t.functionalPages)){const o='["functionalPages"] 配置需要更新,详见文档: https://developers.weixin.qq.com/miniprogram/dev/framework/plugin/functional-pages.html';t.__warning__?t.__warning__=`${t.__warning__}\n${o}`:t.__warning__=o}}function checkPreloadRule(o,t){const{inputJSON:e,filePath:a}=o,{preloadRule:n,subPackages:c}=e;if(!n||!c)return;const i=[],r={},s={},l={};t.forEach((o=>{r[o.root]=!0,l[o.path]=!0,o.name&&(s[o.name]=!0)}));for(const o in n){if(!l[o]&&!o.includes("__plugin__/")){i.push(locales_1.default.config.NOT_FOUND.format(`["preloadRule"]["${o}"]: ${locales_1.default.config.PAGE_PATH}`));continue}const t=n[o];for(let e=0,a=t.packages.length;e<a;e++){let a=t.packages[e];a!==config_1.MINI_PROGRAM_MAIN_PACKAGE_ROOT&&(s[a]||(a=(0,tools_1.normalizePath)(`${a}/`),r[a]||i.push(locales_1.default.config.NOT_FOUND.format(`["preloadRule"]["${o}"]["packages"][${e}]: ${a}`))))}}i.length>0&&(0,common_2.throwError)({msg:i.join("\n"),filePath:a})}function checkEntryPagePath(o,t){const{inputJSON:e,filePath:a}=o,{entryPagePath:n}=e;if(!n)return;(0,common_2.checkPath)({value:n,tips:'["entryPagePath"]',filePath:a});let c=!1;for(const o of t)if(o.path===n){c=!0;break}c||(0,common_2.throwError)({msg:locales_1.default.config.JSON_ENTRY_PAGE_PATH_NOT_FOUND.format(["pages、subPackages","entryPagePath"]),filePath:a})}function checkTabbarPage(o){const{filePath:t,inputJSON:e}=o,{tabBar:a,pages:n=[]}=e;if(!a)return;const c=[];for(let o=0;o<a.list.length;o++){const t=a.list[o],{pagePath:e}=t;n.indexOf(e)<0&&c.push(`["tabBar"][${o}]["pagePath"]: "${e}" need in ["pages"]`)}c.length>0&&(0,common_2.throwError)({msg:c.join("\n"),filePath:t})}function checkMainPkgPageIsInSubpkg(o){const{filePath:t,inputJSON:e}=o,{subPackages:a,pages:n=[]}=e;if(!a)return;const c=[];for(let o=0;o<a.length;o++){const t=a[o];for(let e=0;e<n.length;e++){const a=n[e];a.startsWith(t.root)&&c.push(locales_1.default.config.SHOULD_NOT_IN.format([`["pages"][${e}]: "${a}"`,`["subPackages"][${o}]`]))}}c.length>0&&(0,common_2.throwError)({msg:c.join("\n"),filePath:t})}function checkMainPkgPluginIsInSubPkg(o){const{filePath:t,inputJSON:e}=o,{plugins:a={},subPackages:n}=e,c={},i={},r=[];for(const o in a){const t=a[o],e=`["plugins"]["${o}"]`;c[t.provider]?r.push(locales_1.default.config.SAME_ITEM.format(`["plugins"]["${o}"]`,c[t.provider].tips,"provider")):c[t.provider]=i[o]={provider:t.provider,version:t.version,alias:o,tips:e}}if(n)for(let o=0;o<n.length;o++){const t=n[o];if(t.plugins)for(const e in t.plugins){const a=`["subPackages"][${o}]["plugins"]`,n=t.plugins[e];c[n.provider]?r.push(locales_1.default.config.SAME_ITEM.format(`${a}["${e}"]`,c[n.provider].tips,"provider")):i[e]?r.push(locales_1.default.config.PLUGINS_SAME_ALIAS.format(`${a}["${e}"]`,i[e].tips)):c[n.provider]=i[e]={provider:n.provider,version:n.version,alias:n,tips:a}}}r.length>0&&(0,common_2.throwError)({msg:r.join("\n"),filePath:t})}function checkComponentPath(o){const{project:t,miniprogramRoot:e,filePath:a,inputJSON:n}=o;(0,common_1.checkComponentPath)({project:t,root:e,relativePath:path_1.default.posix.relative(e,a),inputJSON:n})}function checkEntranceDeclare(o){const t=o.inputJSON;if(!t.entranceDeclare||!t.entranceDeclare.locationMessage)return;let e=t.pages||[];t.subpackages&&(e=e.concat(t.subpackages.map((o=>o.pages.map((t=>o.root+t))))),e=lodash_1.default.flattenDeep(e)),t.subPackages&&(e=e.concat(t.subPackages.map((o=>o.pages.map((t=>o.root+t))))),e=lodash_1.default.flattenDeep(e));const a=[],n=t.entranceDeclare.locationMessage.path;void 0===n?a.push(locales_1.default.config.JSON_ENTRANCE_DECLARE_PATH_EMPTY.format([])):e.includes(n)||a.push(locales_1.default.config.JSON_ENTRANCE_DECLARE_PATH_ERR.format([n||"undefined"])),a.length>0&&(0,common_2.throwError)({msg:a.join("\n"),filePath:o.filePath})}function getAppJSONVariableDecalearProperty(o){const{windowPropertWhiteList:t,tabBarPropertyWhiteList:e,tabbarListItemPropertyWhiteList:a}=config_1.jsonVariablePropertyWhiteList;let n=[];return"[object Object]"===Object.prototype.toString.call(o.window)&&(n=n.concat(Object.keys(o.window).filter((o=>t.includes(o))).map((t=>({property:`["window"]["${t}"]`,value:o.window[t]}))).filter((o=>"string"==typeof o.value&&o.value.startsWith("@"))))),"[object Object]"===Object.prototype.toString.call(o.tabBar)&&(n=n.concat(Object.keys(o.tabBar).filter((o=>e.includes(o))).map((t=>({property:`["tabBar"]["${t}"]`,value:o.tabBar[t]}))).filter((o=>"string"==typeof o.value&&o.value.startsWith("@")))),Array.isArray(o.tabBar.list)&&o.tabBar.list.forEach(((t,e)=>{n=n.concat(Object.keys(t).filter((o=>a.includes(o))).map((t=>({property:`["tabBar"]["list"][${e}]["${t}"]`,value:o.tabBar.list[e][t]}))).filter((o=>"string"==typeof o.value&&o.value.startsWith("@"))))}))),n}function checkOpenDataContext(o,t){const{project:e,miniprogramRoot:a,filePath:n}=o,{openDataContext:c}=t;if(void 0===c)return;(0,common_2.checkPath)({value:c,tips:'["openDataContext"]',filePath:n});const i=e.stat(a,c);i&&i.isDirectory||(0,common_2.throwError)({msg:locales_1.default.config.JSON_CONTENT_SHOULD_BE.format(['["openDataContext"]',locales_1.default.config.DIRECTORY]),filePath:n});const r=path_1.default.posix.join(c,"./index.js"),s=e.stat(a,r);s&&s.isFile||(0,common_2.throwError)({msg:locales_1.default.config.CORRESPONDING_FILE_NOT_FOUND.format('["openDataContext"]',r),filePath:n}),t.openDataContext=(0,tools_1.normalizePath)(`${c}/`)}function checkRenderer(o){var t,e,a,n;const{filePath:c,inputJSON:i}=o,{renderer:r,lazyCodeLoading:s,rendererOptions:l}=i;if("skyline"===r&&"requiredComponents"!==s&&(0,common_2.throwError)({msg:locales_1.default.config.APP_JSON_SHOULD_SET_LAZYCODELOADING.format("app.json"),filePath:c}),"skyline"===r&&(void 0===l?(0,common_2.throwError)({msg:locales_1.default.config.JSON_SHOULD_SET_RENDEREROPTIONS.format("app.json"),filePath:c}):void 0===l.skyline&&(0,common_2.throwError)({msg:locales_1.default.config.JSON_SHOULD_SET_RENDEREROPTIONS_SKYLINE.format("app.json"),filePath:c})),"skyline"===r||(null==l?void 0:l.skyline)){const o=(null===(t=i.window)||void 0===t?void 0:t.navigationBarTextStyle)||(null===(e=i.window)||void 0===e?void 0:e.navigationBarTitleText)||(null===(a=i.window)||void 0===a?void 0:a.navigationBarBackgroundColor),c="custom"===(null===(n=i.window)||void 0===n?void 0:n.navigationStyle);if(o&&!c){const o=locales_1.default.config.APP_JSON_SKYLINE_WINDOW_TIPS.format("");i.__warning__?i.__warning__=`${i.__warning__}\n${o}`:i.__warning__=o}}}function checkResolveAlias(o){const{filePath:t,inputJSON:e}=o,{resolveAlias:a}=e;if(a){const o=o=>o.includes("//");for(const e in a)(o(e)||o(a[e]))&&(0,common_2.throwError)({msg:locales_1.default.config.JSON_RESOLVE_ALIAS_ILLEGAL.format(e,a[e]),filePath:t}),a[e].startsWith("./")&&(0,common_2.throwError)({msg:locales_1.default.config.JSON_RESOLVE_ALIAS_SHOULD_NOT_START_WITH.format(a[e]),filePath:t}),e.endsWith("/*")&&a[e].endsWith("/*")||(0,common_2.throwError)({msg:locales_1.default.config.JSON_RESOLVE_ALIAS_INCLUDE_STAR.format(e,a[e]),filePath:t})}}exports.checkMainPkgPages=checkMainPkgPages;const detailLocationApis={getLocation:!0,onLocationChange:!0,startLocationUpdate:!0,startLocationUpdateBackground:!0};function checkRequiredPrivateInfos(o){const{filePath:t,inputJSON:e}=o,{requiredPrivateInfos:a}=e;if(a){if(a.indexOf("getFuzzyLocation")>=0){const o=[];for(let t=0;t<a.length;t++){const e=a[t];detailLocationApis[e]&&o.push(`'${e}'`)}o.length>0&&(0,common_2.throwError)({msg:locales_1.default.config.JSON_REQUIRED_PRIVATE_INFOS_MUTUALLY_EXCLUSIVE.format("'getFuzzyLocation'",o.join("、")),filePath:t})}}}function checkAccountCardPackage(o){const{project:t,filePath:e,inputJSON:a,miniprogramRoot:n}=o,{accountCardPackage:c}=a;if(c){c.root=(0,tools_1.normalizePath)(`${c.root}/`);const o=a.subPackages||a.subpackages||[];console.log("subPackages",o),o.find((o=>o.root===c.root&&o.independent))||(0,common_2.throwError)({msg:locales_1.default.config.ACCOUNT_CARD_PACKAPGE_IN_VALID.format(),filePath:e});for(const o of c.cardList){const{componentPath:a}=o,i=path_1.default.posix.join(c.root,`${a}.js`);t.stat(n,path_1.default.posix.join(c.root,`${a}.js`))||(0,common_2.throwError)({msg:locales_1.default.config.CORRESPONDING_FILE_NOT_FOUND.format('["accountCardPackage"]',i),code:config_1.FILE_NOT_FOUND,filePath:e})}}}
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getExtJSON=void 0;const tslib_1=require("tslib"),path_1=tslib_1.__importDefault(require("path")),lodash_1=require("lodash"),cache_1=require("../../../../../utils/cache"),common_1=require("../common"),common_2=require("../../../../../utils/common"),tools_1=require("../../../../../utils/tools"),projectconfig_1=require("../projectconfig"),locales_1=tslib_1.__importDefault(require("../../../../../utils/locales/locales")),schemaValidate_1=require("../../validate/schemaValidate"),theme_1=require("../theme"),reactiveCache_1=require("../reactiveCache"),checkAppFields_1=require("./checkAppFields");function checkExtPages(e){const{project:o,inputJSON:t,filePath:c,miniprogramRoot:a}=e,{extPages:i}=t;if(i)for(const e in i){const t=i[e];if(t){t.navigationBarBackgroundColor&&!(0,tools_1.isHexColor)(t.navigationBarBackgroundColor)&&(0,common_2.throwError)({msg:`["extPages"]["${e}"]["navigationBarBackgroundColor"]: "${t.navigationBarBackgroundColor}" is not hexColor`,filePath:c}),t.backgroundColor&&!(0,tools_1.isHexColor)(t.backgroundColor)&&(0,common_2.throwError)({msg:`["extPages"]["${e}"]["backgroundColor"]: "${t.backgroundColor}" is not hexColor`,filePath:c});try{(0,checkAppFields_1.checkComponentPath)({project:o,miniprogramRoot:a,inputJSON:t,filePath:e+".json"})}catch(o){(0,common_2.throwError)({msg:`["extPages"]["${e}"]${o.message}`,filePath:c})}}}}exports.getExtJSON=(0,reactiveCache_1.wrapCompileJSONFunc)(cache_1.CACHE_KEY.EXT_JSON,e=>{const o=(0,projectconfig_1.getProjectConfigJSON)(e),{miniprogramRoot:t=""}=o,c=e.attrSync(),a=(0,tools_1.normalizePath)(path_1.default.posix.join(t,"ext.json"));if(!e.exists(a))return;if(!c||!c.platform)return e.stat(t,"ext.json")?{__warning__:locales_1.default.config.EXT_JSON_INVALID.format(e.appid,"https://developers.weixin.qq.com/miniprogram/dev/devtools/ext.html")}:void 0;if(!e.stat(t,"ext.json"))return;const i=e.getFile(t,"ext.json"),r=(0,common_1.checkJSONFormat)((0,common_2.checkUTF8)(i,a),a);if(!r.extEnable)return{};const n=(0,theme_1.getThemeLocation)(e);let s={};n&&(s=(0,theme_1.checkThemeJSON)(e,{themeLocation:n}));const l=(0,theme_1.mergeThemeJSONToAppJSON)(s,r),h=(0,schemaValidate_1.schemaValidate)("ext",l.appJSONLight),p=(0,schemaValidate_1.schemaValidate)("ext",l.appJSONDark);h.warning&&(r.__warning__=locales_1.default.config.INVALID.format(h.warning)),p.warning&&(r.__warning__=locales_1.default.config.INVALID.format(p.warning)),(0,schemaValidate_1.transValidateResult)(a,h),(0,schemaValidate_1.transValidateResult)(a,p),r.extAppid||(0,common_2.throwError)({msg:""+locales_1.default.config.EXT_APPID_SHOULD_NOT_BE_EMPTY,filePath:a});const _={filePath:a,project:e,miniprogramRoot:t,inputJSON:r},m=(0,lodash_1.cloneDeep)(_);m.inputJSON=l.appJSONLight,m.mode="light";const g=(0,lodash_1.cloneDeep)(_);return g.inputJSON=l.appJSONDark,g.mode="dark",(0,checkAppFields_1.checkMainPkgPages)(_),(0,checkAppFields_1.checkMainPkgPages)(_),(0,checkAppFields_1.checkSubpackages)(_),(0,checkAppFields_1.checkTabbar)(m),(0,checkAppFields_1.checkTabbar)(g),(0,checkAppFields_1.checkWorkers)(_),(0,checkAppFields_1.checkFunctionalPages)(_),(0,checkAppFields_1.checkOpenLocationPagePath)(_),(0,checkAppFields_1.checkPlugins)(_),(0,checkAppFields_1.checkWindow)(m),(0,checkAppFields_1.checkWindow)(g),(0,checkAppFields_1.checkComponentPath)(_),checkExtPages(_),r});
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getExtJSON=void 0;const tslib_1=require("tslib"),path_1=tslib_1.__importDefault(require("path")),lodash_1=require("lodash"),cache_1=require("../../../../../utils/cache"),common_1=require("../common"),common_2=require("../../../../../utils/common"),tools_1=require("../../../../../utils/tools"),projectconfig_1=require("../projectconfig"),locales_1=tslib_1.__importDefault(require("../../../../../utils/locales/locales")),schemaValidate_1=require("../../validate/schemaValidate"),theme_1=require("../theme"),reactiveCache_1=require("../reactiveCache"),checkAppFields_1=require("./checkAppFields");function checkExtPages(e){const{project:o,inputJSON:t,filePath:c,miniprogramRoot:a}=e,{extPages:i}=t;if(i)for(const e in i){const t=i[e];if(t){t.navigationBarBackgroundColor&&!(0,tools_1.isHexColor)(t.navigationBarBackgroundColor)&&(0,common_2.throwError)({msg:`["extPages"]["${e}"]["navigationBarBackgroundColor"]: "${t.navigationBarBackgroundColor}" is not hexColor`,filePath:c}),t.backgroundColor&&!(0,tools_1.isHexColor)(t.backgroundColor)&&(0,common_2.throwError)({msg:`["extPages"]["${e}"]["backgroundColor"]: "${t.backgroundColor}" is not hexColor`,filePath:c});try{(0,checkAppFields_1.checkComponentPath)({project:o,miniprogramRoot:a,inputJSON:t,filePath:`${e}.json`})}catch(o){(0,common_2.throwError)({msg:`["extPages"]["${e}"]${o.message}`,filePath:c})}}}}exports.getExtJSON=(0,reactiveCache_1.wrapCompileJSONFunc)(cache_1.CACHE_KEY.EXT_JSON,(e=>{const o=(0,projectconfig_1.getProjectConfigJSON)(e),{miniprogramRoot:t=""}=o,c=e.attrSync(),a="ext.json",i=(0,tools_1.normalizePath)(path_1.default.posix.join(t,a));if(!e.exists(i))return;if(!c||!c.platform)return e.stat(t,a)?{__warning__:locales_1.default.config.EXT_JSON_INVALID.format(e.appid,"https://developers.weixin.qq.com/miniprogram/dev/devtools/ext.html")}:void 0;if(!e.stat(t,a))return;const r=e.getFile(t,a),n=(0,common_1.checkJSONFormat)((0,common_2.checkUTF8)(r,i),i);if(!n.extEnable)return{};const l=(0,theme_1.getThemeLocation)(e);let s={};l&&(s=(0,theme_1.checkThemeJSON)(e,{themeLocation:l}));const h=(0,theme_1.mergeThemeJSONToAppJSON)(s,n),p=(0,schemaValidate_1.schemaValidate)("ext",h.appJSONLight),_=(0,schemaValidate_1.schemaValidate)("ext",h.appJSONDark);p.warning&&(n.__warning__=locales_1.default.config.INVALID.format(p.warning)),_.warning&&(n.__warning__=locales_1.default.config.INVALID.format(_.warning)),(0,schemaValidate_1.transValidateResult)(i,p),(0,schemaValidate_1.transValidateResult)(i,_),n.extAppid||(0,common_2.throwError)({msg:`${locales_1.default.config.EXT_APPID_SHOULD_NOT_BE_EMPTY}`,filePath:i});const m={filePath:i,project:e,miniprogramRoot:t,inputJSON:n},g=(0,lodash_1.cloneDeep)(m);g.inputJSON=h.appJSONLight,g.mode="light";const d=(0,lodash_1.cloneDeep)(m);return d.inputJSON=h.appJSONDark,d.mode="dark",(0,checkAppFields_1.checkMainPkgPages)(m),(0,checkAppFields_1.checkMainPkgPages)(m),(0,checkAppFields_1.checkSubpackages)(m),(0,checkAppFields_1.checkTabbar)(g),(0,checkAppFields_1.checkTabbar)(d),(0,checkAppFields_1.checkWorkers)(m),(0,checkAppFields_1.checkFunctionalPages)(m),(0,checkAppFields_1.checkOpenLocationPagePath)(m),(0,checkAppFields_1.checkPlugins)(m),(0,checkAppFields_1.checkWindow)(g),(0,checkAppFields_1.checkWindow)(d),(0,checkAppFields_1.checkComponentPath)(m),checkExtPages(m),n}));
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getExtJSON=exports.getAppJSON=void 0;const tslib_1=require("tslib"),path_1=tslib_1.__importDefault(require("path")),lodash_1=require("lodash"),cache_1=require("../../../../../utils/cache"),projectconfig_1=require("../projectconfig"),common_1=require("../../../../../utils/common"),locales_1=tslib_1.__importDefault(require("../../../../../utils/locales/locales")),theme_1=require("../theme"),reactiveCache_1=require("../reactiveCache"),tools_1=require("../../../../../utils/tools"),appJSON_1=require("./appJSON"),extJSON_1=require("./extJSON");function mergeExtJSON(e,t){if(t)for(const o in t)if("__warning__"!==o){if("extPages"!==o){if("plugins"===o||"supportedMaterials"===o){e[o]=t[o];continue}"object"===(0,tools_1.getType)(t[o])?"object"!==(0,tools_1.getType)(e[o])?e[o]=Object.assign({},t[o]):e[o]=Object.assign({},e[o]||{},t[o]):e[o]=t[o]}}else e.__warning__=e.__warning__?`${e.__warning__}、${t.__warning__}`:t.__warning__}exports.getAppJSON=(0,reactiveCache_1.wrapCompileJSONFunc)(cache_1.CACHE_KEY.COMPILED_APP_JSON,e=>{const t=(0,projectconfig_1.getProjectConfigJSON)(e),{miniprogramRoot:o=""}=t;let r=(0,appJSON_1.getAppJSON)(e);const i=(0,extJSON_1.getExtJSON)(e);if(i&&(r=(0,lodash_1.cloneDeep)(r),mergeExtJSON(r,i),i.extEnable))try{const t=(0,theme_1.getThemeLocation)(e);let i={};t&&(i=(0,theme_1.checkThemeJSON)(e,{themeLocation:t}));const _=(0,theme_1.mergeThemeJSONToAppJSON)(i,r);(0,appJSON_1.checkAppJSON)({project:e,miniprogramRoot:o,inputJSON:_.appJSONLight,filePath:path_1.default.posix.join(o,"app.json")}),(0,appJSON_1.checkAppJSON)({project:e,miniprogramRoot:o,inputJSON:_.appJSONDark,filePath:path_1.default.posix.join(o,"app.json")})}catch(e){(0,common_1.throwError)({msg:e.message,code:e.code,filePath:`app.json ${locales_1.default.config.OR} ext.json`})}return r});var extJSON_2=require("./extJSON");Object.defineProperty(exports,"getExtJSON",{enumerable:!0,get:function(){return extJSON_2.getExtJSON}});
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getExtJSON=exports.getAppJSON=void 0;const tslib_1=require("tslib"),path_1=tslib_1.__importDefault(require("path")),lodash_1=require("lodash"),cache_1=require("../../../../../utils/cache"),projectconfig_1=require("../projectconfig"),common_1=require("../../../../../utils/common"),locales_1=tslib_1.__importDefault(require("../../../../../utils/locales/locales")),theme_1=require("../theme"),reactiveCache_1=require("../reactiveCache"),tools_1=require("../../../../../utils/tools"),appJSON_1=require("./appJSON"),extJSON_1=require("./extJSON");function mergeExtJSON(e,t){if(t)for(const o in t)if("__warning__"!==o){if("extPages"!==o){if("plugins"===o||"supportedMaterials"===o){e[o]=t[o];continue}"object"===(0,tools_1.getType)(t[o])?"object"!==(0,tools_1.getType)(e[o])?e[o]=Object.assign({},t[o]):e[o]=Object.assign({},e[o]||{},t[o]):e[o]=t[o]}}else e.__warning__=e.__warning__?`${e.__warning__}、${t.__warning__}`:t.__warning__}exports.getAppJSON=(0,reactiveCache_1.wrapCompileJSONFunc)(cache_1.CACHE_KEY.COMPILED_APP_JSON,(e=>{const t=(0,projectconfig_1.getProjectConfigJSON)(e),{miniprogramRoot:o=""}=t;let r=(0,appJSON_1.getAppJSON)(e);const i=(0,extJSON_1.getExtJSON)(e);if(i&&(r=(0,lodash_1.cloneDeep)(r),mergeExtJSON(r,i),i.extEnable))try{const t=(0,theme_1.getThemeLocation)(e);let i={};t&&(i=(0,theme_1.checkThemeJSON)(e,{themeLocation:t}));const _=(0,theme_1.mergeThemeJSONToAppJSON)(i,r);(0,appJSON_1.checkAppJSON)({project:e,miniprogramRoot:o,inputJSON:_.appJSONLight,filePath:path_1.default.posix.join(o,"app.json")}),(0,appJSON_1.checkAppJSON)({project:e,miniprogramRoot:o,inputJSON:_.appJSONDark,filePath:path_1.default.posix.join(o,"app.json")})}catch(e){(0,common_1.throwError)({msg:e.message,code:e.code,filePath:`app.json ${locales_1.default.config.OR} ext.json`})}return r}));var extJSON_2=require("./extJSON");Object.defineProperty(exports,"getExtJSON",{enumerable:!0,get:function(){return extJSON_2.getExtJSON}});
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getPageJSONVariableDecalearProperty=exports.checkComponentPath=exports.getUseExtendLib=exports.checkFilePathIsInIndependentSubpackage=exports.checkPagePathIsInIndependentSubpackage=exports.checkPagePathIsInSubPackage=exports.checkJSONFormat=void 0;const tslib_1=require("tslib"),path_1=tslib_1.__importDefault(require("path")),lodash_1=require("lodash"),tools_1=require("../../../../utils/tools"),locales_1=tslib_1.__importDefault(require("../../../../utils/locales/locales")),common_1=require("../../../../utils/common"),config_1=require("../../../../config/config"),appJSON_1=require("./app/appJSON");function checkJSONFormat(e,t){let o={};e||(0,common_1.throwError)({filePath:t,msg:"Empty file is NOT a valid json file",code:config_1.JSON_PARSE_ERR});try{o=JSON.parse(e)}catch(o){const n=(0,tools_1.formatJSONParseErr)({filePath:t,data:e,error:o});(0,common_1.throwError)({filePath:t,msg:n,code:config_1.JSON_PARSE_ERR})}return o}function checkPagePathIsInSubPackage(e,t){const{subPackages:o,subpackages:n}=e;if(o||n)for(const e of o||n)if(t.startsWith(e.root))return e}function checkPagePathIsInIndependentSubpackage(e,t){const o=checkPagePathIsInSubPackage(e,t);if(o&&!0===o.independent)return o}function checkFilePathIsInIndependentSubpackage(e,t){const{subPackages:o}=e;if(o)for(const e of o)if(!0===e.independent){const o=e.root.replace(/^\//,"");if(t.startsWith(o))return o}}function checkNodeModulesFile2(e,t,o){var n,a;for(const i of o){const o=i+".json",r=i+".wxml";if((null===(n=e.stat(t,o))||void 0===n?void 0:n.isFile)&&(null===(a=e.stat(t,r))||void 0===a?void 0:a.isFile))return i}return""}function resolveComponentPath2(e,t,o,n){n=(0,tools_1.normalizePath)(n);const a=[path_1.default.posix.join(o,n),path_1.default.posix.join(o,n,"index")];let i=o.split(path_1.default.posix.sep);for(i=i.filter(e=>!!e);i.length;){const e=[path_1.default.posix.join(i.join(path_1.default.posix.sep),"miniprogram_npm",n),path_1.default.posix.join(i.join(path_1.default.posix.sep),"miniprogram_npm",n,"index")];a.push(...e),i.pop()}const r=[path_1.default.posix.join("miniprogram_npm",n),path_1.default.posix.join("miniprogram_npm",n,"index")];a.push(...r);const s=checkNodeModulesFile2(e,t,a);return s?{searchedPaths:a,requirePath:path_1.default.posix.relative(o,s)}:{searchedPaths:a,requirePath:""}}exports.checkJSONFormat=checkJSONFormat,exports.checkPagePathIsInSubPackage=checkPagePathIsInSubPackage,exports.checkPagePathIsInIndependentSubpackage=checkPagePathIsInIndependentSubpackage,exports.checkFilePathIsInIndependentSubpackage=checkFilePathIsInIndependentSubpackage;const innerCheckComponentPath=e=>{const{value:t,tips:o,project:n,root:a,relativePath:i}=e,r=`${o}: "${t}"`,s=path_1.default.posix.join(a,i);if(t.startsWith("plugin://")||t.startsWith("plugin-private://"))return t;const c=e=>n.stat(a,e+".json")&&n.stat(a,e+".wxml"),p=(0,exports.getUseExtendLib)(n,i);if(t.startsWith("/")){if(p.length){const e=p.map(e=>"/miniprogram_npm/"+e);let o=!1;for(const n of e)if(t.startsWith(n)){o=!0;break}if(o)return t}if(c(t))return t;if(c(t+"/index"))return t+"/index";(0,common_1.throwError)({msg:locales_1.default.config.COMPONENT_NOT_FOUND.format(r,path_1.default.posix.join(n.projectPath,a,t)),filePath:s})}if(t.startsWith(".")){if(t.startsWith("../")){const e=t.replace(/^(\.\.\/)+/,"");if(c("/"+e))return t;if(c(`/${e}/index`))return t+"/index"}if(c(path_1.default.posix.join(path_1.default.posix.dirname(i),""+t)))return t;if(c(path_1.default.posix.join(path_1.default.posix.dirname(i),t+"/index")))return t+"/index";(0,common_1.throwError)({msg:locales_1.default.config.COMPONENT_NOT_FOUND.format(r,path_1.default.posix.join(n.projectPath,a,path_1.default.posix.dirname(i),t)),filePath:s})}for(const e of p)if(t.startsWith(e))return"miniprogram-element"===e?`/miniprogram_npm/${e}/index`:t.replace(e,"/miniprogram_npm/"+e);const l=resolveComponentPath2(n,a,path_1.default.posix.dirname(i),t);l.requirePath||(0,common_1.throwError)({msg:locales_1.default.config.COMPONENT_NOT_FOUND.format(r,l.searchedPaths.map(e=>path_1.default.posix.join(n.projectPath,a,e)).join("\n")),filePath:s});const h=l.requirePath||"";return h.startsWith(".")?h:"./"+h},getUseExtendLib=(e,t)=>{var o;const n=(0,appJSON_1.getRawAppJSON)(e);let a=[];if("[object Object]"===Object.prototype.toString.call(n.useExtendedLib)){const e=Object.keys(config_1.extendedLibMap),t=Object.keys(n.useExtendedLib).filter(t=>!e.includes(t));t.length&&(0,common_1.throwError)({msg:t.join(", ")+' is not allowed in ["useExtendedLib"]',filePath:"app.json"}),a=Object.keys(n.useExtendedLib||{}).filter(e=>n.useExtendedLib[e]).map(e=>config_1.extendedLibMap[e].packages),a=(0,lodash_1.flattenDeep)(a)}const i=checkPagePathIsInSubPackage(n,t);if((null==i?void 0:i.useExtendedLib)&&"[object Object]"===Object.prototype.toString.call(i.useExtendedLib)){const e=Object.keys(config_1.extendedLibMap),t=Object.keys(i.useExtendedLib).filter(t=>!e.includes(t));t.length&&(0,common_1.throwError)({msg:`${t.join(", ")} is not allowed in subPackages[${null===(o=n.subPackages)||void 0===o?void 0:o.indexOf(i)}]["useExtendedLib"]`,filePath:"app.json"});const r=Object.keys(i.useExtendedLib||{}).filter(e=>i.useExtendedLib[e]).map(e=>config_1.extendedLibMap[e].packages);a=(0,lodash_1.uniq)(a.concat((0,lodash_1.flattenDeep)(r)))}return a};exports.getUseExtendLib=getUseExtendLib;const checkComponentPath=e=>{const{project:t,root:o,relativePath:n,inputJSON:a}=e,{usingComponents:i,componentGenerics:r}=a;if(i)for(const e in i){const a=i[e]||"";i[e]=innerCheckComponentPath({tips:`["usingComponents"]["${e}"]`,value:a,project:t,root:o,relativePath:n})}if(r)for(const e in r){const a="object"==typeof r[e],i=a?r[e].default:r[e];if(!i||"string"!=typeof i)continue;const s=innerCheckComponentPath({tips:`["componentGenerics"]["${e}"]`,value:i,project:t,root:o,relativePath:n});a?r[e].default=s:r[e]=s}};function getPageJSONVariableDecalearProperty(e){const{windowPropertWhiteList:t}=config_1.jsonVariablePropertyWhiteList;let o=[];return"[object Object]"===Object.prototype.toString.call(e)&&(o=o.concat(Object.keys(e).filter(e=>t.includes(e)).map(t=>({property:`["${t}"]`,value:e[t]})).filter(e=>e.value.startsWith("@")))),o}exports.checkComponentPath=checkComponentPath,exports.getPageJSONVariableDecalearProperty=getPageJSONVariableDecalearProperty;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.checkComponentPath=exports.getUseExtendLib=void 0,exports.checkJSONFormat=checkJSONFormat,exports.checkPagePathIsInSubPackage=checkPagePathIsInSubPackage,exports.checkPagePathIsInIndependentSubpackage=checkPagePathIsInIndependentSubpackage,exports.checkFilePathIsInIndependentSubpackage=checkFilePathIsInIndependentSubpackage,exports.getPageJSONVariableDecalearProperty=getPageJSONVariableDecalearProperty;const tslib_1=require("tslib"),path_1=tslib_1.__importDefault(require("path")),lodash_1=require("lodash"),tools_1=require("../../../../utils/tools"),locales_1=tslib_1.__importDefault(require("../../../../utils/locales/locales")),common_1=require("../../../../utils/common"),config_1=require("../../../../config/config"),appJSON_1=require("./app/appJSON");function checkJSONFormat(e,t){let o={};e||(0,common_1.throwError)({filePath:t,msg:"Empty file is NOT a valid json file",code:config_1.JSON_PARSE_ERR});try{o=JSON.parse(e)}catch(o){const n=(0,tools_1.formatJSONParseErr)({filePath:t,data:e,error:o});(0,common_1.throwError)({filePath:t,msg:n,code:config_1.JSON_PARSE_ERR})}return o}function checkPagePathIsInSubPackage(e,t){const{subPackages:o,subpackages:n}=e;if(o||n)for(const e of o||n)if(t.startsWith(e.root))return e}function checkPagePathIsInIndependentSubpackage(e,t){const o=checkPagePathIsInSubPackage(e,t);if(o&&!0===o.independent)return o}function checkFilePathIsInIndependentSubpackage(e,t){const{subPackages:o}=e;if(o)for(const e of o)if(!0===e.independent){const o=e.root.replace(/^\//,"");if(t.startsWith(o))return o}}function checkNodeModulesFile2(e,t,o){var n,a;for(const i of o){const o=`${i}.json`,r=`${i}.wxml`;if((null===(n=e.stat(t,o))||void 0===n?void 0:n.isFile)&&(null===(a=e.stat(t,r))||void 0===a?void 0:a.isFile))return i}return""}function resolveComponentPath2(e,t,o,n){n=(0,tools_1.normalizePath)(n);const a=[path_1.default.posix.join(o,n),path_1.default.posix.join(o,n,"index")];let i=o.split(path_1.default.posix.sep);for(i=i.filter((e=>!!e));i.length;){const e=[path_1.default.posix.join(i.join(path_1.default.posix.sep),"miniprogram_npm",n),path_1.default.posix.join(i.join(path_1.default.posix.sep),"miniprogram_npm",n,"index")];a.push(...e),i.pop()}const r=[path_1.default.posix.join("miniprogram_npm",n),path_1.default.posix.join("miniprogram_npm",n,"index")];a.push(...r);const s=checkNodeModulesFile2(e,t,a);return s?{searchedPaths:a,requirePath:path_1.default.posix.relative(o,s)}:{searchedPaths:a,requirePath:""}}const innerCheckComponentPath=e=>{const{value:t,tips:o,project:n,root:a,relativePath:i}=e,r=`${o}: "${t}"`,s=path_1.default.posix.join(a,i);if(t.startsWith("plugin://")||t.startsWith("plugin-private://"))return t;const c=e=>n.stat(a,`${e}.json`)&&n.stat(a,`${e}.wxml`),p=(0,exports.getUseExtendLib)(n,i);if(t.startsWith("/")){if(p.length){const e=p.map((e=>`/miniprogram_npm/${e}`));let o=!1;for(const n of e)if(t.startsWith(n)){o=!0;break}if(o)return t}if(c(t))return t;if(c(`${t}/index`))return`${t}/index`;(0,common_1.throwError)({msg:locales_1.default.config.COMPONENT_NOT_FOUND.format(r,path_1.default.posix.join(n.projectPath,a,t)),filePath:s})}if(t.startsWith(".")){if(t.startsWith("../")){const e=t.replace(/^(\.\.\/)+/,"");if(c(`/${e}`))return t;if(c(`/${e}/index`))return`${t}/index`}if(c(path_1.default.posix.join(path_1.default.posix.dirname(i),`${t}`)))return t;if(c(path_1.default.posix.join(path_1.default.posix.dirname(i),`${t}/index`)))return`${t}/index`;(0,common_1.throwError)({msg:locales_1.default.config.COMPONENT_NOT_FOUND.format(r,path_1.default.posix.join(n.projectPath,a,path_1.default.posix.dirname(i),t)),filePath:s})}for(const e of p)if(t.startsWith(e))return"miniprogram-element"===e?`/miniprogram_npm/${e}/index`:t.replace(e,`/miniprogram_npm/${e}`);const l=resolveComponentPath2(n,a,path_1.default.posix.dirname(i),t);l.requirePath||(0,common_1.throwError)({msg:locales_1.default.config.COMPONENT_NOT_FOUND.format(r,l.searchedPaths.map((e=>path_1.default.posix.join(n.projectPath,a,e))).join("\n")),filePath:s});const d=l.requirePath||"";return d.startsWith(".")?d:`./${d}`},getUseExtendLib=(e,t)=>{var o;const n=(0,appJSON_1.getRawAppJSON)(e);let a=[];if("[object Object]"===Object.prototype.toString.call(n.useExtendedLib)){const e=Object.keys(config_1.extendedLibMap),t=Object.keys(n.useExtendedLib).filter((t=>!e.includes(t)));t.length&&(0,common_1.throwError)({msg:`${t.join(", ")} is not allowed in ["useExtendedLib"]`,filePath:"app.json"}),a=Object.keys(n.useExtendedLib||{}).filter((e=>n.useExtendedLib[e])).map((e=>config_1.extendedLibMap[e].packages)),a=(0,lodash_1.flattenDeep)(a)}const i=checkPagePathIsInSubPackage(n,t);if((null==i?void 0:i.useExtendedLib)&&"[object Object]"===Object.prototype.toString.call(i.useExtendedLib)){const e=Object.keys(config_1.extendedLibMap),t=Object.keys(i.useExtendedLib).filter((t=>!e.includes(t)));t.length&&(0,common_1.throwError)({msg:`${t.join(", ")} is not allowed in subPackages[${null===(o=n.subPackages)||void 0===o?void 0:o.indexOf(i)}]["useExtendedLib"]`,filePath:"app.json"});const r=Object.keys(i.useExtendedLib||{}).filter((e=>i.useExtendedLib[e])).map((e=>config_1.extendedLibMap[e].packages));a=(0,lodash_1.uniq)(a.concat((0,lodash_1.flattenDeep)(r)))}return a};exports.getUseExtendLib=getUseExtendLib;const checkComponentPath=e=>{const{project:t,root:o,relativePath:n,inputJSON:a}=e,{usingComponents:i,componentGenerics:r}=a;if(i)for(const e in i){const a=i[e]||"";i[e]=innerCheckComponentPath({tips:`["usingComponents"]["${e}"]`,value:a,project:t,root:o,relativePath:n})}if(r)for(const e in r){const a="object"==typeof r[e],i=a?r[e].default:r[e];if(!i||"string"!=typeof i)continue;const s=innerCheckComponentPath({tips:`["componentGenerics"]["${e}"]`,value:i,project:t,root:o,relativePath:n});a?r[e].default=s:r[e]=s}};function getPageJSONVariableDecalearProperty(e){const{windowPropertWhiteList:t}=config_1.jsonVariablePropertyWhiteList;let o=[];return"[object Object]"===Object.prototype.toString.call(e)&&(o=o.concat(Object.keys(e).filter((e=>t.includes(e))).map((t=>({property:`["${t}"]`,value:e[t]}))).filter((e=>e.value.startsWith("@"))))),o}exports.checkComponentPath=checkComponentPath;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});const tslib_1=require("tslib"),path_1=tslib_1.__importDefault(require("path")),cache_1=require("../../../../utils/cache"),common_1=require("../../../../utils/common"),config_1=require("../../../../config/config"),tools_1=require("../../../../utils/tools"),locales_1=tslib_1.__importDefault(require("../../../../utils/locales/locales")),schemaValidate_1=require("../validate/schemaValidate"),signaturejson_1=tslib_1.__importDefault(require("../validate/signaturejson")),gamepluginjson_1=tslib_1.__importDefault(require("../validate/gamepluginjson")),projectconfig_1=require("./projectconfig"),common_2=require("./common"),reactiveCache_1=require("./reactiveCache");function isPluginMode(o){return o.type===config_1.COMPILE_TYPE.miniGamePlugin}function checkLocalPlugin(o,t){const{project:e,root:a,filePath:i}=o,r=t.path;let n=e.stat(a,r);n&&n.isDirectory||(0,common_1.throwError)({msg:locales_1.default.config.JSON_CONTENT_SHOULD_BE.format(t.tips+'["path"]',locales_1.default.config.DIRECTORY),filePath:i});const c=path_1.default.posix.join(r,"signature.json");n=e.stat(a,c);let s=(0,tools_1.normalizePath)(path_1.default.posix.join(a,c));n||(0,common_1.throwError)({msg:locales_1.default.config.CORRESPONDING_FILE_NOT_FOUND.format(t.tips+'["path"]',s),filePath:i,code:config_1.FILE_NOT_FOUND});let _=e.getFile(a,c),l=(0,common_1.checkUTF8)(_,s);const f=(0,common_2.checkJSONFormat)(l,s);try{signaturejson_1.default.check(f)}catch(o){(0,common_1.throwError)({msg:"signature.json"+o.message,filePath:s})}f.provider!==t.provider&&(0,common_1.throwError)({msg:locales_1.default.config.JSON_CONTENT_SHOULD_BE.format('["provider"]',`"${t.provider}"`),filePath:s});for(let o=0;o<f.signature.length;o++){const t=f.signature[o];(0,common_1.checkPath)({value:t.path,tips:`["signature"][${o}]["path"]`,filePath:s});const i=path_1.default.posix.join(r,t.path);n=e.stat(a,i),n&&n.isFile||(0,common_1.throwError)({msg:locales_1.default.config.CORRESPONDING_FILE_NOT_FOUND.format(`["signature"][${o}]["path"]`,i),filePath:s,code:config_1.FILE_NOT_FOUND});const c=e.getFile(a,i),_=(0,tools_1.generateMD5)(c);_!==t.md5&&(0,common_1.throwError)({msg:locales_1.default.config.GAME_PLUGIN_SIGNATURE_MD5_NOT_MATCH_CONTENT.format(path_1.default.posix.join(r,t.path),_,t.md5),code:config_1.GAME_PLUGIN_LIB_MD5_NOT_MATCH,filePath:s})}const g=path_1.default.posix.join(r,"plugin.json");n=e.stat(a,g),s=(0,tools_1.normalizePath)(path_1.default.posix.join(a,g)),n||(0,common_1.throwError)({msg:locales_1.default.config.CORRESPONDING_FILE_NOT_FOUND.format(t.tips+'["path"]',s),code:config_1.FILE_NOT_FOUND,filePath:i}),_=e.getFile(a,g),l=(0,common_1.checkUTF8)(_,s);const u=(0,common_2.checkJSONFormat)(l,s);try{gamepluginjson_1.default.check(u)}catch(o){(0,common_1.throwError)({msg:"plugin.json"+o.message,filePath:s})}u.main&&((0,common_1.checkPath)({value:u.main,tips:'["main"]',filePath:s}),n=e.stat(a,path_1.default.posix.join(r,u.main)),n||(0,common_1.throwError)({msg:locales_1.default.config.CORRESPONDING_FILE_NOT_FOUND.format('["main"]',""+u.main),filePath:s,code:config_1.FILE_NOT_FOUND}))}function checkPluginPath(o,t){const{subPackages:e}=t,a=[],i=(o,t,e)=>{const{plugins:i}=o;if(i)for(const o in i){if(!i.hasOwnProperty(o))continue;const r=i[o];r&&r.path&&a.push({alias:o,version:r.version||"",provider:r.provider||"",tips:`${e}["plugins"]["${o}"]`,path:(0,tools_1.normalizePath)(path_1.default.posix.join(t,r.path))})}};if(i(t,"",""),e)for(let o=0;o<e.length;o++){const t=e[o];i(t,t.root||"",`["subPackages"][${o}]`)}if(!(a.length<=0))for(const t of a)checkLocalPlugin(o,t)}function checkPlugins(o,t){const{project:e,filePath:a}=o,i=[],r=t.plugins||{};function n(o,t){const{appid:r}=e,n=isPluginMode(e),c=(0,projectconfig_1.getProjectConfigJSON)(e),s=(null==c?void 0:c.pluginAppid)||r;if(n||"dev"!==o.version)if(n&&"dev"===o.version&&o.provider!==s)i.push(locales_1.default.config.JSON_CONTENT_SHOULD_BE.format(t+'["provider"]',s));else if("dev"!==o.version||"string"!=typeof o.path){if("dev"===o.version||"latest"===o.version||/^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$/.test(o.version)||/^dev-[A-Za-z0-9]+$/.test(o.version))return o.path&&(0,common_1.checkPath)({value:o.path,tips:t+'["path"]',filePath:a}),!0;i.push(locales_1.default.config.JSON_CONTENT_SHOULD_BE.format(t+'["version"]',locales_1.default.config.TRIPLE_NUMBER_DOT))}else i.push(locales_1.default.config.GAME_DEV_PLUGIN_SHOULD_NOT_USE_LOCAL_PATH.format(t,t+'["path"]'));else i.push(`${locales_1.default.config.JSON_CONTENT_SHOULD_NOT_BE.format(t+'["version"]',"dev")}\n${locales_1.default.config.PLEASE_CHOOSE_PLUGIN_MODE}`)}const c={},s={};for(const o in r){if(!r.hasOwnProperty(o))continue;const t=r[o];n(t,`["plugins"]["${o}"]`)&&(c[t.provider]?i.push(locales_1.default.config.SAME_ITEM.format(`["plugins"]["${o}"]`,c[t.provider].tips,"provider")):c[t.provider]=s[o]={provider:t.provider,version:t.version,alias:o,path:t.path||"",tips:`["plugins"]["${o}"]`})}const _=t.subPackages||t.subpackages;if(Array.isArray(_))for(let o=0,t=_.length;o<t;o++){const t=_[o];if(!t.plugins)continue;const e=`["subPackages"][${o}]["plugins"]`;for(const o in t.plugins){const a=t.plugins[o],r=`${e}["${o}"]`;n(a,r)&&(c[a.provider]?i.push(locales_1.default.config.SAME_ITEM.format(r,c[a.provider].tips,"provider")):s[o]?i.push(locales_1.default.config.PLUGINS_SAME_ALIAS.format(r,s[o].tips)):c[a.provider]=s[o]={provider:a.provider,version:a.version,alias:o,path:a.path||"",tips:r})}}i.length>0&&(0,common_1.throwError)({msg:i.join("\n"),filePath:a})}function checkSubpackages(o,t){const{root:e,project:a,filePath:i}=o,r=[];let n='["subPackages"]';if(t.subpackages&&(n='["subpackages"]',t.subPackages=t.subpackages,delete t.subpackages),t.subPackages){const o=a.attrSync(),{setting:c}=o;t.subPackages.length>c.MaxSubPackageLimit&&(0,common_1.throwError)({msg:locales_1.default.config.EXCEED_LIMIT.format([n,c.MaxSubPackageLimit]),filePath:i});const s={},_={};for(let o=0,i=t.subPackages.length;o<i;o++){const i=t.subPackages[o];if(i.name){if(i.name===config_1.MINI_PROGRAM_MAIN_PACKAGE_ROOT){r.push(locales_1.default.config.JSON_CONTENT_SHOULD_NOT_BE.format(`${n}[${o}]["name"]`,config_1.MINI_PROGRAM_MAIN_PACKAGE_ROOT));continue}if(i.name===config_1.MINI_GAME_MAIN_PACKAGE_ROOT){r.push(locales_1.default.config.JSON_CONTENT_SHOULD_NOT_BE.format(`${n}[${o}]["name"]`,config_1.MINI_GAME_MAIN_PACKAGE_ROOT));continue}s[i.name]&&r.push(locales_1.default.config.SAME_ITEM.format(`${n}[${o}]`,s[i.name],"name")),s[i.name]=`${n}[${o}]`}if(i.root===config_1.MINI_PROGRAM_MAIN_PACKAGE_ROOT){r.push(locales_1.default.config.JSON_CONTENT_SHOULD_NOT_BE.format(`${n}[${o}]["root"]`,config_1.MINI_PROGRAM_MAIN_PACKAGE_ROOT));continue}if(i.root===config_1.MINI_GAME_MAIN_PACKAGE_ROOT){r.push(locales_1.default.config.JSON_CONTENT_SHOULD_NOT_BE.format(`${n}[${o}]["root"]`,config_1.MINI_GAME_MAIN_PACKAGE_ROOT));continue}if(i.root===config_1.MINI_GAME_WORKERS_PACKAGE_ROOT){r.push(locales_1.default.config.JSON_CONTENT_SHOULD_NOT_BE.format(`${n}[${o}]["root"]`,config_1.MINI_GAME_WORKERS_PACKAGE_ROOT));continue}if(i.root==="/"+config_1.MINI_GAME_WORKERS_PACKAGE_ROOT){r.push(locales_1.default.config.JSON_CONTENT_SHOULD_NOT_BE.format(`${n}[${o}]["root"]`,"/"+config_1.MINI_GAME_WORKERS_PACKAGE_ROOT));continue}if(i.root.startsWith(".")){r.push(locales_1.default.config.JSON_SHOULD_NOT_START_WITH.format(`${n}[${o}]["root"]`,"."));continue}if(i.root.startsWith("__wx__")){r.push(locales_1.default.config.JSON_SHOULD_NOT_START_WITH.format(`${n}[${o}]["root"]`,"__wx__"));continue}i.root.startsWith("/")||(i.root=(0,tools_1.normalizePath)("/"+i.root)),i.root.endsWith(".js")?i.root=(0,tools_1.normalizePath)(i.root):i.root=(0,tools_1.normalizePath)(i.root+"/"),_[i.root]&&r.push(locales_1.default.config.SAME_ITEM.format(`${n}[${o}]`,_[i.root],"root")),_[i.root]=`${n}[${o}]`;const c=a.stat(e,i.root);if(c){if(c.isDirectory){i.root.endsWith("/")||(i.root+="/");const t=path_1.default.posix.join(i.root,"./game.js"),c=a.stat(e,t);c&&c.isFile||r.push(locales_1.default.config.CORRESPONDING_FILE_NOT_FOUND.format(`${n}[${o}]["root"]`,t))}}else r.push(locales_1.default.config.JSON_CONTENT_NOT_FOUND.format(`${n}[${o}]["root"]`))}}r.length>0&&(0,common_1.throwError)({msg:r.join("\n"),filePath:i})}function checkLoadingImageUrl(o,t){const{project:e,root:a,filePath:i}=o,{loadingImageInfo:r}=t;if(!r)return;(0,common_1.checkPath)({tips:'["loadingImageInfo"]["path"]',value:r.path,filePath:i});const n=e.stat(a,r.path);n&&n.isFile||(0,common_1.throwError)({msg:locales_1.default.config.JSON_CONTENT_NOT_FOUND.format(`["loadingImageInfo"]["path"]: "${r.path}"`),filePath:i}),r.progressBarColor&&!(0,tools_1.isHexColor)(r.progressBarColor)&&(0,common_1.throwError)({msg:locales_1.default.config.JSON_CONTENT_SHOULD_BE.format(`["loadingImageInfo"]["progressBarColor"]: "${r.progressBarColor}"`,"HexColor"),filePath:i})}function checkWorkers(o,t){const{project:e,root:a,filePath:i}=o,{workers:r}=t;if(void 0===r)return;const n=(0,tools_1.getWorkersPath)(r);(0,common_1.checkPath)({tips:'["workers"]',value:n,filePath:i});const c=e.stat(a,n);c&&!c.isFile||(0,common_1.throwError)({msg:locales_1.default.config.JSON_CONTENT_SHOULD_BE.format(['["workers"]',locales_1.default.config.DIRECTORY]),filePath:i})}function checkOpenDataContext(o,t){const{project:e,root:a,filePath:i}=o,{openDataContext:r}=t;if(void 0===r)return;(0,common_1.checkPath)({value:r,tips:'["openDataContext"]',filePath:i});const n=e.stat(a,r);n&&n.isDirectory||(0,common_1.throwError)({msg:locales_1.default.config.JSON_CONTENT_SHOULD_BE.format(['["openDataContext"]',locales_1.default.config.DIRECTORY]),filePath:i});const c=path_1.default.posix.join(r,"./index.js"),s=e.stat(a,c);s&&s.isFile||(0,common_1.throwError)({msg:locales_1.default.config.CORRESPONDING_FILE_NOT_FOUND.format('["openDataContext"]',c),filePath:i}),t.openDataContext=(0,tools_1.normalizePath)(r+"/")}function checkGameJSON(o){const{project:t,root:e,filePath:a}=o;t.stat(e,"game.json")||(0,common_1.throwError)({msg:locales_1.default.config.FILE_NOT_FOUND.format(path_1.default.posix.join(a)),filePath:a,code:config_1.FILE_NOT_FOUND});const i=t.getFile(e,"game.json"),r=(0,common_2.checkJSONFormat)((0,common_1.checkUTF8)(i,a),a),n=(0,schemaValidate_1.schemaValidate)("game",r);return n.warning&&(r.__warning__=locales_1.default.config.INVALID.format(n.warning)),(0,schemaValidate_1.transValidateResult)(a,n),checkOpenDataContext(o,r),checkPlugins(o,r),checkSubpackages(o,r),checkPluginPath(o,r),checkLoadingImageUrl(o,r),checkWorkers(o,r),r}const getGameJSON=(0,reactiveCache_1.wrapCompileJSONFunc)(cache_1.CACHE_KEY.GAME_JSON,o=>{const t=(0,projectconfig_1.getProjectConfigJSON)(o).miniprogramRoot||"";return checkGameJSON({project:o,root:t,filePath:(0,tools_1.normalizePath)(path_1.default.posix.join(t,"game.json"))})});exports.default=getGameJSON;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});const tslib_1=require("tslib"),path_1=tslib_1.__importDefault(require("path")),cache_1=require("../../../../utils/cache"),common_1=require("../../../../utils/common"),config_1=require("../../../../config/config"),tools_1=require("../../../../utils/tools"),locales_1=tslib_1.__importDefault(require("../../../../utils/locales/locales")),schemaValidate_1=require("../validate/schemaValidate"),signaturejson_1=tslib_1.__importDefault(require("../validate/signaturejson")),gamepluginjson_1=tslib_1.__importDefault(require("../validate/gamepluginjson")),projectconfig_1=require("./projectconfig"),common_2=require("./common"),reactiveCache_1=require("./reactiveCache");function isPluginMode(o){return o.type===config_1.COMPILE_TYPE.miniGamePlugin}function checkLocalPlugin(o,t){const{project:e,root:a,filePath:i}=o,r=t.path;let n=e.stat(a,r);n&&n.isDirectory||(0,common_1.throwError)({msg:locales_1.default.config.JSON_CONTENT_SHOULD_BE.format(`${t.tips}["path"]`,locales_1.default.config.DIRECTORY),filePath:i});const c=path_1.default.posix.join(r,"signature.json");n=e.stat(a,c);let s=(0,tools_1.normalizePath)(path_1.default.posix.join(a,c));n||(0,common_1.throwError)({msg:locales_1.default.config.CORRESPONDING_FILE_NOT_FOUND.format(`${t.tips}["path"]`,s),filePath:i,code:config_1.FILE_NOT_FOUND});let _=e.getFile(a,c),l=(0,common_1.checkUTF8)(_,s);const f=(0,common_2.checkJSONFormat)(l,s);try{signaturejson_1.default.check(f)}catch(o){(0,common_1.throwError)({msg:`signature.json${o.message}`,filePath:s})}f.provider!==t.provider&&(0,common_1.throwError)({msg:locales_1.default.config.JSON_CONTENT_SHOULD_BE.format('["provider"]',`"${t.provider}"`),filePath:s});for(let o=0;o<f.signature.length;o++){const t=f.signature[o];(0,common_1.checkPath)({value:t.path,tips:`["signature"][${o}]["path"]`,filePath:s});const i=path_1.default.posix.join(r,t.path);n=e.stat(a,i),n&&n.isFile||(0,common_1.throwError)({msg:locales_1.default.config.CORRESPONDING_FILE_NOT_FOUND.format(`["signature"][${o}]["path"]`,i),filePath:s,code:config_1.FILE_NOT_FOUND});const c=e.getFile(a,i),_=(0,tools_1.generateMD5)(c);_!==t.md5&&(0,common_1.throwError)({msg:locales_1.default.config.GAME_PLUGIN_SIGNATURE_MD5_NOT_MATCH_CONTENT.format(path_1.default.posix.join(r,t.path),_,t.md5),code:config_1.GAME_PLUGIN_LIB_MD5_NOT_MATCH,filePath:s})}const u=path_1.default.posix.join(r,"plugin.json");n=e.stat(a,u),s=(0,tools_1.normalizePath)(path_1.default.posix.join(a,u)),n||(0,common_1.throwError)({msg:locales_1.default.config.CORRESPONDING_FILE_NOT_FOUND.format(`${t.tips}["path"]`,s),code:config_1.FILE_NOT_FOUND,filePath:i}),_=e.getFile(a,u),l=(0,common_1.checkUTF8)(_,s);const g=(0,common_2.checkJSONFormat)(l,s);try{gamepluginjson_1.default.check(g)}catch(o){(0,common_1.throwError)({msg:`plugin.json${o.message}`,filePath:s})}g.main&&((0,common_1.checkPath)({value:g.main,tips:'["main"]',filePath:s}),n=e.stat(a,path_1.default.posix.join(r,g.main)),n||(0,common_1.throwError)({msg:locales_1.default.config.CORRESPONDING_FILE_NOT_FOUND.format('["main"]',`${g.main}`),filePath:s,code:config_1.FILE_NOT_FOUND}))}function checkPluginPath(o,t){const{subPackages:e}=t,a=[],i=(o,t,e)=>{const{plugins:i}=o;if(i)for(const o in i){if(!i.hasOwnProperty(o))continue;const r=i[o];r&&r.path&&a.push({alias:o,version:r.version||"",provider:r.provider||"",tips:`${e}["plugins"]["${o}"]`,path:(0,tools_1.normalizePath)(path_1.default.posix.join(t,r.path))})}};if(i(t,"",""),e)for(let o=0;o<e.length;o++){const t=e[o];i(t,t.root||"",`["subPackages"][${o}]`)}if(!(a.length<=0))for(const t of a)checkLocalPlugin(o,t)}function checkPlugins(o,t){const{project:e,filePath:a}=o,i=[],r=t.plugins||{};function n(o,t){const{appid:r}=e,n=isPluginMode(e),c=(0,projectconfig_1.getProjectConfigJSON)(e),s=(null==c?void 0:c.pluginAppid)||r;if(n||"dev"!==o.version)if(n&&"dev"===o.version&&o.provider!==s)i.push(locales_1.default.config.JSON_CONTENT_SHOULD_BE.format(`${t}["provider"]`,s));else if("dev"!==o.version||"string"!=typeof o.path){if("dev"===o.version||"latest"===o.version||/^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$/.test(o.version)||/^dev-[A-Za-z0-9]+$/.test(o.version))return o.path&&(0,common_1.checkPath)({value:o.path,tips:`${t}["path"]`,filePath:a}),!0;i.push(locales_1.default.config.JSON_CONTENT_SHOULD_BE.format(`${t}["version"]`,locales_1.default.config.TRIPLE_NUMBER_DOT))}else i.push(locales_1.default.config.GAME_DEV_PLUGIN_SHOULD_NOT_USE_LOCAL_PATH.format(t,`${t}["path"]`));else i.push(`${locales_1.default.config.JSON_CONTENT_SHOULD_NOT_BE.format(`${t}["version"]`,"dev")}\n${locales_1.default.config.PLEASE_CHOOSE_PLUGIN_MODE}`)}const c={},s={};for(const o in r){if(!r.hasOwnProperty(o))continue;const t=r[o];n(t,`["plugins"]["${o}"]`)&&(c[t.provider]?i.push(locales_1.default.config.SAME_ITEM.format(`["plugins"]["${o}"]`,c[t.provider].tips,"provider")):c[t.provider]=s[o]={provider:t.provider,version:t.version,alias:o,path:t.path||"",tips:`["plugins"]["${o}"]`})}const _=t.subPackages||t.subpackages;if(Array.isArray(_))for(let o=0,t=_.length;o<t;o++){const t=_[o];if(!t.plugins)continue;const e=`["subPackages"][${o}]["plugins"]`;for(const o in t.plugins){const a=t.plugins[o],r=`${e}["${o}"]`;n(a,r)&&(c[a.provider]?i.push(locales_1.default.config.SAME_ITEM.format(r,c[a.provider].tips,"provider")):s[o]?i.push(locales_1.default.config.PLUGINS_SAME_ALIAS.format(r,s[o].tips)):c[a.provider]=s[o]={provider:a.provider,version:a.version,alias:o,path:a.path||"",tips:r})}}i.length>0&&(0,common_1.throwError)({msg:i.join("\n"),filePath:a})}function checkSubpackages(o,t){const{root:e,project:a,filePath:i}=o,r=[];let n='["subPackages"]';if(t.subpackages&&(n='["subpackages"]',t.subPackages=t.subpackages,delete t.subpackages),t.subPackages){const o=a.attrSync(),{setting:c}=o;t.subPackages.length>c.MaxSubPackageLimit&&(0,common_1.throwError)({msg:locales_1.default.config.EXCEED_LIMIT.format([n,c.MaxSubPackageLimit]),filePath:i});const s={},_={};for(let o=0,i=t.subPackages.length;o<i;o++){const i=t.subPackages[o];if(i.name){if(i.name===config_1.MINI_PROGRAM_MAIN_PACKAGE_ROOT){r.push(locales_1.default.config.JSON_CONTENT_SHOULD_NOT_BE.format(`${n}[${o}]["name"]`,config_1.MINI_PROGRAM_MAIN_PACKAGE_ROOT));continue}if(i.name===config_1.MINI_GAME_MAIN_PACKAGE_ROOT){r.push(locales_1.default.config.JSON_CONTENT_SHOULD_NOT_BE.format(`${n}[${o}]["name"]`,config_1.MINI_GAME_MAIN_PACKAGE_ROOT));continue}s[i.name]&&r.push(locales_1.default.config.SAME_ITEM.format(`${n}[${o}]`,s[i.name],"name")),s[i.name]=`${n}[${o}]`}if(i.root===config_1.MINI_PROGRAM_MAIN_PACKAGE_ROOT){r.push(locales_1.default.config.JSON_CONTENT_SHOULD_NOT_BE.format(`${n}[${o}]["root"]`,config_1.MINI_PROGRAM_MAIN_PACKAGE_ROOT));continue}if(i.root===config_1.MINI_GAME_MAIN_PACKAGE_ROOT){r.push(locales_1.default.config.JSON_CONTENT_SHOULD_NOT_BE.format(`${n}[${o}]["root"]`,config_1.MINI_GAME_MAIN_PACKAGE_ROOT));continue}if(i.root===config_1.MINI_GAME_WORKERS_PACKAGE_ROOT){r.push(locales_1.default.config.JSON_CONTENT_SHOULD_NOT_BE.format(`${n}[${o}]["root"]`,config_1.MINI_GAME_WORKERS_PACKAGE_ROOT));continue}if(i.root===`/${config_1.MINI_GAME_WORKERS_PACKAGE_ROOT}`){r.push(locales_1.default.config.JSON_CONTENT_SHOULD_NOT_BE.format(`${n}[${o}]["root"]`,`/${config_1.MINI_GAME_WORKERS_PACKAGE_ROOT}`));continue}if(i.root.startsWith(".")){r.push(locales_1.default.config.JSON_SHOULD_NOT_START_WITH.format(`${n}[${o}]["root"]`,"."));continue}if(i.root.startsWith("__wx__")){r.push(locales_1.default.config.JSON_SHOULD_NOT_START_WITH.format(`${n}[${o}]["root"]`,"__wx__"));continue}i.root.startsWith("/")||(i.root=(0,tools_1.normalizePath)(`/${i.root}`)),i.root.endsWith(".js")?i.root=(0,tools_1.normalizePath)(i.root):i.root=(0,tools_1.normalizePath)(`${i.root}/`),_[i.root]&&r.push(locales_1.default.config.SAME_ITEM.format(`${n}[${o}]`,_[i.root],"root")),_[i.root]=`${n}[${o}]`;const c=a.stat(e,i.root);if(c){if(c.isDirectory){i.root.endsWith("/")||(i.root+="/");const t=path_1.default.posix.join(i.root,"./game.js"),c=a.stat(e,t);c&&c.isFile||r.push(locales_1.default.config.CORRESPONDING_FILE_NOT_FOUND.format(`${n}[${o}]["root"]`,t))}}else r.push(locales_1.default.config.JSON_CONTENT_NOT_FOUND.format(`${n}[${o}]["root"]`))}}r.length>0&&(0,common_1.throwError)({msg:r.join("\n"),filePath:i})}function checkLoadingImageUrl(o,t){const{project:e,root:a,filePath:i}=o,{loadingImageInfo:r}=t;if(!r)return;(0,common_1.checkPath)({tips:'["loadingImageInfo"]["path"]',value:r.path,filePath:i});const n=e.stat(a,r.path);n&&n.isFile||(0,common_1.throwError)({msg:locales_1.default.config.JSON_CONTENT_NOT_FOUND.format(`["loadingImageInfo"]["path"]: "${r.path}"`),filePath:i}),r.progressBarColor&&!(0,tools_1.isHexColor)(r.progressBarColor)&&(0,common_1.throwError)({msg:locales_1.default.config.JSON_CONTENT_SHOULD_BE.format(`["loadingImageInfo"]["progressBarColor"]: "${r.progressBarColor}"`,"HexColor"),filePath:i})}function checkWorkers(o,t){const{project:e,root:a,filePath:i}=o,{workers:r}=t;if(void 0===r)return;const n=(0,tools_1.getWorkersPath)(r);(0,common_1.checkPath)({tips:'["workers"]',value:n,filePath:i});const c=e.stat(a,n);c&&!c.isFile||(0,common_1.throwError)({msg:locales_1.default.config.JSON_CONTENT_SHOULD_BE.format(['["workers"]',locales_1.default.config.DIRECTORY]),filePath:i})}function checkOpenDataContext(o,t){const{project:e,root:a,filePath:i}=o,{openDataContext:r}=t;if(void 0===r)return;(0,common_1.checkPath)({value:r,tips:'["openDataContext"]',filePath:i});const n=e.stat(a,r);n&&n.isDirectory||(0,common_1.throwError)({msg:locales_1.default.config.JSON_CONTENT_SHOULD_BE.format(['["openDataContext"]',locales_1.default.config.DIRECTORY]),filePath:i});const c=path_1.default.posix.join(r,"./index.js"),s=e.stat(a,c);s&&s.isFile||(0,common_1.throwError)({msg:locales_1.default.config.CORRESPONDING_FILE_NOT_FOUND.format('["openDataContext"]',c),filePath:i}),t.openDataContext=(0,tools_1.normalizePath)(`${r}/`)}function checkGameJSON(o){const{project:t,root:e,filePath:a}=o,i="game.json";t.stat(e,i)||(0,common_1.throwError)({msg:locales_1.default.config.FILE_NOT_FOUND.format(path_1.default.posix.join(a)),filePath:a,code:config_1.FILE_NOT_FOUND});const r=t.getFile(e,i),n=(0,common_2.checkJSONFormat)((0,common_1.checkUTF8)(r,a),a),c=(0,schemaValidate_1.schemaValidate)("game",n);return c.warning&&(n.__warning__=locales_1.default.config.INVALID.format(c.warning)),(0,schemaValidate_1.transValidateResult)(a,c),checkOpenDataContext(o,n),checkPlugins(o,n),checkSubpackages(o,n),checkPluginPath(o,n),checkLoadingImageUrl(o,n),checkWorkers(o,n),n}const getGameJSON=(0,reactiveCache_1.wrapCompileJSONFunc)(cache_1.CACHE_KEY.GAME_JSON,(o=>{const t=(0,projectconfig_1.getProjectConfigJSON)(o).miniprogramRoot||"";return checkGameJSON({project:o,root:t,filePath:(0,tools_1.normalizePath)(path_1.default.posix.join(t,"game.json"))})}));exports.default=getGameJSON;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.checkPageJSON=void 0;const tslib_1=require("tslib"),path_1=tslib_1.__importDefault(require("path")),locales_1=tslib_1.__importDefault(require("../../../../../utils/locales/locales")),common_1=require("../common"),schemaValidate_1=require("../../validate/schemaValidate"),tools_1=require("../../../../../utils/tools"),common_2=require("../../../../../utils/common"),theme_1=require("../theme"),checkHexColor=e=>{const{inputJSON:a,mode:o,pagePath:t,themeLocation:r}=e;let i=t+".json";if(a){r&&(i=`${t}.json or ${r}["${o}"]`);const{navigationBarBackgroundColor:e,backgroundColor:l}=a;void 0===e||(0,tools_1.isHexColor)(e)||(0,common_2.throwError)({msg:`["navigationBarBackgroundColor"]: "${e}" is not hexColor`,filePath:i}),void 0===l||(0,tools_1.isHexColor)(l)||(0,common_2.throwError)({msg:`["backgroundColor"]: "${l}" is not hexColor`,filePath:i})}};function checkPageJSON(e,a){const{pagePath:o,miniprogramRoot:t=""}=a,r=(0,tools_1.normalizePath)(path_1.default.posix.join(t,o+".json"));if(!e.stat("",r))return{};const i=e.getFile("",r),l=(0,common_1.checkJSONFormat)((0,common_2.checkUTF8)(i,r),r),n=(0,theme_1.getThemeLocation)(e);if(!n){const e=(0,common_1.getPageJSONVariableDecalearProperty)(l);e.length&&(0,common_2.throwError)({msg:'["themeLocation"] is required because:\n'+e.map(e=>`"${e.value}" as variable was declared at ${r}:${e.property}`).join("\n"),filePath:r})}let c={light:{},dark:{}};n&&(c=(0,theme_1.checkThemeJSON)(e,{themeLocation:n}));const m=(0,theme_1.mergeThemeJSONToPageJSON)(c,l,r),s=(0,schemaValidate_1.schemaValidate)("page",m.pageJSONLight),h=(0,schemaValidate_1.schemaValidate)("page",m.pageJSONDark),g=(0,common_1.getPageJSONVariableDecalearProperty)(m.pageJSONLight);g.length&&(0,common_2.throwError)({msg:g.map(e=>`"${e.value}" as variable was declared at ${r}:${e.property}, but not found at ${n}["light"]`).join("\n"),filePath:r});const _=(0,common_1.getPageJSONVariableDecalearProperty)(m.pageJSONDark);return _.length&&(0,common_2.throwError)({msg:_.map(e=>`"${e.value}" as variable was declared at ${r}:${e.property}, but not found at ${n}["dark"]`).join("\n"),filePath:r}),s.warning&&(l.__warning__=locales_1.default.config.INVALID.format(s.warning)),n&&h.warning&&(l.__warning__=locales_1.default.config.INVALID.format(h.warning)),(0,schemaValidate_1.transValidateResult)(n?`${r} or ${n}["light"]`:r,s),n&&(0,schemaValidate_1.transValidateResult)(`${r} or ${n}["dark"]`,h),checkHexColor({inputJSON:m.pageJSONLight,mode:"light",themeLocation:n||"",filePath:r,pagePath:o}),checkHexColor({inputJSON:m.pageJSONDark,mode:"dark",themeLocation:n||"",filePath:r,pagePath:o}),l}exports.checkPageJSON=checkPageJSON;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.checkPageJSON=checkPageJSON;const tslib_1=require("tslib"),path_1=tslib_1.__importDefault(require("path")),locales_1=tslib_1.__importDefault(require("../../../../../utils/locales/locales")),common_1=require("../common"),schemaValidate_1=require("../../validate/schemaValidate"),tools_1=require("../../../../../utils/tools"),common_2=require("../../../../../utils/common"),theme_1=require("../theme"),checkHexColor=e=>{const{inputJSON:a,mode:o,pagePath:t,themeLocation:r}=e;let i=`${t}.json`;if(a){r&&(i=`${t}.json or ${r}["${o}"]`);const{navigationBarBackgroundColor:e,backgroundColor:l}=a;void 0===e||(0,tools_1.isHexColor)(e)||(0,common_2.throwError)({msg:`["navigationBarBackgroundColor"]: "${e}" is not hexColor`,filePath:i}),void 0===l||(0,tools_1.isHexColor)(l)||(0,common_2.throwError)({msg:`["backgroundColor"]: "${l}" is not hexColor`,filePath:i})}};function checkPageJSON(e,a){const{pagePath:o,miniprogramRoot:t=""}=a,r=(0,tools_1.normalizePath)(path_1.default.posix.join(t,`${o}.json`));if(!e.stat("",r))return{};const i=e.getFile("",r),l=(0,common_1.checkJSONFormat)((0,common_2.checkUTF8)(i,r),r),n=(0,theme_1.getThemeLocation)(e);if(!n){const e=(0,common_1.getPageJSONVariableDecalearProperty)(l);e.length&&(0,common_2.throwError)({msg:`["themeLocation"] is required because:\n${e.map((e=>`"${e.value}" as variable was declared at ${r}:${e.property}`)).join("\n")}`,filePath:r})}let c={light:{},dark:{}};n&&(c=(0,theme_1.checkThemeJSON)(e,{themeLocation:n}));const m=(0,theme_1.mergeThemeJSONToPageJSON)(c,l,r),s=(0,schemaValidate_1.schemaValidate)("page",m.pageJSONLight),h=(0,schemaValidate_1.schemaValidate)("page",m.pageJSONDark),g=(0,common_1.getPageJSONVariableDecalearProperty)(m.pageJSONLight);g.length&&(0,common_2.throwError)({msg:g.map((e=>`"${e.value}" as variable was declared at ${r}:${e.property}, but not found at ${n}["light"]`)).join("\n"),filePath:r});const _=(0,common_1.getPageJSONVariableDecalearProperty)(m.pageJSONDark);return _.length&&(0,common_2.throwError)({msg:_.map((e=>`"${e.value}" as variable was declared at ${r}:${e.property}, but not found at ${n}["dark"]`)).join("\n"),filePath:r}),s.warning&&(l.__warning__=locales_1.default.config.INVALID.format(s.warning)),n&&h.warning&&(l.__warning__=locales_1.default.config.INVALID.format(h.warning)),(0,schemaValidate_1.transValidateResult)(n?`${r} or ${n}["light"]`:r,s),n&&(0,schemaValidate_1.transValidateResult)(`${r} or ${n}["dark"]`,h),checkHexColor({inputJSON:m.pageJSONLight,mode:"light",themeLocation:n||"",filePath:r,pagePath:o}),checkHexColor({inputJSON:m.pageJSONDark,mode:"dark",themeLocation:n||"",filePath:r,pagePath:o}),l}
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getPageJSONWithDisableSpreading=exports.getPageJSON=exports.originGetPageJSON=void 0;const tslib_1=require("tslib"),path_1=tslib_1.__importDefault(require("path")),lodash_1=require("lodash"),extJSON_1=require("../app/extJSON"),app_1=require("../app"),tools_1=require("../../../../../utils/tools"),common_1=require("../common"),common_2=require("../../../../../utils/common"),locales_1=tslib_1.__importDefault(require("../../../../../utils/locales/locales")),reactiveCache_1=require("../reactiveCache"),checkPageJSON_1=require("./checkPageJSON"),spreadUsingComponent=e=>{const{project:o,pagePath:t,inputJSON:n}=e;if(t.includes("miniprogram_npm"))return;const a=(0,app_1.getAppJSON)(o);if((0,common_1.checkPagePathIsInIndependentSubpackage)(a,t))return;if(a.componentPlaceholder){n.componentPlaceholder=n.componentPlaceholder||{};for(const e in a.componentPlaceholder)n.componentPlaceholder[e]=n.componentPlaceholder[e]||a.componentPlaceholder[e]}const i=Object.assign({},a.usingComponents);if(0!==Object.keys(i).length){n.usingComponents||(n.usingComponents={});for(const e in i){if(n.usingComponents[e])continue;const o=i[e]||"";if(o.startsWith("/")||o.startsWith("plugin://")){n.usingComponents[e]=o;continue}const a=(0,tools_1.normalizePath)(path_1.default.posix.relative(path_1.default.posix.dirname(t),o));n.usingComponents[e]=a.startsWith(".")?a:"./"+a}}},mergeExtJSON=e=>{var o;const{project:t,inputJSON:n,pagePath:a}=e,i=(0,extJSON_1.getExtJSON)(t);(null===(o=null==i?void 0:i.extPages)||void 0===o?void 0:o[a])&&Object.assign(n,i.extPages[a])},checkComponentPath=e=>{const{project:o,miniprogramRoot:t,pagePath:n,inputJSON:a}=e;(0,common_1.checkComponentPath)({project:o,root:t,relativePath:n+".json",inputJSON:a})},checkComponentGenerics=e=>{const{pagePath:o,inputJSON:t}=e,n=o+".json";if(!t.componentGenerics)return;const a=[];for(const e in t.componentGenerics){const o=t.componentGenerics[e],n=(0,tools_1.getType)(o);"boolean"===n||"object"===n?"object"===n&&"string"!==(0,tools_1.getType)(o.default)&&a.push(locales_1.default.config.JSON_CONTENT_SHOULD_BE.format([`["componentGenerics"]["${e}"]["default"]`,"string"])):a.push(locales_1.default.config.JSON_CONTENT_SHOULD_BE.format([`["componentGenerics"]["${e}"]`,"boolean/object"]))}a.length>0&&(0,common_2.throwError)({msg:a.join("\n"),filePath:n})};function checkRenderer(e){var o,t;const{filePath:n,inputJSON:a}=e,{renderer:i}=a,r=(0,app_1.getAppJSON)(e.project);if((0,common_2.getAllPages)(r).includes(e.pagePath)&&("skyline"===i&&"requiredComponents"!==r.lazyCodeLoading&&(0,common_2.throwError)({msg:locales_1.default.config.APP_JSON_SHOULD_SET_LAZYCODELOADING.format(n),filePath:n}),"skyline"===i||"skyline"===r.renderer&&void 0===i)){"default"===a.navigationStyle&&(0,common_2.throwError)({msg:locales_1.default.config.PAGE_JSON_SHOULD_SET_NAVIGATIONSTYLE_CUSTOM.format(n),filePath:n});!(a.navigationStyle?"custom"===a.navigationStyle:"custom"===(null===(o=r.window)||void 0===o?void 0:o.navigationStyle))&&(a.navigationBarTitleText||a.navigationBarTextStyle||a.navigationBarBackgroundColor)&&(0,common_2.throwError)({msg:locales_1.default.config.PAGE_JSON_SHOULD_SET_NAVIGATIONSTYLE_CUSTOM.format(n),filePath:n}),a.disableScroll=null===(t=a.disableScroll)||void 0===t||t,a.navigationStyle="custom"}}function checkComponentFramework(e){const{filePath:o,inputJSON:t}=e,{renderer:n,componentFramework:a}=t,i=(0,app_1.getAppJSON)(e.project);if(!(0,common_2.getAllPages)(i).includes(e.pagePath))return;const r="skyline"===n||"skyline"===i.renderer&&void 0===n,c="glass-easel"===a||"glass-easel"===i.componentFramework&&void 0===a;r&&(c||(0,common_2.throwError)({msg:locales_1.default.config.JSON_SHOULD_SET_COMPONENTFRAMEWORK_SKYLINE.format(o),filePath:o}))}const compilePageJSON=(e,o=!1)=>{mergeExtJSON(e),checkComponentGenerics(e),checkComponentPath(e),o||spreadUsingComponent(e),checkRenderer(e),checkComponentFramework(e)};function originGetPageJSON(e,o){const{pagePath:t,miniprogramRoot:n=""}=o,a=(0,tools_1.normalizePath)(path_1.default.posix.join(n,t+".json")),i=(0,reactiveCache_1.tryToGetReactiveJSONCompiler)(e),r=(0,lodash_1.cloneDeep)(i.getPageJSON("checked",o));return compilePageJSON({project:e,miniprogramRoot:n,inputJSON:r,filePath:a,pagePath:t}),r.usingComponents||(r.usingComponents={}),r}async function getPageJSON(e,o){const t=(0,reactiveCache_1.tryToGetReactiveProject)(e);return(0,reactiveCache_1.tryToGetReactiveJSONCompiler)(t).getPageJSON("compiled",o)}function getPageJSONWithDisableSpreading(e,o){const t=(0,reactiveCache_1.tryToGetReactiveProject)(e),n=(0,reactiveCache_1.tryToGetReactiveJSONCompiler)(t),{pagePath:a,miniprogramRoot:i=""}=o,r=(0,tools_1.normalizePath)(path_1.default.posix.join(i,a+".json")),c=(0,lodash_1.cloneDeep)(n.getPageJSON("checked",o));return compilePageJSON({project:t,miniprogramRoot:i,inputJSON:c,filePath:r,pagePath:a},!0),c.usingComponents||(c.usingComponents={}),c}exports.originGetPageJSON=originGetPageJSON,reactiveCache_1.ReactiveJSONCompiler.setOriginCheckPageJSON(checkPageJSON_1.checkPageJSON),reactiveCache_1.ReactiveJSONCompiler.setOriginGetPageJSON(originGetPageJSON),exports.getPageJSON=getPageJSON,exports.getPageJSONWithDisableSpreading=getPageJSONWithDisableSpreading;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.originGetPageJSON=originGetPageJSON,exports.getPageJSON=getPageJSON,exports.getPageJSONWithDisableSpreading=getPageJSONWithDisableSpreading;const tslib_1=require("tslib"),path_1=tslib_1.__importDefault(require("path")),lodash_1=require("lodash"),extJSON_1=require("../app/extJSON"),app_1=require("../app"),tools_1=require("../../../../../utils/tools"),common_1=require("../common"),common_2=require("../../../../../utils/common"),locales_1=tslib_1.__importDefault(require("../../../../../utils/locales/locales")),reactiveCache_1=require("../reactiveCache"),checkPageJSON_1=require("./checkPageJSON"),spreadUsingComponent=e=>{const{project:o,pagePath:t,inputJSON:n}=e;if(t.includes("miniprogram_npm"))return;const a=(0,app_1.getAppJSON)(o);if((0,common_1.checkPagePathIsInIndependentSubpackage)(a,t))return;if(a.componentPlaceholder){n.componentPlaceholder=n.componentPlaceholder||{};for(const e in a.componentPlaceholder)n.componentPlaceholder[e]=n.componentPlaceholder[e]||a.componentPlaceholder[e]}const i=Object.assign({},a.usingComponents);if(0!==Object.keys(i).length){n.usingComponents||(n.usingComponents={});for(const e in i){if(n.usingComponents[e])continue;const o=i[e]||"";if(o.startsWith("/")||o.startsWith("plugin://")){n.usingComponents[e]=o;continue}const a=(0,tools_1.normalizePath)(path_1.default.posix.relative(path_1.default.posix.dirname(t),o));n.usingComponents[e]=a.startsWith(".")?a:`./${a}`}}},mergeExtJSON=e=>{var o;const{project:t,inputJSON:n,pagePath:a}=e,i=(0,extJSON_1.getExtJSON)(t);(null===(o=null==i?void 0:i.extPages)||void 0===o?void 0:o[a])&&Object.assign(n,i.extPages[a])},checkComponentPath=e=>{const{project:o,miniprogramRoot:t,pagePath:n,inputJSON:a}=e;(0,common_1.checkComponentPath)({project:o,root:t,relativePath:`${n}.json`,inputJSON:a})},checkComponentGenerics=e=>{const{pagePath:o,inputJSON:t}=e,n=`${o}.json`;if(!t.componentGenerics)return;const a=[];for(const e in t.componentGenerics){const o=t.componentGenerics[e],n=(0,tools_1.getType)(o);"boolean"===n||"object"===n?"object"===n&&"string"!==(0,tools_1.getType)(o.default)&&a.push(locales_1.default.config.JSON_CONTENT_SHOULD_BE.format([`["componentGenerics"]["${e}"]["default"]`,"string"])):a.push(locales_1.default.config.JSON_CONTENT_SHOULD_BE.format([`["componentGenerics"]["${e}"]`,"boolean/object"]))}a.length>0&&(0,common_2.throwError)({msg:a.join("\n"),filePath:n})};function checkRenderer(e){var o,t;const{filePath:n,inputJSON:a}=e,{renderer:i}=a,r=(0,app_1.getAppJSON)(e.project);if((0,common_2.getAllPages)(r).includes(e.pagePath)&&("skyline"===i&&"requiredComponents"!==r.lazyCodeLoading&&(0,common_2.throwError)({msg:locales_1.default.config.APP_JSON_SHOULD_SET_LAZYCODELOADING.format(n),filePath:n}),"skyline"===i||"skyline"===r.renderer&&void 0===i)){"default"===a.navigationStyle&&(0,common_2.throwError)({msg:locales_1.default.config.PAGE_JSON_SHOULD_SET_NAVIGATIONSTYLE_CUSTOM.format(n),filePath:n});!(a.navigationStyle?"custom"===a.navigationStyle:"custom"===(null===(o=r.window)||void 0===o?void 0:o.navigationStyle))&&(a.navigationBarTitleText||a.navigationBarTextStyle||a.navigationBarBackgroundColor)&&(0,common_2.throwError)({msg:locales_1.default.config.PAGE_JSON_SHOULD_SET_NAVIGATIONSTYLE_CUSTOM.format(n),filePath:n}),a.disableScroll=null===(t=a.disableScroll)||void 0===t||t,a.navigationStyle="custom"}}function checkComponentFramework(e){const{filePath:o,inputJSON:t}=e,{renderer:n,componentFramework:a}=t,i=(0,app_1.getAppJSON)(e.project);if(!(0,common_2.getAllPages)(i).includes(e.pagePath))return;const r="skyline"===n||"skyline"===i.renderer&&void 0===n,c="glass-easel"===a||"glass-easel"===i.componentFramework&&void 0===a;r&&(c||(0,common_2.throwError)({msg:locales_1.default.config.JSON_SHOULD_SET_COMPONENTFRAMEWORK_SKYLINE.format(o),filePath:o}))}const compilePageJSON=(e,o=!1)=>{mergeExtJSON(e),checkComponentGenerics(e),checkComponentPath(e),o||spreadUsingComponent(e),checkRenderer(e),checkComponentFramework(e)};function originGetPageJSON(e,o){const{pagePath:t,miniprogramRoot:n=""}=o,a=(0,tools_1.normalizePath)(path_1.default.posix.join(n,`${t}.json`)),i=(0,reactiveCache_1.tryToGetReactiveJSONCompiler)(e),r=(0,lodash_1.cloneDeep)(i.getPageJSON("checked",o));return compilePageJSON({project:e,miniprogramRoot:n,inputJSON:r,filePath:a,pagePath:t}),r.usingComponents||(r.usingComponents={}),r}async function getPageJSON(e,o){const t=(0,reactiveCache_1.tryToGetReactiveProject)(e);return(0,reactiveCache_1.tryToGetReactiveJSONCompiler)(t).getPageJSON("compiled",o)}function getPageJSONWithDisableSpreading(e,o){const t=(0,reactiveCache_1.tryToGetReactiveProject)(e),n=(0,reactiveCache_1.tryToGetReactiveJSONCompiler)(t),{pagePath:a,miniprogramRoot:i=""}=o,r=(0,tools_1.normalizePath)(path_1.default.posix.join(i,`${a}.json`)),c=(0,lodash_1.cloneDeep)(n.getPageJSON("checked",o));return compilePageJSON({project:t,miniprogramRoot:i,inputJSON:c,filePath:r,pagePath:a},!0),c.usingComponents||(c.usingComponents={}),c}reactiveCache_1.ReactiveJSONCompiler.setOriginCheckPageJSON(checkPageJSON_1.checkPageJSON),reactiveCache_1.ReactiveJSONCompiler.setOriginGetPageJSON(originGetPageJSON);
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getGameLocalPluginJSON=exports.getDevPluginJSON=exports.checkWorkers=exports.checkComponentPath=void 0;const tslib_1=require("tslib"),path_1=tslib_1.__importDefault(require("path")),projectconfig_1=require("../projectconfig"),locales_1=tslib_1.__importDefault(require("../../../../../utils/locales/locales")),common_1=require("../common"),config_1=require("../../../../../config/config"),schemaValidate_1=require("../../validate/schemaValidate"),tools_1=require("../../../../../utils/tools"),cache_1=require("../../../../../utils/cache"),common_2=require("../../../../../utils/common"),reactiveCache_1=require("../reactiveCache");function checkComponentPath(o,e){const{project:t,root:c,filePath:i}=o;void 0!==e.usingComponents&&(0,common_1.checkComponentPath)({project:t,root:c,relativePath:path_1.default.posix.relative(c,i),inputJSON:e})}function checkPublicComponentsAndPages(o,e){const{project:t,root:c,filePath:i}=o,{publicComponents:n,pages:a}=e,r={};if(n){const o=[];for(const a in n){const n=e.publicComponents[a];(0,common_2.checkPath)({value:n,tips:`["publicComponents"]["${a}"]`,filePath:i,code:config_1.PLUGIN_JSON_CONTENT_ERR});let s=t.stat(c,n+".wxml");s&&!s.isDirectory||o.push(locales_1.default.config.CORRESPONDING_FILE_NOT_FOUND.format(`["publicComponents"]["${n}"]`,n+".wxml")),s=t.stat(c,n+".js"),s&&!s.isDirectory||o.push(locales_1.default.config.CORRESPONDING_FILE_NOT_FOUND.format(`["publicComponents"]["${n}"]`,n+".js")),s=t.stat(c,n+".json"),s&&!s.isDirectory||o.push(locales_1.default.config.CORRESPONDING_FILE_NOT_FOUND.format(`["publicComponents"]["${n}"]`,n+".json")),r[a]=!0}o.length>0&&(0,common_2.throwError)({msg:o.join("\n"),code:config_1.PLUGIN_JSON_CONTENT_ERR,filePath:i})}if(a){const o=[];for(const e in a){const n=a[e];(0,common_2.checkPath)({value:n,tips:`["pages"]["${e}"]`,filePath:i,code:config_1.PLUGIN_JSON_CONTENT_ERR});let s=t.stat(c,n+".wxml");s&&!s.isDirectory||o.push(locales_1.default.config.CORRESPONDING_FILE_NOT_FOUND.format(`["pages"]["${n}"]`,n+".wxml")),s=t.stat(c,n+".js"),s&&!s.isDirectory||o.push(locales_1.default.config.CORRESPONDING_FILE_NOT_FOUND.format(`["pages"]["${n}"]`,n+".js")),s=t.stat(c,n+".json"),s&&!s.isDirectory||o.push(locales_1.default.config.CORRESPONDING_FILE_NOT_FOUND.format(`["pages"]["${n}"]`,n+".json")),r[e]&&o.push(locales_1.default.config.SAME_KEY_PAGE_PUBLICCOMPONENTS.format(`"${e}"`)),r[e]=!0}o.length>0&&(0,common_2.throwError)({msg:o.join("\n"),code:config_1.PLUGIN_JSON_CONTENT_ERR,filePath:i})}}function checkWorkers(o,e){const{project:t,root:c,filePath:i}=o,{workers:n}=e;if(void 0===n)return;const a='["workers"]';""===n&&(0,common_2.throwError)({msg:locales_1.default.config.JSON_CONTENT_SHOULD_BE.format(a,locales_1.default.config.DIRECTORY),filePath:i}),(0,common_2.checkPath)({value:n,tips:a,filePath:i});const r=t.stat(c,n);r&&r.isDirectory||(0,common_2.throwError)({msg:locales_1.default.config.JSON_CONTENT_SHOULD_BE.format([a,locales_1.default.config.DIRECTORY]),filePath:i}),e.workers=(0,tools_1.normalizePath)(n+"/")}function checkMain(o,e){const{project:t,root:c,filePath:i}=o,{main:n}=e;if(void 0===n)return;""===n&&(0,common_2.throwError)({msg:locales_1.default.config.SHOULD_NOT_BE_EMPTY.format('["main"]'),code:config_1.PLUGIN_JSON_CONTENT_ERR,filePath:i}),(0,common_2.checkPath)({value:n,tips:'["main"]',filePath:i,code:config_1.PLUGIN_JSON_CONTENT_ERR});const a=t.stat(c,n);a&&!a.isDirectory||(0,common_2.throwError)({msg:locales_1.default.config.CORRESPONDING_FILE_NOT_FOUND.format('["main"]',n),code:config_1.PLUGIN_JSON_CONTENT_ERR,filePath:i})}function isKindOfGamePlugin(o){return o.type===config_1.COMPILE_TYPE.miniGamePlugin}function checkPluginJSON(o){const{root:e="",project:t}=o,c=path_1.default.posix.join(e,"plugin.json");t.stat(e,"plugin.json")||(0,common_2.throwError)({msg:locales_1.default.config.PLUGIN_JSON_NOT_FOUND.format(e,"plugin.json"),code:config_1.PLUGIN_JSON_FILE_NOT_FOUND,filePath:c});const i=t.getFile(e,"plugin.json"),n=(0,common_1.checkJSONFormat)((0,common_2.checkUTF8)(i,c),c),a=(0,schemaValidate_1.schemaValidate)("plugin",n);if(a.error.length){const o=(0,schemaValidate_1.transValidateResult)(c,a,!0);(0,common_2.throwError)({msg:"pluginJSON$"+o,code:config_1.PLUGIN_JSON_CONTENT_ERR,filePath:c})}return void 0!==n.themeLocation&&(0,common_2.checkPath)({value:n.themeLocation,tips:'["themeLocation"]',filePath:c}),isKindOfGamePlugin(t)||(checkPublicComponentsAndPages(o,n),checkComponentPath(o,n)),checkMain(o,n),checkWorkers(o,n),n}exports.checkComponentPath=checkComponentPath,exports.checkWorkers=checkWorkers,exports.getDevPluginJSON=(0,reactiveCache_1.wrapCompileJSONFunc)(cache_1.CACHE_KEY.PLUGIN_JSON,(o,e="")=>{const t=(0,projectconfig_1.getProjectConfigJSON)(o),{pluginRoot:c=""}=t;let i=c;o.type===config_1.COMPILE_TYPE.miniGame&&e&&(i=e),e||c||(0,common_2.throwError)({msg:locales_1.default.config.NOT_FOUND.format('["pluginRoot"]'),filePath:"project.config.json",code:config_1.JSON_CONTENT_ERR});return checkPluginJSON({project:o,filePath:path_1.default.posix.join(i,"plugin.json"),root:i})});const getGameLocalPluginJSON=async(o,e)=>{const t=await(0,projectconfig_1.getProjectConfigJSON)(o),{miniprogramRoot:c}=t;if(!e)return{};const i=(0,tools_1.normalizePath)(path_1.default.posix.join(c||"",e));return checkPluginJSON({project:(0,reactiveCache_1.tryToGetReactiveProject)(o),filePath:path_1.default.posix.join(i,"plugin.json"),root:i})};exports.getGameLocalPluginJSON=getGameLocalPluginJSON;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getGameLocalPluginJSON=exports.getDevPluginJSON=void 0,exports.checkComponentPath=checkComponentPath,exports.checkWorkers=checkWorkers;const tslib_1=require("tslib"),path_1=tslib_1.__importDefault(require("path")),projectconfig_1=require("../projectconfig"),locales_1=tslib_1.__importDefault(require("../../../../../utils/locales/locales")),common_1=require("../common"),config_1=require("../../../../../config/config"),schemaValidate_1=require("../../validate/schemaValidate"),tools_1=require("../../../../../utils/tools"),cache_1=require("../../../../../utils/cache"),common_2=require("../../../../../utils/common"),reactiveCache_1=require("../reactiveCache");function checkComponentPath(o,e){const{project:t,root:c,filePath:i}=o;void 0!==e.usingComponents&&(0,common_1.checkComponentPath)({project:t,root:c,relativePath:path_1.default.posix.relative(c,i),inputJSON:e})}function checkPublicComponentsAndPages(o,e){const{project:t,root:c,filePath:i}=o,{publicComponents:n,pages:a}=e,r={};if(n){const o=[];for(const a in n){const n=e.publicComponents[a];(0,common_2.checkPath)({value:n,tips:`["publicComponents"]["${a}"]`,filePath:i,code:config_1.PLUGIN_JSON_CONTENT_ERR});let l=t.stat(c,`${n}.wxml`);l&&!l.isDirectory||o.push(locales_1.default.config.CORRESPONDING_FILE_NOT_FOUND.format(`["publicComponents"]["${n}"]`,`${n}.wxml`)),l=t.stat(c,`${n}.js`),l&&!l.isDirectory||o.push(locales_1.default.config.CORRESPONDING_FILE_NOT_FOUND.format(`["publicComponents"]["${n}"]`,`${n}.js`)),l=t.stat(c,`${n}.json`),l&&!l.isDirectory||o.push(locales_1.default.config.CORRESPONDING_FILE_NOT_FOUND.format(`["publicComponents"]["${n}"]`,`${n}.json`)),r[a]=!0}o.length>0&&(0,common_2.throwError)({msg:o.join("\n"),code:config_1.PLUGIN_JSON_CONTENT_ERR,filePath:i})}if(a){const o=[];for(const e in a){const n=a[e];(0,common_2.checkPath)({value:n,tips:`["pages"]["${e}"]`,filePath:i,code:config_1.PLUGIN_JSON_CONTENT_ERR});let l=t.stat(c,`${n}.wxml`);l&&!l.isDirectory||o.push(locales_1.default.config.CORRESPONDING_FILE_NOT_FOUND.format(`["pages"]["${n}"]`,`${n}.wxml`)),l=t.stat(c,`${n}.js`),l&&!l.isDirectory||o.push(locales_1.default.config.CORRESPONDING_FILE_NOT_FOUND.format(`["pages"]["${n}"]`,`${n}.js`)),l=t.stat(c,`${n}.json`),l&&!l.isDirectory||o.push(locales_1.default.config.CORRESPONDING_FILE_NOT_FOUND.format(`["pages"]["${n}"]`,`${n}.json`)),r[e]&&o.push(locales_1.default.config.SAME_KEY_PAGE_PUBLICCOMPONENTS.format(`"${e}"`)),r[e]=!0}o.length>0&&(0,common_2.throwError)({msg:o.join("\n"),code:config_1.PLUGIN_JSON_CONTENT_ERR,filePath:i})}}function checkWorkers(o,e){const{project:t,root:c,filePath:i}=o,{workers:n}=e;if(void 0===n)return;const a='["workers"]';""===n&&(0,common_2.throwError)({msg:locales_1.default.config.JSON_CONTENT_SHOULD_BE.format(a,locales_1.default.config.DIRECTORY),filePath:i}),(0,common_2.checkPath)({value:n,tips:a,filePath:i});const r=t.stat(c,n);r&&r.isDirectory||(0,common_2.throwError)({msg:locales_1.default.config.JSON_CONTENT_SHOULD_BE.format([a,locales_1.default.config.DIRECTORY]),filePath:i}),e.workers=(0,tools_1.normalizePath)(`${n}/`)}function checkMain(o,e){const{project:t,root:c,filePath:i}=o,{main:n}=e;if(void 0===n)return;""===n&&(0,common_2.throwError)({msg:locales_1.default.config.SHOULD_NOT_BE_EMPTY.format('["main"]'),code:config_1.PLUGIN_JSON_CONTENT_ERR,filePath:i}),(0,common_2.checkPath)({value:n,tips:'["main"]',filePath:i,code:config_1.PLUGIN_JSON_CONTENT_ERR});const a=t.stat(c,n);a&&!a.isDirectory||(0,common_2.throwError)({msg:locales_1.default.config.CORRESPONDING_FILE_NOT_FOUND.format('["main"]',n),code:config_1.PLUGIN_JSON_CONTENT_ERR,filePath:i})}function isKindOfGamePlugin(o){return o.type===config_1.COMPILE_TYPE.miniGamePlugin}function checkPluginJSON(o){const{root:e="",project:t}=o,c="plugin.json",i=path_1.default.posix.join(e,c);t.stat(e,c)||(0,common_2.throwError)({msg:locales_1.default.config.PLUGIN_JSON_NOT_FOUND.format(e,c),code:config_1.PLUGIN_JSON_FILE_NOT_FOUND,filePath:i});const n=t.getFile(e,c),a=(0,common_1.checkJSONFormat)((0,common_2.checkUTF8)(n,i),i),r=(0,schemaValidate_1.schemaValidate)("plugin",a);if(r.error.length){const o=(0,schemaValidate_1.transValidateResult)(i,r,!0);(0,common_2.throwError)({msg:`pluginJSON$${o}`,code:config_1.PLUGIN_JSON_CONTENT_ERR,filePath:i})}return void 0!==a.themeLocation&&(0,common_2.checkPath)({value:a.themeLocation,tips:'["themeLocation"]',filePath:i}),isKindOfGamePlugin(t)||(checkPublicComponentsAndPages(o,a),checkComponentPath(o,a)),checkMain(o,a),checkWorkers(o,a),a}exports.getDevPluginJSON=(0,reactiveCache_1.wrapCompileJSONFunc)(cache_1.CACHE_KEY.PLUGIN_JSON,((o,e="")=>{const t=(0,projectconfig_1.getProjectConfigJSON)(o),{pluginRoot:c=""}=t;let i=c;o.type===config_1.COMPILE_TYPE.miniGame&&e&&(i=e),e||c||(0,common_2.throwError)({msg:locales_1.default.config.NOT_FOUND.format('["pluginRoot"]'),filePath:"project.config.json",code:config_1.JSON_CONTENT_ERR});return checkPluginJSON({project:o,filePath:path_1.default.posix.join(i,"plugin.json"),root:i})}));const getGameLocalPluginJSON=async(o,e)=>{const t=await(0,projectconfig_1.getProjectConfigJSON)(o),{miniprogramRoot:c}=t;if(!e)return{};const i=(0,tools_1.normalizePath)(path_1.default.posix.join(c||"",e));return checkPluginJSON({project:(0,reactiveCache_1.tryToGetReactiveProject)(o),filePath:path_1.default.posix.join(i,"plugin.json"),root:i})};exports.getGameLocalPluginJSON=getGameLocalPluginJSON;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getPluginPageJSON=void 0;const tslib_1=require("tslib"),path_1=tslib_1.__importDefault(require("path")),common_1=require("../common"),schemaValidate_1=require("../../validate/schemaValidate"),locales_1=tslib_1.__importDefault(require("../../../../../utils/locales/locales")),common_2=require("../../../../../utils/common"),theme_1=require("../theme"),plugin_1=require("./plugin"),spreadUsingComponent=async(e,t)=>{const{project:a,root:i,filePath:n}=t,o=path_1.default.posix.relative(i,n);if(n.includes("miniprogram_npm/"))return;const r=await(0,plugin_1.getDevPluginJSON)(a,!0),s=Object.assign({},r.usingComponents);if(0!==Object.keys(s).length){e.usingComponents||(e.usingComponents={});for(const t in s){if(e.usingComponents[t])continue;const a=s[t]||"";if(a.startsWith("/")||a.startsWith("plugin://")){e.usingComponents[t]=a;continue}const i=path_1.default.posix.normalize(path_1.default.posix.relative(path_1.default.posix.dirname(o),a));e.usingComponents[t]=i.startsWith(".")?i:"./"+i}}};async function checkComponentPath(e,t){const{project:a,root:i,filePath:n}=t;await(0,common_1.checkComponentPath)({project:a,root:i,relativePath:path_1.default.posix.relative(i,n),inputJSON:e})}async function getPluginPageJSON(e){const{project:t}=e,{filePath:a}=e;if(!t.stat("",a))return{};const i=await t.getFile("",a),n=(0,common_1.checkJSONFormat)((0,common_2.checkUTF8)(i,a),a),o=await(0,theme_1.getPluginThemeLocation)(t);if(!o){const e=(0,common_1.getPageJSONVariableDecalearProperty)(n);e.length&&(0,common_2.throwError)({msg:'pluginJSON["themeLocation"] is required because:\n'+e.map(e=>`"${e.value}" as variable was declared at ${a}:${e.property}`).join("\n"),filePath:a})}let r={light:{},dark:{}};o&&(r=await(0,theme_1.checkThemeJSON)(t,{themeLocation:o,isPlugin:!0}));const s=(0,theme_1.mergeThemeJSONToPageJSON)(r,n,a),l=(0,schemaValidate_1.schemaValidate)("page",s.pageJSONLight),c=(0,schemaValidate_1.schemaValidate)("page",s.pageJSONDark);return l.warning&&(n.__warning__=locales_1.default.config.INVALID.format(l.warning)),o&&c.warning&&(n.__warning__=locales_1.default.config.INVALID.format(c.warning)),(0,schemaValidate_1.transValidateResult)(o?`${a} or ${o}["light"]`:a,l),o&&(0,schemaValidate_1.transValidateResult)(`${a} or ${o}["dark"]`,c),await checkComponentPath(n,e),await spreadUsingComponent(n,e),n}exports.getPluginPageJSON=getPluginPageJSON;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getPluginPageJSON=getPluginPageJSON;const tslib_1=require("tslib"),path_1=tslib_1.__importDefault(require("path")),common_1=require("../common"),schemaValidate_1=require("../../validate/schemaValidate"),locales_1=tslib_1.__importDefault(require("../../../../../utils/locales/locales")),common_2=require("../../../../../utils/common"),theme_1=require("../theme"),plugin_1=require("./plugin"),spreadUsingComponent=async(e,t)=>{const{project:a,root:i,filePath:n}=t,o=path_1.default.posix.relative(i,n);if(n.includes("miniprogram_npm/"))return;const r=await(0,plugin_1.getDevPluginJSON)(a,!0),s=Object.assign({},r.usingComponents);if(0!==Object.keys(s).length){e.usingComponents||(e.usingComponents={});for(const t in s){if(e.usingComponents[t])continue;const a=s[t]||"";if(a.startsWith("/")||a.startsWith("plugin://")){e.usingComponents[t]=a;continue}const i=path_1.default.posix.normalize(path_1.default.posix.relative(path_1.default.posix.dirname(o),a));e.usingComponents[t]=i.startsWith(".")?i:`./${i}`}}};async function checkComponentPath(e,t){const{project:a,root:i,filePath:n}=t;await(0,common_1.checkComponentPath)({project:a,root:i,relativePath:path_1.default.posix.relative(i,n),inputJSON:e})}async function getPluginPageJSON(e){const{project:t}=e,{filePath:a}=e;if(!t.stat("",a))return{};const i=await t.getFile("",a),n=(0,common_1.checkJSONFormat)((0,common_2.checkUTF8)(i,a),a),o=await(0,theme_1.getPluginThemeLocation)(t);if(!o){const e=(0,common_1.getPageJSONVariableDecalearProperty)(n);e.length&&(0,common_2.throwError)({msg:`pluginJSON["themeLocation"] is required because:\n${e.map((e=>`"${e.value}" as variable was declared at ${a}:${e.property}`)).join("\n")}`,filePath:a})}let r={light:{},dark:{}};o&&(r=await(0,theme_1.checkThemeJSON)(t,{themeLocation:o,isPlugin:!0}));const s=(0,theme_1.mergeThemeJSONToPageJSON)(r,n,a),l=(0,schemaValidate_1.schemaValidate)("page",s.pageJSONLight),c=(0,schemaValidate_1.schemaValidate)("page",s.pageJSONDark);return l.warning&&(n.__warning__=locales_1.default.config.INVALID.format(l.warning)),o&&c.warning&&(n.__warning__=locales_1.default.config.INVALID.format(c.warning)),(0,schemaValidate_1.transValidateResult)(o?`${a} or ${o}["light"]`:a,l),o&&(0,schemaValidate_1.transValidateResult)(`${a} or ${o}["dark"]`,c),await checkComponentPath(n,e),await spreadUsingComponent(n,e),n}
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getProjectConfigJSON=void 0;const tslib_1=require("tslib"),lodash_1=require("lodash"),common_1=require("../../../../utils/common"),schemaValidate_1=require("../validate/schemaValidate"),cache_1=require("../../../../utils/cache"),tools_1=require("../../../../utils/tools"),config_1=require("../../../../config/config"),locales_1=tslib_1.__importDefault(require("../../../../utils/locales/locales")),reactiveCache_1=require("./reactiveCache"),common_2=require("./common"),PROJECT_CONFIG_JSON="project.config.json",rootConfig=["svr","client","qcloudRoot","miniprogramRoot","pluginRoot","cloudfunctionRoot","jsserverRoot","testRoot"];function formatPath(o=""){return o&&"/"!==o?(o=(0,tools_1.normalizePath)(o+"/")).replace(/^(\/)*/,"").replace(/\.\.\//g,"").replace(/^\.\//,""):""}const _getProjectConfigJSON=(0,reactiveCache_1.wrapCompileJSONFunc)(cache_1.CACHE_KEY.PROJECT_CONFIG,o=>{if(!o.stat("",PROJECT_CONFIG_JSON))return o.type!==config_1.COMPILE_TYPE.miniGamePlugin&&o.type!==config_1.COMPILE_TYPE.miniProgramPlugin||(0,common_1.throwError)({msg:locales_1.default.config.NOT_FOUND.format("project.config.json"),code:config_1.FILE_NOT_FOUND,filePath:PROJECT_CONFIG_JSON}),{};const e=o.getFile("",PROJECT_CONFIG_JSON),t=(0,common_1.checkUTF8)(e,PROJECT_CONFIG_JSON),i=(0,common_2.checkJSONFormat)(t,PROJECT_CONFIG_JSON),r=(0,schemaValidate_1.schemaValidate)("projectconfig",i);return(0,schemaValidate_1.transValidateResult)(PROJECT_CONFIG_JSON,r),o.miniprogramRoot=i.miniprogramRoot||"",o.pluginRoot=i.pluginRoot||"",rootConfig.forEach(o=>{"string"==typeof i[o]?i[o]=formatPath(i[o]):i[o]=""}),"gamePlugin"!==i.compileType&&"plugin"!==i.compileType||i.pluginRoot||(0,common_1.throwError)({msg:locales_1.default.config.SHOULD_NOT_BE_EMPTY.format('["pluginRoot"]'),filePath:PROJECT_CONFIG_JSON}),"gamePlugin"!==i.compileType&&"plugin"!==i.compileType||i.pluginRoot!==i.miniprogramRoot||(0,common_1.throwError)({msg:locales_1.default.config.PLUGIN_PATH_SAME_WITH_MINIPROGRAM.format([i.pluginRoot,i.miniprogramRoot]),filePath:PROJECT_CONFIG_JSON}),i}),getProjectConfigJSON=function(o){const e=_getProjectConfigJSON(o);return(0,lodash_1.cloneDeep)(e)};exports.getProjectConfigJSON=getProjectConfigJSON;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getProjectConfigJSON=void 0;const tslib_1=require("tslib"),lodash_1=require("lodash"),common_1=require("../../../../utils/common"),schemaValidate_1=require("../validate/schemaValidate"),cache_1=require("../../../../utils/cache"),tools_1=require("../../../../utils/tools"),config_1=require("../../../../config/config"),locales_1=tslib_1.__importDefault(require("../../../../utils/locales/locales")),reactiveCache_1=require("./reactiveCache"),common_2=require("./common"),PROJECT_CONFIG_JSON="project.config.json",rootConfig=["svr","client","qcloudRoot","miniprogramRoot","pluginRoot","cloudfunctionRoot","jsserverRoot","testRoot"];function formatPath(o=""){return o&&"/"!==o?(o=(0,tools_1.normalizePath)(`${o}/`)).replace(/^(\/)*/,"").replace(/\.\.\//g,"").replace(/^\.\//,""):""}const _getProjectConfigJSON=(0,reactiveCache_1.wrapCompileJSONFunc)(cache_1.CACHE_KEY.PROJECT_CONFIG,(o=>{if(!o.stat("",PROJECT_CONFIG_JSON))return o.type!==config_1.COMPILE_TYPE.miniGamePlugin&&o.type!==config_1.COMPILE_TYPE.miniProgramPlugin||(0,common_1.throwError)({msg:locales_1.default.config.NOT_FOUND.format("project.config.json"),code:config_1.FILE_NOT_FOUND,filePath:PROJECT_CONFIG_JSON}),{};const e=o.getFile("",PROJECT_CONFIG_JSON),t=(0,common_1.checkUTF8)(e,PROJECT_CONFIG_JSON),i=(0,common_2.checkJSONFormat)(t,PROJECT_CONFIG_JSON),r=(0,schemaValidate_1.schemaValidate)("projectconfig",i);return(0,schemaValidate_1.transValidateResult)(PROJECT_CONFIG_JSON,r),o.miniprogramRoot=i.miniprogramRoot||"",o.pluginRoot=i.pluginRoot||"",rootConfig.forEach((o=>{"string"==typeof i[o]?i[o]=formatPath(i[o]):i[o]=""})),"gamePlugin"!==i.compileType&&"plugin"!==i.compileType||i.pluginRoot||(0,common_1.throwError)({msg:locales_1.default.config.SHOULD_NOT_BE_EMPTY.format('["pluginRoot"]'),filePath:PROJECT_CONFIG_JSON}),"gamePlugin"!==i.compileType&&"plugin"!==i.compileType||i.pluginRoot!==i.miniprogramRoot||(0,common_1.throwError)({msg:locales_1.default.config.PLUGIN_PATH_SAME_WITH_MINIPROGRAM.format([i.pluginRoot,i.miniprogramRoot]),filePath:PROJECT_CONFIG_JSON}),i})),getProjectConfigJSON=function(o){const e=_getProjectConfigJSON(o);return(0,lodash_1.cloneDeep)(e)};exports.getProjectConfigJSON=getProjectConfigJSON;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.cleanReactiveCache=exports.wrapCompileJSONFunc=exports.tryToGetReactiveJSONCompiler=exports.ReactiveJSONCompiler=exports.tryToGetReactiveProject=exports.ReactiveProject=void 0;const process_1=require("process"),reactivity_1=require("@vue/reactivity"),lodash_1=require("lodash"),tools_1=require("../../../../utils/tools"),reactiveProject_1=require("../../../../project/advance/reactiveProject");function makeReadonly(e){return e&&"object"==typeof e?(0,reactivity_1.readonly)(e):e}Object.defineProperty(exports,"ReactiveProject",{enumerable:!0,get:function(){return reactiveProject_1.ReactiveProject}});const reactiveProjectMap=new Map;function tryToGetReactiveProject(e){let t=reactiveProjectMap.get(e.projectPath);return t||(t=new reactiveProject_1.ReactiveProject(e),reactiveProjectMap.set(e.projectPath,t),t)}exports.tryToGetReactiveProject=tryToGetReactiveProject;let isPending=!1;const pendingRunner=new Set,resolvedPromise=Promise.resolve();function runInNextTick(e){pendingRunner.add(e),isPending||(isPending=!0,resolvedPromise.then(()=>{const e=Date.now();try{const t=Array.from(pendingRunner);pendingRunner.clear(),isPending=!1,t.forEach(e=>{e()})}finally{(0,tools_1.devtoolsInfo)(`[reactiveCache] nextTick update cost ${Date.now()-e} ms`)}}))}class ReactiveJSONCompiler{constructor(e){this.pageComputeds=new Map,this.jsonComputeds=new Map,this.project=e}release(){(0,tools_1.devtoolsLog)("[reactiveCache] reactiveJSONCompiler release")}registerOrGet(e,t,...r){let o=this.jsonComputeds.get(e);if(!o){o=(0,reactivity_1.ref)(void 0),this.jsonComputeds.set(e,o);let i=void 0;i=(0,reactivity_1.effect)(()=>{try{const e=t.call(null,this.project,...r);(0,lodash_1.isEqual)(e,o.value)||(o.value=makeReadonly(e))}catch(t){o.value=t instanceof Error?t:new Error(t.toString()),(0,tools_1.devtoolsLog)(`[reactiveCache] update ${e} failed: `,t)}},{scheduler(){i&&i.active&&runInNextTick(i)}})}const{value:i}=o;if(i instanceof Error)throw i;return i}static setOriginGetPageJSON(e){this.originGetPageJSON=e}static setOriginCheckPageJSON(e){this.originCheckPageJSON=e}getPageJSON(e,t){let r=this.pageComputeds.get(t.pagePath);r||(r={checked:(0,reactivity_1.ref)(void 0),compiled:(0,reactivity_1.ref)(void 0)},this.pageComputeds.set(t.pagePath,r));const o=r[e];if(void 0===o.value){let r=void 0;r=(0,reactivity_1.effect)(()=>{try{(0,tools_1.devtoolsInfo)(`[reactiveCache] start to update ${e} ${t.pagePath}`);const r="compiled"===e?ReactiveJSONCompiler.originGetPageJSON(this.project,t):ReactiveJSONCompiler.originCheckPageJSON(this.project,t);o.value=makeReadonly(r),(0,tools_1.devtoolsInfo)(`[reactiveCache] update finish ${e} ${t.pagePath}`)}catch(r){o.value=r instanceof Error?r:new Error(r.toString()),(0,tools_1.devtoolsLog)(`[reactiveCache] update ${e} ${t.pagePath} failed: `,r)}},{scheduler(){r&&r.active&&(0,process_1.nextTick)(r)}})}const{value:i}=o;if(i instanceof Error)throw i;return i}}exports.ReactiveJSONCompiler=ReactiveJSONCompiler;const reactiveJSONCompilerMap=new Map;function tryToGetReactiveJSONCompiler(e){let t=reactiveJSONCompilerMap.get(e.projectPath);return t||(t=new ReactiveJSONCompiler(e),reactiveJSONCompilerMap.set(e.projectPath,t),t)}function wrapCompileJSONFunc(e,t){return function(r,...o){r instanceof reactiveProject_1.ReactiveProject||(r=tryToGetReactiveProject(r));return tryToGetReactiveJSONCompiler(r).registerOrGet(e,t,...o)}}function cleanReactiveCache(){reactiveProjectMap.forEach(e=>{e.release()}),reactiveProjectMap.clear(),reactiveJSONCompilerMap.forEach(e=>{e.release()}),reactiveJSONCompilerMap.clear()}exports.tryToGetReactiveJSONCompiler=tryToGetReactiveJSONCompiler,exports.wrapCompileJSONFunc=wrapCompileJSONFunc,exports.cleanReactiveCache=cleanReactiveCache;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ReactiveJSONCompiler=exports.ReactiveProject=void 0,exports.tryToGetReactiveProject=tryToGetReactiveProject,exports.tryToGetReactiveJSONCompiler=tryToGetReactiveJSONCompiler,exports.wrapCompileJSONFunc=wrapCompileJSONFunc,exports.cleanReactiveCache=cleanReactiveCache;const process_1=require("process"),reactivity_1=require("@vue/reactivity"),lodash_1=require("lodash"),tools_1=require("../../../../utils/tools"),reactiveProject_1=require("../../../../project/advance/reactiveProject");function makeReadonly(e){return e&&"object"==typeof e?(0,reactivity_1.readonly)(e):e}Object.defineProperty(exports,"ReactiveProject",{enumerable:!0,get:function(){return reactiveProject_1.ReactiveProject}});const reactiveProjectMap=new Map;function tryToGetReactiveProject(e){let t=reactiveProjectMap.get(e.projectPath);return t||(t=new reactiveProject_1.ReactiveProject(e),reactiveProjectMap.set(e.projectPath,t),t)}let isPending=!1;const pendingRunner=new Set,resolvedPromise=Promise.resolve();function runInNextTick(e){pendingRunner.add(e),isPending||(isPending=!0,resolvedPromise.then((()=>{const e=Date.now();try{const e=Array.from(pendingRunner);pendingRunner.clear(),isPending=!1,e.forEach((e=>{e()}))}finally{(0,tools_1.devtoolsInfo)(`[reactiveCache] nextTick update cost ${Date.now()-e} ms`)}})))}class ReactiveJSONCompiler{constructor(e){this.pageComputeds=new Map,this.jsonComputeds=new Map,this.project=e}release(){(0,tools_1.devtoolsLog)("[reactiveCache] reactiveJSONCompiler release")}registerOrGet(e,t,...r){let o=this.jsonComputeds.get(e);if(!o){let i;o=(0,reactivity_1.ref)(void 0),this.jsonComputeds.set(e,o),i=(0,reactivity_1.effect)((()=>{try{const e=t.call(null,this.project,...r);(0,lodash_1.isEqual)(e,o.value)||(o.value=makeReadonly(e))}catch(t){o.value=t instanceof Error?t:new Error(t.toString()),(0,tools_1.devtoolsLog)(`[reactiveCache] update ${e} failed: `,t)}}),{scheduler(){i&&i.active&&runInNextTick(i)}})}const{value:i}=o;if(i instanceof Error)throw i;return i}static setOriginGetPageJSON(e){this.originGetPageJSON=e}static setOriginCheckPageJSON(e){this.originCheckPageJSON=e}getPageJSON(e,t){let r=this.pageComputeds.get(t.pagePath);r||(r={checked:(0,reactivity_1.ref)(void 0),compiled:(0,reactivity_1.ref)(void 0)},this.pageComputeds.set(t.pagePath,r));const o=r[e];if(void 0===o.value){let r;r=(0,reactivity_1.effect)((()=>{try{(0,tools_1.devtoolsInfo)(`[reactiveCache] start to update ${e} ${t.pagePath}`);const r="compiled"===e?ReactiveJSONCompiler.originGetPageJSON(this.project,t):ReactiveJSONCompiler.originCheckPageJSON(this.project,t);o.value=makeReadonly(r),(0,tools_1.devtoolsInfo)(`[reactiveCache] update finish ${e} ${t.pagePath}`)}catch(r){o.value=r instanceof Error?r:new Error(r.toString()),(0,tools_1.devtoolsLog)(`[reactiveCache] update ${e} ${t.pagePath} failed: `,r)}}),{scheduler(){r&&r.active&&(0,process_1.nextTick)(r)}})}const{value:i}=o;if(i instanceof Error)throw i;return i}}exports.ReactiveJSONCompiler=ReactiveJSONCompiler;const reactiveJSONCompilerMap=new Map;function tryToGetReactiveJSONCompiler(e){let t=reactiveJSONCompilerMap.get(e.projectPath);return t||(t=new ReactiveJSONCompiler(e),reactiveJSONCompilerMap.set(e.projectPath,t),t)}function wrapCompileJSONFunc(e,t){var r;return(null===(r=null===process||void 0===process?void 0:process.env)||void 0===r?void 0:r.BUILD_SERVER)?t:function(r,...o){r instanceof reactiveProject_1.ReactiveProject||(r=tryToGetReactiveProject(r));return tryToGetReactiveJSONCompiler(r).registerOrGet(e,t,...o)}}function cleanReactiveCache(){reactiveProjectMap.forEach((e=>{e.release()})),reactiveProjectMap.clear(),reactiveJSONCompilerMap.forEach((e=>{e.release()})),reactiveJSONCompilerMap.clear()}
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getAllPluginSignatures=exports.isPathValid=exports.getAllPluginsWithPath=exports.friendlyPathMake=exports.trailing=void 0;const tslib_1=require("tslib"),path_1=tslib_1.__importDefault(require("path")),fs_extra_1=tslib_1.__importDefault(require("fs-extra")),tools_1=require("../../../../utils/tools"),log=tslib_1.__importStar(require("../../../../utils/log")),game_1=tslib_1.__importDefault(require("./game")),trailing=(t,e)=>t.endsWith(e)?t:t+e;exports.trailing=trailing;const friendlyPathMake=(t,e)=>path_1.default.normalize(path_1.default.join(t,e.replace(/\\/g,"/")).replace(/^\/+/,""));async function getAllPluginsWithPath(t){const e=(0,game_1.default)(t),i=[],a=(t,e="")=>{if(t.plugins)for(const a in t.plugins){if(!t.plugins.hasOwnProperty(a))continue;const r=t.plugins[a];r&&"string"==typeof r.path&&i.push({alias:a,version:r.version||"",provider:r.provider||"",path:r.path,friendlyPath:(0,exports.friendlyPathMake)(e,r.path)})}};a(e,"");const r=e.subPackages||e.subpackages;if(Array.isArray(r))for(const t of r)t&&"string"==typeof t.root&&a(t,t.root);return i}function isPathValid(t,e){if(e=e.replace(/\\/g,"/"),t=t.replace(/\\/g,"/"),e.includes("../")||e.endsWith("/.."))return!1;const i=(0,tools_1.normalizePath)(path_1.default.join(t,e)),a=(0,tools_1.normalizePath)(t);return!!i.startsWith(a)}async function getAllPluginSignatures(t){const e=await getAllPluginsWithPath(t),i=[];let a=t.miniprogramRoot?path_1.default.join(t.projectPath,t.miniprogramRoot):t.projectPath;a=(0,tools_1.normalizePath)(a),a=a.endsWith("/")?a:a+"/";for(const t of e)try{const e=path_1.default.join(a,t.friendlyPath);let r=await fs_extra_1.default.pathExists(e);if(!r)continue;const n=await fs_extra_1.default.stat(e);let s=e;n.isDirectory()||(s=path_1.default.dirname(e));const l=path_1.default.join(s,"signature.json");if(r=await fs_extra_1.default.pathExists(l),!r)continue;const o=await fs_extra_1.default.readFile(l,"utf8");let u=null;try{u=JSON.parse(o)}catch(t){log.error(t);continue}if(!u||!Array.isArray(u.signature))continue;const p=[];for(let t=0;t<u.signature.length;t++){const e=u.signature[t];if(!e)continue;if("string"!=typeof e.path||"string"!=typeof e.md5)continue;if(!isPathValid(s,e.path))continue;const i=path_1.default.join(s,e.path);p.push({fullPath:i,md5:e.md5})}i.push({provider:t.provider,fullPath:e,signature:p})}catch(t){log.error(t);continue}return i}exports.friendlyPathMake=friendlyPathMake,exports.getAllPluginsWithPath=getAllPluginsWithPath,exports.isPathValid=isPathValid,exports.getAllPluginSignatures=getAllPluginSignatures;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.friendlyPathMake=exports.trailing=void 0,exports.getAllPluginsWithPath=getAllPluginsWithPath,exports.isPathValid=isPathValid,exports.getAllPluginSignatures=getAllPluginSignatures;const tslib_1=require("tslib"),path_1=tslib_1.__importDefault(require("path")),fs_extra_1=tslib_1.__importDefault(require("fs-extra")),tools_1=require("../../../../utils/tools"),log=tslib_1.__importStar(require("../../../../utils/log")),game_1=tslib_1.__importDefault(require("./game")),trailing=(t,e)=>t.endsWith(e)?t:t+e;exports.trailing=trailing;const friendlyPathMake=(t,e)=>path_1.default.normalize(path_1.default.join(t,e.replace(/\\/g,"/")).replace(/^\/+/,""));async function getAllPluginsWithPath(t){const e=(0,game_1.default)(t),i=[],a=(t,e="")=>{if(t.plugins)for(const a in t.plugins){if(!t.plugins.hasOwnProperty(a))continue;const r=t.plugins[a];r&&"string"==typeof r.path&&i.push({alias:a,version:r.version||"",provider:r.provider||"",path:r.path,friendlyPath:(0,exports.friendlyPathMake)(e,r.path)})}};a(e,"");const r=e.subPackages||e.subpackages;if(Array.isArray(r))for(const t of r)t&&"string"==typeof t.root&&a(t,t.root);return i}function isPathValid(t,e){if(e=e.replace(/\\/g,"/"),t=t.replace(/\\/g,"/"),e.includes("../")||e.endsWith("/.."))return!1;const i=(0,tools_1.normalizePath)(path_1.default.join(t,e)),a=(0,tools_1.normalizePath)(t);return!!i.startsWith(a)}async function getAllPluginSignatures(t){const e=await getAllPluginsWithPath(t),i=[];let a=t.miniprogramRoot?path_1.default.join(t.projectPath,t.miniprogramRoot):t.projectPath;a=(0,tools_1.normalizePath)(a),a=a.endsWith("/")?a:`${a}/`;for(const t of e)try{const e=path_1.default.join(a,t.friendlyPath);let r=await fs_extra_1.default.pathExists(e);if(!r)continue;const n=await fs_extra_1.default.stat(e);let o=e;n.isDirectory()||(o=path_1.default.dirname(e));const s=path_1.default.join(o,"signature.json");if(r=await fs_extra_1.default.pathExists(s),!r)continue;const l=await fs_extra_1.default.readFile(s,"utf8");let u=null;try{u=JSON.parse(l)}catch(t){log.error(t);continue}if(!u||!Array.isArray(u.signature))continue;const p=[];for(let t=0;t<u.signature.length;t++){const e=u.signature[t];if(!e)continue;if("string"!=typeof e.path||"string"!=typeof e.md5)continue;if(!isPathValid(o,e.path))continue;const i=path_1.default.join(o,e.path);p.push({fullPath:i,md5:e.md5})}i.push({provider:t.provider,fullPath:e,signature:p})}catch(t){log.error(t);continue}return i}exports.friendlyPathMake=friendlyPathMake;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getSiteMapJSON=void 0;const tslib_1=require("tslib"),path_1=tslib_1.__importDefault(require("path")),tools_1=require("../../../../utils/tools"),common_1=require("../../../../utils/common"),schemaValidate_1=require("../validate/schemaValidate"),cache_1=require("../../../../utils/cache"),config_1=require("../../../../config/config"),reactiveCache_1=require("./reactiveCache"),common_2=require("./common"),projectconfig_1=require("./projectconfig"),appJSON_1=require("./app/appJSON");exports.getSiteMapJSON=(0,reactiveCache_1.wrapCompileJSONFunc)(cache_1.CACHE_KEY.SITE_MAP_JSON,e=>{const t=(0,projectconfig_1.getProjectConfigJSON)(e),i=(0,appJSON_1.getAppJSON)(e),{sitemapLocation:o=""}=i;let a=o;if(a)a=(0,tools_1.normalizePath)(path_1.default.posix.join(t.miniprogramRoot||"",a));else{if(a=(0,tools_1.normalizePath)(path_1.default.posix.join(t.miniprogramRoot||"","sitemap.json")),!e.stat("",a))return e.type,config_1.COMPILE_TYPE.miniProgramPlugin,{desc:"",rules:[{action:"disallow",page:"*"}]}}const r=e.getFile("",a),c=(0,common_1.checkUTF8)(r,a),s=(0,common_2.checkJSONFormat)(c,a),p=(0,schemaValidate_1.schemaValidate)("sitemap",s);return(0,schemaValidate_1.transValidateResult)(a,p),s});
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getSiteMapJSON=void 0;const tslib_1=require("tslib"),path_1=tslib_1.__importDefault(require("path")),tools_1=require("../../../../utils/tools"),common_1=require("../../../../utils/common"),schemaValidate_1=require("../validate/schemaValidate"),cache_1=require("../../../../utils/cache"),config_1=require("../../../../config/config"),reactiveCache_1=require("./reactiveCache"),common_2=require("./common"),projectconfig_1=require("./projectconfig"),appJSON_1=require("./app/appJSON");exports.getSiteMapJSON=(0,reactiveCache_1.wrapCompileJSONFunc)(cache_1.CACHE_KEY.SITE_MAP_JSON,(e=>{const t=(0,projectconfig_1.getProjectConfigJSON)(e),i=(0,appJSON_1.getAppJSON)(e),{sitemapLocation:o=""}=i;let a=o;if(a)a=(0,tools_1.normalizePath)(path_1.default.posix.join(t.miniprogramRoot||"",a));else{if(a=(0,tools_1.normalizePath)(path_1.default.posix.join(t.miniprogramRoot||"","sitemap.json")),!e.stat("",a))return e.type,config_1.COMPILE_TYPE.miniProgramPlugin,{desc:"",rules:[{action:"disallow",page:"*"}]}}const r=e.getFile("",a),c=(0,common_1.checkUTF8)(r,a),s=(0,common_2.checkJSONFormat)(c,a),p=(0,schemaValidate_1.schemaValidate)("sitemap",s);return(0,schemaValidate_1.transValidateResult)(a,p),s}));
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.mergeThemeJSONToPageJSON=exports.mergeThemeJSONToAppJSON=exports.checkThemeJSON=exports.getPluginThemeLocation=exports.getThemeLocation=void 0;const tslib_1=require("tslib"),path_1=tslib_1.__importDefault(require("path")),lodash_1=tslib_1.__importStar(require("lodash")),tools_1=require("../../../../utils/tools"),locales_1=tslib_1.__importDefault(require("../../../../utils/locales/locales")),common_1=require("../../../../utils/common"),cache_1=require("../../../../utils/cache"),schemaValidate_1=require("../validate/schemaValidate"),config_1=require("../../../../config/config"),common_2=require("./common"),appJSON_1=require("./app/appJSON"),plugin_1=require("./plugin/plugin"),reactiveCache_1=require("./reactiveCache"),projectconfig_1=require("./projectconfig");async function getPluginThemeLocation(e){return(await(0,plugin_1.getDevPluginJSON)(e)).themeLocation||null}function checkThemeJSON(e,o){const{isPlugin:t}=o;return t?originCheckThemeJSONForPlugin(e,o):originCheckThemeJSONForMiniProgram(e,o)}exports.getThemeLocation=(0,reactiveCache_1.wrapCompileJSONFunc)(cache_1.CACHE_KEY.APP_JSON_THEME_LOCATION,e=>{const o=(0,appJSON_1.getRawAppJSON)(e),{themeLocation:t}=o;return"[object Undefined]"!==Object.prototype.toString.call(t)?"string"==typeof t?((0,common_1.checkPath)({value:t,tips:'["themeLocation"]',filePath:"app.json"}),t):((0,common_1.throwError)({msg:locales_1.default.config.JSON_CONTENT_SHOULD_BE.format('appJSON["themeLocation"]',"string"),filePath:"app.json"}),null):null}),exports.getPluginThemeLocation=getPluginThemeLocation,exports.checkThemeJSON=checkThemeJSON;const originCheckThemeJSONForMiniProgram=(0,reactiveCache_1.wrapCompileJSONFunc)(cache_1.CACHE_KEY.THEME_JSON,originCheckThemeJSON),originCheckThemeJSONForPlugin=(0,reactiveCache_1.wrapCompileJSONFunc)(cache_1.CACHE_KEY.PLUGIN_THEME_JSON,originCheckThemeJSON);function originCheckThemeJSON(e,o){const{isPlugin:t}=o,i=(0,exports.getThemeLocation)(e),r=(0,projectconfig_1.getProjectConfigJSON)(e),a=t?r.pluginRoot:r.miniprogramRoot,c=(0,tools_1.normalizePath)(path_1.default.posix.join(a||"",i));e.stat("",c)||(0,common_1.throwError)({msg:locales_1.default.config.FILE_NOT_FOUND.format(c),filePath:"app.json"});const n=e.getFile("",c),l=(0,common_1.checkUTF8)(n,c),s=(0,common_2.checkJSONFormat)(l,c),h=(0,schemaValidate_1.schemaValidate)("theme",s);return(0,schemaValidate_1.transValidateResult)(c,h),s}function mergeThemeJSONToAppJSON(e,o){var t,i;const{windowPropertWhiteList:r,tabBarPropertyWhiteList:a,tabbarListItemPropertyWhiteList:c}=config_1.jsonVariablePropertyWhiteList,n=/^@/,l=lodash_1.default.cloneDeep(o.window||{}),s=lodash_1.default.cloneDeep(o.window||{});Object.keys(l).forEach(o=>{const t=l[o];if(n.test(t)){r.includes(o)||(0,common_1.throwError)({msg:""+locales_1.default.config.SHOULD_NOT_IN.format([t,o]),filePath:"app.json"});const i=t.slice(1);l[o]=e.light[i]||t,s[o]=e.dark[i]||t}});const h=(0,lodash_1.cloneDeep)(o),m=(0,lodash_1.cloneDeep)(o);if(h.window=l,m.window=s,null===(i=null===(t=o.tabBar)||void 0===t?void 0:t.list)||void 0===i?void 0:i.length){const t=lodash_1.default.cloneDeep(o.tabBar||{list:[]}),i=lodash_1.default.cloneDeep(o.tabBar||{list:[]});t.list&&t.list.length>0&&Object.keys(t).forEach(o=>{if("list"!==o){const r=t[o];if(n.test(r)){a.includes(o)||(0,common_1.throwError)({msg:""+locales_1.default.config.SHOULD_NOT_IN.format([r,o]),filePath:"app.json"});const c=r.slice(1);t[o]=e.light[c]||r,i[o]=e.dark[c]||r}}else t.list.forEach((o,r)=>{Object.keys(o).forEach(a=>{const l=o[a];if(n.test(l)){c.includes(a)||(0,common_1.throwError)({msg:""+locales_1.default.config.SHOULD_NOT_IN.format([l,a]),filePath:"app.json"});const o=l.slice(1);t.list[r][a]=e.light[o]||l,i.list[r][a]=e.dark[o]||l}})})}),m.tabBar=i,h.tabBar=t}return{appJSONLight:h,appJSONDark:m}}function mergeThemeJSONToPageJSON(e,o,t){const i=config_1.jsonVariablePropertyWhiteList.windowPropertWhiteList,r=lodash_1.default.cloneDeep(o||{}),a=lodash_1.default.cloneDeep(o||{}),c=/^@/;return Object.keys(o).forEach(n=>{const l=o[n];if(c.test(l)){const o=l.slice(1);i.includes(n)||(0,common_1.throwError)({msg:""+locales_1.default.config.SHOULD_NOT_IN.format([l,n]),filePath:t}),a[n]=e.light[o]||l,r[n]=e.dark[o]||l}}),{pageJSONDark:r,pageJSONLight:a}}exports.mergeThemeJSONToAppJSON=mergeThemeJSONToAppJSON,exports.mergeThemeJSONToPageJSON=mergeThemeJSONToPageJSON;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getThemeLocation=void 0,exports.getPluginThemeLocation=getPluginThemeLocation,exports.checkThemeJSON=checkThemeJSON,exports.mergeThemeJSONToAppJSON=mergeThemeJSONToAppJSON,exports.mergeThemeJSONToPageJSON=mergeThemeJSONToPageJSON;const tslib_1=require("tslib"),path_1=tslib_1.__importDefault(require("path")),lodash_1=tslib_1.__importStar(require("lodash")),tools_1=require("../../../../utils/tools"),locales_1=tslib_1.__importDefault(require("../../../../utils/locales/locales")),common_1=require("../../../../utils/common"),cache_1=require("../../../../utils/cache"),schemaValidate_1=require("../validate/schemaValidate"),config_1=require("../../../../config/config"),common_2=require("./common"),appJSON_1=require("./app/appJSON"),plugin_1=require("./plugin/plugin"),reactiveCache_1=require("./reactiveCache"),projectconfig_1=require("./projectconfig");async function getPluginThemeLocation(e){return(await(0,plugin_1.getDevPluginJSON)(e)).themeLocation||null}function checkThemeJSON(e,o){const{isPlugin:t}=o;return t?originCheckThemeJSONForPlugin(e,o):originCheckThemeJSONForMiniProgram(e,o)}exports.getThemeLocation=(0,reactiveCache_1.wrapCompileJSONFunc)(cache_1.CACHE_KEY.APP_JSON_THEME_LOCATION,(e=>{const o=(0,appJSON_1.getRawAppJSON)(e),{themeLocation:t}=o;return"[object Undefined]"!==Object.prototype.toString.call(t)?"string"==typeof t?((0,common_1.checkPath)({value:t,tips:'["themeLocation"]',filePath:"app.json"}),t):((0,common_1.throwError)({msg:locales_1.default.config.JSON_CONTENT_SHOULD_BE.format('appJSON["themeLocation"]',"string"),filePath:"app.json"}),null):null}));const originCheckThemeJSONForMiniProgram=(0,reactiveCache_1.wrapCompileJSONFunc)(cache_1.CACHE_KEY.THEME_JSON,originCheckThemeJSON),originCheckThemeJSONForPlugin=(0,reactiveCache_1.wrapCompileJSONFunc)(cache_1.CACHE_KEY.PLUGIN_THEME_JSON,originCheckThemeJSON);function originCheckThemeJSON(e,o){const{isPlugin:t}=o,i=(0,exports.getThemeLocation)(e),a=(0,projectconfig_1.getProjectConfigJSON)(e),r=t?a.pluginRoot:a.miniprogramRoot,c=(0,tools_1.normalizePath)(path_1.default.posix.join(r||"",i));e.stat("",c)||(0,common_1.throwError)({msg:locales_1.default.config.FILE_NOT_FOUND.format(c),filePath:"app.json"});const n=e.getFile("",c),l=(0,common_1.checkUTF8)(n,c),s=(0,common_2.checkJSONFormat)(l,c),h=(0,schemaValidate_1.schemaValidate)("theme",s);return(0,schemaValidate_1.transValidateResult)(c,h),s}function mergeThemeJSONToAppJSON(e,o){var t,i;const{windowPropertWhiteList:a,tabBarPropertyWhiteList:r,tabbarListItemPropertyWhiteList:c}=config_1.jsonVariablePropertyWhiteList,n=/^@/,l=lodash_1.default.cloneDeep(o.window||{}),s=lodash_1.default.cloneDeep(o.window||{});Object.keys(l).forEach((o=>{const t=l[o];if(n.test(t)){a.includes(o)||(0,common_1.throwError)({msg:`${locales_1.default.config.SHOULD_NOT_IN.format([t,o])}`,filePath:"app.json"});const i=t.slice(1);l[o]=e.light[i]||t,s[o]=e.dark[i]||t}}));const h=(0,lodash_1.cloneDeep)(o),m=(0,lodash_1.cloneDeep)(o);if(h.window=l,m.window=s,null===(i=null===(t=o.tabBar)||void 0===t?void 0:t.list)||void 0===i?void 0:i.length){const t=lodash_1.default.cloneDeep(o.tabBar||{list:[]}),i=lodash_1.default.cloneDeep(o.tabBar||{list:[]});t.list&&t.list.length>0&&Object.keys(t).forEach((o=>{if("list"!==o){const a=t[o];if(n.test(a)){r.includes(o)||(0,common_1.throwError)({msg:`${locales_1.default.config.SHOULD_NOT_IN.format([a,o])}`,filePath:"app.json"});const c=a.slice(1);t[o]=e.light[c]||a,i[o]=e.dark[c]||a}}else t.list.forEach(((o,a)=>{Object.keys(o).forEach((r=>{const l=o[r];if(n.test(l)){c.includes(r)||(0,common_1.throwError)({msg:`${locales_1.default.config.SHOULD_NOT_IN.format([l,r])}`,filePath:"app.json"});const o=l.slice(1);t.list[a][r]=e.light[o]||l,i.list[a][r]=e.dark[o]||l}}))}))})),m.tabBar=i,h.tabBar=t}return{appJSONLight:h,appJSONDark:m}}function mergeThemeJSONToPageJSON(e,o,t){const i=config_1.jsonVariablePropertyWhiteList.windowPropertWhiteList,a=lodash_1.default.cloneDeep(o||{}),r=lodash_1.default.cloneDeep(o||{}),c=/^@/;return Object.keys(o).forEach((n=>{const l=o[n];if(c.test(l)){const o=l.slice(1);i.includes(n)||(0,common_1.throwError)({msg:`${locales_1.default.config.SHOULD_NOT_IN.format([l,n])}`,filePath:t}),r[n]=e.light[o]||l,a[n]=e.dark[o]||l}})),{pageJSONDark:a,pageJSONLight:r}}
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});const tslib_1=require("tslib"),path_1=tslib_1.__importDefault(require("path")),read_package_tree_1=tslib_1.__importDefault(require("read-package-tree"));function checkDeps(e,t){var a,r;const n=new Set(Object.keys((null===(a=e.package)||void 0===a?void 0:a.dependencies)||{})),o=[];let s=e;for(;s;){const e=s.children||[];for(const t of e){const e=(null===(r=t.package)||void 0===r?void 0:r.name)||"";n.has(e)&&(n.delete(e),o.push(t))}s=s.parent}for(const e of o)t.has(e)||(t.add(e),checkDeps(e,t))}async function getDeps(e){return new Promise((t,a)=>{(0,read_package_tree_1.default)(e,(e,r)=>{if(e)return a(e);const n=new Set;try{checkDeps(r,n)}catch(e){return a(e)}t(Array.from(n))})})}async function default_1(e,t){if(null==t?void 0:t.length){const a=t.filter(e=>!/([\\/]|\b)node_modules/.test(e)),r=[],n={};for(const t of a){(await getDeps(path_1.default.join(e,path_1.default.dirname(t)))).forEach(e=>{r.push(e)})}for(const e of r){const t=e.isLink?e.path:e.realpath;n[path_1.default.normalize(path_1.default.join(t,"./package.json"))]=e}t=t.filter(t=>{const a=path_1.default.normalize(path_1.default.join(e,t));return!!n[a]})}return t}exports.default=default_1;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=default_1;const tslib_1=require("tslib"),path_1=tslib_1.__importDefault(require("path")),read_package_tree_1=tslib_1.__importDefault(require("read-package-tree"));function checkDeps(e,t){var a,r;const n=new Set(Object.keys((null===(a=e.package)||void 0===a?void 0:a.dependencies)||{})),o=[];let s=e;for(;s;){const e=s.children||[];for(const t of e){const e=(null===(r=t.package)||void 0===r?void 0:r.name)||"";n.has(e)&&(n.delete(e),o.push(t))}s=s.parent}for(const e of o)t.has(e)||(t.add(e),checkDeps(e,t))}async function getDeps(e){return new Promise(((t,a)=>{(0,read_package_tree_1.default)(e,((e,r)=>{if(e)return a(e);const n=new Set;try{checkDeps(r,n)}catch(e){return a(e)}t(Array.from(n))}))}))}async function default_1(e,t){if(null==t?void 0:t.length){const a=t.filter((e=>!/([\\/]|\b)node_modules/.test(e))),r=[],n={};for(const t of a){(await getDeps(path_1.default.join(e,path_1.default.dirname(t)))).forEach((e=>{r.push(e)}))}for(const e of r){const t=e.isLink?e.path:e.realpath;n[path_1.default.normalize(path_1.default.join(t,"./package.json"))]=e}t=t.filter((t=>{const a=path_1.default.normalize(path_1.default.join(e,t));return!!n[a]}))}return t}
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.packNpmManually=exports.packNpm=void 0;const tslib_1=require("tslib"),path_1=tslib_1.__importDefault(require("path")),fs_1=tslib_1.__importDefault(require("fs")),rimraf_1=tslib_1.__importDefault(require("rimraf")),lodash_1=tslib_1.__importDefault(require("lodash")),glob_1=tslib_1.__importDefault(require("glob")),source_map_1=tslib_1.__importDefault(require("source-map")),locales_1=tslib_1.__importDefault(require("../../../../utils/locales/locales")),error_1=require("../../../../utils/error"),log=tslib_1.__importStar(require("../../../../utils/log")),projectconfig_1=require("../json/projectconfig"),config_1=require("../../../../config/config"),filterdeps_1=tslib_1.__importDefault(require("./filterdeps")),acorn=require("acorn"),NPM_RECORD={start_time:Date.now(),pack_time:0,miniprogram_pack_num:0,other_pack_num:0,warn_not_found_num:0,warn_require_var_num:0,warn_require_rename_num:0,extra1:"",extra2:"",extra3:""},REPORT_LIST=["pack_time","miniprogram_pack_num","other_pack_num","warn_not_found_num","warn_require_var_num","warn_require_rename_num","extra1","extra2","extra3"];function wrap(e,t){return function(...a){if(a.length){const e=a.pop();"function"!=typeof e&&a.push(e)}return new Promise((n,r)=>{a.push((e,t)=>{e?r(e):n(t)}),e.apply(t||null,a)})}}const statSync=wrap(fs_1.default.stat),mkdirSync=wrap(fs_1.default.mkdir),readFileSync=wrap(fs_1.default.readFile),writeFileSync=wrap(fs_1.default.writeFile),accessSync=wrap(fs_1.default.access),renameSync=wrap(fs_1.default.rename),globSync=wrap(glob_1.default);let seed=+new Date;function getId(){return++seed}function startRecord(){NPM_RECORD.start_time=Date.now(),REPORT_LIST.forEach(e=>NPM_RECORD[e]=e.startsWith("extra")?"":0)}function endRecord(e){NPM_RECORD.pack_time=Date.now()-NPM_RECORD.start_time;const t={};REPORT_LIST.forEach(e=>t[e]=NPM_RECORD[e]);try{null==e||e(t)}catch(e){}}async function recursiveMkdir(e){const t=path_1.default.posix.dirname(e);try{await accessSync(t)}catch(e){await recursiveMkdir(t)}try{await accessSync(e);const t=await statSync(e);t&&!t.isDirectory()&&(await renameSync(e,e+".bak"),log.warn(e+" already exists but is not a directory, so it will be rename to a file with the suffix ending in '.bak'"),await mkdirSync(e))}catch(t){await mkdirSync(e)}}async function copyFile(e,t){const a=await readFileSync(e);await writeFile(a,t)}async function writeFile(e,t){await recursiveMkdir(path_1.default.posix.dirname(t)),await writeFileSync(t,e)}function walkNode(e,t){t(e),Object.keys(e).forEach(a=>{const n=e[a];Array.isArray(n)&&n.forEach(e=>{(null==e?void 0:e.type)&&walkNode(e,t)}),(null==n?void 0:n.type)&&walkNode(n,t)})}function parseDeps(e,t,a){const n=[];let r,o=[];try{r=acorn.parse(e,{sourceType:"module",locations:!0,allowHashBang:!0,onComment(t,a,n,r){t||"#"!==e[n]||o.push({start:n,end:r,adjustContent:""})}})}catch(e){const a=`parse js file (${t}) failed: ${e.message}`;throw console.error(a),e.message=a,e}return walkNode(r,r=>{const{callee:i}=r,s=r.arguments;if("CallExpression"===r.type&&i&&"Identifier"===i.type&&"require"===i.name&&s&&1===s.length&&("Literal"===s[0].type?n.push(s[0].value):(a.push({jsPath:t,code:e.substring(r.start,r.end),startLine:r.loc.start.line,endLine:r.loc.end.line,tips:"require variable is not allowed",msg:locales_1.default.config.NOT_ALLOWED_REQUIRE_VAR.format()}),NPM_RECORD.warn_require_var_num++)),"ExpressionStatement"===r.type&&r.expression&&"use strict"===r.expression.value&&o.push({start:r.start,end:r.end,adjustContent:""}),"ImportDeclaration"===r.type){const{source:e}=r,{specifiers:t}=r,a={start:r.start,end:r.end,adjustContent:""},i=[];e&&"Literal"===e.type&&(n.push(e.value),i.push(`var __TEMP__ = require('${e.value}');`)),t&&Array.isArray(t)&&t.forEach(e=>{if("ImportSpecifier"===e.type){const{local:t}=e,{imported:a}=e;"Identifier"===t.type&&"Identifier"===a.type&&i.push(`var ${t.name} = __TEMP__['${a.name}'];`)}else if("ImportDefaultSpecifier"===e.type){const{local:t}=e;"Identifier"===t.type&&i.push(`var ${t.name} = __REQUIRE_DEFAULT__(__TEMP__);`)}else if("ImportNamespaceSpecifier"===e.type){const{local:t}=e;"Identifier"===t.type&&i.push(`var ${t.name} = __REQUIRE_WILDCARD__(__TEMP__);`)}}),a.adjustContent=i.join(""),o.push(a)}if("ExportNamedDeclaration"===r.type){const{source:t}=r,{specifiers:a}=r,{declaration:i}=r;let s=!1;const p={start:r.start,end:r.end,adjustContent:""},c=['if (!exports.__esModule) Object.defineProperty(exports, "__esModule", { value: true });'];if(t&&"Literal"===t.type&&(n.push(t.value),c.push(`var __TEMP__ = require('${t.value}');`),s=!0),i){if("VariableDeclaration"===i.type){const{declarations:t}=i;t&&Array.isArray(t)&&t.forEach(t=>{if("VariableDeclarator"===t.type){const{id:a}=t,{init:n}=t;a&&"Identifier"===a.type&&(p.notAddLines=!0,c.push(`var ${a.name} = exports.${a.name} = ${n?e.substring(n.start,n.end):"undefined"};`))}})}else if("FunctionDeclaration"===i.type){const{id:t}=i;t&&"Identifier"===t.type&&(p.notAddLines=!0,c.push(`${e.substring(i.start,i.end)};exports.${t.name} = ${t.name}`))}else if("ClassDeclaration"===i.type){const{id:t}=i;t&&"Identifier"===t.type&&(p.notAddLines=!0,c.push(`${e.substring(i.start,i.end)};exports.${t.name} = ${t.name}`))}}else;a&&Array.isArray(a)&&a.forEach(e=>{if("ExportSpecifier"===e.type){const{local:t}=e,{exported:a}=e;"Identifier"===t.type&&"Identifier"===a.type&&c.push(`Object.defineProperty(exports, '${a.name}', { enumerable: true, configurable: true, get: function() { return ${s?"__TEMP__.":""}${t.name}; } });`)}}),p.adjustContent=c.join(""),o.push(p)}else if("ExportAllDeclaration"===r.type){const{source:e}=r,t={start:r.start,end:r.end,adjustContent:""},a=['if (!exports.__esModule) Object.defineProperty(exports, "__esModule", { value: true });'];e&&"Literal"===e.type&&(n.push(e.value),a.push(`var __TEMP__ = require('${e.value}');`)),a.push('Object.keys(__TEMP__).forEach(function(k) { if (k === "default" || k === "__esModule") return; Object.defineProperty(exports, k, { enumerable: true, configurable: true, get: function() { return __TEMP__[k]; } }); });'),t.adjustContent=a.join(""),o.push(t)}else if("ExportDefaultDeclaration"===r.type){const{declaration:t}=r,a={start:r.start,end:r.end,adjustContent:""},n=['if (!exports.__esModule) Object.defineProperty(exports, "__esModule", { value: true });'];if(t)if(a.notAddLines=!0,t.id){const{id:a}=t;n.push(`${e.substring(t.start,t.end)};exports.default = ${a.name}`)}else n.push(`exports.default = ${e.substring(t.start,t.end)};`);a.adjustContent=n.join(""),o.push(a)}const{expression:p}=r;"ExpressionStatement"===r.type&&p&&"AssignmentExpression"===p.type&&"Identifier"===p.right.type&&"require"===p.right.name&&(a.push({jsPath:t,code:e.substring(r.start,r.end),startLine:r.loc.start.line,endLine:r.loc.end.line,tips:"assign require function to a variable is not allowed",msg:locales_1.default.config.NOT_ALLOWED_REQUIRE_ASSIGN.format()}),NPM_RECORD.warn_require_rename_num++);const{declarations:c}=r;"VariableDeclaration"===r.type&&c.length>0&&c.forEach(n=>{const{init:o}=n;"VariableDeclarator"===n.type&&o&&"Identifier"===o.type&&"require"===o.name&&(a.push({jsPath:t,code:e.substring(r.start,r.end),startLine:r.loc.start.line,endLine:r.loc.end.line,tips:"assign require function to a variable is not allowed",msg:locales_1.default.config.NOT_ALLOWED_REQUIRE_ASSIGN.format()}),NPM_RECORD.warn_require_rename_num++)})}),o=o.sort((e,t)=>t.start-e.start),o.forEach(t=>{const a=e.substring(t.start,t.end),n=t.notAddLines?0:a.split("\n").length;e=e.substring(0,t.start)+t.adjustContent+new Array(n).join("\n")+e.substring(t.end)}),{deps:n,parsedContent:e}}async function parseJs(e,t,a,n,r,o){if(r[t=path_1.default.posix.normalize(t)])return r[t];const i=await readFileSync(t,"utf8"),s=getId(),p=path_1.default.posix.relative(e,t);if(t.endsWith(".json")){const e={id:s,name:p,content:"module.exports = "+i,deps:[],depsMap:{}};return r[t]=s,n.push(e),s}const{deps:c,parsedContent:_}=parseDeps(i,t,o),u={id:s,name:p,content:_,deps:c,depsMap:{}};r[t]=s,n.push(u);for(const i of c){let s,p=path_1.default.posix.join(path_1.default.posix.dirname(t),i);if(!p.endsWith(".js")&&!p.endsWith(".json")){const e=p+".js";try{await accessSync(e),p=e}catch(e){}}try{const e=await statSync(p);(null==e?void 0:e.isDirectory())&&(p=path_1.default.posix.join(p,"index.js"))}catch(e){}p.endsWith(".js")||p.endsWith(".json")||(p+=".js");try{await accessSync(p),s=await parseJs(e,p,a,n,r,o)}catch(e){}s&&(u.depsMap[i]=s)}return s}function addJsToMap(e,t,a,n){const r=t.split("\n").length;for(let o=1;o<=r;o++)e.addMapping({generated:{line:n+o,column:0},original:{line:o,column:0},source:a}),e.setSourceContent(a,t)}function findOutsideDeps(e){const t=new Set;return e.forEach(e=>{e.deps.forEach(a=>{Object.keys(e.depsMap).includes(a)||t.add(a)})}),Array.from(t)}async function packJs(e,t,a){try{const t=await statSync(e);(null==t?void 0:t.isDirectory())&&(e=path_1.default.posix.join(e,"index.js"))}catch(e){}e.endsWith(".js")||e.endsWith(".json")||(e+=".js");try{await accessSync(e)}catch(t){return a.push({jsPath:e,code:"",tips:"entry file is not found",msg:locales_1.default.config.NOT_FOUND_NPM_ENTRY.format()}),void NPM_RECORD.warn_not_found_num++}const n=new source_map_1.default.SourceMapGenerator({file:"index.js"}),r=[];await parseJs(path_1.default.posix.dirname(e),e,t,r,{},a);const o=findOutsideDeps(r),i=["module.exports = (function() {","var __MODS__ = {};","var __DEFINE__ = function(modId, func, req) { var m = { exports: {}, _tempexports: {} }; __MODS__[modId] = { status: 0, func: func, req: req, m: m }; };",'var __REQUIRE__ = function(modId, source) { if(!__MODS__[modId]) return require(source); if(!__MODS__[modId].status) { var m = __MODS__[modId].m; m._exports = m._tempexports; var desp = Object.getOwnPropertyDescriptor(m, "exports"); if (desp && desp.configurable) Object.defineProperty(m, "exports", { set: function (val) { if(typeof val === "object" && val !== m._exports) { m._exports.__proto__ = val.__proto__; Object.keys(val).forEach(function (k) { m._exports[k] = val[k]; }); } m._tempexports = val }, get: function () { return m._tempexports; } }); __MODS__[modId].status = 1; __MODS__[modId].func(__MODS__[modId].req, m, m.exports); } return __MODS__[modId].m.exports; };',"var __REQUIRE_WILDCARD__ = function(obj) { if(obj && obj.__esModule) { return obj; } else { var newObj = {}; if(obj != null) { for(var k in obj) { if (Object.prototype.hasOwnProperty.call(obj, k)) newObj[k] = obj[k]; } } newObj.default = obj; return newObj; } };","var __REQUIRE_DEFAULT__ = function(obj) { return obj && obj.__esModule ? obj.default : obj; };"];if(r.length){const e=r.shift();i.push(`__DEFINE__(${e.id}, function(require, module, exports) {`),addJsToMap(n,e.content,e.name,i.length),i.push(e.content),i.push(`}, function(modId) {var map = ${JSON.stringify(e.depsMap)}; return __REQUIRE__(map[modId], modId); })`);for(const e of r)i.push(`__DEFINE__(${e.id}, function(require, module, exports) {`),addJsToMap(n,e.content,e.name,i.length),i.push(e.content),i.push(`}, function(modId) { var map = ${JSON.stringify(e.depsMap)}; return __REQUIRE__(map[modId], modId); })`);i.push(`return __REQUIRE__(${e.id});`)}return i.push("})()"),i.push("//miniprogram-npm-outsideDeps="+JSON.stringify(o)),i.push("//# sourceMappingURL=index.js.map"),{js:i.join("\n"),map:n.toString()}}async function checkIsMiniprogramPack(e,t){let a="miniprogram_dist";t.miniprogram&&"string"==typeof t.miniprogram&&(a=t.miniprogram);try{const t=path_1.default.posix.join(e,a);await accessSync(t);const n=await statSync(t);if(null==n?void 0:n.isDirectory())return t}catch(e){}return""}async function packNpm(e,t={}){const{projectPath:a}=e,n=e.type,r=await(0,projectconfig_1.getProjectConfigJSON)(e),o=r.pluginRoot||"",i=r.miniprogramRoot||"",s="miniProgramPlugin"===n||"miniGamePlugin"===n,{ignores:p,reporter:c}=t;if(!a)throw new error_1.CodeError(locales_1.default.config.SHOULD_NOT_BE_EMPTY.format("projectPath"),config_1.PARAM_ERROR);if("miniProgramPlugin"===n&&!o)throw new error_1.CodeError(locales_1.default.config.SHOULD_NOT_BE_EMPTY.format('project.config.json "pluginRoot"'),config_1.PARAM_ERROR);startRecord();const _=path_1.default.isAbsolute(a)?a:path_1.default.posix.join(process.cwd(),a),u=[{searchRoot:path_1.default.posix.join(_,i),paths:await globSync("**/package.json",{cwd:path_1.default.posix.join(_,i),nodir:!0,dot:!0,ignore:(p||[]).concat("**/node_modules/**")})}];s&&u.push({searchRoot:path_1.default.posix.join(_,o),paths:await globSync("**/package.json",{cwd:path_1.default.posix.join(_,o),nodir:!0,dot:!0,ignore:(p||[]).concat("**/node_modules/**")})});lodash_1.default.flattenDeep(u.map(e=>e.paths.map(t=>path_1.default.posix.join(e.searchRoot,path_1.default.dirname(t),"miniprogram_npm")))).forEach(e=>rimraf_1.default.sync(e));const l=[];for(const e of u)for(const t of e.paths){const a=path_1.default.dirname(path_1.default.posix.join(e.searchRoot,t)),n=lodash_1.default.xorWith(e.paths,[t]).map(e=>path_1.default.posix.join(path_1.default.posix.dirname(e),"/**")).filter(e=>"**"!==e);let r=await globSync("**/package.json",{cwd:a.replace(/\\/g,"/"),nodir:!0,dot:!0,ignore:(p||[]).concat(n).concat(["node_modules/@types/**"])});if(r=await(0,filterdeps_1.default)(a,r),r&&r.length)for(const e of r){const t=path_1.default.posix.join(a,e);let n=await readFileSync(t,"utf8");const r=path_1.default.dirname(t);let o=r.replace(/([\b/\\])node_modules([\b/\\])/g,(e,t,a)=>`${t}miniprogram_npm${a}`),i=path_1.default.basename(o);const s=i.split("@");s.length&&(i=s.pop()||""),o=o.replace(path_1.default.basename(o),i),n=JSON.parse(n);const p=path_1.default.posix.join(r,n.main||"index.js"),c=await checkIsMiniprogramPack(r,n);if(c){const e=await globSync("**/*",{cwd:c.replace(/\\/g,"/"),nodir:!0,dot:!0,ignore:"**/node_modules/**"});for(const t of e)await copyFile(path_1.default.posix.join(c,t),path_1.default.posix.join(o,t));NPM_RECORD.miniprogram_pack_num++}else{const e=await packJs(p,o,l);if(!e)continue;await writeFile(e.js,path_1.default.posix.join(o,"./index.js")),await writeFile(e.map,path_1.default.posix.join(o,"./index.js.map")),NPM_RECORD.other_pack_num++}}}if(endRecord(c),NPM_RECORD.miniprogram_pack_num+NPM_RECORD.other_pack_num<=0)throw new Error("__NO_NODE_MODULES__ "+locales_1.default.config.NOT_FOUND_NODE_MODULES.format());return"function"==typeof e.updateFileAndDirs&&e.updateFileAndDirs(),l}async function packNpmManually(e){let{packageJsonPath:t,miniprogramNpmDistDir:a}=e;const n=e.ignores||[],r={pack_time:0,miniprogram_pack_num:0,other_pack_num:0,warn_not_found_num:0,warn_require_var_num:0,warn_require_rename_num:0},o=[];if(!a)throw new Error("param miniprogramNpmDistDir is required");if(!t)throw new Error("param packageJsonPath is required");if(path_1.default.isAbsolute(a)||(a=path_1.default.join(process.cwd(),a)),path_1.default.isAbsolute(t)||(t=path_1.default.join(process.cwd(),t)),!fs_1.default.existsSync(t))throw new Error(`param packageJsonPath: ${t} file is not exited`);const i=path_1.default.dirname(t);let s=await globSync("**/package.json",{cwd:i.replace(/\\/g,"/"),nodir:!0,dot:!0,ignore:(n||[]).concat(["node_modules/@types/**"])});if(s=await(0,filterdeps_1.default)(i,s),!s||!s.length){const e={jsPath:i,code:"",tips:"",msg:"No miniprogram_npm package was found, please check package.json -> dependencies."};return log.warn(e.msg),o.push(e),{miniProgramPackNum:0,otherNpmPackNum:0,warnList:o}}s=s.filter(e=>e.startsWith("node_modules"));for(const e of s){const t=path_1.default.posix.join(i,e);let n=await readFileSync(t,"utf8");const s=path_1.default.dirname(t);let p=s.replace(/([\b/\\])node_modules([\b/\\])/g,(e,t,a)=>`${t}miniprogram_npm${a}`);p=path_1.default.posix.normalize(path_1.default.posix.join(a,"miniprogram_npm",p.split(/[/\\]miniprogram_npm[/\\]/)[1]));let c=path_1.default.basename(p);const _=c.split("@");_.length&&(c=_.pop()||""),p=p.replace(path_1.default.basename(p),c),n=JSON.parse(n);const u=path_1.default.posix.join(s,n.main||"index.js"),l=await checkIsMiniprogramPack(s,n);if(l){const e=await globSync("**/*",{cwd:l.replace(/\\/g,"/"),nodir:!0,dot:!0,ignore:"**/node_modules/**"});for(const t of e)await copyFile(path_1.default.posix.join(l,t),path_1.default.posix.join(p,t));r.miniprogram_pack_num++}else{const e=await packJs(u,p,o);if(!e)continue;await writeFile(e.js,path_1.default.posix.join(p,"./index.js")),await writeFile(e.map,path_1.default.posix.join(p,"./index.js.map")),r.other_pack_num++}}return{miniProgramPackNum:r.miniprogram_pack_num,otherNpmPackNum:r.other_pack_num,warnList:o}}exports.packNpm=packNpm,exports.packNpmManually=packNpmManually;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.packNpm=packNpm,exports.packNpmManually=packNpmManually;const tslib_1=require("tslib"),path_1=tslib_1.__importDefault(require("path")),fs_1=tslib_1.__importDefault(require("fs")),rimraf_1=tslib_1.__importDefault(require("rimraf")),lodash_1=tslib_1.__importDefault(require("lodash")),glob_1=tslib_1.__importDefault(require("glob")),source_map_1=tslib_1.__importDefault(require("source-map")),locales_1=tslib_1.__importDefault(require("../../../../utils/locales/locales")),error_1=require("../../../../utils/error"),log=tslib_1.__importStar(require("../../../../utils/log")),projectconfig_1=require("../json/projectconfig"),config_1=require("../../../../config/config"),filterdeps_1=tslib_1.__importDefault(require("./filterdeps")),acorn=require("acorn"),NPM_RECORD={start_time:Date.now(),pack_time:0,miniprogram_pack_num:0,other_pack_num:0,warn_not_found_num:0,warn_require_var_num:0,warn_require_rename_num:0,extra1:"",extra2:"",extra3:""},REPORT_LIST=["pack_time","miniprogram_pack_num","other_pack_num","warn_not_found_num","warn_require_var_num","warn_require_rename_num","extra1","extra2","extra3"];function wrap(e,t){return function(...a){if(a.length){const e=a.pop();"function"!=typeof e&&a.push(e)}return new Promise(((n,r)=>{a.push(((e,t)=>{e?r(e):n(t)})),e.apply(t||null,a)}))}}const statSync=wrap(fs_1.default.stat),mkdirSync=wrap(fs_1.default.mkdir),readFileSync=wrap(fs_1.default.readFile),writeFileSync=wrap(fs_1.default.writeFile),accessSync=wrap(fs_1.default.access),renameSync=wrap(fs_1.default.rename),globSync=wrap(glob_1.default);let seed=+new Date;function getId(){return++seed}function startRecord(){NPM_RECORD.start_time=Date.now(),REPORT_LIST.forEach((e=>NPM_RECORD[e]=e.startsWith("extra")?"":0))}function endRecord(e){NPM_RECORD.pack_time=Date.now()-NPM_RECORD.start_time;const t={};REPORT_LIST.forEach((e=>t[e]=NPM_RECORD[e]));try{null==e||e(t)}catch(e){}}async function recursiveMkdir(e){const t=path_1.default.posix.dirname(e);try{await accessSync(t)}catch(e){await recursiveMkdir(t)}try{await accessSync(e);const t=await statSync(e);t&&!t.isDirectory()&&(await renameSync(e,`${e}.bak`),log.warn(`${e} already exists but is not a directory, so it will be rename to a file with the suffix ending in '.bak'`),await mkdirSync(e))}catch(t){await mkdirSync(e)}}async function copyFile(e,t){const a=await readFileSync(e);await writeFile(a,t)}async function writeFile(e,t){await recursiveMkdir(path_1.default.posix.dirname(t)),await writeFileSync(t,e)}function walkNode(e,t){t(e),Object.keys(e).forEach((a=>{const n=e[a];Array.isArray(n)&&n.forEach((e=>{(null==e?void 0:e.type)&&walkNode(e,t)})),(null==n?void 0:n.type)&&walkNode(n,t)}))}function parseDeps(e,t,a){const n=[];let r,o=[];try{r=acorn.parse(e,{sourceType:"module",locations:!0,allowHashBang:!0,onComment(t,a,n,r){t||"#"!==e[n]||o.push({start:n,end:r,adjustContent:""})}})}catch(e){const a=`parse js file (${t}) failed: ${e.message}`;throw console.error(a),e.message=a,e}return walkNode(r,(r=>{const{callee:i}=r,s=r.arguments;if("CallExpression"===r.type&&i&&"Identifier"===i.type&&"require"===i.name&&s&&1===s.length&&("Literal"===s[0].type?n.push(s[0].value):(a.push({jsPath:t,code:e.substring(r.start,r.end),startLine:r.loc.start.line,endLine:r.loc.end.line,tips:"require variable is not allowed",msg:locales_1.default.config.NOT_ALLOWED_REQUIRE_VAR.format()}),NPM_RECORD.warn_require_var_num++)),"ExpressionStatement"===r.type&&r.expression&&"use strict"===r.expression.value&&o.push({start:r.start,end:r.end,adjustContent:""}),"ImportDeclaration"===r.type){const{source:e}=r,{specifiers:t}=r,a={start:r.start,end:r.end,adjustContent:""},i=[];e&&"Literal"===e.type&&(n.push(e.value),i.push(`var __TEMP__ = require('${e.value}');`)),t&&Array.isArray(t)&&t.forEach((e=>{if("ImportSpecifier"===e.type){const{local:t}=e,{imported:a}=e;"Identifier"===t.type&&"Identifier"===a.type&&i.push(`var ${t.name} = __TEMP__['${a.name}'];`)}else if("ImportDefaultSpecifier"===e.type){const{local:t}=e;"Identifier"===t.type&&i.push(`var ${t.name} = __REQUIRE_DEFAULT__(__TEMP__);`)}else if("ImportNamespaceSpecifier"===e.type){const{local:t}=e;"Identifier"===t.type&&i.push(`var ${t.name} = __REQUIRE_WILDCARD__(__TEMP__);`)}})),a.adjustContent=i.join(""),o.push(a)}if("ExportNamedDeclaration"===r.type){const{source:t}=r,{specifiers:a}=r,{declaration:i}=r;let s=!1;const p={start:r.start,end:r.end,adjustContent:""},c=['if (!exports.__esModule) Object.defineProperty(exports, "__esModule", { value: true });'];if(t&&"Literal"===t.type&&(n.push(t.value),c.push(`var __TEMP__ = require('${t.value}');`),s=!0),i){if("VariableDeclaration"===i.type){const{declarations:t}=i;t&&Array.isArray(t)&&t.forEach((t=>{if("VariableDeclarator"===t.type){const{id:a}=t,{init:n}=t;a&&"Identifier"===a.type&&(p.notAddLines=!0,c.push(`var ${a.name} = exports.${a.name} = ${n?e.substring(n.start,n.end):"undefined"};`))}}))}else if("FunctionDeclaration"===i.type){const{id:t}=i;t&&"Identifier"===t.type&&(p.notAddLines=!0,c.push(`${e.substring(i.start,i.end)};exports.${t.name} = ${t.name}`))}else if("ClassDeclaration"===i.type){const{id:t}=i;t&&"Identifier"===t.type&&(p.notAddLines=!0,c.push(`${e.substring(i.start,i.end)};exports.${t.name} = ${t.name}`))}}else;a&&Array.isArray(a)&&a.forEach((e=>{if("ExportSpecifier"===e.type){const{local:t}=e,{exported:a}=e;"Identifier"===t.type&&"Identifier"===a.type&&c.push(`Object.defineProperty(exports, '${a.name}', { enumerable: true, configurable: true, get: function() { return ${s?"__TEMP__.":""}${t.name}; } });`)}})),p.adjustContent=c.join(""),o.push(p)}else if("ExportAllDeclaration"===r.type){const{source:e}=r,t={start:r.start,end:r.end,adjustContent:""},a=['if (!exports.__esModule) Object.defineProperty(exports, "__esModule", { value: true });'];e&&"Literal"===e.type&&(n.push(e.value),a.push(`var __TEMP__ = require('${e.value}');`)),a.push('Object.keys(__TEMP__).forEach(function(k) { if (k === "default" || k === "__esModule") return; Object.defineProperty(exports, k, { enumerable: true, configurable: true, get: function() { return __TEMP__[k]; } }); });'),t.adjustContent=a.join(""),o.push(t)}else if("ExportDefaultDeclaration"===r.type){const{declaration:t}=r,a={start:r.start,end:r.end,adjustContent:""},n=['if (!exports.__esModule) Object.defineProperty(exports, "__esModule", { value: true });'];if(t)if(a.notAddLines=!0,t.id){const{id:a}=t;n.push(`${e.substring(t.start,t.end)};exports.default = ${a.name}`)}else n.push(`exports.default = ${e.substring(t.start,t.end)};`);a.adjustContent=n.join(""),o.push(a)}const{expression:p}=r;"ExpressionStatement"===r.type&&p&&"AssignmentExpression"===p.type&&"Identifier"===p.right.type&&"require"===p.right.name&&(a.push({jsPath:t,code:e.substring(r.start,r.end),startLine:r.loc.start.line,endLine:r.loc.end.line,tips:"assign require function to a variable is not allowed",msg:locales_1.default.config.NOT_ALLOWED_REQUIRE_ASSIGN.format()}),NPM_RECORD.warn_require_rename_num++);const{declarations:c}=r;"VariableDeclaration"===r.type&&c.length>0&&c.forEach((n=>{const{init:o}=n;"VariableDeclarator"===n.type&&o&&"Identifier"===o.type&&"require"===o.name&&(a.push({jsPath:t,code:e.substring(r.start,r.end),startLine:r.loc.start.line,endLine:r.loc.end.line,tips:"assign require function to a variable is not allowed",msg:locales_1.default.config.NOT_ALLOWED_REQUIRE_ASSIGN.format()}),NPM_RECORD.warn_require_rename_num++)}))})),o=o.sort(((e,t)=>t.start-e.start)),o.forEach((t=>{const a=e.substring(t.start,t.end),n=t.notAddLines?0:a.split("\n").length;e=e.substring(0,t.start)+t.adjustContent+new Array(n).join("\n")+e.substring(t.end)})),{deps:n,parsedContent:e}}async function parseJs(e,t,a,n,r,o){if(r[t=path_1.default.posix.normalize(t)])return r[t];const i=await readFileSync(t,"utf8"),s=getId(),p=path_1.default.posix.relative(e,t);if(t.endsWith(".json")){const e={id:s,name:p,content:`module.exports = ${i}`,deps:[],depsMap:{}};return r[t]=s,n.push(e),s}const{deps:c,parsedContent:_}=parseDeps(i,t,o),u={id:s,name:p,content:_,deps:c,depsMap:{}};r[t]=s,n.push(u);for(const i of c){let s,p=path_1.default.posix.join(path_1.default.posix.dirname(t),i);if(!p.endsWith(".js")&&!p.endsWith(".json")){const e=`${p}.js`;try{await accessSync(e),p=e}catch(e){}}try{const e=await statSync(p);(null==e?void 0:e.isDirectory())&&(p=path_1.default.posix.join(p,"index.js"))}catch(e){}p.endsWith(".js")||p.endsWith(".json")||(p+=".js");try{await accessSync(p),s=await parseJs(e,p,a,n,r,o)}catch(e){}s&&(u.depsMap[i]=s)}return s}function addJsToMap(e,t,a,n){const r=t.split("\n").length;for(let o=1;o<=r;o++)e.addMapping({generated:{line:n+o,column:0},original:{line:o,column:0},source:a}),e.setSourceContent(a,t)}function findOutsideDeps(e){const t=new Set;return e.forEach((e=>{e.deps.forEach((a=>{Object.keys(e.depsMap).includes(a)||t.add(a)}))})),Array.from(t)}async function packJs(e,t,a){try{const t=await statSync(e);(null==t?void 0:t.isDirectory())&&(e=path_1.default.posix.join(e,"index.js"))}catch(e){}e.endsWith(".js")||e.endsWith(".json")||(e+=".js");try{await accessSync(e)}catch(t){return a.push({jsPath:e,code:"",tips:"entry file is not found",msg:locales_1.default.config.NOT_FOUND_NPM_ENTRY.format()}),void NPM_RECORD.warn_not_found_num++}const n=new source_map_1.default.SourceMapGenerator({file:"index.js"}),r=[];await parseJs(path_1.default.posix.dirname(e),e,t,r,{},a);const o=findOutsideDeps(r),i=["module.exports = (function() {","var __MODS__ = {};","var __DEFINE__ = function(modId, func, req) { var m = { exports: {}, _tempexports: {} }; __MODS__[modId] = { status: 0, func: func, req: req, m: m }; };",'var __REQUIRE__ = function(modId, source) { if(!__MODS__[modId]) return require(source); if(!__MODS__[modId].status) { var m = __MODS__[modId].m; m._exports = m._tempexports; var desp = Object.getOwnPropertyDescriptor(m, "exports"); if (desp && desp.configurable) Object.defineProperty(m, "exports", { set: function (val) { if(typeof val === "object" && val !== m._exports) { m._exports.__proto__ = val.__proto__; Object.keys(val).forEach(function (k) { m._exports[k] = val[k]; }); } m._tempexports = val }, get: function () { return m._tempexports; } }); __MODS__[modId].status = 1; __MODS__[modId].func(__MODS__[modId].req, m, m.exports); } return __MODS__[modId].m.exports; };',"var __REQUIRE_WILDCARD__ = function(obj) { if(obj && obj.__esModule) { return obj; } else { var newObj = {}; if(obj != null) { for(var k in obj) { if (Object.prototype.hasOwnProperty.call(obj, k)) newObj[k] = obj[k]; } } newObj.default = obj; return newObj; } };","var __REQUIRE_DEFAULT__ = function(obj) { return obj && obj.__esModule ? obj.default : obj; };"];if(r.length){const e=r.shift();i.push(`__DEFINE__(${e.id}, function(require, module, exports) {`),addJsToMap(n,e.content,e.name,i.length),i.push(e.content),i.push(`}, function(modId) {var map = ${JSON.stringify(e.depsMap)}; return __REQUIRE__(map[modId], modId); })`);for(const e of r)i.push(`__DEFINE__(${e.id}, function(require, module, exports) {`),addJsToMap(n,e.content,e.name,i.length),i.push(e.content),i.push(`}, function(modId) { var map = ${JSON.stringify(e.depsMap)}; return __REQUIRE__(map[modId], modId); })`);i.push(`return __REQUIRE__(${e.id});`)}return i.push("})()"),i.push(`//miniprogram-npm-outsideDeps=${JSON.stringify(o)}`),i.push("//# sourceMappingURL=index.js.map"),{js:i.join("\n"),map:n.toString()}}async function checkIsMiniprogramPack(e,t){let a="miniprogram_dist";t.miniprogram&&"string"==typeof t.miniprogram&&(a=t.miniprogram);try{const t=path_1.default.posix.join(e,a);await accessSync(t);const n=await statSync(t);if(null==n?void 0:n.isDirectory())return t}catch(e){}return""}async function packNpm(e,t={}){const a="miniprogram_npm",{projectPath:n}=e,r=e.type,o=await(0,projectconfig_1.getProjectConfigJSON)(e),i=o.pluginRoot||"",s=o.miniprogramRoot||"",p="miniProgramPlugin"===r||"miniGamePlugin"===r,{ignores:c,reporter:_}=t;if(!n)throw new error_1.CodeError(locales_1.default.config.SHOULD_NOT_BE_EMPTY.format("projectPath"),config_1.PARAM_ERROR);if("miniProgramPlugin"===r&&!i)throw new error_1.CodeError(locales_1.default.config.SHOULD_NOT_BE_EMPTY.format('project.config.json "pluginRoot"'),config_1.PARAM_ERROR);startRecord();const u=path_1.default.isAbsolute(n)?n:path_1.default.posix.join(process.cwd(),n),l=[{searchRoot:path_1.default.posix.join(u,s),paths:await globSync("**/package.json",{cwd:path_1.default.posix.join(u,s),nodir:!0,dot:!0,ignore:(c||[]).concat("**/node_modules/**")})}];p&&l.push({searchRoot:path_1.default.posix.join(u,i),paths:await globSync("**/package.json",{cwd:path_1.default.posix.join(u,i),nodir:!0,dot:!0,ignore:(c||[]).concat("**/node_modules/**")})});lodash_1.default.flattenDeep(l.map((e=>e.paths.map((t=>path_1.default.posix.join(e.searchRoot,path_1.default.dirname(t),a)))))).forEach((e=>rimraf_1.default.sync(e)));const d=[];for(const e of l)for(const t of e.paths){const n=path_1.default.dirname(path_1.default.posix.join(e.searchRoot,t)),r=lodash_1.default.xorWith(e.paths,[t]).map((e=>path_1.default.posix.join(path_1.default.posix.dirname(e),"/**"))).filter((e=>"**"!==e));let o=await globSync("**/package.json",{cwd:n.replace(/\\/g,"/"),nodir:!0,dot:!0,ignore:(c||[]).concat(r).concat(["node_modules/@types/**"])});if(o=await(0,filterdeps_1.default)(n,o),o&&o.length)for(const e of o){const t=path_1.default.posix.join(n,e);let r=await readFileSync(t,"utf8");const o=path_1.default.dirname(t);let i=o.replace(/([\b/\\])node_modules([\b/\\])/g,((e,t,n)=>`${t}${a}${n}`)),s=path_1.default.basename(i);const p=s.split("@");p.length&&(s=p.pop()||""),i=i.replace(path_1.default.basename(i),s),r=JSON.parse(r);const c=path_1.default.posix.join(o,r.main||"index.js"),_=await checkIsMiniprogramPack(o,r);if(_){const e=await globSync("**/*",{cwd:_.replace(/\\/g,"/"),nodir:!0,dot:!0,ignore:"**/node_modules/**"});for(const t of e)await copyFile(path_1.default.posix.join(_,t),path_1.default.posix.join(i,t));NPM_RECORD.miniprogram_pack_num++}else{const e=await packJs(c,i,d);if(!e)continue;await writeFile(e.js,path_1.default.posix.join(i,"./index.js")),await writeFile(e.map,path_1.default.posix.join(i,"./index.js.map")),NPM_RECORD.other_pack_num++}}}if(endRecord(_),NPM_RECORD.miniprogram_pack_num+NPM_RECORD.other_pack_num<=0)throw new Error(`__NO_NODE_MODULES__ ${locales_1.default.config.NOT_FOUND_NODE_MODULES.format()}`);return"function"==typeof e.updateFileAndDirs&&e.updateFileAndDirs(),d}async function packNpmManually(e){let{packageJsonPath:t,miniprogramNpmDistDir:a}=e;const n=e.ignores||[],r={pack_time:0,miniprogram_pack_num:0,other_pack_num:0,warn_not_found_num:0,warn_require_var_num:0,warn_require_rename_num:0},o=[],i="miniprogram_npm";if(!a)throw new Error("param miniprogramNpmDistDir is required");if(!t)throw new Error("param packageJsonPath is required");if(path_1.default.isAbsolute(a)||(a=path_1.default.join(process.cwd(),a)),path_1.default.isAbsolute(t)||(t=path_1.default.join(process.cwd(),t)),!fs_1.default.existsSync(t))throw new Error(`param packageJsonPath: ${t} file is not exited`);const s=path_1.default.dirname(t);let p=await globSync("**/package.json",{cwd:s.replace(/\\/g,"/"),nodir:!0,dot:!0,ignore:(n||[]).concat(["node_modules/@types/**"])});if(p=await(0,filterdeps_1.default)(s,p),!p||!p.length){const e={jsPath:s,code:"",tips:"",msg:"No miniprogram_npm package was found, please check package.json -> dependencies."};return log.warn(e.msg),o.push(e),{miniProgramPackNum:0,otherNpmPackNum:0,warnList:o}}p=p.filter((e=>e.startsWith("node_modules")));for(const e of p){const t=path_1.default.posix.join(s,e);let n=await readFileSync(t,"utf8");const p=path_1.default.dirname(t);let c=p.replace(/([\b/\\])node_modules([\b/\\])/g,((e,t,a)=>`${t}${i}${a}`));c=path_1.default.posix.normalize(path_1.default.posix.join(a,i,c.split(/[/\\]miniprogram_npm[/\\]/)[1]));let _=path_1.default.basename(c);const u=_.split("@");u.length&&(_=u.pop()||""),c=c.replace(path_1.default.basename(c),_),n=JSON.parse(n);const l=path_1.default.posix.join(p,n.main||"index.js"),d=await checkIsMiniprogramPack(p,n);if(d){const e=await globSync("**/*",{cwd:d.replace(/\\/g,"/"),nodir:!0,dot:!0,ignore:"**/node_modules/**"});for(const t of e)await copyFile(path_1.default.posix.join(d,t),path_1.default.posix.join(c,t));r.miniprogram_pack_num++}else{const e=await packJs(l,c,o);if(!e)continue;await writeFile(e.js,path_1.default.posix.join(c,"./index.js")),await writeFile(e.map,path_1.default.posix.join(c,"./index.js.map")),r.other_pack_num++}}return{miniProgramPackNum:r.miniprogram_pack_num,otherNpmPackNum:r.other_pack_num,warnList:o}}