miniprogram-ci 2.1.31 → 2.1.32

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 (414) hide show
  1. package/CHANGELOG.md +3 -0
  2. package/README.md +3 -0
  3. package/dist/@types/ci/checkCodeQuality.d.ts +1 -1
  4. package/dist/@types/ci/code-analyse.d.ts +1 -1
  5. package/dist/@types/ci/cos-upload.d.ts +0 -1
  6. package/dist/@types/ci/getCompiledResult.d.ts +0 -1
  7. package/dist/@types/ci/utils/filterUnusedFile.d.ts +0 -1
  8. package/dist/@types/ci/utils/pack.d.ts +0 -1
  9. package/dist/@types/ci/utils/packfile.d.ts +0 -1
  10. package/dist/@types/ci/utils/tools.d.ts +1 -1
  11. package/dist/@types/ci/utils/wxvpkg/unpack/version0.d.ts +0 -1
  12. package/dist/@types/ci/utils/wxvpkg/unpack/version10.d.ts +0 -1
  13. package/dist/@types/config/compiletype.config.d.ts +4 -4
  14. package/dist/@types/config/config.d.ts +1 -1
  15. package/dist/@types/config/dir.config.d.ts +17 -0
  16. package/dist/@types/config/url.config.d.ts +42 -42
  17. package/dist/@types/index.d.ts +4 -2
  18. package/dist/@types/modules/corecompiler/baseCompiler.d.ts +3 -4
  19. package/dist/@types/modules/corecompiler/original/compile/common.d.ts +0 -1
  20. package/dist/@types/modules/corecompiler/original/compile/gamePlugin.d.ts +0 -1
  21. package/dist/@types/modules/corecompiler/original/compile/handler/mpjson.d.ts +0 -1
  22. package/dist/@types/modules/corecompiler/original/compile/miniprogram.d.ts +0 -1
  23. package/dist/@types/modules/corecompiler/original/compile/miniprogramPlugin.d.ts +0 -1
  24. package/dist/@types/modules/corecompiler/original/js/index.d.ts +0 -1
  25. package/dist/@types/modules/corecompiler/original/protect/uglifyfilenames.d.ts +0 -1
  26. package/dist/@types/modules/corecompiler/original/webWorker/webWorkerManager.d.ts +0 -1
  27. package/dist/@types/modules/corecompiler/original/workerThread/task/compilejs.d.ts +1 -2
  28. package/dist/@types/modules/corecompiler/original/workerThread/task/compilewxss.d.ts +0 -1
  29. package/dist/@types/modules/corecompiler/original/workerThread/task/minifywxml.d.ts +0 -1
  30. package/dist/@types/modules/corecompiler/summer/graph/appconf.d.ts +1 -1
  31. package/dist/@types/modules/corecompiler/summer/graph/gameconf.d.ts +1 -1
  32. package/dist/@types/modules/corecompiler/summer/plugins/less.d.ts +0 -1
  33. package/dist/@types/modules/corecompiler/summer/resolver.d.ts +1 -1
  34. package/dist/@types/modules/corecompiler/summerCompiler.d.ts +2 -3
  35. package/dist/@types/modules/nativecompiler/ios/buildCloud.d.ts +2 -2
  36. package/dist/@types/modules/nativecompiler/processHandler.d.ts +1 -1
  37. package/dist/@types/modules/precompiler/conditioncompile/compiler/base.d.ts +0 -1
  38. package/dist/@types/modules/precompiler/conditioncompile/compiler/json.d.ts +0 -1
  39. package/dist/@types/modules/precompiler/conditioncompile/compiler/macro.d.ts +0 -1
  40. package/dist/@types/modules/precompiler/conditioncompile/compiler/plant.d.ts +0 -1
  41. package/dist/@types/modules/precompiler/conditioncompile/index.d.ts +0 -1
  42. package/dist/@types/project/advance/precompileProject.d.ts +0 -1
  43. package/dist/@types/project/advance/reactiveProject.d.ts +1 -2
  44. package/dist/@types/project/baseProject.d.ts +3 -3
  45. package/dist/@types/project/ciProjectWithMockBuffer.d.ts +0 -1
  46. package/dist/@types/services/accountcard/accountcard.d.ts +18 -0
  47. package/dist/@types/services/accountcard/accountcardService.d.ts +0 -0
  48. package/dist/@types/services/app/common/appDirService.d.ts +10 -0
  49. package/dist/@types/services/app/common/appDirService.devtools.d.ts +7 -0
  50. package/dist/@types/services/app/electron/appDirService.d.ts +3 -0
  51. package/dist/@types/services/app/node/appDirService.d.ts +6 -0
  52. package/dist/@types/services/app/nw/appDirService.d.ts +3 -0
  53. package/dist/@types/services/builder/common/builder.d.ts +22 -0
  54. package/dist/@types/services/builder/nw/builder.d.ts +15 -0
  55. package/dist/@types/services/builder/webide/builder.d.ts +4 -0
  56. package/dist/@types/services/common/extensions.d.ts +8 -0
  57. package/dist/@types/services/common/getservice.d.ts +24 -0
  58. package/dist/@types/services/common/librarybase.d.ts +2063 -0
  59. package/dist/@types/services/common/vsbase.d.ts +3 -0
  60. package/dist/@types/services/compilewxml/common/compilewxmlService.d.ts +41 -0
  61. package/dist/@types/services/compilewxml/electron/compilewxmlService.d.ts +5 -0
  62. package/dist/@types/services/compilewxml/node/compileUtils.d.ts +3 -0
  63. package/dist/@types/services/compilewxml/node/compileglasseasel.d.ts +0 -0
  64. package/dist/@types/services/compilewxml/nw/compilewxmlService.d.ts +5 -0
  65. package/dist/@types/services/compilewxml/webide/compilewxmlService.d.ts +5 -0
  66. package/dist/@types/services/compilewxml/webide/pageFrameWasm/wcc/runWcc.d.ts +3 -0
  67. package/dist/@types/services/compilewxss/common/compilewxssService.d.ts +15 -0
  68. package/dist/@types/services/compilewxss/electron/compilewxssService.d.ts +4 -0
  69. package/dist/@types/services/compilewxss/node/compileUtils.d.ts +2 -0
  70. package/dist/@types/services/compilewxss/nw/compilewxssService.d.ts +4 -0
  71. package/dist/@types/services/compilewxss/webide/compilewxssService.d.ts +4 -0
  72. package/dist/@types/services/compilewxss/webide/pageFrameWasm/wcsc/runWcsc.d.ts +3 -0
  73. package/dist/@types/services/consoledisplay/common/consoledisplay.d.ts +5 -0
  74. package/dist/@types/services/consoledisplay/nw/consoledisplay.d.ts +6 -0
  75. package/dist/@types/services/fileUtilsManager/common/fileUtilsManager.d.ts +5 -0
  76. package/dist/@types/services/fileUtilsManager/nw/fileUtilsManager.d.ts +6 -0
  77. package/dist/@types/services/fs/common/fileService.d.ts +28 -0
  78. package/dist/@types/services/genTempFile/common/genTempFile.devtools.d.ts +4 -0
  79. package/dist/@types/services/genTempFile/common/genTempFile.node.d.ts +4 -0
  80. package/dist/@types/services/genTempFile/common/genTempFileService.d.ts +4 -0
  81. package/dist/@types/services/genTempFile/electron/genTempFileService.d.ts +3 -0
  82. package/dist/@types/services/genTempFile/node/genTempFileService.d.ts +3 -0
  83. package/dist/@types/services/genTempFile/nw/genTempFileService.d.ts +3 -0
  84. package/dist/@types/services/global/common/global.d.ts +10 -0
  85. package/dist/@types/services/global/nw/global.d.ts +12 -0
  86. package/dist/@types/services/initializeCheck/common/initializeCheck.d.ts +21 -0
  87. package/dist/@types/services/initializeCheck/nw/initializeCheck.d.ts +4 -0
  88. package/dist/@types/services/initializeCheck/webide/initializeCheck.d.ts +0 -0
  89. package/dist/@types/services/locales/common/locales.d.ts +7 -0
  90. package/dist/@types/services/locales/nw/locales.d.ts +9 -0
  91. package/dist/@types/services/log/common/logService.d.ts +9 -0
  92. package/dist/@types/services/miniappjson/common/miniappjson.d.ts +5 -0
  93. package/dist/@types/services/miniappjson/electron/miniappjson.d.ts +6 -0
  94. package/dist/@types/services/miniappjson/nw/miniappjson.d.ts +6 -0
  95. package/dist/@types/services/miniappjson/webide/miniappjson.d.ts +4 -0
  96. package/dist/@types/services/nativeModule/common/nativeModule.d.ts +9 -0
  97. package/dist/@types/services/nativeModule/common/nativeModule.impl.d.ts +12 -0
  98. package/dist/@types/services/nativeModule/electron/nativeModule.d.ts +3 -0
  99. package/dist/@types/services/nativeModule/nw/nativeModule.d.ts +3 -0
  100. package/dist/@types/services/partialcompile/common/parialcompile.impl.d.ts +0 -0
  101. package/dist/@types/services/partialcompile/common/partialcompile.d.ts +0 -0
  102. package/dist/@types/services/partialcompile/nw/partialcompile.d.ts +0 -0
  103. package/dist/@types/services/partialcompile/webide/partialcompile.d.ts +0 -0
  104. package/dist/@types/services/performance/common/performance.d.ts +9 -0
  105. package/dist/@types/services/performance/nw/performance.d.ts +9 -0
  106. package/dist/@types/services/performance/webide/performance.d.ts +7 -0
  107. package/dist/@types/services/project/common/cloudProjectService.d.ts +0 -0
  108. package/dist/@types/services/project/common/createProjectService.d.ts +0 -0
  109. package/dist/@types/services/project/common/project.helper.d.ts +0 -0
  110. package/dist/@types/services/project/common/projectConfigService.d.ts +0 -0
  111. package/dist/@types/services/project/common/projectFileService.d.ts +0 -0
  112. package/dist/@types/services/project/common/projectconfigjsonutils.d.ts +0 -0
  113. package/dist/@types/services/project/electron-backend/projectManagerService.d.ts +0 -0
  114. package/dist/@types/services/project/node/createProjectService.d.ts +0 -0
  115. package/dist/@types/services/project/node/projectConfigService.d.ts +0 -0
  116. package/dist/@types/services/project/node/projectManagerService.d.ts +0 -0
  117. package/dist/@types/services/project/web/projectManagerService.d.ts +0 -0
  118. package/dist/@types/services/project/webide/projectConfigService.d.ts +0 -0
  119. package/dist/@types/services/project/webide/projectFileService.d.ts +0 -0
  120. package/dist/@types/services/project/webide/projectManagerService.d.ts +0 -0
  121. package/dist/@types/services/projectManager/common/buildServerProjectManager.d.ts +5 -0
  122. package/dist/@types/services/projectManager/common/projectManager.d.ts +7 -0
  123. package/dist/@types/services/projectManager/nw/projectManager.d.ts +9 -0
  124. package/dist/@types/services/root/common/createService.d.ts +12 -0
  125. package/dist/@types/services/root/electron/root.d.ts +11 -0
  126. package/dist/@types/services/root/electron/rootService.d.ts +2 -0
  127. package/dist/@types/services/root/node/root.d.ts +11 -0
  128. package/dist/@types/services/root/node/rootService.d.ts +0 -0
  129. package/dist/@types/services/root/nw/root.d.ts +11 -0
  130. package/dist/@types/services/root/nw/rootService.d.ts +0 -0
  131. package/dist/@types/services/staticConfig/common/staticConfigService.d.ts +5 -0
  132. package/dist/@types/services/staticConfig/nw/staticConfigService.d.ts +6 -0
  133. package/dist/@types/services/store/common/storeService.d.ts +17 -0
  134. package/dist/@types/services/uniapp/common/uniapp.d.ts +5 -0
  135. package/dist/@types/services/uniapp/nw/uniapp.d.ts +9 -0
  136. package/dist/@types/services/uniapp/webide/uniapp.d.ts +4 -0
  137. package/dist/@types/services/vendor/common/utils.d.ts +0 -0
  138. package/dist/@types/services/vendor/common/vendorService.d.ts +0 -0
  139. package/dist/@types/services/vendor/node/vendorService.d.ts +0 -0
  140. package/dist/@types/services/vendor/webide/vendorService.d.ts +0 -0
  141. package/dist/@types/types/ci.d.ts +1 -2
  142. package/dist/@types/types/core.d.ts +1 -2
  143. package/dist/@types/types/devtools.d.ts +0 -1
  144. package/dist/@types/types/summer.d.ts +0 -1
  145. package/dist/@types/utils/common.d.ts +3 -1
  146. package/dist/@types/utils/cosUpload.d.ts +0 -1
  147. package/dist/@types/utils/fsagent.d.ts +0 -1
  148. package/dist/@types/utils/locales/locales.d.ts +2 -114
  149. package/dist/@types/utils/locales/zh.d.ts +114 -113
  150. package/dist/@types/utils/miniappJson.d.ts +1 -1
  151. package/dist/@types/utils/node/common.d.ts +1 -0
  152. package/dist/@types/utils/packOptionsHelper.d.ts +1 -1
  153. package/dist/@types/utils/signature.d.ts +0 -1
  154. package/dist/@types/utils/singletontask.d.ts +1 -0
  155. package/dist/@types/utils/taskqueue.d.ts +0 -1
  156. package/dist/@types/utils/taskstatus.d.ts +1 -1
  157. package/dist/@types/utils/tools.d.ts +3 -4
  158. package/dist/@types/utils/web/common.d.ts +1 -0
  159. package/dist/@types/utils/wxapkg/pack.d.ts +0 -1
  160. package/dist/@types/utils/wxvpkgreader/wxvpkg/reader/version0.d.ts +0 -1
  161. package/dist/@types/utils/wxvpkgreader/wxvpkg/reader/version10.d.ts +0 -1
  162. package/dist/@types/utils/wxvpkgreader/wxvpkg/unpack/version0.d.ts +0 -1
  163. package/dist/@types/utils/wxvpkgreader/wxvpkg/unpack/version10.d.ts +0 -1
  164. package/dist/@types/utils/wxvpkgreader/wxvpkgreader.d.ts +0 -1
  165. package/dist/ci/android-miniapp-toolkit/dist/index.js +1 -1
  166. package/dist/ci/build-apk.js +1 -1
  167. package/dist/ci/build-ipa.js +1 -1
  168. package/dist/ci/checkCodeQuality.js +1 -1
  169. package/dist/ci/cloud/cloudapi.js +1 -1
  170. package/dist/ci/cloud/createTimeTrigger.js +1 -1
  171. package/dist/ci/cloud/uploadContainer.js +1 -1
  172. package/dist/ci/cloud/uploadFile.js +1 -1
  173. package/dist/ci/cloud/uploadFunction.js +1 -1
  174. package/dist/ci/cloud/utils.js +1 -1
  175. package/dist/ci/code-analyse.js +1 -1
  176. package/dist/ci/cos-upload.js +1 -1
  177. package/dist/ci/gamepkg/apkplug.js +1 -1
  178. package/dist/ci/gamepkg/index.js +1 -1
  179. package/dist/ci/getCompiledResult.js +1 -1
  180. package/dist/ci/getDevSourceMap.js +1 -1
  181. package/dist/ci/getLatestVersion.js +1 -1
  182. package/dist/ci/getcompiler.js +1 -1
  183. package/dist/ci/index.js +1 -1
  184. package/dist/ci/jsserver.js +1 -1
  185. package/dist/ci/miniapp/archive.js +1 -1
  186. package/dist/ci/miniapp/checkBuildArgument.js +1 -1
  187. package/dist/ci/miniapp/miniappPlugin.js +1 -1
  188. package/dist/ci/miniapp/sdkManager.js +1 -1
  189. package/dist/ci/miniapp/upload.js +1 -1
  190. package/dist/ci/miniapp-cloud-upload.js +1 -1
  191. package/dist/ci/miniappattr.js +1 -1
  192. package/dist/ci/preview.js +1 -1
  193. package/dist/ci/projectattr.js +1 -1
  194. package/dist/ci/upload.js +1 -1
  195. package/dist/ci/utils/ciRequest.js +1 -1
  196. package/dist/ci/utils/filterUnusedFile.js +1 -1
  197. package/dist/ci/utils/pack.js +1 -1
  198. package/dist/ci/utils/terminalQrcode.js +1 -1
  199. package/dist/ci/utils/tools.js +1 -1
  200. package/dist/ci/utils/wxvpkg/unpack/version0.js +1 -1
  201. package/dist/ci/utils/wxvpkg/unpack/version10.js +1 -1
  202. package/dist/config/config.js +1 -1
  203. package/dist/config/dir.config.js +1 -0
  204. package/dist/index.js +1 -1
  205. package/dist/modules/corecompiler/baseCompiler.js +1 -1
  206. package/dist/modules/corecompiler/original/analyse/partial.js +1 -1
  207. package/dist/modules/corecompiler/original/compile/common.js +1 -1
  208. package/dist/modules/corecompiler/original/compile/game.js +1 -1
  209. package/dist/modules/corecompiler/original/compile/gamePlugin.js +1 -1
  210. package/dist/modules/corecompiler/original/compile/handler/js.js +1 -1
  211. package/dist/modules/corecompiler/original/compile/handler/mpjson.js +1 -1
  212. package/dist/modules/corecompiler/original/compile/handler/wxml.js +1 -1
  213. package/dist/modules/corecompiler/original/compile/handler/wxss.js +1 -1
  214. package/dist/modules/corecompiler/original/compile/index.js +1 -1
  215. package/dist/modules/corecompiler/original/compile/miniprogram.js +1 -1
  216. package/dist/modules/corecompiler/original/compile/miniprogramPlugin.js +1 -1
  217. package/dist/modules/corecompiler/original/index.js +1 -1
  218. package/dist/modules/corecompiler/original/js/index.js +1 -1
  219. package/dist/modules/corecompiler/original/json/app/appJSON.js +1 -1
  220. package/dist/modules/corecompiler/original/json/app/checkAppFields.js +1 -1
  221. package/dist/modules/corecompiler/original/json/common.js +1 -1
  222. package/dist/modules/corecompiler/original/json/page/checkPageJSON.js +1 -1
  223. package/dist/modules/corecompiler/original/json/page/getPageJSON.js +1 -1
  224. package/dist/modules/corecompiler/original/json/plugin/plugin.js +1 -1
  225. package/dist/modules/corecompiler/original/json/plugin/pluginPage.js +1 -1
  226. package/dist/modules/corecompiler/original/json/reactiveCache.js +1 -1
  227. package/dist/modules/corecompiler/original/json/signaturejson.js +1 -1
  228. package/dist/modules/corecompiler/original/json/theme.js +1 -1
  229. package/dist/modules/corecompiler/original/npm/filterdeps.js +1 -1
  230. package/dist/modules/corecompiler/original/npm/packnpm.js +1 -1
  231. package/dist/modules/corecompiler/original/protect/uglifyfilenames.js +1 -1
  232. package/dist/modules/corecompiler/original/validate/schemaValidate.js +1 -1
  233. package/dist/modules/corecompiler/original/webWorker/configs.js +1 -1
  234. package/dist/modules/corecompiler/original/workerThread/config.js +1 -1
  235. package/dist/modules/corecompiler/original/workerThread/getWorkerPoolSize.js +1 -1
  236. package/dist/modules/corecompiler/original/workerThread/index.js +1 -1
  237. package/dist/modules/corecompiler/original/workerThread/task/call_func.js +1 -1
  238. package/dist/modules/corecompiler/original/workerThread/task/func.js +1 -1
  239. package/dist/modules/corecompiler/original/workerThread/task/minifywxml.js +1 -1
  240. package/dist/modules/corecompiler/processHandler.js +1 -1
  241. package/dist/modules/corecompiler/summer/graph/basegraph.js +1 -1
  242. package/dist/modules/corecompiler/summer/graph/util.js +1 -1
  243. package/dist/modules/corecompiler/summer/index.js +1 -1
  244. package/dist/modules/corecompiler/summer/initPlugin.js +1 -1
  245. package/dist/modules/corecompiler/summer/pluginDriver.js +1 -1
  246. package/dist/modules/corecompiler/summer/pluginconfig.js +1 -1
  247. package/dist/modules/corecompiler/summer/plugins/base/es6module.js +1 -1
  248. package/dist/modules/corecompiler/summer/plugins/base/javascript.js +1 -1
  249. package/dist/modules/corecompiler/summer/plugins/base/swc.js +1 -1
  250. package/dist/modules/corecompiler/summer/plugins/base/wxss.js +1 -1
  251. package/dist/modules/corecompiler/summer/plugins/enhance.js +1 -1
  252. package/dist/modules/corecompiler/summer/plugins/filetask/script.js +1 -1
  253. package/dist/modules/corecompiler/summer/plugins/less.js +1 -1
  254. package/dist/modules/corecompiler/summer/plugins/minifywxml.js +1 -1
  255. package/dist/modules/corecompiler/summer/plugins/sass.js +1 -1
  256. package/dist/modules/corecompiler/summer/plugins/script_task/babel_script_task.js +1 -1
  257. package/dist/modules/corecompiler/summer/plugins/script_task/load_script_task.js +1 -1
  258. package/dist/modules/corecompiler/summer/plugins/script_task/minify_script_task.js +1 -1
  259. package/dist/modules/corecompiler/summer/plugins/script_task/swc_task.js +1 -1
  260. package/dist/modules/corecompiler/summer/plugins/terser.js +1 -1
  261. package/dist/modules/corecompiler/summer/plugins/typescript.js +1 -1
  262. package/dist/modules/corecompiler/summer/plugins/worklet.js +1 -1
  263. package/dist/modules/corecompiler/summer/utils/ensureArray.js +1 -1
  264. package/dist/modules/corecompiler/summer/utils/inputsourcemap.js +1 -1
  265. package/dist/modules/corecompiler/summer/worker.js +1 -1
  266. package/dist/modules/fullcompiler/app/app.js +1 -1
  267. package/dist/modules/fullcompiler/app/contactandlaunch/updateContactForSubpkg.js +1 -1
  268. package/dist/modules/fullcompiler/app/contactandlaunch/updatecontactandlaunch.js +1 -1
  269. package/dist/modules/nativecompiler/android/adb.js +1 -1
  270. package/dist/modules/nativecompiler/android/device.js +1 -1
  271. package/dist/modules/nativecompiler/ios/device.js +1 -1
  272. package/dist/modules/nativecompiler/ios/projectconfig.js +1 -1
  273. package/dist/modules/nativecompiler/processHandler.js +1 -1
  274. package/dist/project/advance/precompileProject.js +1 -1
  275. package/dist/project/advance/reactiveProject.js +1 -1
  276. package/dist/project/baseProject.js +1 -1
  277. package/dist/services/accountcard/accountcard.js +1 -0
  278. package/dist/services/accountcard/accountcardService.js +1 -0
  279. package/dist/services/app/common/appDirService.devtools.js +1 -0
  280. package/dist/services/app/common/appDirService.js +1 -0
  281. package/dist/services/app/electron/appDirService.js +1 -0
  282. package/dist/services/app/node/appDirService.js +1 -0
  283. package/dist/services/app/nw/appDirService.js +1 -0
  284. package/dist/services/builder/common/builder.js +1 -0
  285. package/dist/services/builder/nw/builder.js +1 -0
  286. package/dist/services/builder/webide/builder.js +1 -0
  287. package/dist/services/common/extensions.js +1 -0
  288. package/dist/services/common/getservice.js +1 -0
  289. package/dist/services/common/librarybase.js +1 -0
  290. package/dist/services/common/vsbase.js +1 -0
  291. package/dist/services/compilewxml/common/compilewxmlService.js +1 -0
  292. package/dist/services/compilewxml/electron/compilewxmlService.js +1 -0
  293. package/dist/services/compilewxml/node/compileUtils.js +1 -0
  294. package/dist/services/compilewxml/node/compileglasseasel.js +1 -0
  295. package/dist/services/compilewxml/nw/compilewxmlService.js +1 -0
  296. package/dist/services/compilewxml/webide/compilewxmlService.js +1 -0
  297. package/dist/services/compilewxml/webide/pageFrameWasm/wcc/runWcc.js +1 -0
  298. package/dist/services/compilewxss/common/compilewxssService.js +1 -0
  299. package/dist/services/compilewxss/electron/compilewxssService.js +1 -0
  300. package/dist/services/compilewxss/node/compileUtils.js +1 -0
  301. package/dist/services/compilewxss/nw/compilewxssService.js +1 -0
  302. package/dist/services/compilewxss/webide/compilewxssService.js +1 -0
  303. package/dist/services/compilewxss/webide/pageFrameWasm/wcsc/runWcsc.js +1 -0
  304. package/dist/services/consoledisplay/common/consoledisplay.js +1 -0
  305. package/dist/services/consoledisplay/nw/consoledisplay.js +1 -0
  306. package/dist/services/fileUtilsManager/common/fileUtilsManager.js +1 -0
  307. package/dist/services/fileUtilsManager/nw/fileUtilsManager.js +1 -0
  308. package/dist/services/fs/common/fileService.js +1 -0
  309. package/dist/services/genTempFile/common/genTempFile.devtools.js +1 -0
  310. package/dist/services/genTempFile/common/genTempFile.node.js +1 -0
  311. package/dist/services/genTempFile/common/genTempFileService.js +1 -0
  312. package/dist/services/genTempFile/electron/genTempFileService.js +1 -0
  313. package/dist/services/genTempFile/node/genTempFileService.js +1 -0
  314. package/dist/services/genTempFile/nw/genTempFileService.js +1 -0
  315. package/dist/services/global/common/global.js +1 -0
  316. package/dist/services/global/nw/global.js +1 -0
  317. package/dist/services/initializeCheck/common/initializeCheck.js +1 -0
  318. package/dist/services/initializeCheck/nw/initializeCheck.js +1 -0
  319. package/dist/services/initializeCheck/webide/initializeCheck.js +1 -0
  320. package/dist/services/locales/common/locales.js +1 -0
  321. package/dist/services/locales/nw/locales.js +1 -0
  322. package/dist/services/log/common/logService.js +1 -0
  323. package/dist/services/miniappjson/common/miniappjson.js +1 -0
  324. package/dist/services/miniappjson/electron/miniappjson.js +1 -0
  325. package/dist/services/miniappjson/nw/miniappjson.js +1 -0
  326. package/dist/services/miniappjson/webide/miniappjson.js +1 -0
  327. package/dist/services/nativeModule/common/nativeModule.impl.js +1 -0
  328. package/dist/services/nativeModule/common/nativeModule.js +1 -0
  329. package/dist/services/nativeModule/electron/nativeModule.js +1 -0
  330. package/dist/services/nativeModule/nw/nativeModule.js +1 -0
  331. package/dist/services/partialcompile/common/parialcompile.impl.js +1 -0
  332. package/dist/services/partialcompile/common/partialcompile.js +1 -0
  333. package/dist/services/partialcompile/nw/partialcompile.js +1 -0
  334. package/dist/services/partialcompile/webide/partialcompile.js +1 -0
  335. package/dist/services/performance/common/performance.js +1 -0
  336. package/dist/services/performance/nw/performance.js +1 -0
  337. package/dist/services/performance/webide/performance.js +1 -0
  338. package/dist/services/project/common/cloudProjectService.js +1 -0
  339. package/dist/services/project/common/createProjectService.js +1 -0
  340. package/dist/services/project/common/project.helper.js +1 -0
  341. package/dist/services/project/common/projectConfigService.js +1 -0
  342. package/dist/services/project/common/projectFileService.js +1 -0
  343. package/dist/services/project/common/projectconfigjsonutils.js +1 -0
  344. package/dist/services/project/electron-backend/projectManagerService.js +1 -0
  345. package/dist/services/project/node/createProjectService.js +1 -0
  346. package/dist/services/project/node/projectConfigService.js +1 -0
  347. package/dist/services/project/node/projectManagerService.js +1 -0
  348. package/dist/services/project/web/projectManagerService.js +1 -0
  349. package/dist/services/project/webide/projectConfigService.js +1 -0
  350. package/dist/services/project/webide/projectFileService.js +1 -0
  351. package/dist/services/project/webide/projectManagerService.js +1 -0
  352. package/dist/services/projectManager/common/buildServerProjectManager.js +1 -0
  353. package/dist/services/projectManager/common/projectManager.js +1 -0
  354. package/dist/services/projectManager/nw/projectManager.js +1 -0
  355. package/dist/services/root/common/createService.js +1 -0
  356. package/dist/services/root/electron/root.js +1 -0
  357. package/dist/services/root/electron/rootService.js +1 -0
  358. package/dist/services/root/node/root.js +1 -0
  359. package/dist/services/root/node/rootService.js +1 -0
  360. package/dist/services/root/nw/root.js +1 -0
  361. package/dist/services/root/nw/rootService.js +1 -0
  362. package/dist/services/staticConfig/common/staticConfigService.js +1 -0
  363. package/dist/services/staticConfig/nw/staticConfigService.js +1 -0
  364. package/dist/services/store/common/storeService.js +1 -0
  365. package/dist/services/uniapp/common/uniapp.js +1 -0
  366. package/dist/services/uniapp/nw/uniapp.js +1 -0
  367. package/dist/services/uniapp/webide/uniapp.js +1 -0
  368. package/dist/services/vendor/common/utils.js +1 -0
  369. package/dist/services/vendor/common/vendorService.js +1 -0
  370. package/dist/services/vendor/node/vendorService.js +1 -0
  371. package/dist/services/vendor/webide/vendorService.js +1 -0
  372. package/dist/types/ci.js +1 -1
  373. package/dist/utils/asyncTask/index.js +1 -1
  374. package/dist/utils/babel_helper.js +1 -1
  375. package/dist/utils/cache.js +1 -1
  376. package/dist/utils/codesign.js +1 -1
  377. package/dist/utils/common.js +1 -1
  378. package/dist/utils/cosUpload.js +1 -1
  379. package/dist/utils/cp.js +1 -1
  380. package/dist/utils/customError.js +1 -1
  381. package/dist/utils/debug.js +1 -1
  382. package/dist/utils/download.js +1 -1
  383. package/dist/utils/env.js +1 -1
  384. package/dist/utils/fs.js +1 -1
  385. package/dist/utils/genTempFile.js +1 -1
  386. package/dist/utils/generateIpa.js +1 -1
  387. package/dist/utils/glob.js +1 -1
  388. package/dist/utils/helper_util.js +1 -1
  389. package/dist/utils/jsonParse.js +1 -1
  390. package/dist/utils/miniapp-builder.js +1 -1
  391. package/dist/utils/miniappJson.js +1 -1
  392. package/dist/utils/node/common.js +1 -0
  393. package/dist/utils/officialDonutPlugin.js +1 -1
  394. package/dist/utils/packOptionsHelper.js +1 -1
  395. package/dist/utils/progressRecorder.js +1 -1
  396. package/dist/utils/report.js +1 -1
  397. package/dist/utils/request.js +1 -1
  398. package/dist/utils/sign.js +1 -1
  399. package/dist/utils/signature.js +1 -1
  400. package/dist/utils/singletontask.js +1 -1
  401. package/dist/utils/subprocess/entryProcess.js +1 -1
  402. package/dist/utils/subprocess/processService.js +1 -1
  403. package/dist/utils/subprocess/stringifyPostMsg.js +1 -1
  404. package/dist/utils/swc_helper.js +1 -1
  405. package/dist/utils/tools.js +1 -1
  406. package/dist/utils/usbProcess.js +1 -1
  407. package/dist/utils/web/common.js +1 -0
  408. package/dist/utils/white_ext_list.js +1 -1
  409. package/dist/utils/wxapkg/pack.js +1 -1
  410. package/dist/utils/wxvpkgreader/wxvpkg/unpack/version0.js +1 -1
  411. package/dist/utils/wxvpkgreader/wxvpkg/unpack/version10.js +1 -1
  412. package/dist/utils/zip.js +1 -1
  413. package/dist/vendor/vslibrary/bundled/base.bundled.js +2 -0
  414. package/package.json +1 -1
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.minifyWXML=exports.StyleAttrValueTokenizer=exports.TemplateTokenizer=void 0;const tslib_1=require("tslib"),path_1=tslib_1.__importDefault(require("path")),log=tslib_1.__importStar(require("../../../../../utils/log")),config_1=require("../../../../../config/config");function getCharCode(T){return T.charCodeAt(0)>=256?BASE_STATE.OTHERS:T.charCodeAt(0)}function trimStringLeft(T,E=!0){return E?T.trimLeft():T.split("\n").map(T=>T.replace(/^[ \t]*/g,"")).join("\n")}function trimStringRight(T,E=!0){return E?T.trimRight():T.split("\n").map(T=>T.replace(/[ \t]*$/,"")).join("\n")}var TokenType,BASE_STATE,STATE,TEMPLATE_STATE,STYLE_ATTR_VALUE_STATE,ACTION;!function(T){T[T.ATTR=0]="ATTR",T[T.TAG=1]="TAG",T[T.LEFT_ANGLE_BRACKET=2]="LEFT_ANGLE_BRACKET",T[T.RIGHT_ANGLE_BRACKET=3]="RIGHT_ANGLE_BRACKET",T[T.END_LEFT_ANGLE_BRACKET=4]="END_LEFT_ANGLE_BRACKET",T[T.STRING1=5]="STRING1",T[T.STRING2=6]="STRING2",T[T.ATTR_VALUE=7]="ATTR_VALUE",T[T.TEXT_VALUE=8]="TEXT_VALUE",T[T.TAG_TEXT_VALUE=9]="TAG_TEXT_VALUE",T[T.TEMPLATE_START=10]="TEMPLATE_START",T[T.TEMPLATE_END=11]="TEMPLATE_END",T[T.TEMPLATE_ITEM=12]="TEMPLATE_ITEM",T[T.TEMPLATE_STRING=13]="TEMPLATE_STRING",T[T.SELF_CLOSE=14]="SELF_CLOSE",T[T.WXS_VALUE=15]="WXS_VALUE",T[T.STYLE_KEY=16]="STYLE_KEY",T[T.TAG_EQ=17]="TAG_EQ",T[T.STYLE_VALUE=18]="STYLE_VALUE",T[T.STYLE_ATTR_VALUE=19]="STYLE_ATTR_VALUE",T[T.CLASS_ATTR_VALUE=20]="CLASS_ATTR_VALUE",T[T.OTHERS=21]="OTHERS"}(TokenType||(TokenType={})),function(T){T[T.ERROR=-1]="ERROR",T[T.NOT_SET=0]="NOT_SET",T[T.START=1]="START",T[T.OTHERS=2]="OTHERS",T[T.END=3]="END",T[T.MAX_STATE=4]="MAX_STATE"}(BASE_STATE||(BASE_STATE={})),function(T){T[T.IN_TAG_TEXT=5]="IN_TAG_TEXT",T[T.TAG_START=6]="TAG_START",T[T.IN_TAG_WORD=7]="IN_TAG_WORD",T[T.TAG_EQ=8]="TAG_EQ",T[T.IN_TAG_ATTR_WORD=9]="IN_TAG_ATTR_WORD",T[T.IN_TAG_ATTR_VALUE_STRING=10]="IN_TAG_ATTR_VALUE_STRING",T[T.IN_TAG_ATTR_VALUE_STRING_ESCAPE=11]="IN_TAG_ATTR_VALUE_STRING_ESCAPE",T[T.IN_TAG_ATTR_VALUE_STRING_SINGLE=12]="IN_TAG_ATTR_VALUE_STRING_SINGLE",T[T.IN_TAG_ATTR_VALUE_STRING_SINGLE_ESCAPE=13]="IN_TAG_ATTR_VALUE_STRING_SINGLE_ESCAPE",T[T.WAIT_TEMPLATE_START=14]="WAIT_TEMPLATE_START",T[T.IN_TEMPLATE=15]="IN_TEMPLATE",T[T.WAIT_TEMPLATE_END=16]="WAIT_TEMPLATE_END",T[T.TEMPLATE_END_CHECK=17]="TEMPLATE_END_CHECK",T[T.IN_TEMPLATE_STRING=18]="IN_TEMPLATE_STRING",T[T.IN_TEMPLATE_STRING_ESCAPE=19]="IN_TEMPLATE_STRING_ESCAPE",T[T.IN_TEMPLATE_STRING2=20]="IN_TEMPLATE_STRING2",T[T.IN_TEMPLATE_STRING2_ESCAPE=21]="IN_TEMPLATE_STRING2_ESCAPE",T[T.WAIT_FOR_RIGHT_BRACKET=22]="WAIT_FOR_RIGHT_BRACKET",T[T.IN_WXS=23]="IN_WXS",T[T.IN_WXS_STRING=24]="IN_WXS_STRING",T[T.IN_WXS_STRING_ESCAPE=25]="IN_WXS_STRING_ESCAPE",T[T.IN_WXS_STRING_SINGLE=26]="IN_WXS_STRING_SINGLE",T[T.IN_WXS_STRING_SINGLE_ESCAPE=27]="IN_WXS_STRING_SINGLE_ESCAPE",T[T.WXS_END_STEP=28]="WXS_END_STEP",T[T.IN_COMMENT_BEGIN1=29]="IN_COMMENT_BEGIN1",T[T.IN_COMMENT_BEGIN2=30]="IN_COMMENT_BEGIN2",T[T.IN_COMMENT=31]="IN_COMMENT",T[T.WAIT_FOR_COMMENT_END1=32]="WAIT_FOR_COMMENT_END1",T[T.WAIT_FOR_COMMENT_END2=33]="WAIT_FOR_COMMENT_END2",T[T.IN_TEXT=34]="IN_TEXT",T[T.IN_END_TAG=35]="IN_END_TAG",T[T.IN_END_TAG_WORD=36]="IN_END_TAG_WORD",T[T.MAX_STATE=37]="MAX_STATE"}(STATE||(STATE={})),function(T){T[T.WAIT_TEMPLATE_START=5]="WAIT_TEMPLATE_START",T[T.IN_TEMPLATE_ITEM=6]="IN_TEMPLATE_ITEM",T[T.WAIT_TEMPLATE_END=7]="WAIT_TEMPLATE_END",T[T.SPACE_AFTER_WAIT_TEMPLATE_END=8]="SPACE_AFTER_WAIT_TEMPLATE_END",T[T.IN_TEMPLATE_STRING=9]="IN_TEMPLATE_STRING",T[T.IN_TEMPLATE_STRING_ESCAPE=10]="IN_TEMPLATE_STRING_ESCAPE",T[T.IN_TEMPLATE_STRING2=11]="IN_TEMPLATE_STRING2",T[T.IN_TEMPLATE_STRING2_ESCAPE=12]="IN_TEMPLATE_STRING2_ESCAPE",T[T.WAIT_FOR_COMMENT_START=13]="WAIT_FOR_COMMENT_START",T[T.IN_COMMENT=14]="IN_COMMENT",T[T.WAIT_FOR_COMMENT_END=15]="WAIT_FOR_COMMENT_END",T[T.IN_TEMPLATE_SPACE=16]="IN_TEMPLATE_SPACE",T[T.MAX_STATE=17]="MAX_STATE"}(TEMPLATE_STATE||(TEMPLATE_STATE={})),function(T){T[T.WAIT_KEY=5]="WAIT_KEY",T[T.IN_KEY=6]="IN_KEY",T[T.WAIT_KEY_VALUE_SAPERATE=7]="WAIT_KEY_VALUE_SAPERATE",T[T.IN_KEY_VALUE_SAPERATE=8]="IN_KEY_VALUE_SAPERATE",T[T.WAIT_VALUE=9]="WAIT_VALUE",T[T.IN_VALUE=10]="IN_VALUE",T[T.WAIT_ITEM_SAPERATE=11]="WAIT_ITEM_SAPERATE",T[T.IN_ITEM_SAPERATE=12]="IN_ITEM_SAPERATE",T[T.IN_STRING=13]="IN_STRING",T[T.IN_STRING_ESCAPE=14]="IN_STRING_ESCAPE",T[T.IN_STRING2=15]="IN_STRING2",T[T.IN_STRING2_ESCAPE=16]="IN_STRING2_ESCAPE",T[T.WAIT_TEMPLATE_START=17]="WAIT_TEMPLATE_START",T[T.IN_TEMPLATE=18]="IN_TEMPLATE",T[T.WAIT_TEMPLATE_END=19]="WAIT_TEMPLATE_END",T[T.IN_TEMPLATE_STRING=20]="IN_TEMPLATE_STRING",T[T.IN_TEMPLATE_STRING_ESCAPE=21]="IN_TEMPLATE_STRING_ESCAPE",T[T.IN_TEMPLATE_STRING2=22]="IN_TEMPLATE_STRING2",T[T.IN_TEMPLATE_STRING2_ESCAPE=23]="IN_TEMPLATE_STRING2_ESCAPE",T[T.WAIT_FOR_COMMENT_START=24]="WAIT_FOR_COMMENT_START",T[T.IN_COMMENT=25]="IN_COMMENT",T[T.WAIT_FOR_COMMENT_END=26]="WAIT_FOR_COMMENT_END",T[T.MAX_STATE=27]="MAX_STATE"}(STYLE_ATTR_VALUE_STATE||(STYLE_ATTR_VALUE_STATE={})),function(T){T[T.NOTHING=0]="NOTHING",T[T.DO_ACTION=65536]="DO_ACTION",T[T.STORE_TOKEN_EXCLUDE=131072]="STORE_TOKEN_EXCLUDE",T[T.STORE_TOKEN_INCLUDE=262144]="STORE_TOKEN_INCLUDE",T[T.IGNORE=524288]="IGNORE",T[T.REFEED=1048576]="REFEED",T[T.STORE_TOKEN_FIRST=2097152]="STORE_TOKEN_FIRST",T[T.STORE_ONE_SPACE=4194304]="STORE_ONE_SPACE",T[T.STORE_ONE_LINE_BREAK=8388608]="STORE_ONE_LINE_BREAK",T[T.GET_STATE_BEFORE=16777216]="GET_STATE_BEFORE",T[T.STORE_STATE_BEFORE=33554432]="STORE_STATE_BEFORE",T[T.SET_WXS_STATE=67108864]="SET_WXS_STATE",T[T.RECORD_IN_TEMPLATE_OBJECT=134217728]="RECORD_IN_TEMPLATE_OBJECT",T[T.CHECK_IN_TEMPLATE_OBJECT=268435456]="CHECK_IN_TEMPLATE_OBJECT"}(ACTION||(ACTION={}));class Token{constructor(T,E){this.type=T,this.value=E}}class MachineState{constructor(){this.cur_pos=0,this.last_pos=0,this.line=1,this.col=1,this.mark_pos=0,this.mark_col=0,this.last_line=this.line,this.last_col=1,this.state=BASE_STATE.START,this.in_template_object_count=0}}const ALPHA="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-:",DIGIT="0123456789.",WHITECHARS=" \n\t\r";class BaseMachine{constructor(T,E){this.mState=new MachineState,this.storedStates=[],this.oldState=BASE_STATE.START,this.tokens=[],this.mPath=T,this.mSrc=E}FillTT(T,E,_,A){for(const S of A)this.TT[T][getCharCode(S)]=E|_}Reset(){return this.mState.cur_pos=0,this.mState.last_pos=0,this.mState.mark_pos=0,this.mState.line=1,this.mState.col=1,this.mState.last_col=1,this.mState.mark_col=1,this.mState.last_line=this.mState.line,this.mState.state=BASE_STATE.START,0}refeed(T){let E=this.TT[this.mState.state][getCharCode(T)];if(E===BASE_STATE.NOT_SET&&(E=this.TT[this.mState.state][BASE_STATE.OTHERS]),E===BASE_STATE.NOT_SET)throw{col:this.mState.col,line:this.mState.line,message:"BAD STATE MACHINE!"};if(E<0){if("\0"!==T)throw{col:this.mState.col,line:this.mState.line,message:`unexpected character \`${T.replace(/\n/g,"\\n")}\``};throw{col:this.mState.col,line:this.mState.line,message:"unexpected end"}}const _=E,A=65535&E,S=this.mState.state;_&ACTION.STORE_STATE_BEFORE&&(this.storedStates.push(S),this.mState.mark_pos=this.mState.cur_pos,this.mState.mark_col=this.mState.mark_col),this.mState.state=A,this.doAction(T,S,_)}Feed(T){"\n"===T&&(this.mState.line++,this.mState.col=0),this.refeed(T)}FillTT_template_string(T,E,_){const A=T+1;this.TT[T][getCharCode("\\")]=A,this.TT[A][BASE_STATE.OTHERS]=T,this.TT[T][getCharCode(_)]=E,this.TT[T][0]=BASE_STATE.ERROR,this.TT[T][BASE_STATE.OTHERS]=T}updatePosition(){this.mState.last_pos=this.mState.cur_pos,this.mState.last_col=this.mState.col,this.mState.last_line=this.mState.line}processPosition(){this.mState.cur_pos++,this.mState.col++}doAction(T,E,_){if(_&ACTION.STORE_TOKEN_FIRST&&this.mState.mark_pos>this.mState.last_pos){const T=this.mSrc.substring(this.mState.last_pos,this.mState.mark_pos);this.doExcludeAction(this.storedStates[this.storedStates.length-1],T),this.mState.last_pos=this.mState.mark_pos,this.mState.last_col=this.mState.mark_col}if(_&ACTION.STORE_ONE_LINE_BREAK&&(this.appendToken(TokenType.OTHERS,"\n"),this.updatePosition()),_&ACTION.STORE_ONE_SPACE&&(this.appendToken(TokenType.OTHERS," "),this.updatePosition()),_&ACTION.STORE_TOKEN_EXCLUDE){const T=this.mState.cur_pos,_=this.mState.last_pos;if(T>=_){const A=this.mSrc.substring(_,T);this.doExcludeAction(E,A),this.updatePosition()}}if(_&ACTION.RECORD_IN_TEMPLATE_OBJECT&&this.mState.in_template_object_count++,_&ACTION.CHECK_IN_TEMPLATE_OBJECT&&this.mState.in_template_object_count>0&&(this.mState.in_template_object_count--,this.mState.state=STATE.IN_TEMPLATE),_&ACTION.REFEED){if(_&ACTION.IGNORE&&this.updatePosition(),_&ACTION.GET_STATE_BEFORE){const T=this.storedStates.pop();T&&(this.mState.state=T)}this.refeed(T)}else{if(this.processPosition(),_&ACTION.STORE_TOKEN_INCLUDE){const _=this.mSrc.substring(this.mState.last_pos,this.mState.cur_pos);this.doIncludeAction(T,E,_),this.updatePosition()}if(_&ACTION.IGNORE&&this.updatePosition(),_&ACTION.GET_STATE_BEFORE){const T=this.storedStates.pop();T&&(this.mState.state=T)}}}}class StyleAttrValueMachine extends BaseMachine{get TT(){return StyleAttrValueMachine._TT||this.InitTransitTable(),StyleAttrValueMachine._TT}constructor(T,E){super(T,E),this.mState.state=BASE_STATE.START}getTokens(){return[...this.tokens]}appendToken(T,E){T===TokenType.STYLE_VALUE&&(E=E.replace(/[ \t]+/g," ")),this.tokens.push(new Token(T,E))}doExcludeAction(T,E){let _=TokenType.OTHERS;switch(T){case STYLE_ATTR_VALUE_STATE.IN_KEY:_=TokenType.STYLE_KEY;break;case STYLE_ATTR_VALUE_STATE.IN_KEY_VALUE_SAPERATE:_=TokenType.OTHERS;break;case STYLE_ATTR_VALUE_STATE.IN_ITEM_SAPERATE:_=TokenType.OTHERS,E=";";break;case STYLE_ATTR_VALUE_STATE.IN_VALUE:_=TokenType.STYLE_VALUE}this.appendToken(_,E)}doIncludeAction(T,E,_){let A=TokenType.OTHERS;switch(E){case STYLE_ATTR_VALUE_STATE.IN_STRING:A=TokenType.STRING1;break;case STYLE_ATTR_VALUE_STATE.IN_STRING2:A=TokenType.STRING2;break;case STYLE_ATTR_VALUE_STATE.WAIT_TEMPLATE_END:A=TokenType.TEMPLATE_ITEM,_=new TemplateTokenizer(_,this.mPath).toString();break;case STYLE_ATTR_VALUE_STATE.WAIT_FOR_COMMENT_START:this.doExcludeAction(this.storedStates[this.storedStates.length-1],_.replace(/\/\*$/,"")),A=TokenType.OTHERS,_="/*";break;case STYLE_ATTR_VALUE_STATE.WAIT_FOR_COMMENT_END:A=TokenType.OTHERS,_="*/"}this.appendToken(A,_)}FillTT_string(T,E,_){const A=T+1;this.TT[T][getCharCode("\\")]=A,this.TT[T][getCharCode("\n")]=BASE_STATE.ERROR,this.TT[A][BASE_STATE.OTHERS]=T,this.TT[A][getCharCode("\n")]=E|ACTION.STORE_TOKEN_EXCLUDE|ACTION.IGNORE,this.TT[T][getCharCode(_)]=E|ACTION.STORE_TOKEN_INCLUDE,this.TT[T][getCharCode("{")]=STYLE_ATTR_VALUE_STATE.WAIT_TEMPLATE_START|ACTION.STORE_STATE_BEFORE,this.TT[T][0]=BASE_STATE.ERROR,this.TT[T][BASE_STATE.OTHERS]=T}InitTransitTable(){StyleAttrValueMachine._TT=new Array(STYLE_ATTR_VALUE_STATE.MAX_STATE);for(let T=0;T<STYLE_ATTR_VALUE_STATE.MAX_STATE;T++){const E=new Array(257);E.fill(0),this.TT[T]=E}this.TT[BASE_STATE.END][BASE_STATE.OTHERS]=BASE_STATE.END,this.FillTT(BASE_STATE.START,BASE_STATE.START,ACTION.IGNORE," \n\t\r"),this.TT[BASE_STATE.START][getCharCode(":")]=BASE_STATE.ERROR,this.TT[BASE_STATE.START][getCharCode(";")]=STYLE_ATTR_VALUE_STATE.IN_ITEM_SAPERATE|ACTION.STORE_TOKEN_EXCLUDE,this.TT[BASE_STATE.START][getCharCode("{")]=STYLE_ATTR_VALUE_STATE.WAIT_TEMPLATE_START|ACTION.STORE_STATE_BEFORE,this.TT[BASE_STATE.START][getCharCode("/")]=STYLE_ATTR_VALUE_STATE.WAIT_FOR_COMMENT_START|ACTION.STORE_STATE_BEFORE,this.TT[BASE_STATE.START][BASE_STATE.OTHERS]=STYLE_ATTR_VALUE_STATE.IN_KEY,this.FillTT(STYLE_ATTR_VALUE_STATE.WAIT_KEY,STYLE_ATTR_VALUE_STATE.WAIT_KEY,ACTION.IGNORE," \n\t\r"),this.TT[STYLE_ATTR_VALUE_STATE.WAIT_KEY][getCharCode(":")]=BASE_STATE.ERROR,this.TT[STYLE_ATTR_VALUE_STATE.WAIT_KEY][getCharCode(";")]=STYLE_ATTR_VALUE_STATE.IN_ITEM_SAPERATE|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STYLE_ATTR_VALUE_STATE.WAIT_KEY][getCharCode("{")]=STYLE_ATTR_VALUE_STATE.IN_KEY|ACTION.REFEED,this.TT[STYLE_ATTR_VALUE_STATE.WAIT_KEY][BASE_STATE.OTHERS]=STYLE_ATTR_VALUE_STATE.IN_KEY,this.TT[STYLE_ATTR_VALUE_STATE.WAIT_KEY][getCharCode("/")]=STYLE_ATTR_VALUE_STATE.WAIT_FOR_COMMENT_START|ACTION.STORE_STATE_BEFORE,this.FillTT(STYLE_ATTR_VALUE_STATE.IN_KEY,STYLE_ATTR_VALUE_STATE.WAIT_KEY_VALUE_SAPERATE,ACTION.STORE_TOKEN_EXCLUDE|ACTION.IGNORE," \n\t\r"),this.TT[STYLE_ATTR_VALUE_STATE.IN_KEY][getCharCode(":")]=STYLE_ATTR_VALUE_STATE.IN_KEY_VALUE_SAPERATE|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STYLE_ATTR_VALUE_STATE.IN_KEY][getCharCode(";")]=STYLE_ATTR_VALUE_STATE.IN_ITEM_SAPERATE|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STYLE_ATTR_VALUE_STATE.IN_KEY][getCharCode("{")]=STYLE_ATTR_VALUE_STATE.WAIT_TEMPLATE_START|ACTION.STORE_STATE_BEFORE,this.TT[STYLE_ATTR_VALUE_STATE.IN_KEY][getCharCode('"')]=BASE_STATE.ERROR,this.TT[STYLE_ATTR_VALUE_STATE.IN_KEY][getCharCode("'")]=BASE_STATE.ERROR,this.TT[STYLE_ATTR_VALUE_STATE.IN_KEY][BASE_STATE.OTHERS]=STYLE_ATTR_VALUE_STATE.IN_KEY,this.TT[STYLE_ATTR_VALUE_STATE.IN_KEY][getCharCode("/")]=STYLE_ATTR_VALUE_STATE.WAIT_FOR_COMMENT_START|ACTION.STORE_STATE_BEFORE,this.FillTT(STYLE_ATTR_VALUE_STATE.WAIT_KEY_VALUE_SAPERATE,STYLE_ATTR_VALUE_STATE.WAIT_KEY_VALUE_SAPERATE,ACTION.IGNORE," \n\t\r"),this.TT[STYLE_ATTR_VALUE_STATE.WAIT_KEY_VALUE_SAPERATE][getCharCode(":")]=STYLE_ATTR_VALUE_STATE.IN_KEY_VALUE_SAPERATE|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STYLE_ATTR_VALUE_STATE.WAIT_KEY_VALUE_SAPERATE][getCharCode(";")]=STYLE_ATTR_VALUE_STATE.WAIT_KEY|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STYLE_ATTR_VALUE_STATE.WAIT_KEY_VALUE_SAPERATE][BASE_STATE.OTHERS]=BASE_STATE.ERROR,this.TT[STYLE_ATTR_VALUE_STATE.WAIT_KEY_VALUE_SAPERATE][getCharCode("/")]=STYLE_ATTR_VALUE_STATE.WAIT_FOR_COMMENT_START|ACTION.STORE_STATE_BEFORE,this.FillTT(STYLE_ATTR_VALUE_STATE.IN_KEY_VALUE_SAPERATE,STYLE_ATTR_VALUE_STATE.WAIT_VALUE,ACTION.STORE_TOKEN_EXCLUDE|ACTION.IGNORE," \n\t\r"),this.TT[STYLE_ATTR_VALUE_STATE.IN_KEY_VALUE_SAPERATE][getCharCode(":")]=STYLE_ATTR_VALUE_STATE.IN_KEY_VALUE_SAPERATE|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STYLE_ATTR_VALUE_STATE.IN_KEY_VALUE_SAPERATE][getCharCode(";")]=STYLE_ATTR_VALUE_STATE.IN_ITEM_SAPERATE|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STYLE_ATTR_VALUE_STATE.IN_KEY_VALUE_SAPERATE][BASE_STATE.OTHERS]=STYLE_ATTR_VALUE_STATE.IN_VALUE|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STYLE_ATTR_VALUE_STATE.IN_KEY_VALUE_SAPERATE][getCharCode("\0")]=BASE_STATE.END|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STYLE_ATTR_VALUE_STATE.IN_KEY_VALUE_SAPERATE][getCharCode('"')]=STYLE_ATTR_VALUE_STATE.IN_VALUE|ACTION.REFEED,this.TT[STYLE_ATTR_VALUE_STATE.IN_KEY_VALUE_SAPERATE][getCharCode("'")]=STYLE_ATTR_VALUE_STATE.IN_VALUE|ACTION.REFEED,this.TT[STYLE_ATTR_VALUE_STATE.IN_KEY_VALUE_SAPERATE][getCharCode("/")]=STYLE_ATTR_VALUE_STATE.IN_VALUE|ACTION.REFEED|ACTION.STORE_TOKEN_EXCLUDE,this.FillTT(STYLE_ATTR_VALUE_STATE.WAIT_VALUE,STYLE_ATTR_VALUE_STATE.WAIT_VALUE,ACTION.IGNORE," \n\t\r"),this.TT[STYLE_ATTR_VALUE_STATE.WAIT_VALUE][getCharCode(":")]=BASE_STATE.ERROR,this.TT[STYLE_ATTR_VALUE_STATE.WAIT_VALUE][getCharCode(";")]=STYLE_ATTR_VALUE_STATE.IN_ITEM_SAPERATE|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STYLE_ATTR_VALUE_STATE.WAIT_VALUE][getCharCode("{")]=STYLE_ATTR_VALUE_STATE.WAIT_TEMPLATE_START|ACTION.STORE_STATE_BEFORE,this.TT[STYLE_ATTR_VALUE_STATE.WAIT_VALUE][getCharCode('"')]=STYLE_ATTR_VALUE_STATE.IN_VALUE|ACTION.REFEED,this.TT[STYLE_ATTR_VALUE_STATE.WAIT_VALUE][getCharCode("'")]=STYLE_ATTR_VALUE_STATE.IN_VALUE|ACTION.REFEED,this.TT[STYLE_ATTR_VALUE_STATE.WAIT_VALUE][getCharCode("\0")]=BASE_STATE.END,this.TT[STYLE_ATTR_VALUE_STATE.WAIT_VALUE][BASE_STATE.OTHERS]=STYLE_ATTR_VALUE_STATE.IN_VALUE,this.TT[STYLE_ATTR_VALUE_STATE.WAIT_VALUE][getCharCode("/")]=STYLE_ATTR_VALUE_STATE.WAIT_FOR_COMMENT_START|ACTION.STORE_STATE_BEFORE,this.TT[STYLE_ATTR_VALUE_STATE.IN_VALUE][getCharCode(";")]=STYLE_ATTR_VALUE_STATE.IN_ITEM_SAPERATE|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STYLE_ATTR_VALUE_STATE.IN_VALUE][getCharCode('"')]=STYLE_ATTR_VALUE_STATE.IN_STRING|ACTION.STORE_STATE_BEFORE|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STYLE_ATTR_VALUE_STATE.IN_VALUE][getCharCode("'")]=STYLE_ATTR_VALUE_STATE.IN_STRING2|ACTION.STORE_STATE_BEFORE|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STYLE_ATTR_VALUE_STATE.IN_VALUE][getCharCode("{")]=STYLE_ATTR_VALUE_STATE.WAIT_TEMPLATE_START|ACTION.STORE_STATE_BEFORE,this.TT[STYLE_ATTR_VALUE_STATE.IN_VALUE][BASE_STATE.OTHERS]=STYLE_ATTR_VALUE_STATE.IN_VALUE,this.TT[STYLE_ATTR_VALUE_STATE.IN_VALUE][getCharCode("\0")]=BASE_STATE.END|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STYLE_ATTR_VALUE_STATE.IN_VALUE][getCharCode("/")]=STYLE_ATTR_VALUE_STATE.WAIT_FOR_COMMENT_START|ACTION.STORE_STATE_BEFORE,this.FillTT(STYLE_ATTR_VALUE_STATE.IN_ITEM_SAPERATE,STYLE_ATTR_VALUE_STATE.WAIT_KEY,ACTION.STORE_TOKEN_EXCLUDE|ACTION.IGNORE," \n\t\r"),this.TT[STYLE_ATTR_VALUE_STATE.IN_ITEM_SAPERATE][getCharCode(";")]=STYLE_ATTR_VALUE_STATE.IN_ITEM_SAPERATE|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STYLE_ATTR_VALUE_STATE.IN_ITEM_SAPERATE][getCharCode("{")]=STYLE_ATTR_VALUE_STATE.WAIT_TEMPLATE_START|ACTION.STORE_STATE_BEFORE,this.TT[STYLE_ATTR_VALUE_STATE.IN_ITEM_SAPERATE][getCharCode("'")]=BASE_STATE.ERROR,this.TT[STYLE_ATTR_VALUE_STATE.IN_ITEM_SAPERATE][getCharCode('"')]=BASE_STATE.ERROR,this.TT[STYLE_ATTR_VALUE_STATE.IN_ITEM_SAPERATE][BASE_STATE.OTHERS]=STYLE_ATTR_VALUE_STATE.IN_KEY|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STYLE_ATTR_VALUE_STATE.IN_ITEM_SAPERATE][getCharCode("\0")]=BASE_STATE.END|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STYLE_ATTR_VALUE_STATE.IN_ITEM_SAPERATE][getCharCode("/")]=STYLE_ATTR_VALUE_STATE.IN_KEY|ACTION.REFEED,this.TT[STYLE_ATTR_VALUE_STATE.WAIT_TEMPLATE_START][getCharCode("{")]=STYLE_ATTR_VALUE_STATE.IN_TEMPLATE|ACTION.STORE_TOKEN_FIRST,this.TT[STYLE_ATTR_VALUE_STATE.WAIT_TEMPLATE_START][BASE_STATE.OTHERS]=ACTION.GET_STATE_BEFORE,this.TT[STYLE_ATTR_VALUE_STATE.WAIT_TEMPLATE_START][getCharCode("/")]=STYLE_ATTR_VALUE_STATE.WAIT_FOR_COMMENT_START|ACTION.STORE_STATE_BEFORE,this.TT[STYLE_ATTR_VALUE_STATE.IN_TEMPLATE][getCharCode("}")]=STYLE_ATTR_VALUE_STATE.WAIT_TEMPLATE_END,this.TT[STYLE_ATTR_VALUE_STATE.IN_TEMPLATE][getCharCode("\\")]=BASE_STATE.ERROR,this.FillTT(STYLE_ATTR_VALUE_STATE.IN_TEMPLATE,STYLE_ATTR_VALUE_STATE.IN_TEMPLATE,ACTION.NOTHING," \n\t\r"),this.TT[STYLE_ATTR_VALUE_STATE.IN_TEMPLATE][BASE_STATE.OTHERS]=STYLE_ATTR_VALUE_STATE.IN_TEMPLATE,this.TT[STYLE_ATTR_VALUE_STATE.IN_TEMPLATE][0]=BASE_STATE.ERROR,this.TT[STYLE_ATTR_VALUE_STATE.IN_TEMPLATE][getCharCode("/")]=STYLE_ATTR_VALUE_STATE.WAIT_FOR_COMMENT_START|ACTION.STORE_STATE_BEFORE,this.TT[STYLE_ATTR_VALUE_STATE.WAIT_TEMPLATE_END][getCharCode("}")]=ACTION.GET_STATE_BEFORE|ACTION.STORE_TOKEN_INCLUDE,this.TT[STYLE_ATTR_VALUE_STATE.WAIT_TEMPLATE_END][BASE_STATE.OTHERS]=STYLE_ATTR_VALUE_STATE.IN_TEMPLATE|ACTION.REFEED,this.TT[STYLE_ATTR_VALUE_STATE.WAIT_TEMPLATE_END][getCharCode("/")]=STYLE_ATTR_VALUE_STATE.WAIT_FOR_COMMENT_START|ACTION.STORE_STATE_BEFORE,this.TT[STYLE_ATTR_VALUE_STATE.IN_TEMPLATE][getCharCode('"')]=STYLE_ATTR_VALUE_STATE.IN_TEMPLATE_STRING|ACTION.NOTHING,this.TT[STYLE_ATTR_VALUE_STATE.IN_TEMPLATE][getCharCode("'")]=STYLE_ATTR_VALUE_STATE.IN_TEMPLATE_STRING2|ACTION.NOTHING,this.TT[STYLE_ATTR_VALUE_STATE.WAIT_FOR_COMMENT_START][getCharCode("*")]=STYLE_ATTR_VALUE_STATE.IN_COMMENT|ACTION.STORE_TOKEN_INCLUDE,this.TT[STYLE_ATTR_VALUE_STATE.WAIT_FOR_COMMENT_START][BASE_STATE.OTHERS]=ACTION.GET_STATE_BEFORE,this.TT[STYLE_ATTR_VALUE_STATE.IN_COMMENT][getCharCode("*")]=STYLE_ATTR_VALUE_STATE.WAIT_FOR_COMMENT_END,this.TT[STYLE_ATTR_VALUE_STATE.IN_COMMENT][BASE_STATE.OTHERS]=STYLE_ATTR_VALUE_STATE.IN_COMMENT|ACTION.IGNORE,this.TT[STYLE_ATTR_VALUE_STATE.WAIT_FOR_COMMENT_END][getCharCode("/")]=ACTION.GET_STATE_BEFORE|ACTION.STORE_TOKEN_INCLUDE,this.TT[STYLE_ATTR_VALUE_STATE.WAIT_FOR_COMMENT_END][BASE_STATE.OTHERS]=STYLE_ATTR_VALUE_STATE.IN_COMMENT|ACTION.NOTHING,this.FillTT_template_string(STYLE_ATTR_VALUE_STATE.IN_TEMPLATE_STRING,STYLE_ATTR_VALUE_STATE.IN_TEMPLATE|ACTION.NOTHING,'"'),this.FillTT_template_string(STYLE_ATTR_VALUE_STATE.IN_TEMPLATE_STRING2,STYLE_ATTR_VALUE_STATE.IN_TEMPLATE|ACTION.NOTHING,"'"),this.FillTT_string(STYLE_ATTR_VALUE_STATE.IN_STRING,ACTION.GET_STATE_BEFORE,'"'),this.FillTT_string(STYLE_ATTR_VALUE_STATE.IN_STRING2,ACTION.GET_STATE_BEFORE,"'")}}class TemplateMachine extends BaseMachine{get TT(){return TemplateMachine._TT||this.InitTransitTable(),TemplateMachine._TT}constructor(T,E){super(T,E),this.mState.state=BASE_STATE.START}getTokens(){return[...this.tokens]}appendToken(T,E){this.tokens.push(new Token(T,E))}doExcludeAction(T,E){let _=TokenType.OTHERS;switch(T){case TEMPLATE_STATE.IN_TEMPLATE_ITEM:case TEMPLATE_STATE.WAIT_TEMPLATE_END:_=TokenType.TEMPLATE_ITEM}this.appendToken(_,E)}doIncludeAction(T,E,_){let A=TokenType.OTHERS;switch(E){case TEMPLATE_STATE.WAIT_TEMPLATE_START:A=TokenType.TEMPLATE_START;break;case TEMPLATE_STATE.WAIT_TEMPLATE_END:A=TokenType.TEMPLATE_END}this.appendToken(A,_)}InitTransitTable(){TemplateMachine._TT=new Array(TEMPLATE_STATE.MAX_STATE);for(let T=0;T<TEMPLATE_STATE.MAX_STATE;T++){const E=new Array(257);E.fill(0),this.TT[T]=E}this.FillTT(BASE_STATE.START,BASE_STATE.START,ACTION.IGNORE," \n\t\r"),this.TT[BASE_STATE.START][getCharCode("{")]=TEMPLATE_STATE.WAIT_TEMPLATE_START,this.TT[BASE_STATE.START][BASE_STATE.OTHERS]=BASE_STATE.ERROR,this.TT[TEMPLATE_STATE.WAIT_TEMPLATE_START][getCharCode("{")]=TEMPLATE_STATE.IN_TEMPLATE_ITEM|ACTION.STORE_TOKEN_INCLUDE,this.TT[TEMPLATE_STATE.WAIT_TEMPLATE_START][BASE_STATE.OTHERS]=BASE_STATE.ERROR,this.FillTT(TEMPLATE_STATE.IN_TEMPLATE_SPACE,TEMPLATE_STATE.IN_TEMPLATE_SPACE,ACTION.IGNORE," \n\t\r"),this.TT[TEMPLATE_STATE.IN_TEMPLATE_SPACE][getCharCode("}")]=TEMPLATE_STATE.WAIT_TEMPLATE_END,this.TT[TEMPLATE_STATE.IN_TEMPLATE_SPACE][getCharCode('"')]=TEMPLATE_STATE.IN_TEMPLATE_STRING|ACTION.STORE_STATE_BEFORE,this.TT[TEMPLATE_STATE.IN_TEMPLATE_SPACE][getCharCode("'")]=TEMPLATE_STATE.IN_TEMPLATE_STRING2|ACTION.STORE_STATE_BEFORE,this.TT[TEMPLATE_STATE.IN_TEMPLATE_SPACE][getCharCode("/")]=TEMPLATE_STATE.WAIT_FOR_COMMENT_START,this.TT[TEMPLATE_STATE.IN_TEMPLATE_SPACE][BASE_STATE.OTHERS]=TEMPLATE_STATE.IN_TEMPLATE_ITEM,this.FillTT(TEMPLATE_STATE.IN_TEMPLATE_ITEM,TEMPLATE_STATE.IN_TEMPLATE_SPACE,ACTION.STORE_TOKEN_EXCLUDE|ACTION.IGNORE," \n\t\r"),this.TT[TEMPLATE_STATE.IN_TEMPLATE_ITEM][getCharCode("}")]=TEMPLATE_STATE.WAIT_TEMPLATE_END,this.TT[TEMPLATE_STATE.IN_TEMPLATE_ITEM][getCharCode("\\")]=BASE_STATE.ERROR,this.TT[TEMPLATE_STATE.IN_TEMPLATE_ITEM][getCharCode('"')]=TEMPLATE_STATE.IN_TEMPLATE_STRING|ACTION.STORE_STATE_BEFORE|ACTION.STORE_TOKEN_EXCLUDE,this.TT[TEMPLATE_STATE.IN_TEMPLATE_ITEM][getCharCode("'")]=TEMPLATE_STATE.IN_TEMPLATE_STRING2|ACTION.STORE_STATE_BEFORE|ACTION.STORE_TOKEN_EXCLUDE,this.TT[TEMPLATE_STATE.IN_TEMPLATE_ITEM][BASE_STATE.OTHERS]=TEMPLATE_STATE.IN_TEMPLATE_ITEM,this.TT[TEMPLATE_STATE.IN_TEMPLATE_ITEM][0]=BASE_STATE.ERROR,this.TT[TEMPLATE_STATE.WAIT_FOR_COMMENT_START][getCharCode("*")]=TEMPLATE_STATE.IN_COMMENT,this.FillTT(TEMPLATE_STATE.WAIT_FOR_COMMENT_START,TEMPLATE_STATE.IN_TEMPLATE_ITEM,ACTION.REFEED," \n\t\r"),this.TT[TEMPLATE_STATE.WAIT_FOR_COMMENT_START][BASE_STATE.OTHERS]=TEMPLATE_STATE.IN_TEMPLATE_ITEM,this.TT[TEMPLATE_STATE.IN_COMMENT][getCharCode("*")]=TEMPLATE_STATE.WAIT_FOR_COMMENT_END,this.TT[TEMPLATE_STATE.IN_COMMENT][BASE_STATE.OTHERS]=TEMPLATE_STATE.IN_COMMENT,this.TT[TEMPLATE_STATE.WAIT_FOR_COMMENT_END][getCharCode("/")]=TEMPLATE_STATE.IN_TEMPLATE_SPACE|ACTION.IGNORE,this.FillTT_template_string(TEMPLATE_STATE.IN_TEMPLATE_STRING,TEMPLATE_STATE.IN_TEMPLATE_ITEM|ACTION.STORE_TOKEN_INCLUDE|ACTION.GET_STATE_BEFORE,'"'),this.FillTT_template_string(TEMPLATE_STATE.IN_TEMPLATE_STRING2,TEMPLATE_STATE.IN_TEMPLATE_ITEM|ACTION.STORE_TOKEN_INCLUDE|ACTION.GET_STATE_BEFORE,"'"),this.TT[TEMPLATE_STATE.WAIT_TEMPLATE_END][getCharCode("}")]=BASE_STATE.END|ACTION.STORE_TOKEN_INCLUDE,this.FillTT(TEMPLATE_STATE.WAIT_TEMPLATE_END,TEMPLATE_STATE.SPACE_AFTER_WAIT_TEMPLATE_END,ACTION.STORE_TOKEN_EXCLUDE," \n\t\r"),this.TT[TEMPLATE_STATE.WAIT_TEMPLATE_END][BASE_STATE.OTHERS]=TEMPLATE_STATE.IN_TEMPLATE_ITEM|ACTION.REFEED,this.FillTT(TEMPLATE_STATE.SPACE_AFTER_WAIT_TEMPLATE_END,TEMPLATE_STATE.SPACE_AFTER_WAIT_TEMPLATE_END,ACTION.IGNORE," \n\t\r"),this.TT[TEMPLATE_STATE.SPACE_AFTER_WAIT_TEMPLATE_END][getCharCode("}")]=TEMPLATE_STATE.WAIT_TEMPLATE_END|ACTION.STORE_ONE_SPACE,this.TT[TEMPLATE_STATE.SPACE_AFTER_WAIT_TEMPLATE_END][BASE_STATE.OTHERS]=TEMPLATE_STATE.IN_TEMPLATE_ITEM|ACTION.IGNORE|ACTION.REFEED,this.FillTT(BASE_STATE.END,BASE_STATE.END,ACTION.IGNORE," \n\t\r"),this.TT[BASE_STATE.END][getCharCode("\0")]=BASE_STATE.END,this.TT[BASE_STATE.END][BASE_STATE.OTHERS]=BASE_STATE.ERROR}}class TemplateTokenizer{constructor(T,E){this.machine=new TemplateMachine(E,T),this.m_pSrc=T,this.path=E}toString(){this.tokens||(this.tokens=this.generateTokens());return this.tokens.map(T=>T.value).join("")}generateTokens(){if(this.machine.Reset(),0===this.m_pSrc.length)return[];for(let T=0;T<this.m_pSrc.length;T++){const E=this.m_pSrc[T];this.machine.Feed(E)}return this.machine.Feed("\0"),this.machine.getTokens()}}exports.TemplateTokenizer=TemplateTokenizer;class StyleAttrValueTokenizer{constructor(T,E){this.machine=new StyleAttrValueMachine(E,T),this.m_pSrc=T,this.path=E}toString(){return this.tokens||(this.tokens=this.generateTokens()),this.tokens.map(T=>T.value).join("")}generateTokens(){if(this.machine.Reset(),0===this.m_pSrc.length)return[];for(let T=0;T<this.m_pSrc.length;T++){const E=this.m_pSrc[T];this.machine.Feed(E)}return this.machine.Feed("\0"),this.machine.getTokens()}}exports.StyleAttrValueTokenizer=StyleAttrValueTokenizer;class Machine extends BaseMachine{get TT(){return Machine._TT||this.InitTransitTable(),Machine._TT}constructor(T,E){super(T,E),this.tagStack=[],this.InitTransitTable(),this.mPath=T,this.mSrc=E}get wxsState(){return"wxs"===this.tagStack[this.tagStack.length-1]}get textState(){return"text"===this.tagStack[this.tagStack.length-1]}getTokens(){return[...this.tokens]}checkLastTokenIfTypeMatch(T){var E;return(null===(E=this.tokens[this.tokens.length-1])||void 0===E?void 0:E.type)===T?this.tokens[this.tokens.length-1]:void 0}getLastTokenIfTypeMatch(T){if(0!==this.tokens.length)for(let E=this.tokens.length-1;E>=0;E--){const _=this.tokens[E];if(_.type===T)return _}}canBeOmittedTokenType(T){return T===TokenType.WXS_VALUE}appendToken(T,E){if(this.canBeOmittedTokenType(T)&&(E=this.transTagTextTokenValue(E)),T===TokenType.ATTR_VALUE){const T=this.getLastTokenIfTypeMatch(TokenType.ATTR);"style"===(null==T?void 0:T.value)&&(E=this.trySlimStyleAttrValue(E))}E&&this.tokens.push(new Token(T,E))}transTagTextTokenValue(T){return this.wxsState?T=T.split("\n").map(T=>T.trim()).join("\n"):T}trySlimStyleAttrValue(T){const E=[];try{if(T.length<=1)return T;for(let T=this.tokens.length-1;T>=0;T--){if(this.tokens[T].type===TokenType.TAG_EQ)break;E.unshift(this.tokens.pop())}const _=`${E.map(T=>null==T?void 0:T.value).join("")}${T}`,A=_.startsWith('"')||_.startsWith("'"),S=_.endsWith('"')||_.endsWith("'"),t=new StyleAttrValueTokenizer(_.replace(/^['"]/,"").replace(/['"]$/,""),this.mPath).toString();return`${A?_.substr(0,1):""}${t}${S?_.substr(_.length-1,1):""}`}catch(T){this.tokens.push(...E)}return T}doExcludeAction(T,E){let _=TokenType.OTHERS;switch(T){case STATE.IN_TAG_ATTR_VALUE_STRING:case STATE.IN_TAG_ATTR_VALUE_STRING_SINGLE:_=TokenType.ATTR_VALUE;break;case STATE.IN_TAG_WORD:_=TokenType.TAG,this.tagStack.push(E);break;case STATE.IN_END_TAG_WORD:_=TokenType.TAG;if(this.tagStack.pop()!==E)throw{col:this.mState.col-E.length,line:this.mState.line,message:"unexpected end tag: "+E};break;case STATE.IN_WXS:_=TokenType.WXS_VALUE;break;case STATE.IN_TEXT:_=TokenType.TEXT_VALUE;break;case STATE.IN_TAG_TEXT:_=TokenType.TAG_TEXT_VALUE;break;case STATE.IN_TAG_ATTR_WORD:_=TokenType.ATTR;break;case STATE.TAG_START:_=TokenType.LEFT_ANGLE_BRACKET;break;case STATE.IN_TEMPLATE:_=TokenType.TEMPLATE_ITEM;break;case STATE.TAG_EQ:_=TokenType.TAG_EQ;break;case STATE.TEMPLATE_END_CHECK:{const T=this.mState.cur_pos;if("}"===this.mSrc.substring(T-3,T-2))throw{col:this.mState.col-3,line:this.mState.line,message:"unexpected end tag: }. } should not be followed by }} direactly, add a space and change it to } }}"};this.appendToken(TokenType.TEMPLATE_ITEM,""+new TemplateTokenizer(E,this.mPath)),_=TokenType.TEMPLATE_END,E=""}}this.appendToken(_,E)}doIncludeAction(T,E,_){const A=this.mState.state;let S;E===STATE.WXS_END_STEP?(this.appendToken(TokenType.WXS_VALUE,_.substr(0,_.length-2)),S=TokenType.END_LEFT_ANGLE_BRACKET,_="</"):E===STATE.IN_WXS_STRING||E===STATE.IN_WXS_STRING_SINGLE?S=TokenType.WXS_VALUE:E===STATE.IN_TAG_ATTR_VALUE_STRING||E===STATE.IN_TAG_ATTR_VALUE_STRING_SINGLE?S=TokenType.ATTR_VALUE:E===STATE.TAG_START&&A===STATE.IN_END_TAG?S=TokenType.END_LEFT_ANGLE_BRACKET:E===STATE.WAIT_FOR_RIGHT_BRACKET?(S=TokenType.SELF_CLOSE,this.tagStack.pop()):S=TokenType.OTHERS,">"!==T||E!==STATE.IN_TAG_WORD&&E!==STATE.IN_TAG_ATTR_WORD&&E!==STATE.IN_TAG_ATTR_VALUE_STRING&&E!==STATE.IN_TAG_ATTR_VALUE_STRING_SINGLE&&E!==STATE.IN_END_TAG_WORD||(S=TokenType.RIGHT_ANGLE_BRACKET),this.appendToken(S,_)}Feed(T){super.Feed(T),this.wxsState&&this.mState.state===STATE.IN_TAG_TEXT&&(this.mState.state=STATE.IN_WXS),this.textState&&this.mState.state===STATE.IN_TAG_TEXT&&(this.mState.state=STATE.IN_TEXT)}FillTT_attr_string(T,E,_){const A=T+1;this.TT[T][getCharCode("\\")]=A,this.TT[A][BASE_STATE.OTHERS]=T,this.TT[A][getCharCode("\n")]=E|ACTION.STORE_TOKEN_EXCLUDE|ACTION.IGNORE,this.TT[T][getCharCode(_)]=E|ACTION.STORE_TOKEN_INCLUDE,this.TT[T][getCharCode("{")]=STATE.WAIT_TEMPLATE_START|ACTION.STORE_STATE_BEFORE,this.TT[T][0]=BASE_STATE.ERROR,this.TT[T][BASE_STATE.OTHERS]=T}InitTransitTable(){Machine._TT=new Array(STATE.MAX_STATE);for(let T=0;T<STATE.MAX_STATE;T++){const E=new Array(257);E.fill(0),this.TT[T]=E}this.TT[BASE_STATE.END][BASE_STATE.OTHERS]=BASE_STATE.END,this.TT[BASE_STATE.START][getCharCode("<")]=STATE.TAG_START|ACTION.STORE_TOKEN_EXCLUDE|ACTION.STORE_STATE_BEFORE,this.TT[BASE_STATE.START][getCharCode("{")]=STATE.WAIT_TEMPLATE_START|ACTION.STORE_STATE_BEFORE,this.TT[BASE_STATE.START][BASE_STATE.OTHERS]=STATE.IN_TAG_TEXT|ACTION.NOTHING,this.TT[BASE_STATE.START][0]=BASE_STATE.END|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STATE.IN_TAG_TEXT][getCharCode("<")]=STATE.TAG_START|ACTION.STORE_TOKEN_EXCLUDE|ACTION.STORE_STATE_BEFORE,this.TT[STATE.IN_TAG_TEXT][getCharCode("{")]=STATE.WAIT_TEMPLATE_START|ACTION.STORE_STATE_BEFORE,this.TT[STATE.IN_TAG_TEXT][BASE_STATE.OTHERS]=STATE.IN_TAG_TEXT|ACTION.NOTHING,this.TT[STATE.IN_TAG_TEXT][0]=BASE_STATE.END|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STATE.IN_TAG_TEXT][BASE_STATE.OTHERS]=STATE.IN_TAG_TEXT,this.TT[STATE.WAIT_TEMPLATE_START][getCharCode("{")]=STATE.IN_TEMPLATE|ACTION.STORE_TOKEN_FIRST,this.TT[STATE.WAIT_TEMPLATE_START][BASE_STATE.OTHERS]=STATE.IN_TAG_TEXT|ACTION.GET_STATE_BEFORE,this.TT[STATE.IN_TEMPLATE][getCharCode("{")]=STATE.IN_TEMPLATE|ACTION.RECORD_IN_TEMPLATE_OBJECT,this.TT[STATE.IN_TEMPLATE][getCharCode("}")]=STATE.WAIT_TEMPLATE_END|ACTION.CHECK_IN_TEMPLATE_OBJECT,this.TT[STATE.IN_TEMPLATE][getCharCode("\\")]=BASE_STATE.ERROR,this.FillTT(STATE.IN_TEMPLATE,STATE.IN_TEMPLATE,ACTION.NOTHING," \n\t\r"),this.TT[STATE.IN_TEMPLATE][BASE_STATE.OTHERS]=STATE.IN_TEMPLATE,this.TT[STATE.IN_TEMPLATE][0]=BASE_STATE.ERROR,this.TT[STATE.WAIT_TEMPLATE_END][getCharCode("}")]=STATE.TEMPLATE_END_CHECK,this.TT[STATE.TEMPLATE_END_CHECK][BASE_STATE.OTHERS]=STATE.IN_TAG_TEXT|ACTION.REFEED|ACTION.STORE_TOKEN_EXCLUDE|ACTION.GET_STATE_BEFORE,this.TT[STATE.WAIT_TEMPLATE_END][BASE_STATE.OTHERS]=STATE.IN_TEMPLATE|ACTION.REFEED,this.TT[STATE.IN_TEMPLATE][getCharCode('"')]=STATE.IN_TEMPLATE_STRING|ACTION.NOTHING,this.TT[STATE.IN_TEMPLATE][getCharCode("'")]=STATE.IN_TEMPLATE_STRING2|ACTION.NOTHING,this.FillTT_template_string(STATE.IN_TEMPLATE_STRING,STATE.IN_TEMPLATE|ACTION.NOTHING,'"'),this.FillTT_template_string(STATE.IN_TEMPLATE_STRING2,STATE.IN_TEMPLATE|ACTION.NOTHING,"'"),this.FillTT(STATE.TAG_START,STATE.TAG_START,ACTION.STORE_TOKEN_EXCLUDE|ACTION.IGNORE," \n\t\r"),this.FillTT(STATE.TAG_START,STATE.IN_TAG_WORD,ACTION.STORE_TOKEN_EXCLUDE,ALPHA),this.TT[STATE.TAG_START][getCharCode("/")]=STATE.IN_END_TAG|ACTION.STORE_TOKEN_INCLUDE,this.TT[STATE.TAG_START][getCharCode("!")]=STATE.IN_COMMENT_BEGIN1,this.TT[STATE.TAG_START][BASE_STATE.OTHERS]=BASE_STATE.ERROR,this.TT[STATE.IN_COMMENT_BEGIN1][getCharCode("-")]=STATE.IN_COMMENT_BEGIN2,this.TT[STATE.IN_COMMENT_BEGIN1][BASE_STATE.OTHERS]=BASE_STATE.ERROR,this.TT[STATE.IN_COMMENT_BEGIN2][getCharCode("-")]=STATE.IN_COMMENT,this.TT[STATE.IN_COMMENT_BEGIN2][BASE_STATE.OTHERS]=BASE_STATE.ERROR,this.TT[STATE.IN_COMMENT][getCharCode("-")]=STATE.WAIT_FOR_COMMENT_END1,this.TT[STATE.IN_COMMENT][BASE_STATE.OTHERS]=STATE.IN_COMMENT,this.TT[STATE.WAIT_FOR_COMMENT_END1][getCharCode("-")]=STATE.WAIT_FOR_COMMENT_END2,this.TT[STATE.WAIT_FOR_COMMENT_END1][BASE_STATE.OTHERS]=STATE.IN_COMMENT,this.TT[STATE.WAIT_FOR_COMMENT_END2][getCharCode(">")]=STATE.IN_TAG_TEXT|ACTION.IGNORE|ACTION.GET_STATE_BEFORE,this.TT[STATE.WAIT_FOR_COMMENT_END2][getCharCode("-")]=STATE.WAIT_FOR_COMMENT_END2,this.TT[STATE.WAIT_FOR_COMMENT_END2][BASE_STATE.OTHERS]=STATE.IN_COMMENT,this.FillTT(STATE.IN_TAG_WORD,STATE.IN_TAG_WORD,ACTION.NOTHING,ALPHA),this.FillTT(STATE.IN_TAG_WORD,STATE.IN_TAG_WORD,ACTION.NOTHING,DIGIT),this.FillTT(STATE.IN_TAG_WORD,STATE.IN_TAG_ATTR_WORD,ACTION.STORE_TOKEN_EXCLUDE|ACTION.IGNORE," \n\t\r"),this.TT[STATE.IN_TAG_WORD][getCharCode(">")]=STATE.IN_TAG_TEXT|ACTION.STORE_TOKEN_EXCLUDE|ACTION.STORE_TOKEN_INCLUDE,this.TT[STATE.IN_TAG_WORD][getCharCode("/")]=STATE.WAIT_FOR_RIGHT_BRACKET|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STATE.IN_TAG_WORD][BASE_STATE.OTHERS]=BASE_STATE.ERROR,this.TT[STATE.IN_TAG_WORD][0]=BASE_STATE.ERROR,this.FillTT(STATE.IN_TAG_ATTR_WORD,STATE.IN_TAG_ATTR_WORD,ACTION.NOTHING,ALPHA),this.FillTT(STATE.IN_TAG_ATTR_WORD,STATE.IN_TAG_ATTR_WORD,ACTION.NOTHING,DIGIT),this.FillTT(STATE.IN_TAG_ATTR_WORD,STATE.IN_TAG_ATTR_WORD,ACTION.STORE_TOKEN_EXCLUDE|ACTION.IGNORE," \n\t\r"),this.TT[STATE.IN_TAG_ATTR_WORD][getCharCode("=")]=STATE.TAG_EQ|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STATE.IN_TAG_ATTR_WORD][getCharCode('"')]=BASE_STATE.ERROR,this.TT[STATE.IN_TAG_ATTR_WORD][getCharCode(">")]=STATE.IN_TAG_TEXT|ACTION.STORE_TOKEN_EXCLUDE|ACTION.STORE_TOKEN_INCLUDE,this.TT[STATE.IN_TAG_ATTR_WORD][getCharCode("/")]=STATE.WAIT_FOR_RIGHT_BRACKET|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STATE.IN_TAG_ATTR_WORD][BASE_STATE.OTHERS]=BASE_STATE.ERROR,this.TT[STATE.IN_TAG_ATTR_WORD][0]=BASE_STATE.ERROR,this.FillTT(STATE.TAG_EQ,STATE.TAG_EQ,ACTION.STORE_TOKEN_EXCLUDE|ACTION.IGNORE," \n\t\r"),this.FillTT(STATE.TAG_EQ,STATE.IN_TAG_ATTR_VALUE_STRING,ACTION.STORE_TOKEN_EXCLUDE,ALPHA),this.TT[STATE.TAG_EQ][getCharCode('"')]=STATE.IN_TAG_ATTR_VALUE_STRING|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STATE.TAG_EQ][getCharCode("'")]=STATE.IN_TAG_ATTR_VALUE_STRING_SINGLE|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STATE.TAG_EQ][0]=BASE_STATE.ERROR,this.TT[STATE.TAG_EQ][BASE_STATE.OTHERS]=BASE_STATE.ERROR,this.FillTT(STATE.IN_END_TAG,STATE.IN_END_TAG,ACTION.IGNORE," \n\t\r"),this.FillTT(STATE.IN_END_TAG,STATE.IN_END_TAG_WORD,ACTION.NOTHING,ALPHA),this.FillTT(STATE.IN_END_TAG,BASE_STATE.ERROR,ACTION.NOTHING,DIGIT),this.TT[STATE.IN_END_TAG][getCharCode(">")]=STATE.IN_TAG_TEXT|ACTION.STORE_TOKEN_INCLUDE,this.TT[STATE.IN_END_TAG][BASE_STATE.OTHERS]=BASE_STATE.ERROR,this.FillTT(STATE.IN_END_TAG_WORD,STATE.IN_END_TAG_WORD,ACTION.NOTHING,ALPHA),this.FillTT(STATE.IN_END_TAG_WORD,STATE.IN_END_TAG_WORD,ACTION.NOTHING,DIGIT),this.FillTT(STATE.IN_END_TAG_WORD,STATE.IN_END_TAG,ACTION.STORE_TOKEN_EXCLUDE|ACTION.IGNORE," \n\t\r"),this.TT[STATE.IN_END_TAG_WORD][getCharCode(">")]=STATE.IN_TAG_TEXT|ACTION.STORE_TOKEN_EXCLUDE|ACTION.STORE_TOKEN_INCLUDE,this.TT[STATE.IN_END_TAG_WORD][getCharCode("/")]=STATE.WAIT_FOR_RIGHT_BRACKET|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STATE.IN_END_TAG_WORD][BASE_STATE.OTHERS]=BASE_STATE.ERROR,this.FillTT(STATE.WAIT_FOR_RIGHT_BRACKET,STATE.IN_TAG_WORD,ACTION.STORE_TOKEN_EXCLUDE,ALPHA),this.TT[STATE.WAIT_FOR_RIGHT_BRACKET][getCharCode(">")]=STATE.IN_TAG_TEXT|ACTION.STORE_TOKEN_INCLUDE,this.TT[STATE.WAIT_FOR_RIGHT_BRACKET][BASE_STATE.OTHERS]=BASE_STATE.ERROR,this.FillTT_attr_string(STATE.IN_TAG_ATTR_VALUE_STRING,STATE.IN_TAG_ATTR_WORD,'"'),this.FillTT_attr_string(STATE.IN_TAG_ATTR_VALUE_STRING_SINGLE,STATE.IN_TAG_ATTR_WORD,"'"),this.TT[STATE.IN_WXS][getCharCode("<")]=STATE.WXS_END_STEP,this.TT[STATE.IN_WXS][getCharCode('"')]=STATE.IN_WXS_STRING|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STATE.IN_WXS][getCharCode("'")]=STATE.IN_WXS_STRING_SINGLE|ACTION.STORE_TOKEN_EXCLUDE,this.FillTT_attr_string(STATE.IN_WXS_STRING,STATE.IN_WXS,'"'),this.FillTT_attr_string(STATE.IN_WXS_STRING_SINGLE,STATE.IN_WXS,"'"),this.TT[STATE.IN_WXS][BASE_STATE.OTHERS]=STATE.IN_WXS,this.TT[STATE.WXS_END_STEP][getCharCode("/")]=STATE.IN_END_TAG|ACTION.STORE_TOKEN_INCLUDE,this.TT[STATE.WXS_END_STEP][BASE_STATE.OTHERS]=STATE.IN_WXS,this.TT[STATE.IN_TEXT][getCharCode("<")]=STATE.TAG_START|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STATE.IN_TEXT][BASE_STATE.OTHERS]=STATE.IN_TEXT,this.TT[STATE.IN_TEXT][getCharCode("{")]=STATE.WAIT_TEMPLATE_START|ACTION.STORE_STATE_BEFORE}}class Tokenizer{constructor(T,E){this.machine=new Machine(E,T),this.m_pSrc=T,this.path=E}generateTokens(){if(this.machine.Reset(),0===this.m_pSrc.length)return[];try{for(let T=0;T<this.m_pSrc.length;T++){const E=this.m_pSrc[T];this.machine.Feed(E)}this.machine.Feed("\0")}catch(T){throw new Error(`${T.line}:${T.col}:${T.message}`)}return this.machine.getTokens()}}function generateWXMLFromTokens(T,E={collapseWhitespace:!0,conservativeCollapse:!1,preserveLineBreaks:!1}){const{collapseWhitespace:_,conservativeCollapse:A,preserveLineBreaks:S}=E,t=[];for(let E=0;E<T.length;E++){const e=T[E];let N=e.value;const R=e.type;if(R===TokenType.ATTR&&(N=" "+N),R===TokenType.TAG_TEXT_VALUE){S||(N=N.replace(/\n/g," ")),_&&(N=N.replace(/([ \t])+/g," "));const t=T[E-1];t&&t.type!==TokenType.RIGHT_ANGLE_BRACKET&&t.type!==TokenType.SELF_CLOSE||_&&!A&&(N=trimStringLeft(N,!1)),(null==t?void 0:t.type)===TokenType.TAG_TEXT_VALUE&&((null==t?void 0:t.value.endsWith(" "))||(null==t?void 0:t.value.endsWith("\n")))&&_&&(N=trimStringLeft(N,!1))}if(R===TokenType.LEFT_ANGLE_BRACKET||R===TokenType.END_LEFT_ANGLE_BRACKET){const S=T[E-1];if((null==S?void 0:S.type)===TokenType.TAG_TEXT_VALUE&&_&&!A){const T=t.pop()||"";t.push(trimStringRight(T,!1))}}t.push(N)}return t.join("")}async function minifyWXML(T){const{filePath:E,root:_=""}=T,A=T.code instanceof Buffer?T.code.toString():T.code,S=Object.assign({collapseWhitespace:!0,conservativeCollapse:!1,preserveLineBreaks:!1},T.setting),t=path_1.default.posix.join(_,E);if(A.length>0)try{const T=new Tokenizer(A.replace(/\r\n/g,"\n"),t);return{error:null,code:generateWXMLFromTokens(T.generateTokens(),S)}}catch(T){return log.error("minifywxml error @ "+t),log.error(T.message),{error:{code:config_1.MINIFY_WXML_ERR,path:t,message:T.message}}}return{error:null,code:A.replace(/\r\n/g,"\n")}}exports.minifyWXML=minifyWXML;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.StyleAttrValueTokenizer=exports.TemplateTokenizer=void 0,exports.minifyWXML=minifyWXML;const tslib_1=require("tslib"),path_1=tslib_1.__importDefault(require("path")),log=tslib_1.__importStar(require("../../../../../utils/log")),config_1=require("../../../../../config/config");function getCharCode(T){return T.charCodeAt(0)>=256?BASE_STATE.OTHERS:T.charCodeAt(0)}function trimStringLeft(T,E=!0){return E?T.trimLeft():T.split("\n").map(T=>T.replace(/^[ \t]*/g,"")).join("\n")}function trimStringRight(T,E=!0){return E?T.trimRight():T.split("\n").map(T=>T.replace(/[ \t]*$/,"")).join("\n")}var TokenType,BASE_STATE,STATE,TEMPLATE_STATE,STYLE_ATTR_VALUE_STATE,ACTION;!function(T){T[T.ATTR=0]="ATTR",T[T.TAG=1]="TAG",T[T.LEFT_ANGLE_BRACKET=2]="LEFT_ANGLE_BRACKET",T[T.RIGHT_ANGLE_BRACKET=3]="RIGHT_ANGLE_BRACKET",T[T.END_LEFT_ANGLE_BRACKET=4]="END_LEFT_ANGLE_BRACKET",T[T.STRING1=5]="STRING1",T[T.STRING2=6]="STRING2",T[T.ATTR_VALUE=7]="ATTR_VALUE",T[T.TEXT_VALUE=8]="TEXT_VALUE",T[T.TAG_TEXT_VALUE=9]="TAG_TEXT_VALUE",T[T.TEMPLATE_START=10]="TEMPLATE_START",T[T.TEMPLATE_END=11]="TEMPLATE_END",T[T.TEMPLATE_ITEM=12]="TEMPLATE_ITEM",T[T.TEMPLATE_STRING=13]="TEMPLATE_STRING",T[T.SELF_CLOSE=14]="SELF_CLOSE",T[T.WXS_VALUE=15]="WXS_VALUE",T[T.STYLE_KEY=16]="STYLE_KEY",T[T.TAG_EQ=17]="TAG_EQ",T[T.STYLE_VALUE=18]="STYLE_VALUE",T[T.STYLE_ATTR_VALUE=19]="STYLE_ATTR_VALUE",T[T.CLASS_ATTR_VALUE=20]="CLASS_ATTR_VALUE",T[T.OTHERS=21]="OTHERS"}(TokenType||(TokenType={})),function(T){T[T.ERROR=-1]="ERROR",T[T.NOT_SET=0]="NOT_SET",T[T.START=1]="START",T[T.OTHERS=2]="OTHERS",T[T.END=3]="END",T[T.MAX_STATE=4]="MAX_STATE"}(BASE_STATE||(BASE_STATE={})),function(T){T[T.IN_TAG_TEXT=5]="IN_TAG_TEXT",T[T.TAG_START=6]="TAG_START",T[T.IN_TAG_WORD=7]="IN_TAG_WORD",T[T.TAG_EQ=8]="TAG_EQ",T[T.IN_TAG_ATTR_WORD=9]="IN_TAG_ATTR_WORD",T[T.IN_TAG_ATTR_VALUE_STRING=10]="IN_TAG_ATTR_VALUE_STRING",T[T.IN_TAG_ATTR_VALUE_STRING_ESCAPE=11]="IN_TAG_ATTR_VALUE_STRING_ESCAPE",T[T.IN_TAG_ATTR_VALUE_STRING_SINGLE=12]="IN_TAG_ATTR_VALUE_STRING_SINGLE",T[T.IN_TAG_ATTR_VALUE_STRING_SINGLE_ESCAPE=13]="IN_TAG_ATTR_VALUE_STRING_SINGLE_ESCAPE",T[T.WAIT_TEMPLATE_START=14]="WAIT_TEMPLATE_START",T[T.IN_TEMPLATE=15]="IN_TEMPLATE",T[T.WAIT_TEMPLATE_END=16]="WAIT_TEMPLATE_END",T[T.TEMPLATE_END_CHECK=17]="TEMPLATE_END_CHECK",T[T.IN_TEMPLATE_STRING=18]="IN_TEMPLATE_STRING",T[T.IN_TEMPLATE_STRING_ESCAPE=19]="IN_TEMPLATE_STRING_ESCAPE",T[T.IN_TEMPLATE_STRING2=20]="IN_TEMPLATE_STRING2",T[T.IN_TEMPLATE_STRING2_ESCAPE=21]="IN_TEMPLATE_STRING2_ESCAPE",T[T.WAIT_FOR_RIGHT_BRACKET=22]="WAIT_FOR_RIGHT_BRACKET",T[T.IN_WXS=23]="IN_WXS",T[T.IN_WXS_STRING=24]="IN_WXS_STRING",T[T.IN_WXS_STRING_ESCAPE=25]="IN_WXS_STRING_ESCAPE",T[T.IN_WXS_STRING_SINGLE=26]="IN_WXS_STRING_SINGLE",T[T.IN_WXS_STRING_SINGLE_ESCAPE=27]="IN_WXS_STRING_SINGLE_ESCAPE",T[T.WXS_END_STEP=28]="WXS_END_STEP",T[T.IN_COMMENT_BEGIN1=29]="IN_COMMENT_BEGIN1",T[T.IN_COMMENT_BEGIN2=30]="IN_COMMENT_BEGIN2",T[T.IN_COMMENT=31]="IN_COMMENT",T[T.WAIT_FOR_COMMENT_END1=32]="WAIT_FOR_COMMENT_END1",T[T.WAIT_FOR_COMMENT_END2=33]="WAIT_FOR_COMMENT_END2",T[T.IN_TEXT=34]="IN_TEXT",T[T.IN_END_TAG=35]="IN_END_TAG",T[T.IN_END_TAG_WORD=36]="IN_END_TAG_WORD",T[T.MAX_STATE=37]="MAX_STATE"}(STATE||(STATE={})),function(T){T[T.WAIT_TEMPLATE_START=5]="WAIT_TEMPLATE_START",T[T.IN_TEMPLATE_ITEM=6]="IN_TEMPLATE_ITEM",T[T.WAIT_TEMPLATE_END=7]="WAIT_TEMPLATE_END",T[T.SPACE_AFTER_WAIT_TEMPLATE_END=8]="SPACE_AFTER_WAIT_TEMPLATE_END",T[T.IN_TEMPLATE_STRING=9]="IN_TEMPLATE_STRING",T[T.IN_TEMPLATE_STRING_ESCAPE=10]="IN_TEMPLATE_STRING_ESCAPE",T[T.IN_TEMPLATE_STRING2=11]="IN_TEMPLATE_STRING2",T[T.IN_TEMPLATE_STRING2_ESCAPE=12]="IN_TEMPLATE_STRING2_ESCAPE",T[T.WAIT_FOR_COMMENT_START=13]="WAIT_FOR_COMMENT_START",T[T.IN_COMMENT=14]="IN_COMMENT",T[T.WAIT_FOR_COMMENT_END=15]="WAIT_FOR_COMMENT_END",T[T.IN_TEMPLATE_SPACE=16]="IN_TEMPLATE_SPACE",T[T.MAX_STATE=17]="MAX_STATE"}(TEMPLATE_STATE||(TEMPLATE_STATE={})),function(T){T[T.WAIT_KEY=5]="WAIT_KEY",T[T.IN_KEY=6]="IN_KEY",T[T.WAIT_KEY_VALUE_SAPERATE=7]="WAIT_KEY_VALUE_SAPERATE",T[T.IN_KEY_VALUE_SAPERATE=8]="IN_KEY_VALUE_SAPERATE",T[T.WAIT_VALUE=9]="WAIT_VALUE",T[T.IN_VALUE=10]="IN_VALUE",T[T.WAIT_ITEM_SAPERATE=11]="WAIT_ITEM_SAPERATE",T[T.IN_ITEM_SAPERATE=12]="IN_ITEM_SAPERATE",T[T.IN_STRING=13]="IN_STRING",T[T.IN_STRING_ESCAPE=14]="IN_STRING_ESCAPE",T[T.IN_STRING2=15]="IN_STRING2",T[T.IN_STRING2_ESCAPE=16]="IN_STRING2_ESCAPE",T[T.WAIT_TEMPLATE_START=17]="WAIT_TEMPLATE_START",T[T.IN_TEMPLATE=18]="IN_TEMPLATE",T[T.WAIT_TEMPLATE_END=19]="WAIT_TEMPLATE_END",T[T.IN_TEMPLATE_STRING=20]="IN_TEMPLATE_STRING",T[T.IN_TEMPLATE_STRING_ESCAPE=21]="IN_TEMPLATE_STRING_ESCAPE",T[T.IN_TEMPLATE_STRING2=22]="IN_TEMPLATE_STRING2",T[T.IN_TEMPLATE_STRING2_ESCAPE=23]="IN_TEMPLATE_STRING2_ESCAPE",T[T.WAIT_FOR_COMMENT_START=24]="WAIT_FOR_COMMENT_START",T[T.IN_COMMENT=25]="IN_COMMENT",T[T.WAIT_FOR_COMMENT_END=26]="WAIT_FOR_COMMENT_END",T[T.MAX_STATE=27]="MAX_STATE"}(STYLE_ATTR_VALUE_STATE||(STYLE_ATTR_VALUE_STATE={})),function(T){T[T.NOTHING=0]="NOTHING",T[T.DO_ACTION=65536]="DO_ACTION",T[T.STORE_TOKEN_EXCLUDE=131072]="STORE_TOKEN_EXCLUDE",T[T.STORE_TOKEN_INCLUDE=262144]="STORE_TOKEN_INCLUDE",T[T.IGNORE=524288]="IGNORE",T[T.REFEED=1048576]="REFEED",T[T.STORE_TOKEN_FIRST=2097152]="STORE_TOKEN_FIRST",T[T.STORE_ONE_SPACE=4194304]="STORE_ONE_SPACE",T[T.STORE_ONE_LINE_BREAK=8388608]="STORE_ONE_LINE_BREAK",T[T.GET_STATE_BEFORE=16777216]="GET_STATE_BEFORE",T[T.STORE_STATE_BEFORE=33554432]="STORE_STATE_BEFORE",T[T.SET_WXS_STATE=67108864]="SET_WXS_STATE",T[T.RECORD_IN_TEMPLATE_OBJECT=134217728]="RECORD_IN_TEMPLATE_OBJECT",T[T.CHECK_IN_TEMPLATE_OBJECT=268435456]="CHECK_IN_TEMPLATE_OBJECT"}(ACTION||(ACTION={}));class Token{constructor(T,E){this.type=T,this.value=E}}class MachineState{constructor(){this.cur_pos=0,this.last_pos=0,this.line=1,this.col=1,this.mark_pos=0,this.mark_col=0,this.last_line=this.line,this.last_col=1,this.state=BASE_STATE.START,this.in_template_object_count=0}}const ALPHA="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-:",DIGIT="0123456789.",WHITECHARS=" \n\t\r";class BaseMachine{constructor(T,E){this.mState=new MachineState,this.storedStates=[],this.oldState=BASE_STATE.START,this.tokens=[],this.mPath=T,this.mSrc=E}FillTT(T,E,_,A){for(const S of A)this.TT[T][getCharCode(S)]=E|_}Reset(){return this.mState.cur_pos=0,this.mState.last_pos=0,this.mState.mark_pos=0,this.mState.line=1,this.mState.col=1,this.mState.last_col=1,this.mState.mark_col=1,this.mState.last_line=this.mState.line,this.mState.state=BASE_STATE.START,0}refeed(T){let E=this.TT[this.mState.state][getCharCode(T)];if(E===BASE_STATE.NOT_SET&&(E=this.TT[this.mState.state][BASE_STATE.OTHERS]),E===BASE_STATE.NOT_SET)throw{col:this.mState.col,line:this.mState.line,message:"BAD STATE MACHINE!"};if(E<0){if("\0"!==T)throw{col:this.mState.col,line:this.mState.line,message:`unexpected character \`${T.replace(/\n/g,"\\n")}\``};throw{col:this.mState.col,line:this.mState.line,message:"unexpected end"}}const _=E,A=65535&E,S=this.mState.state;_&ACTION.STORE_STATE_BEFORE&&(this.storedStates.push(S),this.mState.mark_pos=this.mState.cur_pos,this.mState.mark_col=this.mState.mark_col),this.mState.state=A,this.doAction(T,S,_)}Feed(T){"\n"===T&&(this.mState.line++,this.mState.col=0),this.refeed(T)}FillTT_template_string(T,E,_){const A=T+1;this.TT[T][getCharCode("\\")]=A,this.TT[A][BASE_STATE.OTHERS]=T,this.TT[T][getCharCode(_)]=E,this.TT[T][0]=BASE_STATE.ERROR,this.TT[T][BASE_STATE.OTHERS]=T}updatePosition(){this.mState.last_pos=this.mState.cur_pos,this.mState.last_col=this.mState.col,this.mState.last_line=this.mState.line}processPosition(){this.mState.cur_pos++,this.mState.col++}doAction(T,E,_){if(_&ACTION.STORE_TOKEN_FIRST&&this.mState.mark_pos>this.mState.last_pos){const T=this.mSrc.substring(this.mState.last_pos,this.mState.mark_pos);this.doExcludeAction(this.storedStates[this.storedStates.length-1],T),this.mState.last_pos=this.mState.mark_pos,this.mState.last_col=this.mState.mark_col}if(_&ACTION.STORE_ONE_LINE_BREAK&&(this.appendToken(TokenType.OTHERS,"\n"),this.updatePosition()),_&ACTION.STORE_ONE_SPACE&&(this.appendToken(TokenType.OTHERS," "),this.updatePosition()),_&ACTION.STORE_TOKEN_EXCLUDE){const T=this.mState.cur_pos,_=this.mState.last_pos;if(T>=_){const A=this.mSrc.substring(_,T);this.doExcludeAction(E,A),this.updatePosition()}}if(_&ACTION.RECORD_IN_TEMPLATE_OBJECT&&this.mState.in_template_object_count++,_&ACTION.CHECK_IN_TEMPLATE_OBJECT&&this.mState.in_template_object_count>0&&(this.mState.in_template_object_count--,this.mState.state=STATE.IN_TEMPLATE),_&ACTION.REFEED){if(_&ACTION.IGNORE&&this.updatePosition(),_&ACTION.GET_STATE_BEFORE){const T=this.storedStates.pop();T&&(this.mState.state=T)}this.refeed(T)}else{if(this.processPosition(),_&ACTION.STORE_TOKEN_INCLUDE){const _=this.mSrc.substring(this.mState.last_pos,this.mState.cur_pos);this.doIncludeAction(T,E,_),this.updatePosition()}if(_&ACTION.IGNORE&&this.updatePosition(),_&ACTION.GET_STATE_BEFORE){const T=this.storedStates.pop();T&&(this.mState.state=T)}}}}class StyleAttrValueMachine extends BaseMachine{get TT(){return StyleAttrValueMachine._TT||this.InitTransitTable(),StyleAttrValueMachine._TT}constructor(T,E){super(T,E),this.mState.state=BASE_STATE.START}getTokens(){return[...this.tokens]}appendToken(T,E){T===TokenType.STYLE_VALUE&&(E=E.replace(/[ \t]+/g," ")),this.tokens.push(new Token(T,E))}doExcludeAction(T,E){let _=TokenType.OTHERS;switch(T){case STYLE_ATTR_VALUE_STATE.IN_KEY:_=TokenType.STYLE_KEY;break;case STYLE_ATTR_VALUE_STATE.IN_KEY_VALUE_SAPERATE:_=TokenType.OTHERS;break;case STYLE_ATTR_VALUE_STATE.IN_ITEM_SAPERATE:_=TokenType.OTHERS,E=";";break;case STYLE_ATTR_VALUE_STATE.IN_VALUE:_=TokenType.STYLE_VALUE}this.appendToken(_,E)}doIncludeAction(T,E,_){let A=TokenType.OTHERS;switch(E){case STYLE_ATTR_VALUE_STATE.IN_STRING:A=TokenType.STRING1;break;case STYLE_ATTR_VALUE_STATE.IN_STRING2:A=TokenType.STRING2;break;case STYLE_ATTR_VALUE_STATE.WAIT_TEMPLATE_END:A=TokenType.TEMPLATE_ITEM,_=new TemplateTokenizer(_,this.mPath).toString();break;case STYLE_ATTR_VALUE_STATE.WAIT_FOR_COMMENT_START:this.doExcludeAction(this.storedStates[this.storedStates.length-1],_.replace(/\/\*$/,"")),A=TokenType.OTHERS,_="/*";break;case STYLE_ATTR_VALUE_STATE.WAIT_FOR_COMMENT_END:A=TokenType.OTHERS,_="*/"}this.appendToken(A,_)}FillTT_string(T,E,_){const A=T+1;this.TT[T][getCharCode("\\")]=A,this.TT[T][getCharCode("\n")]=BASE_STATE.ERROR,this.TT[A][BASE_STATE.OTHERS]=T,this.TT[A][getCharCode("\n")]=E|ACTION.STORE_TOKEN_EXCLUDE|ACTION.IGNORE,this.TT[T][getCharCode(_)]=E|ACTION.STORE_TOKEN_INCLUDE,this.TT[T][getCharCode("{")]=STYLE_ATTR_VALUE_STATE.WAIT_TEMPLATE_START|ACTION.STORE_STATE_BEFORE,this.TT[T][0]=BASE_STATE.ERROR,this.TT[T][BASE_STATE.OTHERS]=T}InitTransitTable(){StyleAttrValueMachine._TT=new Array(STYLE_ATTR_VALUE_STATE.MAX_STATE);for(let T=0;T<STYLE_ATTR_VALUE_STATE.MAX_STATE;T++){const E=new Array(257);E.fill(0),this.TT[T]=E}this.TT[BASE_STATE.END][BASE_STATE.OTHERS]=BASE_STATE.END,this.FillTT(BASE_STATE.START,BASE_STATE.START,ACTION.IGNORE," \n\t\r"),this.TT[BASE_STATE.START][getCharCode(":")]=BASE_STATE.ERROR,this.TT[BASE_STATE.START][getCharCode(";")]=STYLE_ATTR_VALUE_STATE.IN_ITEM_SAPERATE|ACTION.STORE_TOKEN_EXCLUDE,this.TT[BASE_STATE.START][getCharCode("{")]=STYLE_ATTR_VALUE_STATE.WAIT_TEMPLATE_START|ACTION.STORE_STATE_BEFORE,this.TT[BASE_STATE.START][getCharCode("/")]=STYLE_ATTR_VALUE_STATE.WAIT_FOR_COMMENT_START|ACTION.STORE_STATE_BEFORE,this.TT[BASE_STATE.START][BASE_STATE.OTHERS]=STYLE_ATTR_VALUE_STATE.IN_KEY,this.FillTT(STYLE_ATTR_VALUE_STATE.WAIT_KEY,STYLE_ATTR_VALUE_STATE.WAIT_KEY,ACTION.IGNORE," \n\t\r"),this.TT[STYLE_ATTR_VALUE_STATE.WAIT_KEY][getCharCode(":")]=BASE_STATE.ERROR,this.TT[STYLE_ATTR_VALUE_STATE.WAIT_KEY][getCharCode(";")]=STYLE_ATTR_VALUE_STATE.IN_ITEM_SAPERATE|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STYLE_ATTR_VALUE_STATE.WAIT_KEY][getCharCode("{")]=STYLE_ATTR_VALUE_STATE.IN_KEY|ACTION.REFEED,this.TT[STYLE_ATTR_VALUE_STATE.WAIT_KEY][BASE_STATE.OTHERS]=STYLE_ATTR_VALUE_STATE.IN_KEY,this.TT[STYLE_ATTR_VALUE_STATE.WAIT_KEY][getCharCode("/")]=STYLE_ATTR_VALUE_STATE.WAIT_FOR_COMMENT_START|ACTION.STORE_STATE_BEFORE,this.FillTT(STYLE_ATTR_VALUE_STATE.IN_KEY,STYLE_ATTR_VALUE_STATE.WAIT_KEY_VALUE_SAPERATE,ACTION.STORE_TOKEN_EXCLUDE|ACTION.IGNORE," \n\t\r"),this.TT[STYLE_ATTR_VALUE_STATE.IN_KEY][getCharCode(":")]=STYLE_ATTR_VALUE_STATE.IN_KEY_VALUE_SAPERATE|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STYLE_ATTR_VALUE_STATE.IN_KEY][getCharCode(";")]=STYLE_ATTR_VALUE_STATE.IN_ITEM_SAPERATE|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STYLE_ATTR_VALUE_STATE.IN_KEY][getCharCode("{")]=STYLE_ATTR_VALUE_STATE.WAIT_TEMPLATE_START|ACTION.STORE_STATE_BEFORE,this.TT[STYLE_ATTR_VALUE_STATE.IN_KEY][getCharCode('"')]=BASE_STATE.ERROR,this.TT[STYLE_ATTR_VALUE_STATE.IN_KEY][getCharCode("'")]=BASE_STATE.ERROR,this.TT[STYLE_ATTR_VALUE_STATE.IN_KEY][BASE_STATE.OTHERS]=STYLE_ATTR_VALUE_STATE.IN_KEY,this.TT[STYLE_ATTR_VALUE_STATE.IN_KEY][getCharCode("/")]=STYLE_ATTR_VALUE_STATE.WAIT_FOR_COMMENT_START|ACTION.STORE_STATE_BEFORE,this.FillTT(STYLE_ATTR_VALUE_STATE.WAIT_KEY_VALUE_SAPERATE,STYLE_ATTR_VALUE_STATE.WAIT_KEY_VALUE_SAPERATE,ACTION.IGNORE," \n\t\r"),this.TT[STYLE_ATTR_VALUE_STATE.WAIT_KEY_VALUE_SAPERATE][getCharCode(":")]=STYLE_ATTR_VALUE_STATE.IN_KEY_VALUE_SAPERATE|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STYLE_ATTR_VALUE_STATE.WAIT_KEY_VALUE_SAPERATE][getCharCode(";")]=STYLE_ATTR_VALUE_STATE.WAIT_KEY|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STYLE_ATTR_VALUE_STATE.WAIT_KEY_VALUE_SAPERATE][BASE_STATE.OTHERS]=BASE_STATE.ERROR,this.TT[STYLE_ATTR_VALUE_STATE.WAIT_KEY_VALUE_SAPERATE][getCharCode("/")]=STYLE_ATTR_VALUE_STATE.WAIT_FOR_COMMENT_START|ACTION.STORE_STATE_BEFORE,this.FillTT(STYLE_ATTR_VALUE_STATE.IN_KEY_VALUE_SAPERATE,STYLE_ATTR_VALUE_STATE.WAIT_VALUE,ACTION.STORE_TOKEN_EXCLUDE|ACTION.IGNORE," \n\t\r"),this.TT[STYLE_ATTR_VALUE_STATE.IN_KEY_VALUE_SAPERATE][getCharCode(":")]=STYLE_ATTR_VALUE_STATE.IN_KEY_VALUE_SAPERATE|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STYLE_ATTR_VALUE_STATE.IN_KEY_VALUE_SAPERATE][getCharCode(";")]=STYLE_ATTR_VALUE_STATE.IN_ITEM_SAPERATE|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STYLE_ATTR_VALUE_STATE.IN_KEY_VALUE_SAPERATE][BASE_STATE.OTHERS]=STYLE_ATTR_VALUE_STATE.IN_VALUE|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STYLE_ATTR_VALUE_STATE.IN_KEY_VALUE_SAPERATE][getCharCode("\0")]=BASE_STATE.END|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STYLE_ATTR_VALUE_STATE.IN_KEY_VALUE_SAPERATE][getCharCode('"')]=STYLE_ATTR_VALUE_STATE.IN_VALUE|ACTION.REFEED,this.TT[STYLE_ATTR_VALUE_STATE.IN_KEY_VALUE_SAPERATE][getCharCode("'")]=STYLE_ATTR_VALUE_STATE.IN_VALUE|ACTION.REFEED,this.TT[STYLE_ATTR_VALUE_STATE.IN_KEY_VALUE_SAPERATE][getCharCode("/")]=STYLE_ATTR_VALUE_STATE.IN_VALUE|ACTION.REFEED|ACTION.STORE_TOKEN_EXCLUDE,this.FillTT(STYLE_ATTR_VALUE_STATE.WAIT_VALUE,STYLE_ATTR_VALUE_STATE.WAIT_VALUE,ACTION.IGNORE," \n\t\r"),this.TT[STYLE_ATTR_VALUE_STATE.WAIT_VALUE][getCharCode(":")]=BASE_STATE.ERROR,this.TT[STYLE_ATTR_VALUE_STATE.WAIT_VALUE][getCharCode(";")]=STYLE_ATTR_VALUE_STATE.IN_ITEM_SAPERATE|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STYLE_ATTR_VALUE_STATE.WAIT_VALUE][getCharCode("{")]=STYLE_ATTR_VALUE_STATE.WAIT_TEMPLATE_START|ACTION.STORE_STATE_BEFORE,this.TT[STYLE_ATTR_VALUE_STATE.WAIT_VALUE][getCharCode('"')]=STYLE_ATTR_VALUE_STATE.IN_VALUE|ACTION.REFEED,this.TT[STYLE_ATTR_VALUE_STATE.WAIT_VALUE][getCharCode("'")]=STYLE_ATTR_VALUE_STATE.IN_VALUE|ACTION.REFEED,this.TT[STYLE_ATTR_VALUE_STATE.WAIT_VALUE][getCharCode("\0")]=BASE_STATE.END,this.TT[STYLE_ATTR_VALUE_STATE.WAIT_VALUE][BASE_STATE.OTHERS]=STYLE_ATTR_VALUE_STATE.IN_VALUE,this.TT[STYLE_ATTR_VALUE_STATE.WAIT_VALUE][getCharCode("/")]=STYLE_ATTR_VALUE_STATE.WAIT_FOR_COMMENT_START|ACTION.STORE_STATE_BEFORE,this.TT[STYLE_ATTR_VALUE_STATE.IN_VALUE][getCharCode(";")]=STYLE_ATTR_VALUE_STATE.IN_ITEM_SAPERATE|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STYLE_ATTR_VALUE_STATE.IN_VALUE][getCharCode('"')]=STYLE_ATTR_VALUE_STATE.IN_STRING|ACTION.STORE_STATE_BEFORE|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STYLE_ATTR_VALUE_STATE.IN_VALUE][getCharCode("'")]=STYLE_ATTR_VALUE_STATE.IN_STRING2|ACTION.STORE_STATE_BEFORE|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STYLE_ATTR_VALUE_STATE.IN_VALUE][getCharCode("{")]=STYLE_ATTR_VALUE_STATE.WAIT_TEMPLATE_START|ACTION.STORE_STATE_BEFORE,this.TT[STYLE_ATTR_VALUE_STATE.IN_VALUE][BASE_STATE.OTHERS]=STYLE_ATTR_VALUE_STATE.IN_VALUE,this.TT[STYLE_ATTR_VALUE_STATE.IN_VALUE][getCharCode("\0")]=BASE_STATE.END|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STYLE_ATTR_VALUE_STATE.IN_VALUE][getCharCode("/")]=STYLE_ATTR_VALUE_STATE.WAIT_FOR_COMMENT_START|ACTION.STORE_STATE_BEFORE,this.FillTT(STYLE_ATTR_VALUE_STATE.IN_ITEM_SAPERATE,STYLE_ATTR_VALUE_STATE.WAIT_KEY,ACTION.STORE_TOKEN_EXCLUDE|ACTION.IGNORE," \n\t\r"),this.TT[STYLE_ATTR_VALUE_STATE.IN_ITEM_SAPERATE][getCharCode(";")]=STYLE_ATTR_VALUE_STATE.IN_ITEM_SAPERATE|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STYLE_ATTR_VALUE_STATE.IN_ITEM_SAPERATE][getCharCode("{")]=STYLE_ATTR_VALUE_STATE.WAIT_TEMPLATE_START|ACTION.STORE_STATE_BEFORE,this.TT[STYLE_ATTR_VALUE_STATE.IN_ITEM_SAPERATE][getCharCode("'")]=BASE_STATE.ERROR,this.TT[STYLE_ATTR_VALUE_STATE.IN_ITEM_SAPERATE][getCharCode('"')]=BASE_STATE.ERROR,this.TT[STYLE_ATTR_VALUE_STATE.IN_ITEM_SAPERATE][BASE_STATE.OTHERS]=STYLE_ATTR_VALUE_STATE.IN_KEY|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STYLE_ATTR_VALUE_STATE.IN_ITEM_SAPERATE][getCharCode("\0")]=BASE_STATE.END|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STYLE_ATTR_VALUE_STATE.IN_ITEM_SAPERATE][getCharCode("/")]=STYLE_ATTR_VALUE_STATE.IN_KEY|ACTION.REFEED,this.TT[STYLE_ATTR_VALUE_STATE.WAIT_TEMPLATE_START][getCharCode("{")]=STYLE_ATTR_VALUE_STATE.IN_TEMPLATE|ACTION.STORE_TOKEN_FIRST,this.TT[STYLE_ATTR_VALUE_STATE.WAIT_TEMPLATE_START][BASE_STATE.OTHERS]=ACTION.GET_STATE_BEFORE,this.TT[STYLE_ATTR_VALUE_STATE.WAIT_TEMPLATE_START][getCharCode("/")]=STYLE_ATTR_VALUE_STATE.WAIT_FOR_COMMENT_START|ACTION.STORE_STATE_BEFORE,this.TT[STYLE_ATTR_VALUE_STATE.IN_TEMPLATE][getCharCode("}")]=STYLE_ATTR_VALUE_STATE.WAIT_TEMPLATE_END,this.TT[STYLE_ATTR_VALUE_STATE.IN_TEMPLATE][getCharCode("\\")]=BASE_STATE.ERROR,this.FillTT(STYLE_ATTR_VALUE_STATE.IN_TEMPLATE,STYLE_ATTR_VALUE_STATE.IN_TEMPLATE,ACTION.NOTHING," \n\t\r"),this.TT[STYLE_ATTR_VALUE_STATE.IN_TEMPLATE][BASE_STATE.OTHERS]=STYLE_ATTR_VALUE_STATE.IN_TEMPLATE,this.TT[STYLE_ATTR_VALUE_STATE.IN_TEMPLATE][0]=BASE_STATE.ERROR,this.TT[STYLE_ATTR_VALUE_STATE.IN_TEMPLATE][getCharCode("/")]=STYLE_ATTR_VALUE_STATE.WAIT_FOR_COMMENT_START|ACTION.STORE_STATE_BEFORE,this.TT[STYLE_ATTR_VALUE_STATE.WAIT_TEMPLATE_END][getCharCode("}")]=ACTION.GET_STATE_BEFORE|ACTION.STORE_TOKEN_INCLUDE,this.TT[STYLE_ATTR_VALUE_STATE.WAIT_TEMPLATE_END][BASE_STATE.OTHERS]=STYLE_ATTR_VALUE_STATE.IN_TEMPLATE|ACTION.REFEED,this.TT[STYLE_ATTR_VALUE_STATE.WAIT_TEMPLATE_END][getCharCode("/")]=STYLE_ATTR_VALUE_STATE.WAIT_FOR_COMMENT_START|ACTION.STORE_STATE_BEFORE,this.TT[STYLE_ATTR_VALUE_STATE.IN_TEMPLATE][getCharCode('"')]=STYLE_ATTR_VALUE_STATE.IN_TEMPLATE_STRING|ACTION.NOTHING,this.TT[STYLE_ATTR_VALUE_STATE.IN_TEMPLATE][getCharCode("'")]=STYLE_ATTR_VALUE_STATE.IN_TEMPLATE_STRING2|ACTION.NOTHING,this.TT[STYLE_ATTR_VALUE_STATE.WAIT_FOR_COMMENT_START][getCharCode("*")]=STYLE_ATTR_VALUE_STATE.IN_COMMENT|ACTION.STORE_TOKEN_INCLUDE,this.TT[STYLE_ATTR_VALUE_STATE.WAIT_FOR_COMMENT_START][BASE_STATE.OTHERS]=ACTION.GET_STATE_BEFORE,this.TT[STYLE_ATTR_VALUE_STATE.IN_COMMENT][getCharCode("*")]=STYLE_ATTR_VALUE_STATE.WAIT_FOR_COMMENT_END,this.TT[STYLE_ATTR_VALUE_STATE.IN_COMMENT][BASE_STATE.OTHERS]=STYLE_ATTR_VALUE_STATE.IN_COMMENT|ACTION.IGNORE,this.TT[STYLE_ATTR_VALUE_STATE.WAIT_FOR_COMMENT_END][getCharCode("/")]=ACTION.GET_STATE_BEFORE|ACTION.STORE_TOKEN_INCLUDE,this.TT[STYLE_ATTR_VALUE_STATE.WAIT_FOR_COMMENT_END][BASE_STATE.OTHERS]=STYLE_ATTR_VALUE_STATE.IN_COMMENT|ACTION.NOTHING,this.FillTT_template_string(STYLE_ATTR_VALUE_STATE.IN_TEMPLATE_STRING,STYLE_ATTR_VALUE_STATE.IN_TEMPLATE|ACTION.NOTHING,'"'),this.FillTT_template_string(STYLE_ATTR_VALUE_STATE.IN_TEMPLATE_STRING2,STYLE_ATTR_VALUE_STATE.IN_TEMPLATE|ACTION.NOTHING,"'"),this.FillTT_string(STYLE_ATTR_VALUE_STATE.IN_STRING,ACTION.GET_STATE_BEFORE,'"'),this.FillTT_string(STYLE_ATTR_VALUE_STATE.IN_STRING2,ACTION.GET_STATE_BEFORE,"'")}}class TemplateMachine extends BaseMachine{get TT(){return TemplateMachine._TT||this.InitTransitTable(),TemplateMachine._TT}constructor(T,E){super(T,E),this.mState.state=BASE_STATE.START}getTokens(){return[...this.tokens]}appendToken(T,E){this.tokens.push(new Token(T,E))}doExcludeAction(T,E){let _=TokenType.OTHERS;switch(T){case TEMPLATE_STATE.IN_TEMPLATE_ITEM:case TEMPLATE_STATE.WAIT_TEMPLATE_END:_=TokenType.TEMPLATE_ITEM}this.appendToken(_,E)}doIncludeAction(T,E,_){let A=TokenType.OTHERS;switch(E){case TEMPLATE_STATE.WAIT_TEMPLATE_START:A=TokenType.TEMPLATE_START;break;case TEMPLATE_STATE.WAIT_TEMPLATE_END:A=TokenType.TEMPLATE_END}this.appendToken(A,_)}InitTransitTable(){TemplateMachine._TT=new Array(TEMPLATE_STATE.MAX_STATE);for(let T=0;T<TEMPLATE_STATE.MAX_STATE;T++){const E=new Array(257);E.fill(0),this.TT[T]=E}this.FillTT(BASE_STATE.START,BASE_STATE.START,ACTION.IGNORE," \n\t\r"),this.TT[BASE_STATE.START][getCharCode("{")]=TEMPLATE_STATE.WAIT_TEMPLATE_START,this.TT[BASE_STATE.START][BASE_STATE.OTHERS]=BASE_STATE.ERROR,this.TT[TEMPLATE_STATE.WAIT_TEMPLATE_START][getCharCode("{")]=TEMPLATE_STATE.IN_TEMPLATE_ITEM|ACTION.STORE_TOKEN_INCLUDE,this.TT[TEMPLATE_STATE.WAIT_TEMPLATE_START][BASE_STATE.OTHERS]=BASE_STATE.ERROR,this.FillTT(TEMPLATE_STATE.IN_TEMPLATE_SPACE,TEMPLATE_STATE.IN_TEMPLATE_SPACE,ACTION.IGNORE," \n\t\r"),this.TT[TEMPLATE_STATE.IN_TEMPLATE_SPACE][getCharCode("}")]=TEMPLATE_STATE.WAIT_TEMPLATE_END,this.TT[TEMPLATE_STATE.IN_TEMPLATE_SPACE][getCharCode('"')]=TEMPLATE_STATE.IN_TEMPLATE_STRING|ACTION.STORE_STATE_BEFORE,this.TT[TEMPLATE_STATE.IN_TEMPLATE_SPACE][getCharCode("'")]=TEMPLATE_STATE.IN_TEMPLATE_STRING2|ACTION.STORE_STATE_BEFORE,this.TT[TEMPLATE_STATE.IN_TEMPLATE_SPACE][getCharCode("/")]=TEMPLATE_STATE.WAIT_FOR_COMMENT_START,this.TT[TEMPLATE_STATE.IN_TEMPLATE_SPACE][BASE_STATE.OTHERS]=TEMPLATE_STATE.IN_TEMPLATE_ITEM,this.FillTT(TEMPLATE_STATE.IN_TEMPLATE_ITEM,TEMPLATE_STATE.IN_TEMPLATE_SPACE,ACTION.STORE_TOKEN_EXCLUDE|ACTION.IGNORE," \n\t\r"),this.TT[TEMPLATE_STATE.IN_TEMPLATE_ITEM][getCharCode("}")]=TEMPLATE_STATE.WAIT_TEMPLATE_END,this.TT[TEMPLATE_STATE.IN_TEMPLATE_ITEM][getCharCode("\\")]=BASE_STATE.ERROR,this.TT[TEMPLATE_STATE.IN_TEMPLATE_ITEM][getCharCode('"')]=TEMPLATE_STATE.IN_TEMPLATE_STRING|ACTION.STORE_STATE_BEFORE|ACTION.STORE_TOKEN_EXCLUDE,this.TT[TEMPLATE_STATE.IN_TEMPLATE_ITEM][getCharCode("'")]=TEMPLATE_STATE.IN_TEMPLATE_STRING2|ACTION.STORE_STATE_BEFORE|ACTION.STORE_TOKEN_EXCLUDE,this.TT[TEMPLATE_STATE.IN_TEMPLATE_ITEM][BASE_STATE.OTHERS]=TEMPLATE_STATE.IN_TEMPLATE_ITEM,this.TT[TEMPLATE_STATE.IN_TEMPLATE_ITEM][0]=BASE_STATE.ERROR,this.TT[TEMPLATE_STATE.WAIT_FOR_COMMENT_START][getCharCode("*")]=TEMPLATE_STATE.IN_COMMENT,this.FillTT(TEMPLATE_STATE.WAIT_FOR_COMMENT_START,TEMPLATE_STATE.IN_TEMPLATE_ITEM,ACTION.REFEED," \n\t\r"),this.TT[TEMPLATE_STATE.WAIT_FOR_COMMENT_START][BASE_STATE.OTHERS]=TEMPLATE_STATE.IN_TEMPLATE_ITEM,this.TT[TEMPLATE_STATE.IN_COMMENT][getCharCode("*")]=TEMPLATE_STATE.WAIT_FOR_COMMENT_END,this.TT[TEMPLATE_STATE.IN_COMMENT][BASE_STATE.OTHERS]=TEMPLATE_STATE.IN_COMMENT,this.TT[TEMPLATE_STATE.WAIT_FOR_COMMENT_END][getCharCode("/")]=TEMPLATE_STATE.IN_TEMPLATE_SPACE|ACTION.IGNORE,this.FillTT_template_string(TEMPLATE_STATE.IN_TEMPLATE_STRING,TEMPLATE_STATE.IN_TEMPLATE_ITEM|ACTION.STORE_TOKEN_INCLUDE|ACTION.GET_STATE_BEFORE,'"'),this.FillTT_template_string(TEMPLATE_STATE.IN_TEMPLATE_STRING2,TEMPLATE_STATE.IN_TEMPLATE_ITEM|ACTION.STORE_TOKEN_INCLUDE|ACTION.GET_STATE_BEFORE,"'"),this.TT[TEMPLATE_STATE.WAIT_TEMPLATE_END][getCharCode("}")]=BASE_STATE.END|ACTION.STORE_TOKEN_INCLUDE,this.FillTT(TEMPLATE_STATE.WAIT_TEMPLATE_END,TEMPLATE_STATE.SPACE_AFTER_WAIT_TEMPLATE_END,ACTION.STORE_TOKEN_EXCLUDE," \n\t\r"),this.TT[TEMPLATE_STATE.WAIT_TEMPLATE_END][BASE_STATE.OTHERS]=TEMPLATE_STATE.IN_TEMPLATE_ITEM|ACTION.REFEED,this.FillTT(TEMPLATE_STATE.SPACE_AFTER_WAIT_TEMPLATE_END,TEMPLATE_STATE.SPACE_AFTER_WAIT_TEMPLATE_END,ACTION.IGNORE," \n\t\r"),this.TT[TEMPLATE_STATE.SPACE_AFTER_WAIT_TEMPLATE_END][getCharCode("}")]=TEMPLATE_STATE.WAIT_TEMPLATE_END|ACTION.STORE_ONE_SPACE,this.TT[TEMPLATE_STATE.SPACE_AFTER_WAIT_TEMPLATE_END][BASE_STATE.OTHERS]=TEMPLATE_STATE.IN_TEMPLATE_ITEM|ACTION.IGNORE|ACTION.REFEED,this.FillTT(BASE_STATE.END,BASE_STATE.END,ACTION.IGNORE," \n\t\r"),this.TT[BASE_STATE.END][getCharCode("\0")]=BASE_STATE.END,this.TT[BASE_STATE.END][BASE_STATE.OTHERS]=BASE_STATE.ERROR}}class TemplateTokenizer{constructor(T,E){this.machine=new TemplateMachine(E,T),this.m_pSrc=T,this.path=E}toString(){this.tokens||(this.tokens=this.generateTokens());return this.tokens.map(T=>T.value).join("")}generateTokens(){if(this.machine.Reset(),0===this.m_pSrc.length)return[];for(let T=0;T<this.m_pSrc.length;T++){const E=this.m_pSrc[T];this.machine.Feed(E)}return this.machine.Feed("\0"),this.machine.getTokens()}}exports.TemplateTokenizer=TemplateTokenizer;class StyleAttrValueTokenizer{constructor(T,E){this.machine=new StyleAttrValueMachine(E,T),this.m_pSrc=T,this.path=E}toString(){return this.tokens||(this.tokens=this.generateTokens()),this.tokens.map(T=>T.value).join("")}generateTokens(){if(this.machine.Reset(),0===this.m_pSrc.length)return[];for(let T=0;T<this.m_pSrc.length;T++){const E=this.m_pSrc[T];this.machine.Feed(E)}return this.machine.Feed("\0"),this.machine.getTokens()}}exports.StyleAttrValueTokenizer=StyleAttrValueTokenizer;class Machine extends BaseMachine{get TT(){return Machine._TT||this.InitTransitTable(),Machine._TT}constructor(T,E){super(T,E),this.tagStack=[],this.InitTransitTable(),this.mPath=T,this.mSrc=E}get wxsState(){return"wxs"===this.tagStack[this.tagStack.length-1]}get textState(){return"text"===this.tagStack[this.tagStack.length-1]}getTokens(){return[...this.tokens]}checkLastTokenIfTypeMatch(T){var E;return(null===(E=this.tokens[this.tokens.length-1])||void 0===E?void 0:E.type)===T?this.tokens[this.tokens.length-1]:void 0}getLastTokenIfTypeMatch(T){if(0!==this.tokens.length)for(let E=this.tokens.length-1;E>=0;E--){const _=this.tokens[E];if(_.type===T)return _}}canBeOmittedTokenType(T){return T===TokenType.WXS_VALUE}appendToken(T,E){if(this.canBeOmittedTokenType(T)&&(E=this.transTagTextTokenValue(E)),T===TokenType.ATTR_VALUE){const T=this.getLastTokenIfTypeMatch(TokenType.ATTR);"style"===(null==T?void 0:T.value)&&(E=this.trySlimStyleAttrValue(E))}E&&this.tokens.push(new Token(T,E))}transTagTextTokenValue(T){return this.wxsState?T=T.split("\n").map(T=>T.trim()).join("\n"):T}trySlimStyleAttrValue(T){const E=[];try{if(T.length<=1)return T;for(let T=this.tokens.length-1;T>=0;T--){if(this.tokens[T].type===TokenType.TAG_EQ)break;E.unshift(this.tokens.pop())}const _=`${E.map(T=>null==T?void 0:T.value).join("")}${T}`,A=_.startsWith('"')||_.startsWith("'"),S=_.endsWith('"')||_.endsWith("'"),t=new StyleAttrValueTokenizer(_.replace(/^['"]/,"").replace(/['"]$/,""),this.mPath).toString();return`${A?_.substr(0,1):""}${t}${S?_.substr(_.length-1,1):""}`}catch(T){this.tokens.push(...E)}return T}doExcludeAction(T,E){let _=TokenType.OTHERS;switch(T){case STATE.IN_TAG_ATTR_VALUE_STRING:case STATE.IN_TAG_ATTR_VALUE_STRING_SINGLE:_=TokenType.ATTR_VALUE;break;case STATE.IN_TAG_WORD:_=TokenType.TAG,this.tagStack.push(E);break;case STATE.IN_END_TAG_WORD:_=TokenType.TAG;if(this.tagStack.pop()!==E)throw{col:this.mState.col-E.length,line:this.mState.line,message:"unexpected end tag: "+E};break;case STATE.IN_WXS:_=TokenType.WXS_VALUE;break;case STATE.IN_TEXT:_=TokenType.TEXT_VALUE;break;case STATE.IN_TAG_TEXT:_=TokenType.TAG_TEXT_VALUE;break;case STATE.IN_TAG_ATTR_WORD:_=TokenType.ATTR;break;case STATE.TAG_START:_=TokenType.LEFT_ANGLE_BRACKET;break;case STATE.IN_TEMPLATE:_=TokenType.TEMPLATE_ITEM;break;case STATE.TAG_EQ:_=TokenType.TAG_EQ;break;case STATE.TEMPLATE_END_CHECK:{const T=this.mState.cur_pos;if("}"===this.mSrc.substring(T-3,T-2))throw{col:this.mState.col-3,line:this.mState.line,message:"unexpected end tag: }. } should not be followed by }} direactly, add a space and change it to } }}"};this.appendToken(TokenType.TEMPLATE_ITEM,""+new TemplateTokenizer(E,this.mPath)),_=TokenType.TEMPLATE_END,E=""}}this.appendToken(_,E)}doIncludeAction(T,E,_){const A=this.mState.state;let S;E===STATE.WXS_END_STEP?(this.appendToken(TokenType.WXS_VALUE,_.substr(0,_.length-2)),S=TokenType.END_LEFT_ANGLE_BRACKET,_="</"):E===STATE.IN_WXS_STRING||E===STATE.IN_WXS_STRING_SINGLE?S=TokenType.WXS_VALUE:E===STATE.IN_TAG_ATTR_VALUE_STRING||E===STATE.IN_TAG_ATTR_VALUE_STRING_SINGLE?S=TokenType.ATTR_VALUE:E===STATE.TAG_START&&A===STATE.IN_END_TAG?S=TokenType.END_LEFT_ANGLE_BRACKET:E===STATE.WAIT_FOR_RIGHT_BRACKET?(S=TokenType.SELF_CLOSE,this.tagStack.pop()):S=TokenType.OTHERS,">"!==T||E!==STATE.IN_TAG_WORD&&E!==STATE.IN_TAG_ATTR_WORD&&E!==STATE.IN_TAG_ATTR_VALUE_STRING&&E!==STATE.IN_TAG_ATTR_VALUE_STRING_SINGLE&&E!==STATE.IN_END_TAG_WORD||(S=TokenType.RIGHT_ANGLE_BRACKET),this.appendToken(S,_)}Feed(T){super.Feed(T),this.wxsState&&this.mState.state===STATE.IN_TAG_TEXT&&(this.mState.state=STATE.IN_WXS),this.textState&&this.mState.state===STATE.IN_TAG_TEXT&&(this.mState.state=STATE.IN_TEXT)}FillTT_attr_string(T,E,_){const A=T+1;this.TT[T][getCharCode("\\")]=A,this.TT[A][BASE_STATE.OTHERS]=T,this.TT[A][getCharCode("\n")]=E|ACTION.STORE_TOKEN_EXCLUDE|ACTION.IGNORE,this.TT[T][getCharCode(_)]=E|ACTION.STORE_TOKEN_INCLUDE,this.TT[T][getCharCode("{")]=STATE.WAIT_TEMPLATE_START|ACTION.STORE_STATE_BEFORE,this.TT[T][0]=BASE_STATE.ERROR,this.TT[T][BASE_STATE.OTHERS]=T}InitTransitTable(){Machine._TT=new Array(STATE.MAX_STATE);for(let T=0;T<STATE.MAX_STATE;T++){const E=new Array(257);E.fill(0),this.TT[T]=E}this.TT[BASE_STATE.END][BASE_STATE.OTHERS]=BASE_STATE.END,this.TT[BASE_STATE.START][getCharCode("<")]=STATE.TAG_START|ACTION.STORE_TOKEN_EXCLUDE|ACTION.STORE_STATE_BEFORE,this.TT[BASE_STATE.START][getCharCode("{")]=STATE.WAIT_TEMPLATE_START|ACTION.STORE_STATE_BEFORE,this.TT[BASE_STATE.START][BASE_STATE.OTHERS]=STATE.IN_TAG_TEXT|ACTION.NOTHING,this.TT[BASE_STATE.START][0]=BASE_STATE.END|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STATE.IN_TAG_TEXT][getCharCode("<")]=STATE.TAG_START|ACTION.STORE_TOKEN_EXCLUDE|ACTION.STORE_STATE_BEFORE,this.TT[STATE.IN_TAG_TEXT][getCharCode("{")]=STATE.WAIT_TEMPLATE_START|ACTION.STORE_STATE_BEFORE,this.TT[STATE.IN_TAG_TEXT][BASE_STATE.OTHERS]=STATE.IN_TAG_TEXT|ACTION.NOTHING,this.TT[STATE.IN_TAG_TEXT][0]=BASE_STATE.END|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STATE.IN_TAG_TEXT][BASE_STATE.OTHERS]=STATE.IN_TAG_TEXT,this.TT[STATE.WAIT_TEMPLATE_START][getCharCode("{")]=STATE.IN_TEMPLATE|ACTION.STORE_TOKEN_FIRST,this.TT[STATE.WAIT_TEMPLATE_START][BASE_STATE.OTHERS]=STATE.IN_TAG_TEXT|ACTION.GET_STATE_BEFORE,this.TT[STATE.IN_TEMPLATE][getCharCode("{")]=STATE.IN_TEMPLATE|ACTION.RECORD_IN_TEMPLATE_OBJECT,this.TT[STATE.IN_TEMPLATE][getCharCode("}")]=STATE.WAIT_TEMPLATE_END|ACTION.CHECK_IN_TEMPLATE_OBJECT,this.TT[STATE.IN_TEMPLATE][getCharCode("\\")]=BASE_STATE.ERROR,this.FillTT(STATE.IN_TEMPLATE,STATE.IN_TEMPLATE,ACTION.NOTHING," \n\t\r"),this.TT[STATE.IN_TEMPLATE][BASE_STATE.OTHERS]=STATE.IN_TEMPLATE,this.TT[STATE.IN_TEMPLATE][0]=BASE_STATE.ERROR,this.TT[STATE.WAIT_TEMPLATE_END][getCharCode("}")]=STATE.TEMPLATE_END_CHECK,this.TT[STATE.TEMPLATE_END_CHECK][BASE_STATE.OTHERS]=STATE.IN_TAG_TEXT|ACTION.REFEED|ACTION.STORE_TOKEN_EXCLUDE|ACTION.GET_STATE_BEFORE,this.TT[STATE.WAIT_TEMPLATE_END][BASE_STATE.OTHERS]=STATE.IN_TEMPLATE|ACTION.REFEED,this.TT[STATE.IN_TEMPLATE][getCharCode('"')]=STATE.IN_TEMPLATE_STRING|ACTION.NOTHING,this.TT[STATE.IN_TEMPLATE][getCharCode("'")]=STATE.IN_TEMPLATE_STRING2|ACTION.NOTHING,this.FillTT_template_string(STATE.IN_TEMPLATE_STRING,STATE.IN_TEMPLATE|ACTION.NOTHING,'"'),this.FillTT_template_string(STATE.IN_TEMPLATE_STRING2,STATE.IN_TEMPLATE|ACTION.NOTHING,"'"),this.FillTT(STATE.TAG_START,STATE.TAG_START,ACTION.STORE_TOKEN_EXCLUDE|ACTION.IGNORE," \n\t\r"),this.FillTT(STATE.TAG_START,STATE.IN_TAG_WORD,ACTION.STORE_TOKEN_EXCLUDE,ALPHA),this.TT[STATE.TAG_START][getCharCode("/")]=STATE.IN_END_TAG|ACTION.STORE_TOKEN_INCLUDE,this.TT[STATE.TAG_START][getCharCode("!")]=STATE.IN_COMMENT_BEGIN1,this.TT[STATE.TAG_START][BASE_STATE.OTHERS]=BASE_STATE.ERROR,this.TT[STATE.IN_COMMENT_BEGIN1][getCharCode("-")]=STATE.IN_COMMENT_BEGIN2,this.TT[STATE.IN_COMMENT_BEGIN1][BASE_STATE.OTHERS]=BASE_STATE.ERROR,this.TT[STATE.IN_COMMENT_BEGIN2][getCharCode("-")]=STATE.IN_COMMENT,this.TT[STATE.IN_COMMENT_BEGIN2][BASE_STATE.OTHERS]=BASE_STATE.ERROR,this.TT[STATE.IN_COMMENT][getCharCode("-")]=STATE.WAIT_FOR_COMMENT_END1,this.TT[STATE.IN_COMMENT][BASE_STATE.OTHERS]=STATE.IN_COMMENT,this.TT[STATE.WAIT_FOR_COMMENT_END1][getCharCode("-")]=STATE.WAIT_FOR_COMMENT_END2,this.TT[STATE.WAIT_FOR_COMMENT_END1][BASE_STATE.OTHERS]=STATE.IN_COMMENT,this.TT[STATE.WAIT_FOR_COMMENT_END2][getCharCode(">")]=STATE.IN_TAG_TEXT|ACTION.IGNORE|ACTION.GET_STATE_BEFORE,this.TT[STATE.WAIT_FOR_COMMENT_END2][getCharCode("-")]=STATE.WAIT_FOR_COMMENT_END2,this.TT[STATE.WAIT_FOR_COMMENT_END2][BASE_STATE.OTHERS]=STATE.IN_COMMENT,this.FillTT(STATE.IN_TAG_WORD,STATE.IN_TAG_WORD,ACTION.NOTHING,ALPHA),this.FillTT(STATE.IN_TAG_WORD,STATE.IN_TAG_WORD,ACTION.NOTHING,DIGIT),this.FillTT(STATE.IN_TAG_WORD,STATE.IN_TAG_ATTR_WORD,ACTION.STORE_TOKEN_EXCLUDE|ACTION.IGNORE," \n\t\r"),this.TT[STATE.IN_TAG_WORD][getCharCode(">")]=STATE.IN_TAG_TEXT|ACTION.STORE_TOKEN_EXCLUDE|ACTION.STORE_TOKEN_INCLUDE,this.TT[STATE.IN_TAG_WORD][getCharCode("/")]=STATE.WAIT_FOR_RIGHT_BRACKET|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STATE.IN_TAG_WORD][BASE_STATE.OTHERS]=BASE_STATE.ERROR,this.TT[STATE.IN_TAG_WORD][0]=BASE_STATE.ERROR,this.FillTT(STATE.IN_TAG_ATTR_WORD,STATE.IN_TAG_ATTR_WORD,ACTION.NOTHING,ALPHA),this.FillTT(STATE.IN_TAG_ATTR_WORD,STATE.IN_TAG_ATTR_WORD,ACTION.NOTHING,DIGIT),this.FillTT(STATE.IN_TAG_ATTR_WORD,STATE.IN_TAG_ATTR_WORD,ACTION.STORE_TOKEN_EXCLUDE|ACTION.IGNORE," \n\t\r"),this.TT[STATE.IN_TAG_ATTR_WORD][getCharCode("=")]=STATE.TAG_EQ|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STATE.IN_TAG_ATTR_WORD][getCharCode('"')]=BASE_STATE.ERROR,this.TT[STATE.IN_TAG_ATTR_WORD][getCharCode(">")]=STATE.IN_TAG_TEXT|ACTION.STORE_TOKEN_EXCLUDE|ACTION.STORE_TOKEN_INCLUDE,this.TT[STATE.IN_TAG_ATTR_WORD][getCharCode("/")]=STATE.WAIT_FOR_RIGHT_BRACKET|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STATE.IN_TAG_ATTR_WORD][BASE_STATE.OTHERS]=BASE_STATE.ERROR,this.TT[STATE.IN_TAG_ATTR_WORD][0]=BASE_STATE.ERROR,this.FillTT(STATE.TAG_EQ,STATE.TAG_EQ,ACTION.STORE_TOKEN_EXCLUDE|ACTION.IGNORE," \n\t\r"),this.FillTT(STATE.TAG_EQ,STATE.IN_TAG_ATTR_VALUE_STRING,ACTION.STORE_TOKEN_EXCLUDE,ALPHA),this.TT[STATE.TAG_EQ][getCharCode('"')]=STATE.IN_TAG_ATTR_VALUE_STRING|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STATE.TAG_EQ][getCharCode("'")]=STATE.IN_TAG_ATTR_VALUE_STRING_SINGLE|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STATE.TAG_EQ][0]=BASE_STATE.ERROR,this.TT[STATE.TAG_EQ][BASE_STATE.OTHERS]=BASE_STATE.ERROR,this.FillTT(STATE.IN_END_TAG,STATE.IN_END_TAG,ACTION.IGNORE," \n\t\r"),this.FillTT(STATE.IN_END_TAG,STATE.IN_END_TAG_WORD,ACTION.NOTHING,ALPHA),this.FillTT(STATE.IN_END_TAG,BASE_STATE.ERROR,ACTION.NOTHING,DIGIT),this.TT[STATE.IN_END_TAG][getCharCode(">")]=STATE.IN_TAG_TEXT|ACTION.STORE_TOKEN_INCLUDE,this.TT[STATE.IN_END_TAG][BASE_STATE.OTHERS]=BASE_STATE.ERROR,this.FillTT(STATE.IN_END_TAG_WORD,STATE.IN_END_TAG_WORD,ACTION.NOTHING,ALPHA),this.FillTT(STATE.IN_END_TAG_WORD,STATE.IN_END_TAG_WORD,ACTION.NOTHING,DIGIT),this.FillTT(STATE.IN_END_TAG_WORD,STATE.IN_END_TAG,ACTION.STORE_TOKEN_EXCLUDE|ACTION.IGNORE," \n\t\r"),this.TT[STATE.IN_END_TAG_WORD][getCharCode(">")]=STATE.IN_TAG_TEXT|ACTION.STORE_TOKEN_EXCLUDE|ACTION.STORE_TOKEN_INCLUDE,this.TT[STATE.IN_END_TAG_WORD][getCharCode("/")]=STATE.WAIT_FOR_RIGHT_BRACKET|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STATE.IN_END_TAG_WORD][BASE_STATE.OTHERS]=BASE_STATE.ERROR,this.FillTT(STATE.WAIT_FOR_RIGHT_BRACKET,STATE.IN_TAG_WORD,ACTION.STORE_TOKEN_EXCLUDE,ALPHA),this.TT[STATE.WAIT_FOR_RIGHT_BRACKET][getCharCode(">")]=STATE.IN_TAG_TEXT|ACTION.STORE_TOKEN_INCLUDE,this.TT[STATE.WAIT_FOR_RIGHT_BRACKET][BASE_STATE.OTHERS]=BASE_STATE.ERROR,this.FillTT_attr_string(STATE.IN_TAG_ATTR_VALUE_STRING,STATE.IN_TAG_ATTR_WORD,'"'),this.FillTT_attr_string(STATE.IN_TAG_ATTR_VALUE_STRING_SINGLE,STATE.IN_TAG_ATTR_WORD,"'"),this.TT[STATE.IN_WXS][getCharCode("<")]=STATE.WXS_END_STEP,this.TT[STATE.IN_WXS][getCharCode('"')]=STATE.IN_WXS_STRING|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STATE.IN_WXS][getCharCode("'")]=STATE.IN_WXS_STRING_SINGLE|ACTION.STORE_TOKEN_EXCLUDE,this.FillTT_attr_string(STATE.IN_WXS_STRING,STATE.IN_WXS,'"'),this.FillTT_attr_string(STATE.IN_WXS_STRING_SINGLE,STATE.IN_WXS,"'"),this.TT[STATE.IN_WXS][BASE_STATE.OTHERS]=STATE.IN_WXS,this.TT[STATE.WXS_END_STEP][getCharCode("/")]=STATE.IN_END_TAG|ACTION.STORE_TOKEN_INCLUDE,this.TT[STATE.WXS_END_STEP][BASE_STATE.OTHERS]=STATE.IN_WXS,this.TT[STATE.IN_TEXT][getCharCode("<")]=STATE.TAG_START|ACTION.STORE_TOKEN_EXCLUDE,this.TT[STATE.IN_TEXT][BASE_STATE.OTHERS]=STATE.IN_TEXT,this.TT[STATE.IN_TEXT][getCharCode("{")]=STATE.WAIT_TEMPLATE_START|ACTION.STORE_STATE_BEFORE}}class Tokenizer{constructor(T,E){this.machine=new Machine(E,T),this.m_pSrc=T,this.path=E}generateTokens(){if(this.machine.Reset(),0===this.m_pSrc.length)return[];try{for(let T=0;T<this.m_pSrc.length;T++){const E=this.m_pSrc[T];this.machine.Feed(E)}this.machine.Feed("\0")}catch(T){throw new Error(`${T.line}:${T.col}:${T.message}`)}return this.machine.getTokens()}}function generateWXMLFromTokens(T,E={collapseWhitespace:!0,conservativeCollapse:!1,preserveLineBreaks:!1}){const{collapseWhitespace:_,conservativeCollapse:A,preserveLineBreaks:S}=E,t=[];for(let E=0;E<T.length;E++){const e=T[E];let N=e.value;const R=e.type;if(R===TokenType.ATTR&&(N=" "+N),R===TokenType.TAG_TEXT_VALUE){S||(N=N.replace(/\n/g," ")),_&&(N=N.replace(/([ \t])+/g," "));const t=T[E-1];t&&t.type!==TokenType.RIGHT_ANGLE_BRACKET&&t.type!==TokenType.SELF_CLOSE||_&&!A&&(N=trimStringLeft(N,!1)),(null==t?void 0:t.type)===TokenType.TAG_TEXT_VALUE&&((null==t?void 0:t.value.endsWith(" "))||(null==t?void 0:t.value.endsWith("\n")))&&_&&(N=trimStringLeft(N,!1))}if(R===TokenType.LEFT_ANGLE_BRACKET||R===TokenType.END_LEFT_ANGLE_BRACKET){const S=T[E-1];if((null==S?void 0:S.type)===TokenType.TAG_TEXT_VALUE&&_&&!A){const T=t.pop()||"";t.push(trimStringRight(T,!1))}}t.push(N)}return t.join("")}async function minifyWXML(T){const{filePath:E,root:_=""}=T,A=T.code instanceof Buffer?T.code.toString():T.code,S=Object.assign({collapseWhitespace:!0,conservativeCollapse:!1,preserveLineBreaks:!1},T.setting),t=path_1.default.posix.join(_,E);if(A.length>0)try{const T=new Tokenizer(A.replace(/\r\n/g,"\n"),t);return{error:null,code:generateWXMLFromTokens(T.generateTokens(),S)}}catch(T){return log.error("minifywxml error @ "+t),log.error(T.message),{error:{code:config_1.MINIFY_WXML_ERR,path:t,message:T.message}}}return{error:null,code:A.replace(/\r\n/g,"\n")}}
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.messageHandler=exports.onMessage=exports.destroy=exports.initHandler=void 0;const summerCPProject_1=require("../../project/summerCPProject"),index_1=require("../precompiler/index"),progressRecorder_1=require("../../utils/progressRecorder"),index_2=require("./original/index"),summer_1=require("./summer/summer"),debug_1=require("../../utils/debug"),getProcess_1=require("../../utils/subprocess/getProcess"),env_1=require("../../utils/env");let summercompileManager,summerProject,preCompiler,precompileProject,inited=!1;const MEMORY_THRESHOLD=500;async function processSend(e){await(0,debug_1.shouldRunInMainProcess)()?emiter.emit("message",e):(0,getProcess_1.getProcess)().send(e)}async function initHandler(e){const{passData:r,projectInfo:o,options:t}=e.data;if(inited)return;summerProject=new summerCPProject_1.SummerCPProject(o),await summerProject.ready();const{targetPlatform:s,targetPlatformDefines:a}=o;preCompiler=new index_1.PreCompiler(summerProject,{showBuildLog:(e,r,o)=>{processSend({type:"log",id:e,status:r,text:o})}},void 0),precompileProject=await preCompiler.getPreCompileProject({targetPlatform:s,targetPlatformDefines:a,runEnv:"summer cp"});const{cachePath:i}=r;summercompileManager=new summer_1.SummerCompiler(precompileProject,i,t),checkMemoryAndGC(),inited=!0}async function checkMemoryAndGC(){(0,env_1.isElectron)()&&process.memoryUsage&&global.gc&&setInterval(()=>{process.memoryUsage().heapTotal>524288e3&&(console.time("[summer-compiler checkMemoryAndGC] gc"),global.gc(),console.timeEnd("[summer-compiler checkMemoryAndGC] gc"))},3e3)}async function getCodeFiles(e,r,o){let t={};"getDevCodeByFileList"===e?t=await r.run("getDevCodeByFileList-"+o.graphId,()=>summercompileManager.getDevCodeByFileList(o,r)):"getCode"===e&&(t=await r.run(`getCode-${o.graphId}-${o.package}`,()=>summercompileManager.getCode(o,r)));const{cacheMd5:s}=o;for(const e of Object.keys(s)){const r=t[e];r?"error"in r||r.md5!==s[e]||delete t[e]:t[e]={path:e,md5:"",code:""}}for(const e of Object.values(t))"error"in e&&e.error instanceof Error&&(e.error={code:e.error.code||-1,message:e.error.message,stack:e.error.stack,path:e.path});return t}async function destroy(){null==summercompileManager||summercompileManager.destroy(),summercompileManager=void 0,inited=!1,preCompiler=void 0,summerProject=void 0,precompileProject=void 0}exports.initHandler=initHandler,exports.destroy=destroy;const emiter=function(){const e={};return{on:(r,o)=>{e.hasOwnProperty(r)||(e[r]=[]),e[r].push(o)},off:(r,o)=>{var t;e[r]=(null===(t=e[r])||void 0===t?void 0:t.filter(e=>e!==o))||[]},emit:(r,...o)=>{const t=e[r];if((null==t?void 0:t.length)>0)for(const e of t)try{e(...o)}catch(e){}}}}(),onMessage=e=>{emiter.on("message",e)};async function messageHandler(e){if("event"===e.type)if("fileChange"===e.name){const{type:r,targetPath:o}=e.data;summerProject.onFileChange(r,o)}else if("updateOptions"===e.name){const r=e.data;summerProject.updateOptions(r),summercompileManager.updateOptions(r)}else if("precompileOptionsChange"===e.name){const r=e.data;precompileProject.updateConditionCompileOptions(r)}if("request"===e.type){const{id:r,name:o,data:t}=e,s=r,a=new progressRecorder_1.Recorder((e,r,o)=>{processSend({type:"progress",id:e,taskId:s,status:r,message:o})});try{let e;if("getCode"===o||"getDevCodeByFileList"===o)e=await getCodeFiles(o,a,t);else if("getPackageFiles"===o)e=await summercompileManager.getPackageFiles(t,a);else if("getConf"===o)e=await summercompileManager.getConf(t,a);else if("getLocalFileList"===o)e=await summercompileManager.getLocalFileList(t);else if("compile"===o)e=await summercompileManager.compile(t,a);else if("compileNewLogic"===o)e=await summercompileManager.compileNewLogic(t,a);else if("compileSingleCode"===o)e=await summercompileManager.compileSingleCode(t,a);else if("setLocale"===o)(0,index_2.setLocale)(t);else if("clearCache"===o)summercompileManager.clearCache();else{if("loadStatus"!==o)throw new Error("unknown command "+o);e=summercompileManager.getStatus()}processSend({type:"response",id:r,data:e})}catch(e){processSend({type:"response",id:r,data:null,error:{code:e.code||-1,message:e.message,stack:e.stack,path:e.path||""}})}}}exports.onMessage=onMessage,exports.messageHandler=messageHandler;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.onMessage=void 0,exports.initHandler=initHandler,exports.destroy=destroy,exports.messageHandler=messageHandler;const summerCPProject_1=require("../../project/summerCPProject"),index_1=require("../precompiler/index"),progressRecorder_1=require("../../utils/progressRecorder"),index_2=require("./original/index"),summer_1=require("./summer/summer"),debug_1=require("../../utils/debug"),getProcess_1=require("../../utils/subprocess/getProcess"),env_1=require("../../utils/env");let summercompileManager,summerProject,preCompiler,precompileProject,inited=!1;const MEMORY_THRESHOLD=500;async function processSend(e){await(0,debug_1.shouldRunInMainProcess)()?emiter.emit("message",e):(0,getProcess_1.getProcess)().send(e)}async function initHandler(e){const{passData:r,projectInfo:o,options:t}=e.data;if(inited)return;summerProject=new summerCPProject_1.SummerCPProject(o),await summerProject.ready();const{targetPlatform:s,targetPlatformDefines:a}=o;preCompiler=new index_1.PreCompiler(summerProject,{showBuildLog:(e,r,o)=>{processSend({type:"log",id:e,status:r,text:o})}},void 0),precompileProject=await preCompiler.getPreCompileProject({targetPlatform:s,targetPlatformDefines:a,runEnv:"summer cp"});const{cachePath:i}=r;summercompileManager=new summer_1.SummerCompiler(precompileProject,i,t),checkMemoryAndGC(),inited=!0}async function checkMemoryAndGC(){(0,env_1.isElectron)()&&process.memoryUsage&&global.gc&&setInterval(()=>{process.memoryUsage().heapTotal>524288e3&&(console.time("[summer-compiler checkMemoryAndGC] gc"),global.gc(),console.timeEnd("[summer-compiler checkMemoryAndGC] gc"))},3e3)}async function getCodeFiles(e,r,o){let t={};"getDevCodeByFileList"===e?t=await r.run("getDevCodeByFileList-"+o.graphId,()=>summercompileManager.getDevCodeByFileList(o,r)):"getCode"===e&&(t=await r.run(`getCode-${o.graphId}-${o.package}`,()=>summercompileManager.getCode(o,r)));const{cacheMd5:s}=o;for(const e of Object.keys(s)){const r=t[e];r?"error"in r||r.md5!==s[e]||delete t[e]:t[e]={path:e,md5:"",code:""}}for(const e of Object.values(t))"error"in e&&e.error instanceof Error&&(e.error={code:e.error.code||-1,message:e.error.message,stack:e.error.stack,path:e.path});return t}async function destroy(){null==summercompileManager||summercompileManager.destroy(),summercompileManager=void 0,inited=!1,preCompiler=void 0,summerProject=void 0,precompileProject=void 0}const emiter=function(){const e={};return{on:(r,o)=>{e.hasOwnProperty(r)||(e[r]=[]),e[r].push(o)},off:(r,o)=>{var t;e[r]=(null===(t=e[r])||void 0===t?void 0:t.filter(e=>e!==o))||[]},emit:(r,...o)=>{const t=e[r];if((null==t?void 0:t.length)>0)for(const e of t)try{e(...o)}catch(e){}}}}(),onMessage=e=>{emiter.on("message",e)};async function messageHandler(e){if("event"===e.type)if("fileChange"===e.name){const{type:r,targetPath:o}=e.data;summerProject.onFileChange(r,o)}else if("updateOptions"===e.name){const r=e.data;summerProject.updateOptions(r),summercompileManager.updateOptions(r)}else if("precompileOptionsChange"===e.name){const r=e.data;precompileProject.updateConditionCompileOptions(r)}if("request"===e.type){const{id:r,name:o,data:t}=e,s=r,a=new progressRecorder_1.Recorder((e,r,o)=>{processSend({type:"progress",id:e,taskId:s,status:r,message:o})});try{let e;if("getCode"===o||"getDevCodeByFileList"===o)e=await getCodeFiles(o,a,t);else if("getPackageFiles"===o)e=await summercompileManager.getPackageFiles(t,a);else if("getConf"===o)e=await summercompileManager.getConf(t,a);else if("getLocalFileList"===o)e=await summercompileManager.getLocalFileList(t);else if("compile"===o)e=await summercompileManager.compile(t,a);else if("compileNewLogic"===o)e=await summercompileManager.compileNewLogic(t,a);else if("compileSingleCode"===o)e=await summercompileManager.compileSingleCode(t,a);else if("setLocale"===o)(0,index_2.setLocale)(t);else if("clearCache"===o)summercompileManager.clearCache();else{if("loadStatus"!==o)throw new Error("unknown command "+o);e=summercompileManager.getStatus()}processSend({type:"response",id:r,data:e})}catch(e){processSend({type:"response",id:r,data:null,error:{code:e.code||-1,message:e.message,stack:e.stack,path:e.path||""}})}}}exports.onMessage=onMessage;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.BaseGraph=exports.JSONType=exports.FileType=void 0;const tslib_1=require("tslib"),path_1=tslib_1.__importDefault(require("path")),lodash_1=require("lodash"),pluginDriver_1=require("../pluginDriver"),module_1=tslib_1.__importDefault(require("../module")),config_1=require("../../../../config/config"),resolver_1=require("../resolver"),common_1=require("../../original/compile/common"),packOptionsHelper_1=tslib_1.__importDefault(require("../../../../utils/packOptionsHelper")),tools_1=require("../../../../utils/tools"),babel_helper_1=require("../../../../utils/babel_helper"),helper_util_1=require("../../../../utils/helper_util"),progressRecorder_1=require("../../../../utils/progressRecorder"),locales_1=tslib_1.__importDefault(require("../../../../utils/locales/locales")),customError_1=require("../../../../utils/customError"),taskmanager_1=tslib_1.__importDefault(require("../../../../utils/taskmanager")),pluginconfig_1=require("../pluginconfig");var FileType,JSONType;function getFileType(e){let t=path_1.default.extname(e);if(t.startsWith(".")){if(t=t.slice(1),t===FileType.JS)return FileType.JS;if(t===FileType.WXML)return FileType.WXML;if(t===FileType.WXSS)return FileType.WXSS;if(t===FileType.WXS)return FileType.WXS;if(t===FileType.JSON)return FileType.JSON}throw Error("unknown the filetype of "+e)}!function(e){e.JSON="json",e.WXML="wxml",e.WXSS="wxss",e.WXS="wxs",e.JS="js"}(FileType=exports.FileType||(exports.FileType={})),function(e){e.APP="app",e.Page="page",e.EXT="ext",e.SITEMAP="sitemap",e.THEME="theme"}(JSONType=exports.JSONType||(exports.JSONType={}));class BaseGraph{constructor(e){var t;this.invalidated=!0,this.running=!1,this.onFileChange=(e,t)=>{t.startsWith(this.root)&&(t=t.replace(new RegExp("^"+this.root),""),this.resolver.onFileChange(e,t),"change"!==e&&"unlink"!==e||this.invalidateModules(t),this.onFileChangeForGraph(e,t))},this.getCodeFileTask=async(e,t,o={useCache:!0,resultType:"dev"})=>{const i=this.loadModuleFromFile(e,t,o);if(i.sourcePath.endsWith(".js")||i.sourcePath.endsWith(".ts")){return{file:e,codeFile:await i.toCodeFile2(o.resultType||"dev"),process:[]}}const r=await i.toCodeFile(o.resultType||"dev");if(!("error"in r)&&"dev"!==o.resultType){const e=await i.toGenerateResult(o.resultType||"dev");if(!("error"in e)){const t=await this.optimize(e,o),i=await this.compress(t,o);r.code=i.target.code,r.map=i.target.map}}return{file:e,codeFile:r,process:await i.getProcessInfo(o.resultType||"dev")||[]}},this.type=e.type,this.root=e.root,this.rootPath=(0,tools_1.joinPath)(e.compiler.project.projectPath,this.root),this.persistCache=e.persistCache,this.compiler=e.compiler,this.project=this.compiler.project,this.cachedModules=new Map,this.pluginDriver=new pluginDriver_1.PluginDriver(this,e),this.modulesByPath=new Map,this.resolver=new resolver_1.Resolver(this,this.root,this.pluginDriver.resolveExtConf),this.compiler.proxyProject.addResolver(this.resolver),null===(t=this.project.event)||void 0===t||t.on("fileChange",this.onFileChange)}destroy(){var e;this.compiler.proxyProject.removeResolver(this.resolver),null===(e=this.project.event)||void 0===e||e.off("fileChange",this.onFileChange)}clearCache(){this.modulesByPath.clear()}async ensureConf(e){this.conf||await this.getConf(e)}async getPackageFile(e){await this.ensureConf(progressRecorder_1.silentRecorder);const t=[];for(const[o,i]of this.resolver.resolveInfoMap.entries())e!==config_1.FullPkg&&this.checkFilePackage(o)!==e||t.push(i);return t.map(e=>Object.assign(Object.assign({},e),{independentRoot:this.getIndependentRoot(e.path),isBabelIgnore:this.isBabelSettingIgnore(e)}))}invalidateModules(e){for(const t of this.modulesByPath.values())(t.sourcePath===e||t.depFiles.includes(e))&&this.modulesByPath.delete(t.path)}loadModuleFromFile(e,t,o){let i=this.modulesByPath.get(e.path),r=!i||i.sourcePath!==e.source||i.independentRoot!==e.independentRoot;if(!r&&(null==i?void 0:i.getError(o.resultType))){if(i.getGeneratedTS(o.resultType)+1e3>Date.now())return i;r=!0}if(r){const t=getFileType(e.path);i=new module_1.default(e.path,e.source,t),i.independentRoot=e.independentRoot,e.isBabelIgnore&&(i.isBabelIgnore=!0),this.modulesByPath.set(e.path,i)}if(e.path.endsWith(".ts")||e.path.endsWith(".js")){let r=i.getLoadingPromise();void 0===r&&(r=t.run(locales_1.default.config.SUMMER_COMPILING_MODULE.format(e.source),()=>this.loadSourceForModuleWithoutTransform(i,o)),i.setLoadingPromise(r));let s=i.getCompilePromise(o.resultType);return void 0===s&&(s=t.run(locales_1.default.config.SUMMER_COMPILING_MODULE.format(e.source),async()=>{const e=await i.getLoadingPromise();return this.compileCode(e,i,o)}),i.setCompilePromise(o.resultType,s)),i}let s=i.getLoadingPromise();void 0===s&&(s=t.run(locales_1.default.config.SUMMER_COMPILING_MODULE.format(e.source),()=>this.loadSourceForModule(i,o)),i.setLoadingPromise(s));let a=i.getGeneratingPromise(o.resultType);return void 0===a&&(a=t.run(locales_1.default.config.SUMMER_COMPILING_MODULE.format(e.source),async()=>{const e=await i.getLoadingPromise();return this.generate(e,i,o)}),i.setGeneratingPromise(o.resultType,a)),i}async loadSourceForModuleWithoutTransform(e,t){try{const o=(0,tools_1.joinPath)(this.rootPath,e.sourcePath),i=t=>Object.assign(Object.assign({},t),{rootPath:this.rootPath,addWatchFile:t=>{const o=(0,tools_1.normalizePath)(t);if(!o.startsWith(this.rootPath))throw(0,customError_1.makeCustomError)(`The file (${t}) required by ${e.sourcePath} is outside the project`,customError_1.CustomErrors.SUMMER_PLUGIN_CODE_ERR,e.path);e.addWatchFile(path_1.default.posix.relative(this.rootPath,o))}});let r=await this.pluginDriver.hookFirst("load",[e.path,o,Object.assign(Object.assign({},t),{independentRoot:e.independentRoot,isBabelIgnore:e.isBabelIgnore||!1})],i);if(!r){const t=Date.now(),i=await this.readFile(o);r={targetPath:e.path,source:{sourceCode:i},process:[{cost:Date.now()-t,pluginName:"readFile",action:"load"}]}}return r}catch(o){throw o.path=(0,tools_1.joinPath)(this.root,e.sourcePath),e.setError(t.resultType,o),o}}async loadSourceForModule(e,t){try{const o=await this.loadSourceForModuleWithoutTransform(e,t);return await this.tranform(o,e,t)}catch(o){throw o.path=(0,tools_1.joinPath)(this.root,e.sourcePath),e.setError(t.resultType,o),o}}async doCompileSingleCode(e,t){const o=this.loadModuleFromFile(e,progressRecorder_1.silentRecorder,{resultType:"dev"}),i=o.getError("dev");if(i)throw i;return await o.toCodeFile("dev")}async getCodeFiles(e,t,o={useCache:!0,resultType:"dev"}){var i;const r=Date.now(),s={},a=new taskmanager_1.default({poolLimit:10,breakWhenError:!0});for(const i of e)a.addTask(this.getCodeFileTask,i,t,o);const n=await a.runAllAsync();for(const e of n)s[e.file.path]=e.codeFile,(null===(i=e.codeFile.jsTag)||void 0===i?void 0:i.isLargeFile)&&t.message("warn",locales_1.default.config.LARGEFILE_WARNING.format(e.file.path,config_1.MAX_CODE_LENGTH/1024));return console.info(`getCodeFiles: count: ${e.length}, cost: ${Date.now()-r}ms.`),s}async readFile(e){const t=path_1.default.relative(this.project.projectPath,e);return this.project.getFile("",t).toString()}async tranform(e,t,o){return await this.pluginDriver.hookReduceArg0("transform",[e,t.path,t.sourcePath,Object.assign(Object.assign({},o),{independentRoot:t.independentRoot,isBabelIgnore:t.isBabelIgnore||!1})],(function(e,t){return void 0===t?e:t}))}async generate(e,t,o){const i=await this.pluginDriver.hookFirst("generate",[e,t.path,t.sourcePath,Object.assign(Object.assign({},o),{independentRoot:t.independentRoot,isBabelIgnore:t.isBabelIgnore||!1})]);return void 0===i||(0,lodash_1.isNull)(i)?Object.assign(Object.assign({},e),{target:{code:e.source.sourceCode,map:e.source.inputMap}}):i}async compileCode(e,t,o){const i=await this.pluginDriver.hookFirst("compile",[t.path,t.sourcePath,e,Object.assign(Object.assign({},o),{independentRoot:t.independentRoot,isBabelIgnore:t.isBabelIgnore||!1})]);if(!i)throw new Error("not handle for "+t.sourcePath);return i}async optimize(e,t){return await this.pluginDriver.hookReduceArg0("optimize",[e,t],(e,t)=>t,e=>e)}async compress(e,t){return await this.pluginDriver.hookReduceArg0("compress",[e,t],(e,t)=>t,e=>e)}async compile(e,t){const{jsons:o}=await t.run(locales_1.default.config.SUMMER_COMPILE_JSON.format(),()=>this.compileJSON(e,t)),i=await this.compileCodeWithoutJSON(e,t),r=await t.run(locales_1.default.config.SUMMER_PACK_FILES.format(),()=>this.compileOther(Object.keys(o),t)),s=Object.assign(Object.assign(Object.assign({},r),i),o);return await t.run(locales_1.default.config.SUMMER_SEAL_PACK.format(),()=>this.pluginDriver.hookParallel("sealed",[s])),s}async compileWithFileList(e,t){const o=e.fileList,{jsons:i}=await t.run(locales_1.default.config.SUMMER_COMPILE_JSON.format(),()=>this.compileJSONWithFileList(Object.assign(Object.assign({},e),{fileList:o.filter(e=>e.endsWith(".json"))}),t)),r=o.filter(e=>!e.endsWith(".json")),s=await this.compileCodeWithoutJSONWithFileList(Object.assign(Object.assign({},e),{fileList:r}),t),a=Object.assign(Object.assign({},s),i);return await t.run(locales_1.default.config.SUMMER_SEAL_PACK.format(),()=>this.pluginDriver.hookParallel("sealed",[a])),a}async getLocalFileList(){const e=this.getLocalCodeFileList(),t=new Set(this.resolver.allExts.map(e=>"."+e)),o=await this.getWhiteListConfig(),i=this.project.getFileList(this.root,"").filter(e=>{const i=path_1.default.posix.extname(e);return o.has(i)&&!t.has(i)}).map(e=>e.replace(new RegExp("^"+this.root),"")),r={};for(const t of e.concat(i)){const e=this.project.stat(this.root,t);r[t]=e}return r}async compileOther(e,t=progressRecorder_1.silentRecorder){const o=new Set(this.resolver.allExts.map(e=>"."+e));o.delete(".json");const i=await this.getWhiteListConfig(),r=this.project.getFileList(this.root,"").filter(r=>{const s=path_1.default.posix.extname(r),a=path_1.default.posix.relative(this.root,r);if(!i.has(s)||o.has(s)||e.includes(a))return!1;return!packOptionsHelper_1.default.isIgnoredByRules(r)||(t.message("warn",r+" is ignored by project.config.json packOptions.ignore setting"),!1)}),s=await(0,common_1.compileOther)(this.project,r,{onProgressUpdate:()=>{}}),a={};for(const e in s){a[path_1.default.posix.relative(this.root,e)]=s[e]}return a}async compileCodeWithoutJSON(e,t){var o;const i={},r=await this.getProdCode(t,Object.assign(Object.assign({},e),{package:config_1.FullPkg})),s=new Set;for(const e in r){const t=r[e];if("error"in t)throw t.error;if(t.path.endsWith(".js")){((null===(o=t.jsTag)||void 0===o?void 0:o.helpers)||[]).forEach(e=>{s.add(e)}),i[e]=t.code;const r=t.map&&(0,tools_1.formatSourceMap)(t.map);r&&(i[e+".map"]=r)}else i[e]=t.code}return await t.run(locales_1.default.config.SUMMER_APPEND_BABEL_HELPERS.format((0,pluginconfig_1.couldUseSWCMode)(this.project.setting)?"swc":"babel"),()=>(0,helper_util_1.appendHelpers)(this.project,s,"",i)),i}async compileCodeWithoutJSONWithFileList(e,t){var o;const i={},r=await this.getProdCodeByFileList(t,e),s=new Set;for(const e in r){const t=r[e];if("error"in t)throw t.error;if(t.path.endsWith(".js")){((null===(o=t.jsTag)||void 0===o?void 0:o.helpers)||[]).forEach(e=>{s.add(e)}),i[e]=t.code;const r=t.map&&(0,tools_1.formatSourceMap)(t.map);r&&(i[e+".map"]=r)}else i[e]=t.code}return await t.run(locales_1.default.config.SUMMER_APPEND_BABEL_HELPERS.format((0,pluginconfig_1.couldUseSWCMode)(this.project.setting)?"swc":"babel"),()=>(0,helper_util_1.appendHelpers)(this.project,s,"",i)),i}isBabelSettingIgnore(e){var t,o;let i=!1;if(e.path.endsWith(".js")){const r=(0,pluginconfig_1.couldUseSWCMode)(this.project.setting)?null===(t=this.compiler.getSWCSetting())||void 0===t?void 0:t.ignore:null===(o=this.compiler.getBabelSetting())||void 0===o?void 0:o.ignore;r&&(i=(0,babel_helper_1.isIgnore)(r,e.source))}return i}async getDevCodeByFileList(e,t){let o=await this.getPackageFile(config_1.FullPkg);return o=o.filter(e=>t.fileList.includes(e.path)),this.getCodeFiles(o,e)}async getProdCodeByFileList(e,t){let o=await this.getPackageFile(config_1.FullPkg);return o=o.filter(e=>t.fileList.includes(e.path)),this.getCodeFiles(o,e,{useCache:!1,resultType:t.resultType||"prod"})}}exports.BaseGraph=BaseGraph;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.BaseGraph=exports.JSONType=exports.FileType=void 0;const tslib_1=require("tslib"),path_1=tslib_1.__importDefault(require("path")),lodash_1=require("lodash"),pluginDriver_1=require("../pluginDriver"),module_1=tslib_1.__importDefault(require("../module")),config_1=require("../../../../config/config"),resolver_1=require("../resolver"),common_1=require("../../original/compile/common"),packOptionsHelper_1=tslib_1.__importDefault(require("../../../../utils/packOptionsHelper")),tools_1=require("../../../../utils/tools"),babel_helper_1=require("../../../../utils/babel_helper"),helper_util_1=require("../../../../utils/helper_util"),progressRecorder_1=require("../../../../utils/progressRecorder"),locales_1=tslib_1.__importDefault(require("../../../../utils/locales/locales")),customError_1=require("../../../../utils/customError"),taskmanager_1=tslib_1.__importDefault(require("../../../../utils/taskmanager")),pluginconfig_1=require("../pluginconfig");var FileType,JSONType;function getFileType(e){let t=path_1.default.extname(e);if(t.startsWith(".")){if(t=t.slice(1),t===FileType.JS)return FileType.JS;if(t===FileType.WXML)return FileType.WXML;if(t===FileType.WXSS)return FileType.WXSS;if(t===FileType.WXS)return FileType.WXS;if(t===FileType.JSON)return FileType.JSON}throw Error("unknown the filetype of "+e)}!function(e){e.JSON="json",e.WXML="wxml",e.WXSS="wxss",e.WXS="wxs",e.JS="js"}(FileType||(exports.FileType=FileType={})),function(e){e.APP="app",e.Page="page",e.EXT="ext",e.SITEMAP="sitemap",e.THEME="theme"}(JSONType||(exports.JSONType=JSONType={}));class BaseGraph{constructor(e){var t;this.invalidated=!0,this.running=!1,this.onFileChange=(e,t)=>{t.startsWith(this.root)&&(t=t.replace(new RegExp("^"+this.root),""),this.resolver.onFileChange(e,t),"change"!==e&&"unlink"!==e||this.invalidateModules(t),this.onFileChangeForGraph(e,t))},this.getCodeFileTask=async(e,t,o={useCache:!0,resultType:"dev"})=>{const i=this.loadModuleFromFile(e,t,o);if(i.sourcePath.endsWith(".js")||i.sourcePath.endsWith(".ts")){return{file:e,codeFile:await i.toCodeFile2(o.resultType||"dev"),process:[]}}const r=await i.toCodeFile(o.resultType||"dev");if(!("error"in r)&&"dev"!==o.resultType){const e=await i.toGenerateResult(o.resultType||"dev");if(!("error"in e)){const t=await this.optimize(e,o),i=await this.compress(t,o);r.code=i.target.code,r.map=i.target.map}}return{file:e,codeFile:r,process:await i.getProcessInfo(o.resultType||"dev")||[]}},this.type=e.type,this.root=e.root,this.rootPath=(0,tools_1.joinPath)(e.compiler.project.projectPath,this.root),this.persistCache=e.persistCache,this.compiler=e.compiler,this.project=this.compiler.project,this.cachedModules=new Map,this.pluginDriver=new pluginDriver_1.PluginDriver(this,e),this.modulesByPath=new Map,this.resolver=new resolver_1.Resolver(this,this.root,this.pluginDriver.resolveExtConf),this.compiler.proxyProject.addResolver(this.resolver),null===(t=this.project.event)||void 0===t||t.on("fileChange",this.onFileChange)}destroy(){var e;this.compiler.proxyProject.removeResolver(this.resolver),null===(e=this.project.event)||void 0===e||e.off("fileChange",this.onFileChange)}clearCache(){this.modulesByPath.clear()}async ensureConf(e){this.conf||await this.getConf(e)}async getPackageFile(e){await this.ensureConf(progressRecorder_1.silentRecorder);const t=[];for(const[o,i]of this.resolver.resolveInfoMap.entries())e!==config_1.FullPkg&&this.checkFilePackage(o)!==e||t.push(i);return t.map(e=>Object.assign(Object.assign({},e),{independentRoot:this.getIndependentRoot(e.path),isBabelIgnore:this.isBabelSettingIgnore(e)}))}invalidateModules(e){for(const t of this.modulesByPath.values())(t.sourcePath===e||t.depFiles.includes(e))&&this.modulesByPath.delete(t.path)}loadModuleFromFile(e,t,o){let i=this.modulesByPath.get(e.path),r=!i||i.sourcePath!==e.source||i.independentRoot!==e.independentRoot;if(!r&&(null==i?void 0:i.getError(o.resultType))){if(i.getGeneratedTS(o.resultType)+1e3>Date.now())return i;r=!0}if(r){const t=getFileType(e.path);i=new module_1.default(e.path,e.source,t),i.independentRoot=e.independentRoot,e.isBabelIgnore&&(i.isBabelIgnore=!0),this.modulesByPath.set(e.path,i)}if(e.path.endsWith(".ts")||e.path.endsWith(".js")){let r=i.getLoadingPromise();void 0===r&&(r=t.run(locales_1.default.config.SUMMER_COMPILING_MODULE.format(e.source),()=>this.loadSourceForModuleWithoutTransform(i,o)),i.setLoadingPromise(r));let s=i.getCompilePromise(o.resultType);return void 0===s&&(s=t.run(locales_1.default.config.SUMMER_COMPILING_MODULE.format(e.source),async()=>{const e=await i.getLoadingPromise();return this.compileCode(e,i,o)}),i.setCompilePromise(o.resultType,s)),i}let s=i.getLoadingPromise();void 0===s&&(s=t.run(locales_1.default.config.SUMMER_COMPILING_MODULE.format(e.source),()=>this.loadSourceForModule(i,o)),i.setLoadingPromise(s));let a=i.getGeneratingPromise(o.resultType);return void 0===a&&(a=t.run(locales_1.default.config.SUMMER_COMPILING_MODULE.format(e.source),async()=>{const e=await i.getLoadingPromise();return this.generate(e,i,o)}),i.setGeneratingPromise(o.resultType,a)),i}async loadSourceForModuleWithoutTransform(e,t){try{const o=(0,tools_1.joinPath)(this.rootPath,e.sourcePath),i=t=>Object.assign(Object.assign({},t),{rootPath:this.rootPath,addWatchFile:t=>{const o=(0,tools_1.normalizePath)(t);if(!o.startsWith(this.rootPath))throw(0,customError_1.makeCustomError)(`The file (${t}) required by ${e.sourcePath} is outside the project`,customError_1.CustomErrors.SUMMER_PLUGIN_CODE_ERR,e.path);e.addWatchFile(path_1.default.posix.relative(this.rootPath,o))}});let r=await this.pluginDriver.hookFirst("load",[e.path,o,Object.assign(Object.assign({},t),{independentRoot:e.independentRoot,isBabelIgnore:e.isBabelIgnore||!1})],i);if(!r){const t=Date.now(),i=await this.readFile(o);r={targetPath:e.path,source:{sourceCode:i},process:[{cost:Date.now()-t,pluginName:"readFile",action:"load"}]}}return r}catch(o){throw o.path=(0,tools_1.joinPath)(this.root,e.sourcePath),e.setError(t.resultType,o),o}}async loadSourceForModule(e,t){try{const o=await this.loadSourceForModuleWithoutTransform(e,t);return await this.tranform(o,e,t)}catch(o){throw o.path=(0,tools_1.joinPath)(this.root,e.sourcePath),e.setError(t.resultType,o),o}}async doCompileSingleCode(e,t){const o=this.loadModuleFromFile(e,progressRecorder_1.silentRecorder,{resultType:"dev"}),i=o.getError("dev");if(i)throw i;return await o.toCodeFile("dev")}async getCodeFiles(e,t,o={useCache:!0,resultType:"dev"}){var i;const r=Date.now(),s={},a=new taskmanager_1.default({poolLimit:10,breakWhenError:!0});for(const i of e)a.addTask(this.getCodeFileTask,i,t,o);const n=await a.runAllAsync();for(const e of n)s[e.file.path]=e.codeFile,(null===(i=e.codeFile.jsTag)||void 0===i?void 0:i.isLargeFile)&&t.message("warn",locales_1.default.config.LARGEFILE_WARNING.format(e.file.path,config_1.MAX_CODE_LENGTH/1024));return console.info(`getCodeFiles: count: ${e.length}, cost: ${Date.now()-r}ms.`),s}async readFile(e){const t=path_1.default.relative(this.project.projectPath,e);return this.project.getFile("",t).toString()}async tranform(e,t,o){return await this.pluginDriver.hookReduceArg0("transform",[e,t.path,t.sourcePath,Object.assign(Object.assign({},o),{independentRoot:t.independentRoot,isBabelIgnore:t.isBabelIgnore||!1})],(function(e,t){return void 0===t?e:t}))}async generate(e,t,o){const i=await this.pluginDriver.hookFirst("generate",[e,t.path,t.sourcePath,Object.assign(Object.assign({},o),{independentRoot:t.independentRoot,isBabelIgnore:t.isBabelIgnore||!1})]);return void 0===i||(0,lodash_1.isNull)(i)?Object.assign(Object.assign({},e),{target:{code:e.source.sourceCode,map:e.source.inputMap}}):i}async compileCode(e,t,o){const i=await this.pluginDriver.hookFirst("compile",[t.path,t.sourcePath,e,Object.assign(Object.assign({},o),{independentRoot:t.independentRoot,isBabelIgnore:t.isBabelIgnore||!1})]);if(!i)throw new Error("not handle for "+t.sourcePath);return i}async optimize(e,t){return await this.pluginDriver.hookReduceArg0("optimize",[e,t],(e,t)=>t,e=>e)}async compress(e,t){return await this.pluginDriver.hookReduceArg0("compress",[e,t],(e,t)=>t,e=>e)}async compile(e,t){const{jsons:o}=await t.run(locales_1.default.config.SUMMER_COMPILE_JSON.format(),()=>this.compileJSON(e,t)),i=await this.compileCodeWithoutJSON(e,t),r=await t.run(locales_1.default.config.SUMMER_PACK_FILES.format(),()=>this.compileOther(Object.keys(o),t)),s=Object.assign(Object.assign(Object.assign({},r),i),o);return await t.run(locales_1.default.config.SUMMER_SEAL_PACK.format(),()=>this.pluginDriver.hookParallel("sealed",[s])),s}async compileWithFileList(e,t){const o=e.fileList,{jsons:i}=await t.run(locales_1.default.config.SUMMER_COMPILE_JSON.format(),()=>this.compileJSONWithFileList(Object.assign(Object.assign({},e),{fileList:o.filter(e=>e.endsWith(".json"))}),t)),r=o.filter(e=>!e.endsWith(".json")),s=await this.compileCodeWithoutJSONWithFileList(Object.assign(Object.assign({},e),{fileList:r}),t),a=Object.assign(Object.assign({},s),i);return await t.run(locales_1.default.config.SUMMER_SEAL_PACK.format(),()=>this.pluginDriver.hookParallel("sealed",[a])),a}async getLocalFileList(){const e=this.getLocalCodeFileList(),t=new Set(this.resolver.allExts.map(e=>"."+e)),o=await this.getWhiteListConfig(),i=this.project.getFileList(this.root,"").filter(e=>{const i=path_1.default.posix.extname(e);return o.has(i)&&!t.has(i)}).map(e=>e.replace(new RegExp("^"+this.root),"")),r={};for(const t of e.concat(i)){const e=this.project.stat(this.root,t);r[t]=e}return r}async compileOther(e,t=progressRecorder_1.silentRecorder){const o=new Set(this.resolver.allExts.map(e=>"."+e));o.delete(".json");const i=await this.getWhiteListConfig(),r=this.project.getFileList(this.root,"").filter(r=>{const s=path_1.default.posix.extname(r),a=path_1.default.posix.relative(this.root,r);if(!i.has(s)||o.has(s)||e.includes(a))return!1;return!packOptionsHelper_1.default.isIgnoredByRules(r)||(t.message("warn",r+" is ignored by project.config.json packOptions.ignore setting"),!1)}),s=await(0,common_1.compileOther)(this.project,r,{onProgressUpdate:()=>{}}),a={};for(const e in s){a[path_1.default.posix.relative(this.root,e)]=s[e]}return a}async compileCodeWithoutJSON(e,t){var o;const i={},r=await this.getProdCode(t,Object.assign(Object.assign({},e),{package:config_1.FullPkg})),s=new Set;for(const e in r){const t=r[e];if("error"in t)throw t.error;if(t.path.endsWith(".js")){((null===(o=t.jsTag)||void 0===o?void 0:o.helpers)||[]).forEach(e=>{s.add(e)}),i[e]=t.code;const r=t.map&&(0,tools_1.formatSourceMap)(t.map);r&&(i[e+".map"]=r)}else i[e]=t.code}return await t.run(locales_1.default.config.SUMMER_APPEND_BABEL_HELPERS.format((0,pluginconfig_1.couldUseSWCMode)(this.project.setting)?"swc":"babel"),()=>(0,helper_util_1.appendHelpers)(this.project,s,"",i)),i}async compileCodeWithoutJSONWithFileList(e,t){var o;const i={},r=await this.getProdCodeByFileList(t,e),s=new Set;for(const e in r){const t=r[e];if("error"in t)throw t.error;if(t.path.endsWith(".js")){((null===(o=t.jsTag)||void 0===o?void 0:o.helpers)||[]).forEach(e=>{s.add(e)}),i[e]=t.code;const r=t.map&&(0,tools_1.formatSourceMap)(t.map);r&&(i[e+".map"]=r)}else i[e]=t.code}return await t.run(locales_1.default.config.SUMMER_APPEND_BABEL_HELPERS.format((0,pluginconfig_1.couldUseSWCMode)(this.project.setting)?"swc":"babel"),()=>(0,helper_util_1.appendHelpers)(this.project,s,"",i)),i}isBabelSettingIgnore(e){var t,o;let i=!1;if(e.path.endsWith(".js")){const r=(0,pluginconfig_1.couldUseSWCMode)(this.project.setting)?null===(t=this.compiler.getSWCSetting())||void 0===t?void 0:t.ignore:null===(o=this.compiler.getBabelSetting())||void 0===o?void 0:o.ignore;r&&(i=(0,babel_helper_1.isIgnore)(r,e.source))}return i}async getDevCodeByFileList(e,t){let o=await this.getPackageFile(config_1.FullPkg);return o=o.filter(e=>t.fileList.includes(e.path)),this.getCodeFiles(o,e)}async getProdCodeByFileList(e,t){let o=await this.getPackageFile(config_1.FullPkg);return o=o.filter(e=>t.fileList.includes(e.path)),this.getCodeFiles(o,e,{useCache:!1,resultType:t.resultType||"prod"})}}exports.BaseGraph=BaseGraph;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.isPluginPath=exports.resolvePath=void 0;const tslib_1=require("tslib"),path_1=tslib_1.__importDefault(require("path"));function resolvePath(t,e){const i=path_1.default.posix.dirname(t);let s=null;return s=e.startsWith("/")?e.replace(/^\//,""):path_1.default.posix.join(i,e),s}function isPluginPath(t){return t.startsWith("plugin://")||t.startsWith("plugin-private://")}exports.resolvePath=resolvePath,exports.isPluginPath=isPluginPath;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.resolvePath=resolvePath,exports.isPluginPath=isPluginPath;const tslib_1=require("tslib"),path_1=tslib_1.__importDefault(require("path"));function resolvePath(t,e){const i=path_1.default.posix.dirname(t);let s=null;return s=e.startsWith("/")?e.replace(/^\//,""):path_1.default.posix.join(i,e),s}function isPluginPath(t){return t.startsWith("plugin://")||t.startsWith("plugin-private://")}
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.compile=void 0;const common_1=require("../original/compile/common"),progressRecorder_1=require("../../../utils/progressRecorder"),summer_1=require("./summer"),pluginconfig_1=require("./pluginconfig");async function compile(e,r,o,i){const s=await e.serialize(),n=Object.assign(Object.assign({},s),{compileType:e.type,summerPlugins:(0,pluginconfig_1.getSummerPluginConfig)(e.setting)});n.files=n.files.filter(common_1.isNotIgnoredByProjectConfig.bind(null,r,e.miniprogramRoot));const t=new summer_1.SummerCompiler(e,"",n),m=new progressRecorder_1.Recorder((e,r,i)=>{var s;null===(s=o.onProgressUpdate)||void 0===s||s.call(o,{id:e.toString(),message:i,status:r})});return await t.compile(o,m)}exports.compile=compile;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.compile=compile;const common_1=require("../original/compile/common"),progressRecorder_1=require("../../../utils/progressRecorder"),summer_1=require("./summer"),pluginconfig_1=require("./pluginconfig");async function compile(e,r,i,o){const s=await e.serialize(),n=Object.assign(Object.assign({},s),{compileType:e.type,summerPlugins:(0,pluginconfig_1.getSummerPluginConfig)(e.setting)});n.files=n.files.filter(common_1.isNotIgnoredByProjectConfig.bind(null,r,e.miniprogramRoot));const t=new summer_1.SummerCompiler(e,"",n),m=new progressRecorder_1.Recorder((e,r,o)=>{var s;null===(s=i.onProgressUpdate)||void 0===s||s.call(i,{id:e.toString(),message:o,status:r})});return await t.compile(i,m)}
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.initPlugin=void 0;const tslib_1=require("tslib"),index_1=tslib_1.__importDefault(require("./plugins/index"));function initPlugin(i,e,t){i.startsWith("summer-")&&(i=i.replace("summer-",""));const n=index_1.default.load(i);if(n)return n(e,t);throw new Error("not found plugin for "+i)}exports.initPlugin=initPlugin;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.initPlugin=initPlugin;const tslib_1=require("tslib"),index_1=tslib_1.__importDefault(require("./plugins/index"));function initPlugin(e,i,t){e.startsWith("summer-")&&(e=e.replace("summer-",""));const r=index_1.default.load(e);if(r)return r(i,t);throw new Error("not found plugin for "+e)}
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.PluginDriver=exports.getPluginContext=exports.genResovleExtConf=void 0;const customError_1=require("../../../utils/customError"),workerThread_1=require("../original/workerThread"),worker_1=require("./worker"),debug_1=require("../../../utils/debug");function genResovleExtConf(r){const o={json:["json"],wxml:["wxml"],wxss:["wxss"],js:["js"],wxs:["wxs"]};for(const e of r)if(e.resolveExt)for(const r of["json","wxml","wxss","js","wxs"]){const t=e.resolveExt[r];if("string"==typeof t)o[r].includes(t)||o[r].push(t);else if(Array.isArray(t))for(const e of t)o[r].includes(e)||o[r].push(e)}return o}function throwPluginError(r,o,{hook:e,id:t}={}){const s=(0,customError_1.makeCustomError)(r);throw s.code||(s.code=customError_1.CustomErrors.SUMMER_PLUGIN_ERR),s.plugin=o,e&&(s.hook=e),t&&!s.path&&(s.path=t),r.stack&&(s.stack=r.stack),s}function getPluginContext(r,o){return{addWatchFile(){throw new Error("addWatchFile should be implemented by replaceContext")},async runWorkerMethod(e,...t){const s=await o.project.serialize(),n={command:"runMethod",plugin:r.name,projectInfo:s,pluginOption:{},method:e,args:t};let i;if(await(0,debug_1.shouldNotRunInWorker)())i=await(0,worker_1.runSummerPluginHook)(n);else try{i=await(0,workerThread_1.runTask)(workerThread_1.TASK_NAME.SUMMER_HOOK,n)}catch(r){throw r}if(i.error){if("CustomError"===i.error.type)throw new customError_1.CustomError(i.error);throw i.error}return i.result},error:o=>throwPluginError(o,r.name)}}exports.genResovleExtConf=genResovleExtConf,exports.getPluginContext=getPluginContext;class PluginDriver{constructor(r,o){this.graph=r,this.options=o,this.pluginContexts=new Map,this.plugins=o.plugins,this.resolveExtConf=genResovleExtConf(o.plugins);for(const o of this.plugins)this.pluginContexts.set(o,getPluginContext(o,r))}runHook(r,o,e,t){const s=e[r];if(!s)return;let n=this.pluginContexts.get(e);return t&&(n=t(n,e)),Promise.resolve().then(()=>s.apply(n,o)).catch(o=>throwPluginError(o,e.name,{hook:r}))}hookFirst(r,o,e){let t=Promise.resolve(void 0);for(const s of this.plugins)t=t.then(t=>t||this.runHook(r,o,s,e));return t}hookParallel(r,o,e){const t=[];for(const s of this.plugins){const n=this.runHook(r,o,s,e);n&&t.push(n)}return Promise.all(t).then(()=>{})}hookReduceArg0(r,[o,...e],t,s){let n=Promise.resolve(o);for(const o of this.plugins)n=n.then(n=>{const i=[n,...e],u=this.runHook(r,i,o,s);return u?u.then(r=>t.call(this.pluginContexts.get(o),n,r,o)):n});return n}}exports.PluginDriver=PluginDriver;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.PluginDriver=void 0,exports.genResovleExtConf=genResovleExtConf,exports.getPluginContext=getPluginContext;const customError_1=require("../../../utils/customError"),workerThread_1=require("../original/workerThread"),worker_1=require("./worker"),debug_1=require("../../../utils/debug");function genResovleExtConf(r){const o={json:["json"],wxml:["wxml"],wxss:["wxss"],js:["js"],wxs:["wxs"]};for(const e of r)if(e.resolveExt)for(const r of["json","wxml","wxss","js","wxs"]){const t=e.resolveExt[r];if("string"==typeof t)o[r].includes(t)||o[r].push(t);else if(Array.isArray(t))for(const e of t)o[r].includes(e)||o[r].push(e)}return o}function throwPluginError(r,o,{hook:e,id:t}={}){const s=(0,customError_1.makeCustomError)(r);throw s.code||(s.code=customError_1.CustomErrors.SUMMER_PLUGIN_ERR),s.plugin=o,e&&(s.hook=e),t&&!s.path&&(s.path=t),r.stack&&(s.stack=r.stack),s}function getPluginContext(r,o){return{addWatchFile(){throw new Error("addWatchFile should be implemented by replaceContext")},async runWorkerMethod(e,...t){const s=await o.project.serialize(),n={command:"runMethod",plugin:r.name,projectInfo:s,pluginOption:{},method:e,args:t};let i;if(await(0,debug_1.shouldNotRunInWorker)())i=await(0,worker_1.runSummerPluginHook)(n);else try{i=await(0,workerThread_1.runTask)(workerThread_1.TASK_NAME.SUMMER_HOOK,n)}catch(r){throw r}if(i.error){if("CustomError"===i.error.type)throw new customError_1.CustomError(i.error);throw i.error}return i.result},error:o=>throwPluginError(o,r.name)}}class PluginDriver{constructor(r,o){this.graph=r,this.options=o,this.pluginContexts=new Map,this.plugins=o.plugins,this.resolveExtConf=genResovleExtConf(o.plugins);for(const o of this.plugins)this.pluginContexts.set(o,getPluginContext(o,r))}runHook(r,o,e,t){const s=e[r];if(!s)return;let n=this.pluginContexts.get(e);return t&&(n=t(n,e)),Promise.resolve().then(()=>s.apply(n,o)).catch(o=>throwPluginError(o,e.name,{hook:r}))}hookFirst(r,o,e){let t=Promise.resolve(void 0);for(const s of this.plugins)t=t.then(t=>t||this.runHook(r,o,s,e));return t}hookParallel(r,o,e){const t=[];for(const s of this.plugins){const n=this.runHook(r,o,s,e);n&&t.push(n)}return Promise.all(t).then(()=>{})}hookReduceArg0(r,[o,...e],t,s){let n=Promise.resolve(o);for(const o of this.plugins)n=n.then(n=>{const i=[n,...e],u=this.runHook(r,i,o,s);return u?u.then(r=>t.call(this.pluginContexts.get(o),n,r,o)):n});return n}}exports.PluginDriver=PluginDriver;
@@ -1 +1 @@
1
- "use strict";function couldUseSWCMode(e){if(e.compileWorklet)return!1;return!1===e.disableSWC||null===e.disableSWC&&(e.es6||e.enhance)||void 0===e.disableSWC&&1==e.swc}function getSummerPluginConfig(e){const i=new Set,{disableUseStrict:r}=e;return i.add(["script",{disableUseStrict:r}]),(e.minifyWXSS||e.postcss)&&i.add("wxss"),e.minifyWXML&&i.add("minifywxml"),e.useCompilerPlugins&&e.useCompilerPlugins.forEach(e=>{if("string"==typeof e)"typescript"!==e&&i.add(e);else{if(!Array.isArray(e))throw new Error("invalid useCompilerPlugins options: "+JSON.stringify(e));if("string"!=typeof e[0]||void 0===e[1])throw new Error("invalid useCompilerPlugins options: "+JSON.stringify(e));"typescript"!==e[0]&&i.add(e)}}),Array.from(i)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.getSummerPluginConfig=exports.couldUseSWCMode=void 0,exports.couldUseSWCMode=couldUseSWCMode,exports.getSummerPluginConfig=getSummerPluginConfig;
1
+ "use strict";function couldUseSWCMode(e){if(e.compileWorklet)return!1;return!1===e.disableSWC||null===e.disableSWC&&(e.es6||e.enhance)||void 0===e.disableSWC&&1==e.swc}function getSummerPluginConfig(e){const i=new Set,{disableUseStrict:r}=e;return i.add(["script",{disableUseStrict:r}]),(e.minifyWXSS||e.postcss)&&i.add("wxss"),e.minifyWXML&&i.add("minifywxml"),e.useCompilerPlugins&&e.useCompilerPlugins.forEach(e=>{if("string"==typeof e)"typescript"!==e&&i.add(e);else{if(!Array.isArray(e))throw new Error("invalid useCompilerPlugins options: "+JSON.stringify(e));if("string"!=typeof e[0]||void 0===e[1])throw new Error("invalid useCompilerPlugins options: "+JSON.stringify(e));"typescript"!==e[0]&&i.add(e)}}),Array.from(i)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.couldUseSWCMode=couldUseSWCMode,exports.getSummerPluginConfig=getSummerPluginConfig;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});const babel_script_task_1=require("../script_task/babel_script_task");function default_1(e,t){return{name:"summer-es6module",workerMethods:{async doGenerate(e,t,s){const r=await(0,babel_script_task_1.transformES6ModuleAndGenCode)(e,t,s);return Object.assign(Object.assign({},r),{resultType:s.resultType})}},async generate(e,s,r,{independentRoot:o,isBabelIgnore:a,resultType:n}){const c=Date.now(),{source:i}=e;if(s.endsWith(".js")&&!i.largeFile&&!a){if(!i.astInfo){if(null===i.sourceCode)throw new Error("source.sourceCode is null");return Object.assign(Object.assign({},e),{target:{code:i.sourceCode,map:i.inputMap,helpers:[],resultType:n||"prod"},process:[...e.process,{cost:Date.now()-c,pluginName:"summer-es6module",action:"generate"}]})}const s={babelRoot:(0,babel_script_task_1.getBabelRoot)(o),disableUseStrict:t.disableUseStrict,resultType:n},a=await this.runWorkerMethod("doGenerate",r,i,s);return Object.assign(Object.assign({},e),{target:a,process:[...e.process,{cost:Date.now()-c,pluginName:"summer-es6module",action:"generate",options:s}]})}}}}exports.default=default_1;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=default_1;const babel_script_task_1=require("../script_task/babel_script_task");function default_1(e,t){return{name:"summer-es6module",workerMethods:{async doGenerate(e,t,s){const r=await(0,babel_script_task_1.transformES6ModuleAndGenCode)(e,t,s);return Object.assign(Object.assign({},r),{resultType:s.resultType})}},async generate(e,s,r,{independentRoot:o,isBabelIgnore:a,resultType:n}){const c=Date.now(),{source:i}=e;if(s.endsWith(".js")&&!i.largeFile&&!a){if(!i.astInfo){if(null===i.sourceCode)throw new Error("source.sourceCode is null");return Object.assign(Object.assign({},e),{target:{code:i.sourceCode,map:i.inputMap,helpers:[],resultType:n||"prod"},process:[...e.process,{cost:Date.now()-c,pluginName:"summer-es6module",action:"generate"}]})}const s={babelRoot:(0,babel_script_task_1.getBabelRoot)(o),disableUseStrict:t.disableUseStrict,resultType:n},a=await this.runWorkerMethod("doGenerate",r,i,s);return Object.assign(Object.assign({},e),{target:a,process:[...e.process,{cost:Date.now()-c,pluginName:"summer-es6module",action:"generate",options:s}]})}}}}
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.MAX_CODE_LENGTH=void 0;const load_script_task_1=require("../script_task/load_script_task");var config_1=require("../../../../../config/config");function default_1(e){return{name:"summer-javascript",async load(t,r){if(r.endsWith(".js"))return await(0,load_script_task_1.loadScriptFile)(e,t,r,"summer-javascript")}}}Object.defineProperty(exports,"MAX_CODE_LENGTH",{enumerable:!0,get:function(){return config_1.MAX_CODE_LENGTH}}),exports.default=default_1;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.MAX_CODE_LENGTH=void 0,exports.default=default_1;const load_script_task_1=require("../script_task/load_script_task");var config_1=require("../../../../../config/config");function default_1(e){return{name:"summer-javascript",async load(t,r){if(r.endsWith(".js"))return await(0,load_script_task_1.loadScriptFile)(e,t,r,"summer-javascript")}}}Object.defineProperty(exports,"MAX_CODE_LENGTH",{enumerable:!0,get:function(){return config_1.MAX_CODE_LENGTH}});
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getSWCRoot=exports.MAX_CODE_LENGTH=void 0;const tslib_1=require("tslib"),path_1=tslib_1.__importDefault(require("path")),config_1=require("../../../../../config/config"),tools_1=require("../../../../../utils/tools"),swc_helper_1=require("../../../../../utils/swc_helper"),inputsourcemap_1=require("../../utils/inputsourcemap"),swc_task_1=require("../script_task/swc_task");var config_2=require("../../../../../config/config");function getSWCRoot(e,t){const s=(0,swc_helper_1.getSWCOutputPath)(e.setting);return""===t?s:(0,tools_1.normalizePath)(`${t}/${s}`)}function default_1(e,t){return{name:"summer-swc",workerMethods:{async doGenerate(e,t,s,r){const o=await(0,swc_task_1.swcCompileTask)(t,e,Object.assign(Object.assign({},r),{swcRoot:s}));return{code:o.code,map:o.map,helpers:o.helpers,resultType:r.resultType}}},async load(t,s){if(!t.endsWith(".js"))return;const r=Date.now(),o=path_1.default.relative(e.projectPath,s),i=e.getFile("",o).toString(),n=e.stat("",o),a=await(0,inputsourcemap_1.tryGetInputSourceMap)(i,s);return{targetPath:t,source:{sourceCode:i,inputMap:null!=a?a:void 0,astInfo:void 0,largeFile:i.length>=config_1.MAX_CODE_LENGTH,mtime:null==n?void 0:n.mtimeMs},process:[{cost:Date.now()-r,pluginName:"summer-swc",action:"load"}]}},async generate(s,r,o,{independentRoot:i,isBabelIgnore:n,resultType:a}){var c;if(!r.endsWith(".js")||n)return;const u=Date.now(),l=getSWCRoot(e,i),p={disableUseStrict:t.disableUseStrict,target:e.setting.enhance||e.setting.es6?"es5":"es2022",rc:null===(c=e.setting.swcSetting)||void 0===c?void 0:c.rc,minify:e.setting.minified,resultType:a},_=await this.runWorkerMethod("doGenerate",s.source,o,l,p);return Object.assign(Object.assign({},s),{target:_,process:[...s.process,{cost:Date.now()-u,pluginName:"summer-swc",action:"transform",options:p}]})}}}Object.defineProperty(exports,"MAX_CODE_LENGTH",{enumerable:!0,get:function(){return config_2.MAX_CODE_LENGTH}}),exports.getSWCRoot=getSWCRoot,exports.default=default_1;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.MAX_CODE_LENGTH=void 0,exports.getSWCRoot=getSWCRoot,exports.default=default_1;const tslib_1=require("tslib"),path_1=tslib_1.__importDefault(require("path")),config_1=require("../../../../../config/config"),tools_1=require("../../../../../utils/tools"),swc_helper_1=require("../../../../../utils/swc_helper"),inputsourcemap_1=require("../../utils/inputsourcemap"),swc_task_1=require("../script_task/swc_task");var config_2=require("../../../../../config/config");function getSWCRoot(e,t){const s=(0,swc_helper_1.getSWCOutputPath)(e.setting);return""===t?s:(0,tools_1.normalizePath)(`${t}/${s}`)}function default_1(e,t){return{name:"summer-swc",workerMethods:{async doGenerate(e,t,s,r){const o=await(0,swc_task_1.swcCompileTask)(t,e,Object.assign(Object.assign({},r),{swcRoot:s}));return{code:o.code,map:o.map,helpers:o.helpers,resultType:r.resultType}}},async load(t,s){if(!t.endsWith(".js"))return;const r=Date.now(),o=path_1.default.relative(e.projectPath,s),i=e.getFile("",o).toString(),n=e.stat("",o),a=await(0,inputsourcemap_1.tryGetInputSourceMap)(i,s);return{targetPath:t,source:{sourceCode:i,inputMap:null!=a?a:void 0,astInfo:void 0,largeFile:i.length>=config_1.MAX_CODE_LENGTH,mtime:null==n?void 0:n.mtimeMs},process:[{cost:Date.now()-r,pluginName:"summer-swc",action:"load"}]}},async generate(s,r,o,{independentRoot:i,isBabelIgnore:n,resultType:a}){var c;if(!r.endsWith(".js")||n)return;const u=Date.now(),l=getSWCRoot(e,i),p={disableUseStrict:t.disableUseStrict,target:e.setting.enhance||e.setting.es6?"es5":"es2022",rc:null===(c=e.setting.swcSetting)||void 0===c?void 0:c.rc,minify:e.setting.minified,resultType:a},_=await this.runWorkerMethod("doGenerate",s.source,o,l,p);return Object.assign(Object.assign({},s),{target:_,process:[...s.process,{cost:Date.now()-u,pluginName:"summer-swc",action:"transform",options:p}]})}}}Object.defineProperty(exports,"MAX_CODE_LENGTH",{enumerable:!0,get:function(){return config_2.MAX_CODE_LENGTH}});
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});const tslib_1=require("tslib"),postcss_1=tslib_1.__importDefault(require("postcss")),autoprefixer_1=tslib_1.__importDefault(require("autoprefixer")),cssnano_1=tslib_1.__importDefault(require("cssnano")),tools_1=require("../../../../../utils/tools"),config_1=require("../../../../../config/config"),customError_1=require("../../../../../utils/customError");"undefined"!=typeof process&&process.env&&(process.env.BROWSERSLIST=process.env.BROWSERSLIST||"iOS >= 8, Chrome >= 37");const MAX_LINE_SHOW_LENGTH=45;function shortString(r,e,t=-1){const s=r.length;if(s<=e)return{result:r,marker:t};const o=Math.floor(e/2);return-1===t||t<=o?{result:r.substr(0,e-3)+"...",marker:t}:t+o>=s?{result:"..."+r.substr(s-e+3,e-3),marker:Math.min(e,e-(s-t))}:{result:`...${r.substr(t-o+3,e-6)}...`,marker:o}}function formatPostcssError(r,e){try{const t=e.line-1,s=e.column-1,o=r.replace(/\r\n/g,"\n").split("\n"),n=[],i=Math.max(0,t-1),u=Math.min(t+2,o.length);for(let r=i;r<u;r++){const e=shortString(o[r],45,s);r===t?n.push(`> ${r+1} | ${e.result.substr(0,e.marker)}${e.result.substr(e.marker)}`):n.push(`> ${r+1} | ${e.result}`)}return`${e.message}\n${n.join("\n")}`}catch(r){}return e.message}function default_1(r,e){const{autoPrefix:t=!0,minify:s=!0}=e||{},o=["iOS >= 8","Chrome >= 37"];return{name:"summer-wxss",workerMethods:{async doOptimize(r,e){try{const n=[];t&&n.push((0,autoprefixer_1.default)({overrideBrowserslist:o,remove:!1})),s&&n.push((0,cssnano_1.default)({preset:["default",{reduceTransforms:!1,calc:!1,minifySelectors:!1,normalizeUrl:!1}]}));return{error:null,content:(await(0,postcss_1.default)(n).process(e,{from:(0,tools_1.leading)(r,"/")})).css.replace(/\r\n/g,"\n")}}catch(t){throw(0,customError_1.makeCustomError)(formatPostcssError(e,t),config_1.POST_WXSS_ERR,r)}}},async optimize(r,e){if("dev"===e.resultType||!r.targetPath.endsWith(".wxss")||!t&&!s)return r;const o=Date.now(),n=await this.runWorkerMethod("doOptimize",r.targetPath,r.target.code);if(n.error)throw n.error;return Object.assign(Object.assign({},r),{target:Object.assign(Object.assign({},r.target),{code:n.content}),process:[...r.process,{cost:Date.now()-o,pluginName:"summer-wxss",action:"optimize"}]})}}}exports.default=default_1;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=default_1;const tslib_1=require("tslib"),postcss_1=tslib_1.__importDefault(require("postcss")),autoprefixer_1=tslib_1.__importDefault(require("autoprefixer")),cssnano_1=tslib_1.__importDefault(require("cssnano")),tools_1=require("../../../../../utils/tools"),config_1=require("../../../../../config/config"),customError_1=require("../../../../../utils/customError");"undefined"!=typeof process&&process.env&&(process.env.BROWSERSLIST=process.env.BROWSERSLIST||"iOS >= 8, Chrome >= 37");const MAX_LINE_SHOW_LENGTH=45;function shortString(r,e,t=-1){const s=r.length;if(s<=e)return{result:r,marker:t};const o=Math.floor(e/2);return-1===t||t<=o?{result:r.substr(0,e-3)+"...",marker:t}:t+o>=s?{result:"..."+r.substr(s-e+3,e-3),marker:Math.min(e,e-(s-t))}:{result:`...${r.substr(t-o+3,e-6)}...`,marker:o}}function formatPostcssError(r,e){try{const t=e.line-1,s=e.column-1,o=r.replace(/\r\n/g,"\n").split("\n"),n=[],i=Math.max(0,t-1),u=Math.min(t+2,o.length);for(let r=i;r<u;r++){const e=shortString(o[r],45,s);r===t?n.push(`> ${r+1} | ${e.result.substr(0,e.marker)}${e.result.substr(e.marker)}`):n.push(`> ${r+1} | ${e.result}`)}return`${e.message}\n${n.join("\n")}`}catch(r){}return e.message}function default_1(r,e){const{autoPrefix:t=!0,minify:s=!0}=e||{},o=["iOS >= 8","Chrome >= 37"];return{name:"summer-wxss",workerMethods:{async doOptimize(r,e){try{const n=[];t&&n.push((0,autoprefixer_1.default)({overrideBrowserslist:o,remove:!1})),s&&n.push((0,cssnano_1.default)({preset:["default",{reduceTransforms:!1,calc:!1,minifySelectors:!1,normalizeUrl:!1}]}));return{error:null,content:(await(0,postcss_1.default)(n).process(e,{from:(0,tools_1.leading)(r,"/")})).css.replace(/\r\n/g,"\n")}}catch(t){throw(0,customError_1.makeCustomError)(formatPostcssError(e,t),config_1.POST_WXSS_ERR,r)}}},async optimize(r,e){if("dev"===e.resultType||!r.targetPath.endsWith(".wxss")||!t&&!s)return r;const o=Date.now(),n=await this.runWorkerMethod("doOptimize",r.targetPath,r.target.code);if(n.error)throw n.error;return Object.assign(Object.assign({},r),{target:Object.assign(Object.assign({},r.target),{code:n.content}),process:[...r.process,{cost:Date.now()-o,pluginName:"summer-wxss",action:"optimize"}]})}}}
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});const babel_script_task_1=require("./script_task/babel_script_task");function default_1(e,s){return{name:"summer-enhance",workerMethods:{doTransform:async(e,s,t,r)=>await(0,babel_script_task_1.babelTransformJS)(e,s)},async transform(e,t,r,{independentRoot:a,isBabelIgnore:n}){const{source:o}=e;if(t.endsWith(".js")&&!o.largeFile&&!n){const t=Date.now(),n=(0,babel_script_task_1.getBabelRoot)(a),c=await this.runWorkerMethod("doTransform",o,r,n,s.disableUseStrict);return Object.assign(Object.assign({},e),{source:Object.assign(Object.assign({},e.source),c),process:[...e.process,{cost:Date.now()-t,pluginName:"summer-enhance",action:"transform"}]})}return e}}}exports.default=default_1;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=default_1;const babel_script_task_1=require("./script_task/babel_script_task");function default_1(e,s){return{name:"summer-enhance",workerMethods:{doTransform:async(e,s,t,r)=>await(0,babel_script_task_1.babelTransformJS)(e,s)},async transform(e,t,r,{independentRoot:a,isBabelIgnore:n}){const{source:o}=e;if(t.endsWith(".js")&&!o.largeFile&&!n){const t=Date.now(),n=(0,babel_script_task_1.getBabelRoot)(a),c=await this.runWorkerMethod("doTransform",o,r,n,s.disableUseStrict);return Object.assign(Object.assign({},e),{source:Object.assign(Object.assign({},e.source),c),process:[...e.process,{cost:Date.now()-t,pluginName:"summer-enhance",action:"transform"}]})}return e}}}
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getSWCRoot=exports.MAX_CODE_LENGTH=void 0;const pluginconfig_1=require("../../pluginconfig"),tools_1=require("../../../../../utils/tools"),swc_helper_1=require("../../../../../utils/swc_helper"),swc_task_1=require("../script_task/swc_task"),load_script_task_1=require("../script_task/load_script_task"),babel_script_task_1=require("../script_task/babel_script_task"),minify_script_task_1=require("../script_task/minify_script_task");var config_1=require("../../../../../config/config");function getSWCRoot(e,t){const s=(0,swc_helper_1.getSWCOutputPath)(e.setting);return""===t?s:(0,tools_1.normalizePath)(`${t}/${s}`)}function useCompilerPlugin(e,t){if(!e.setting.useCompilerPlugins)return!1;for(const s of e.setting.useCompilerPlugins){if("string"==typeof s&&s===t)return!0;if(Array.isArray(s)&&"string"==typeof s[0]&&void 0!==s[1]&&s[0]===t)return!0}return!1}function default_1(e,t){const s=e.setting.minified,r=e.setting.enhance||e.setting.es6,o=useCompilerPlugin(e,"typescript"),i=(0,pluginconfig_1.couldUseSWCMode)(e.setting);return{name:"script",resolveExt:o?{js:"ts"}:{},workerMethods:{async doSwcTask(e,t,s){const r=await(0,swc_task_1.swcCompileTask)(e,t,s);return{code:r.code,map:r.map,helpers:r.helpers,resultType:s.resultType}},async doBabelTask(e,t,s){const r=await(0,babel_script_task_1.bableCompile)(e,t,{typescript:s.typescript,enhance:s.enhance,babelRoot:s.babelRoot,disableUseStrict:s.disableUseStrict});if(s.minify){const t=await(0,minify_script_task_1.doCompress)(e,{code:r.code,map:r.map});return{code:t.code,map:t.map,helpers:r.helpers,resultType:s.resultType}}return{code:r.code,map:r.map,helpers:r.helpers,resultType:s.resultType}}},async load(t,s){if(t.endsWith(".js"))return await(0,load_script_task_1.loadScriptFile)(e,t,s,"script")},async compile(c,a,n,p){var l;if(!c.endsWith(".js"))return;const{independentRoot:u,isBabelIgnore:_,resultType:d}=p;if(_)return{targetPath:c,source:n.source,target:{code:n.source.sourceCode,map:n.source.inputMap,helpers:[],resultType:d},process:n.process};const g=Date.now();if(i){const o={swcRoot:getSWCRoot(e,u),minify:s,resultType:d,rc:null===(l=e.setting.swcSetting)||void 0===l?void 0:l.rc,disableUseStrict:t.disableUseStrict,target:r?"es5":"es2022"},i=await this.runWorkerMethod("doSwcTask",a,n.source,o);return{targetPath:c,source:n.source,target:i,process:[...n.process,{cost:Date.now()-g,pluginName:"script",action:"compile",options:o}]}}const f={babelRoot:(0,babel_script_task_1.getBabelRoot)(u),disableUseStrict:t.disableUseStrict,resultType:d,minify:s,enhance:r,typescript:o},m=await this.runWorkerMethod("doBabelTask",a,n.source,f);return{targetPath:c,source:n.source,target:m,process:[...n.process,{cost:Date.now()-g,pluginName:"script",action:"compile",options:f}]}}}}Object.defineProperty(exports,"MAX_CODE_LENGTH",{enumerable:!0,get:function(){return config_1.MAX_CODE_LENGTH}}),exports.getSWCRoot=getSWCRoot,exports.default=default_1;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.MAX_CODE_LENGTH=void 0,exports.getSWCRoot=getSWCRoot,exports.default=default_1;const pluginconfig_1=require("../../pluginconfig"),tools_1=require("../../../../../utils/tools"),swc_helper_1=require("../../../../../utils/swc_helper"),swc_task_1=require("../script_task/swc_task"),load_script_task_1=require("../script_task/load_script_task"),babel_script_task_1=require("../script_task/babel_script_task"),minify_script_task_1=require("../script_task/minify_script_task");var config_1=require("../../../../../config/config");function getSWCRoot(e,t){const s=(0,swc_helper_1.getSWCOutputPath)(e.setting);return""===t?s:(0,tools_1.normalizePath)(`${t}/${s}`)}function useCompilerPlugin(e,t){if(!e.setting.useCompilerPlugins)return!1;for(const s of e.setting.useCompilerPlugins){if("string"==typeof s&&s===t)return!0;if(Array.isArray(s)&&"string"==typeof s[0]&&void 0!==s[1]&&s[0]===t)return!0}return!1}function default_1(e,t){const s=e.setting.minified,r=e.setting.enhance||e.setting.es6,i=useCompilerPlugin(e,"typescript"),o=(0,pluginconfig_1.couldUseSWCMode)(e.setting);return{name:"script",resolveExt:i?{js:"ts"}:{},workerMethods:{async doSwcTask(e,t,s){const r=await(0,swc_task_1.swcCompileTask)(e,t,s);return{code:r.code,map:r.map,helpers:r.helpers,resultType:s.resultType}},async doBabelTask(e,t,s){const r=await(0,babel_script_task_1.bableCompile)(e,t,{typescript:s.typescript,enhance:s.enhance,babelRoot:s.babelRoot,disableUseStrict:s.disableUseStrict});if(s.minify){const t=await(0,minify_script_task_1.doCompress)(e,{code:r.code,map:r.map});return{code:t.code,map:t.map,helpers:r.helpers,resultType:s.resultType}}return{code:r.code,map:r.map,helpers:r.helpers,resultType:s.resultType}}},async load(t,s){if(t.endsWith(".js"))return await(0,load_script_task_1.loadScriptFile)(e,t,s,"script")},async compile(c,a,n,p){var l;if(!c.endsWith(".js"))return;const{independentRoot:u,isBabelIgnore:_,resultType:d}=p;if(_)return{targetPath:c,source:n.source,target:{code:n.source.sourceCode,map:n.source.inputMap,helpers:[],resultType:d},process:n.process};const g=Date.now();if(o){const i={swcRoot:getSWCRoot(e,u),minify:s,resultType:d,rc:null===(l=e.setting.swcSetting)||void 0===l?void 0:l.rc,disableUseStrict:t.disableUseStrict,target:r?"es5":"es2022"},o=await this.runWorkerMethod("doSwcTask",a,n.source,i);return{targetPath:c,source:n.source,target:o,process:[...n.process,{cost:Date.now()-g,pluginName:"script",action:"compile",options:i}]}}const f={babelRoot:(0,babel_script_task_1.getBabelRoot)(u),disableUseStrict:t.disableUseStrict,resultType:d,minify:s,enhance:r,typescript:i},m=await this.runWorkerMethod("doBabelTask",a,n.source,f);return{targetPath:c,source:n.source,target:m,process:[...n.process,{cost:Date.now()-g,pluginName:"script",action:"compile",options:f}]}}}}Object.defineProperty(exports,"MAX_CODE_LENGTH",{enumerable:!0,get:function(){return config_1.MAX_CODE_LENGTH}});
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.importWxssCssReg=exports.importWxssReg=void 0;const tslib_1=require("tslib"),tools_1=require("../../../../utils/tools"),customError_1=require("../../../../utils/customError"),path_1=tslib_1.__importDefault(require("path")),less=()=>require("less");function default_1(s,t){return{name:"summer-less",resolveExt:{wxss:"less"},async load(e,o){var r,i,a;if(o.endsWith(".less")){const l=Date.now(),p=(0,tools_1.pathRelative)(s.projectPath,o);let u=s.getFile("",p).toString();if(p!==s.getTargetPath(s.miniprogramRoot,"app")+".less"){const t=(null===(i=null===(r=s.setting)||void 0===r?void 0:r.lessSetting)||void 0===i?void 0:i.commonUseFilePath)||"app.less";if(s.exists(s.miniprogramRoot,t)){const e=(0,tools_1.pathRelative)(s.miniprogramRoot,path_1.default.dirname(p))||".";u=`@import (optional, reference) '${"."===e?".":(0,tools_1.pathRelative)(e,"./")}/${t}';\n${u}`}}const c=[];u=u.replace(exports.importWxssReg,(s,t,e)=>(c.push(e),s.replace(e,e+"?css")));try{const r=await require("less").render(u,{sourceMap:{outputSourceFiles:!0},paths:this.rootPath?[this.rootPath]:[],filename:o,globalVars:null!==(a=null==t?void 0:t.globalVars)&&void 0!==a?a:{}}),i=r.css.replace(exports.importWxssCssReg,(s,t,e)=>{const o=e.slice(0,-4);return c.includes(o)?s.replace(e,o):s});if(r.imports.length)for(const s of r.imports)this.addWatchFile(s);let p=void 0;return r.map&&(p=JSON.parse(r.map),p.sources=p.sources.map(t=>path_1.default.posix.relative(s.projectPath,t))),{targetPath:e,source:{sourceCode:i,inputMap:p},process:[{cost:Date.now()-l,pluginName:"summer-less",action:"load"}]}}catch(s){throw(0,customError_1.makeCustomError)(s,customError_1.CustomErrors.SUMMER_PLUGIN_CODE_ERR)}}}}}exports.importWxssReg=/(?:^|\s)?(?:@import)(?:\s*)?(["'])([^"']+.wxss)\1(?:\s*);/g,exports.importWxssCssReg=/(?:^|\s)?(?:@import)(?:\s*)?(["'])([^"']+.wxss\?css)\1(?:\s*);/g,exports.default=default_1;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.importWxssCssReg=exports.importWxssReg=void 0,exports.default=default_1;const tslib_1=require("tslib"),tools_1=require("../../../../utils/tools"),customError_1=require("../../../../utils/customError"),path_1=tslib_1.__importDefault(require("path")),less=()=>require("less");function default_1(s,t){return{name:"summer-less",resolveExt:{wxss:"less"},async load(e,o){var r,i,a;if(o.endsWith(".less")){const l=Date.now(),p=(0,tools_1.pathRelative)(s.projectPath,o);let u=s.getFile("",p).toString();if(p!==s.getTargetPath(s.miniprogramRoot,"app")+".less"){const t=(null===(i=null===(r=s.setting)||void 0===r?void 0:r.lessSetting)||void 0===i?void 0:i.commonUseFilePath)||"app.less";if(s.exists(s.miniprogramRoot,t)){const e=(0,tools_1.pathRelative)(s.miniprogramRoot,path_1.default.dirname(p))||".";u=`@import (optional, reference) '${"."===e?".":(0,tools_1.pathRelative)(e,"./")}/${t}';\n${u}`}}const c=[];u=u.replace(exports.importWxssReg,(s,t,e)=>(c.push(e),s.replace(e,e+"?css")));try{const r=await require("less").render(u,{sourceMap:{outputSourceFiles:!0},paths:this.rootPath?[this.rootPath]:[],filename:o,globalVars:null!==(a=null==t?void 0:t.globalVars)&&void 0!==a?a:{}}),i=r.css.replace(exports.importWxssCssReg,(s,t,e)=>{const o=e.slice(0,-4);return c.includes(o)?s.replace(e,o):s});if(r.imports.length)for(const s of r.imports)this.addWatchFile(s);let p=void 0;return r.map&&(p=JSON.parse(r.map),p.sources=p.sources.map(t=>path_1.default.posix.relative(s.projectPath,t))),{targetPath:e,source:{sourceCode:i,inputMap:p},process:[{cost:Date.now()-l,pluginName:"summer-less",action:"load"}]}}catch(s){throw(0,customError_1.makeCustomError)(s,customError_1.CustomErrors.SUMMER_PLUGIN_CODE_ERR)}}}}}exports.importWxssReg=/(?:^|\s)?(?:@import)(?:\s*)?(["'])([^"']+.wxss)\1(?:\s*);/g,exports.importWxssCssReg=/(?:^|\s)?(?:@import)(?:\s*)?(["'])([^"']+.wxss\?css)\1(?:\s*);/g;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});const tslib_1=require("tslib"),config_1=require("../../../../config/config"),log=tslib_1.__importStar(require("../../../../utils/log")),customError_1=require("../../../../utils/customError"),minifywxml_1=require("../../original/workerThread/task/minifywxml");function default_1(e,t){const{minify:r=!0}=t||{};return{name:"summer-minifywxml",workerMethods:{async doCompress(e,t,r){try{const i=await(0,minifywxml_1.minifyWXML)({code:e,filePath:t,setting:r});if(i.error)throw i.error;return i.code}catch(e){throw log.error(e),(0,customError_1.makeCustomError)(e.message,config_1.MINIFY_WXML_ERR,t)}}},async compress(t,i){var s,o;if(!r||"dev"===i.resultType||!t.targetPath.endsWith(".wxml"))return t;const n=Date.now(),a=t.target.code,c=await this.runWorkerMethod("doCompress",a,t.targetPath,Object.assign(Object.assign({collapseWhitespace:!0,conservativeCollapse:!1,preserveLineBreaks:!1},null===(s=e.setting.minifyWXMLSetting)||void 0===s?void 0:s.global),null===(o=e.setting.minifyWXMLSetting)||void 0===o?void 0:o[t.targetPath]));return Object.assign(Object.assign({},t),{target:Object.assign(Object.assign({},t.target),{code:c}),process:[...t.process,{cost:Date.now()-n,pluginName:"summer-minifywxml",action:"compress"}]})}}}exports.default=default_1;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=default_1;const tslib_1=require("tslib"),config_1=require("../../../../config/config"),log=tslib_1.__importStar(require("../../../../utils/log")),customError_1=require("../../../../utils/customError"),minifywxml_1=require("../../original/workerThread/task/minifywxml");function default_1(e,t){const{minify:r=!0}=t||{};return{name:"summer-minifywxml",workerMethods:{async doCompress(e,t,r){try{const i=await(0,minifywxml_1.minifyWXML)({code:e,filePath:t,setting:r});if(i.error)throw i.error;return i.code}catch(e){throw log.error(e),(0,customError_1.makeCustomError)(e.message,config_1.MINIFY_WXML_ERR,t)}}},async compress(t,i){var s,o;if(!r||"dev"===i.resultType||!t.targetPath.endsWith(".wxml"))return t;const n=Date.now(),a=t.target.code,c=await this.runWorkerMethod("doCompress",a,t.targetPath,Object.assign(Object.assign({collapseWhitespace:!0,conservativeCollapse:!1,preserveLineBreaks:!1},null===(s=e.setting.minifyWXMLSetting)||void 0===s?void 0:s.global),null===(o=e.setting.minifyWXMLSetting)||void 0===o?void 0:o[t.targetPath]));return Object.assign(Object.assign({},t),{target:Object.assign(Object.assign({},t.target),{code:c}),process:[...t.process,{cost:Date.now()-n,pluginName:"summer-minifywxml",action:"compress"}]})}}}
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.random=void 0;const tslib_1=require("tslib"),path_1=tslib_1.__importDefault(require("path")),tools_1=require("../../../../utils/tools"),customError_1=require("../../../../utils/customError"),debug_1=require("../../../../utils/debug");let runInMainProcess=void 0;const sass=async()=>{if(void 0===runInMainProcess&&(runInMainProcess=await(0,debug_1.shouldRunInMainProcess)()),runInMainProcess){return require("sass")}return require("sass")};function random(){return(0,tools_1.generateMD5)(`${Math.random()}${Date.now()}`)}exports.random=random;const importWxssReg=/(?:^|\s)?(?:@import)(?:\s*)?(["'])([^"']+.wxss)\1(?:\s*);/g,importCssReg=/(?:^|\s)?(?:@import)(?:\s*)?(["'])([^"']+.css)\1(?:\s*);/g;async function sassRender(s,t){if("undefined"!=typeof WEBIDE_WEBPECK_DEFINE_PLUGIN);else{(await sass()).render(s,t)}}function default_1(s){return{name:"summer-sass",resolveExt:{wxss:["sass","scss"]},async load(t,e){var o,r,a,i;if(e.endsWith(".scss")||e.endsWith(".sass")){const n=(0,tools_1.pathRelative)(s.projectPath,e);let l=s.getFile("",n).toString();const u=s.getTargetPath(s.miniprogramRoot,"global");if(n!==u+".scss"&&n!==u+".sass"){const t=path_1.default.extname(n),e=(null===(r=null===(o=s.setting)||void 0===o?void 0:o.sassSetting)||void 0===r?void 0:r.sassCommonUseFilePath)||"global.sass",u=(null===(i=null===(a=s.setting)||void 0===a?void 0:a.sassSetting)||void 0===i?void 0:i.scssCommonUseFilePath)||"global.scss";let c=".sass"===t?e:u;const d=(0,tools_1.pathRelative)(s.miniprogramRoot,path_1.default.dirname(n))||".";s.exists(s.miniprogramRoot,c)||(c=".sass"===t?u:e),s.exists(s.miniprogramRoot,c)&&(l=".sass"===t?`@use '${"."===d?".":(0,tools_1.pathRelative)(d,"./")}/${c}'\n${l}`:`@use '${"."===d?".":(0,tools_1.pathRelative)(d,"./")}/${c}';\n${l}`)}const c=[];l=l.replace(importWxssReg,(s,t,e)=>(c.push(e),s.replace(e,e.slice(0,-4)+"css")));const d=path_1.default.posix.dirname((0,tools_1.pathRelative)(s.projectPath,e));return new Promise((s,o)=>{const r=Date.now();sassRender({file:e,data:l,sourceMap:!0,sourceMapContents:!0,omitSourceMapUrl:!0,outFile:e.slice(0,-5)+".wxss",includePaths:this.rootPath?[this.rootPath]:[]},(a,i)=>{if(a){const s=(0,customError_1.makeCustomError)(a,customError_1.CustomErrors.SUMMER_PLUGIN_CODE_ERR);return void o(s)}if(!i)return void o(new Error("no result"));const n=i.css.toString("utf-8").replace(importCssReg,(s,t,e)=>{const o=e.slice(0,-3)+"wxss";return c.includes(o)?s.replace(e,o):s});if(i.stats.includedFiles.length>0)for(const s of i.stats.includedFiles)s!==e&&this.addWatchFile(s);const l=i.map?JSON.parse(i.map.toString("utf-8")):void 0;l&&(l.sourceRoot=d),s({targetPath:t,source:{sourceCode:n,inputMap:l},process:[{cost:Date.now()-r,pluginName:"summer-sass",action:"load"}]})})})}}}}exports.default=default_1;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.random=random,exports.default=default_1;const tslib_1=require("tslib"),path_1=tslib_1.__importDefault(require("path")),tools_1=require("../../../../utils/tools"),customError_1=require("../../../../utils/customError"),debug_1=require("../../../../utils/debug");let runInMainProcess=void 0;const sass=async()=>{if(void 0===runInMainProcess&&(runInMainProcess=await(0,debug_1.shouldRunInMainProcess)()),runInMainProcess){return require("sass")}return require("sass")};function random(){return(0,tools_1.generateMD5)(`${Math.random()}${Date.now()}`)}const importWxssReg=/(?:^|\s)?(?:@import)(?:\s*)?(["'])([^"']+.wxss)\1(?:\s*);/g,importCssReg=/(?:^|\s)?(?:@import)(?:\s*)?(["'])([^"']+.css)\1(?:\s*);/g;async function sassRender(s,t){if("undefined"!=typeof WEBIDE_WEBPECK_DEFINE_PLUGIN);else{(await sass()).render(s,t)}}function default_1(s){return{name:"summer-sass",resolveExt:{wxss:["sass","scss"]},async load(t,e){var o,r,a,i;if(e.endsWith(".scss")||e.endsWith(".sass")){const n=(0,tools_1.pathRelative)(s.projectPath,e);let l=s.getFile("",n).toString();const u=s.getTargetPath(s.miniprogramRoot,"global");if(n!==u+".scss"&&n!==u+".sass"){const t=path_1.default.extname(n),e=(null===(r=null===(o=s.setting)||void 0===o?void 0:o.sassSetting)||void 0===r?void 0:r.sassCommonUseFilePath)||"global.sass",u=(null===(i=null===(a=s.setting)||void 0===a?void 0:a.sassSetting)||void 0===i?void 0:i.scssCommonUseFilePath)||"global.scss";let c=".sass"===t?e:u;const d=(0,tools_1.pathRelative)(s.miniprogramRoot,path_1.default.dirname(n))||".";s.exists(s.miniprogramRoot,c)||(c=".sass"===t?u:e),s.exists(s.miniprogramRoot,c)&&(l=".sass"===t?`@use '${"."===d?".":(0,tools_1.pathRelative)(d,"./")}/${c}'\n${l}`:`@use '${"."===d?".":(0,tools_1.pathRelative)(d,"./")}/${c}';\n${l}`)}const c=[];l=l.replace(importWxssReg,(s,t,e)=>(c.push(e),s.replace(e,e.slice(0,-4)+"css")));const d=path_1.default.posix.dirname((0,tools_1.pathRelative)(s.projectPath,e));return new Promise((s,o)=>{const r=Date.now();sassRender({file:e,data:l,sourceMap:!0,sourceMapContents:!0,omitSourceMapUrl:!0,outFile:e.slice(0,-5)+".wxss",includePaths:this.rootPath?[this.rootPath]:[]},(a,i)=>{if(a){const s=(0,customError_1.makeCustomError)(a,customError_1.CustomErrors.SUMMER_PLUGIN_CODE_ERR);return void o(s)}if(!i)return void o(new Error("no result"));const n=i.css.toString("utf-8").replace(importCssReg,(s,t,e)=>{const o=e.slice(0,-3)+"wxss";return c.includes(o)?s.replace(e,o):s});if(i.stats.includedFiles.length>0)for(const s of i.stats.includedFiles)s!==e&&this.addWatchFile(s);const l=i.map?JSON.parse(i.map.toString("utf-8")):void 0;l&&(l.sourceRoot=d),s({targetPath:t,source:{sourceCode:n,inputMap:l},process:[{cost:Date.now()-r,pluginName:"summer-sass",action:"load"}]})})})}}}}
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.bableCompile=exports.babelTransformTS=exports.transformES6ModuleAndGenCode=exports.babelTransformJS=exports.getBabelRoot=void 0;const config_1=require("../../../../../config/config"),babel_helper_1=require("../../../../../utils/babel_helper"),tools_1=require("../../../../../utils/tools"),customError_1=require("../../../../../utils/customError"),_transformRuntimeCustom=()=>require("../../../../../utils/babel_transform_plugin"),_pluginTransformRuntime=()=>require("@babel/plugin-transform-runtime"),_pluginTransformWorklet=()=>require("../../../../../utils/babel_plugin_worklet"),_pluginTransformModulesCommonjs=()=>require("@babel/plugin-transform-modules-commonjs"),babel7=()=>require("@babel/core"),_presetEnv=()=>require("@babel/preset-env"),_pluginTransformTypescript=()=>require("@babel/plugin-transform-typescript"),pluginReplaceTsExportAssignment=e=>{const r=e.template("\n module.exports = ASSIGNMENT;\n ");return{name:"replace-ts-export-assignment",visitor:{TSExportAssignment(e){e.replaceWith(r({ASSIGNMENT:e.node.expression}))}}}},pluginReplaceTsImportEqualsDeclaration=e=>{const r=e.template("\n const ID = require(SOURCE);\n ");return{name:"replace-ts-import-equals-declaration",visitor:{TSImportEqualsDeclaration(e){e.replaceWith(r({ID:e.node.id,SOURCE:e.node.moduleReference.expression}))}}}};function getEnhancePluginsList(e){const r=[[require("../../../../../utils/babel_transform_plugin")],[require("@babel/plugin-transform-runtime"),{corejs:!1,helpers:!0,regenerator:!0,version:"7.21.0"}]].concat((0,babel_helper_1.getCustomPlugins)([]));return e.supportWorklet&&r.push([_pluginTransformWorklet()]),r}function getCommonPresets(){return[[require("@babel/preset-env"),{targets:{chrome:53,ios:8},modules:!1,include:["@babel/plugin-transform-computed-properties"]}]]}function getTSTransformPluginsList(){return[[pluginReplaceTsImportEqualsDeclaration,{}],[pluginReplaceTsExportAssignment,{}],[require("@babel/plugin-transform-typescript"),{}]]}function getES6ModulePluginsList(e){return[[require("@babel/plugin-transform-modules-commonjs"),{allowTopLevelThis:e,importInterop:e=>e.startsWith("@babel/runtime/helpers/")?"node":"babel"}]]}function getBabelRoot(e){return""===e?"@babel/runtime":(0,tools_1.normalizePath)(e+"/@babel/runtime")}async function babelTransformJS(e,r){const o=babel7(),t=e.sourceCode.includes('"worklet"')||e.sourceCode.includes("'worklet'");let s;try{const n={babelrc:!1,sourceFileName:r,configFile:!1,presets:getCommonPresets(),plugins:getEnhancePluginsList({supportWorklet:t}),inputSourceMap:!1,code:!1,ast:!0,cloneInputAst:!1};if(e.astInfo){if(e.astInfo.type!==config_1.AstType.Babel)throw new Error("ast type is not babel");s=await o.transformFromAstAsync(e.astInfo.ast,e.sourceCode,n)}else{if(null===e.sourceCode)throw new Error("source.sourceCode is null");s=await babel7().transformAsync(e.sourceCode,n)}}catch(e){console.error(e,e.stack);const o=`file: ${r}\n ${e.message}`,t=new Error(o);throw t.code=config_1.BABEL_TRANS_JS_ERR,t}return{sourceCode:e.sourceCode,inputMap:e.inputMap,astInfo:{ast:s.ast,type:config_1.AstType.Babel}}}async function transformES6ModuleAndGenCode(e,r,o){const t=o.disableUseStrict||/^\s*\/\/\s?use strict disable;/i.test(r.sourceCode||"");let s;try{const o={babelrc:!1,sourceFileName:e,configFile:!1,plugins:getES6ModulePluginsList(t),filename:e,sourceMaps:!0,inputSourceMap:r.inputMap,code:!0,cloneInputAst:!0},n=babel7();if(!r.astInfo)throw new Error("source.astInfo is not exist");if(r.astInfo.type!==config_1.AstType.Babel)throw new Error("ast type is not babel");s=await n.transformFromAstAsync(r.astInfo.ast,r.sourceCode,o)}catch(r){throw r.code=config_1.BABEL_TRANS_JS_ERR,r.message=`file: ${e}\n ${r.message}`,r.path=e,r}if(!s)throw new Error("no trans result for callPostEnhance");let n=s.code;const l=s.map;t&&(n=n.replace(/^"use strict";/,""));const a=(0,babel_helper_1.collectBabelHelpers)(r.sourceCode),i=(0,babel_helper_1.replaceBabelHelpers)(n,a,e,o.babelRoot);return{code:i.transformCode,map:l,helpers:i.helpers}}async function babelTransformTS(e,r){let o;console.log("[backend] summer-typescript workerMethod");try{o=await babel7().transformAsync(e.sourceCode,{babelrc:!1,plugins:getTSTransformPluginsList(),sourceFileName:r,sourceMaps:!1,ast:!0,configFile:!1,code:!1})}catch(e){throw(0,customError_1.makeCustomError)(e,customError_1.CustomErrors.SUMMER_PLUGIN_CODE_ERR,r)}return{sourceCode:e.sourceCode,inputMap:e.inputMap,astInfo:{ast:o.ast,type:config_1.AstType.Babel}}}async function bableCompile(e,r,o){const t=babel7(),s=r.sourceCode.includes('"worklet"')||r.sourceCode.includes("'worklet'"),n=o.disableUseStrict||/^\s*\/\/\s?use strict disable;/i.test(r.sourceCode||""),l=[];e.endsWith(".ts")&&o.typescript&&l.push(...getTSTransformPluginsList()),s&&l.push([_pluginTransformWorklet()]),o.enhance&&l.push(...getEnhancePluginsList({})),l.push(...getES6ModulePluginsList(n));const a={babelrc:!1,sourceFileName:e,filename:e,configFile:!1,presets:o.enhance?getCommonPresets():[],plugins:l,inputSourceMap:r.inputMap,sourceMaps:!0,code:!0,ast:!1,cloneInputAst:!1};let i;try{i=await t.transformAsync(r.sourceCode,a)}catch(r){console.error(r,r.stack);const o=`file: ${e}\n ${r.message}`,t=new Error(o);throw t.code=config_1.BABEL_TRANS_JS_ERR,t}if(!i||!i.code)throw new Error("no trans result for bableCompile");let u=i.code;const c=i.map;n&&(u=u.replace(/^"use strict";/,""));const p=(0,babel_helper_1.collectBabelHelpers)(r.sourceCode),b=(0,babel_helper_1.replaceBabelHelpers)(u,p,e,o.babelRoot);return{code:b.transformCode,map:c,helpers:b.helpers}}exports.getBabelRoot=getBabelRoot,exports.babelTransformJS=babelTransformJS,exports.transformES6ModuleAndGenCode=transformES6ModuleAndGenCode,exports.babelTransformTS=babelTransformTS,exports.bableCompile=bableCompile;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getBabelRoot=getBabelRoot,exports.babelTransformJS=babelTransformJS,exports.transformES6ModuleAndGenCode=transformES6ModuleAndGenCode,exports.babelTransformTS=babelTransformTS,exports.bableCompile=bableCompile;const config_1=require("../../../../../config/config"),babel_helper_1=require("../../../../../utils/babel_helper"),tools_1=require("../../../../../utils/tools"),customError_1=require("../../../../../utils/customError"),_transformRuntimeCustom=()=>require("../../../../../utils/babel_transform_plugin"),_pluginTransformRuntime=()=>require("@babel/plugin-transform-runtime"),_pluginTransformWorklet=()=>require("../../../../../utils/babel_plugin_worklet"),_pluginTransformModulesCommonjs=()=>require("@babel/plugin-transform-modules-commonjs"),babel7=()=>require("@babel/core"),_presetEnv=()=>require("@babel/preset-env"),_pluginTransformTypescript=()=>require("@babel/plugin-transform-typescript"),pluginReplaceTsExportAssignment=e=>{const r=e.template("\n module.exports = ASSIGNMENT;\n ");return{name:"replace-ts-export-assignment",visitor:{TSExportAssignment(e){e.replaceWith(r({ASSIGNMENT:e.node.expression}))}}}},pluginReplaceTsImportEqualsDeclaration=e=>{const r=e.template("\n const ID = require(SOURCE);\n ");return{name:"replace-ts-import-equals-declaration",visitor:{TSImportEqualsDeclaration(e){e.replaceWith(r({ID:e.node.id,SOURCE:e.node.moduleReference.expression}))}}}};function getEnhancePluginsList(e){const r=[[require("../../../../../utils/babel_transform_plugin")],[require("@babel/plugin-transform-runtime"),{corejs:!1,helpers:!0,regenerator:!0,version:"7.21.0"}]].concat((0,babel_helper_1.getCustomPlugins)([]));return e.supportWorklet&&r.push([_pluginTransformWorklet()]),r}function getCommonPresets(){return[[require("@babel/preset-env"),{targets:{chrome:53,ios:8},modules:!1,include:["@babel/plugin-transform-computed-properties"]}]]}function getTSTransformPluginsList(){return[[pluginReplaceTsImportEqualsDeclaration,{}],[pluginReplaceTsExportAssignment,{}],[require("@babel/plugin-transform-typescript"),{}]]}function getES6ModulePluginsList(e){return[[require("@babel/plugin-transform-modules-commonjs"),{allowTopLevelThis:e,importInterop:e=>e.startsWith("@babel/runtime/helpers/")?"node":"babel"}]]}function getBabelRoot(e){return""===e?"@babel/runtime":(0,tools_1.normalizePath)(e+"/@babel/runtime")}async function babelTransformJS(e,r){const o=babel7(),t=e.sourceCode.includes('"worklet"')||e.sourceCode.includes("'worklet'");let s;try{const n={babelrc:!1,sourceFileName:r,configFile:!1,presets:getCommonPresets(),plugins:getEnhancePluginsList({supportWorklet:t}),inputSourceMap:!1,code:!1,ast:!0,cloneInputAst:!1};if(e.astInfo){if(e.astInfo.type!==config_1.AstType.Babel)throw new Error("ast type is not babel");s=await o.transformFromAstAsync(e.astInfo.ast,e.sourceCode,n)}else{if(null===e.sourceCode)throw new Error("source.sourceCode is null");s=await babel7().transformAsync(e.sourceCode,n)}}catch(e){console.error(e,e.stack);const o=`file: ${r}\n ${e.message}`,t=new Error(o);throw t.code=config_1.BABEL_TRANS_JS_ERR,t}return{sourceCode:e.sourceCode,inputMap:e.inputMap,astInfo:{ast:s.ast,type:config_1.AstType.Babel}}}async function transformES6ModuleAndGenCode(e,r,o){const t=o.disableUseStrict||/^\s*\/\/\s?use strict disable;/i.test(r.sourceCode||"");let s;try{const o={babelrc:!1,sourceFileName:e,configFile:!1,plugins:getES6ModulePluginsList(t),filename:e,sourceMaps:!0,inputSourceMap:r.inputMap,code:!0,cloneInputAst:!0},n=babel7();if(!r.astInfo)throw new Error("source.astInfo is not exist");if(r.astInfo.type!==config_1.AstType.Babel)throw new Error("ast type is not babel");s=await n.transformFromAstAsync(r.astInfo.ast,r.sourceCode,o)}catch(r){throw r.code=config_1.BABEL_TRANS_JS_ERR,r.message=`file: ${e}\n ${r.message}`,r.path=e,r}if(!s)throw new Error("no trans result for callPostEnhance");let n=s.code;const l=s.map;t&&(n=n.replace(/^"use strict";/,""));const a=(0,babel_helper_1.collectBabelHelpers)(r.sourceCode),i=(0,babel_helper_1.replaceBabelHelpers)(n,a,e,o.babelRoot);return{code:i.transformCode,map:l,helpers:i.helpers}}async function babelTransformTS(e,r){let o;console.log("[backend] summer-typescript workerMethod");try{o=await babel7().transformAsync(e.sourceCode,{babelrc:!1,plugins:getTSTransformPluginsList(),sourceFileName:r,sourceMaps:!1,ast:!0,configFile:!1,code:!1})}catch(e){throw(0,customError_1.makeCustomError)(e,customError_1.CustomErrors.SUMMER_PLUGIN_CODE_ERR,r)}return{sourceCode:e.sourceCode,inputMap:e.inputMap,astInfo:{ast:o.ast,type:config_1.AstType.Babel}}}async function bableCompile(e,r,o){const t=babel7(),s=r.sourceCode.includes('"worklet"')||r.sourceCode.includes("'worklet'"),n=o.disableUseStrict||/^\s*\/\/\s?use strict disable;/i.test(r.sourceCode||""),l=[];e.endsWith(".ts")&&o.typescript&&l.push(...getTSTransformPluginsList()),s&&l.push([_pluginTransformWorklet()]),o.enhance&&l.push(...getEnhancePluginsList({})),l.push(...getES6ModulePluginsList(n));const a={babelrc:!1,sourceFileName:e,filename:e,configFile:!1,presets:o.enhance?getCommonPresets():[],plugins:l,inputSourceMap:r.inputMap,sourceMaps:!0,code:!0,ast:!1,cloneInputAst:!1};let i;try{i=await t.transformAsync(r.sourceCode,a)}catch(r){console.error(r,r.stack);const o=`file: ${e}\n ${r.message}`,t=new Error(o);throw t.code=config_1.BABEL_TRANS_JS_ERR,t}if(!i||!i.code)throw new Error("no trans result for bableCompile");let u=i.code;const c=i.map;n&&(u=u.replace(/^"use strict";/,""));const p=(0,babel_helper_1.collectBabelHelpers)(r.sourceCode),b=(0,babel_helper_1.replaceBabelHelpers)(u,p,e,o.babelRoot);return{code:b.transformCode,map:c,helpers:b.helpers}}
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.loadScriptFile=void 0;const tslib_1=require("tslib"),path_1=tslib_1.__importDefault(require("path")),config_1=require("../../../../../config/config"),inputsourcemap_1=require("../../utils/inputsourcemap");async function loadScriptFile(t,e,i,o){const r=Date.now(),a=path_1.default.relative(t.projectPath,i),l=t.getFile("",a).toString(),u=t.stat("",a),n=await(0,inputsourcemap_1.tryGetInputSourceMap)(l,i);return{targetPath:e,source:{sourceCode:l,inputMap:null!=n?n:void 0,astInfo:void 0,largeFile:l.length>=config_1.MAX_CODE_LENGTH,mtime:null==u?void 0:u.mtimeMs},process:[{cost:Date.now()-r,pluginName:o,action:"load"}]}}exports.loadScriptFile=loadScriptFile;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.loadScriptFile=loadScriptFile;const tslib_1=require("tslib"),path_1=tslib_1.__importDefault(require("path")),config_1=require("../../../../../config/config"),inputsourcemap_1=require("../../utils/inputsourcemap");async function loadScriptFile(t,e,i,o){const r=Date.now(),a=path_1.default.relative(t.projectPath,i),u=t.getFile("",a).toString(),l=t.stat("",a),n=await(0,inputsourcemap_1.tryGetInputSourceMap)(u,i);return{targetPath:e,source:{sourceCode:u,inputMap:null!=n?n:void 0,astInfo:void 0,largeFile:u.length>=config_1.MAX_CODE_LENGTH,mtime:null==l?void 0:l.mtimeMs},process:[{cost:Date.now()-r,pluginName:o,action:"load"}]}}
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.doCompress=void 0;const config_1=require("../../../../../config/config"),customError_1=require("../../../../../utils/customError"),terser=()=>require("terser"),babelCodeFrame=()=>require("babel-code-frame");async function doCompress(e,r){const{code:o,map:s}=r,c=s?{includeSources:!0,content:"string"==typeof s?JSON.parse(s):s,filename:e}:{includeSources:!0,content:void 0,filename:e},t=require("terser").minify(o,{toplevel:!0,compress:{drop_console:!1,drop_debugger:!1},sourceMap:c});if(t.error){const r=t.error,s=`file: ${e}\n ${t.error.message}\n ${require("babel-code-frame")(o,r.line,r.col>0?r.col:1)}`;throw(0,customError_1.makeCustomError)(s,config_1.UGLIFY_JS_ERR,e)}return{code:t.code,map:t.map}}exports.doCompress=doCompress;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.doCompress=doCompress;const config_1=require("../../../../../config/config"),customError_1=require("../../../../../utils/customError"),terser=()=>require("terser"),babelCodeFrame=()=>require("babel-code-frame");async function doCompress(e,r){const{code:o,map:s}=r,c=s?{includeSources:!0,content:"string"==typeof s?JSON.parse(s):s,filename:e}:{includeSources:!0,content:void 0,filename:e},t=require("terser").minify(o,{toplevel:!0,compress:{drop_console:!1,drop_debugger:!1},sourceMap:c});if(t.error){const r=t.error,s=`file: ${e}\n ${t.error.message}\n ${require("babel-code-frame")(o,r.line,r.col>0?r.col:1)}`;throw(0,customError_1.makeCustomError)(s,config_1.UGLIFY_JS_ERR,e)}return{code:t.code,map:t.map}}
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.swcCompileTask=void 0;const swc_helper_1=require("../../../../../utils/swc_helper"),swc=()=>require("@swc/core");async function swcCompileTask(e,s,r){var o,t;const i=r.disableUseStrict||/^\s*\/\/\s?use strict disable;/i.test(s.sourceCode||""),{swcRoot:c}=r,p=await require("@swc/core").transform(s.sourceCode,{jsc:{parser:Object.assign(Object.assign({},null===(o=r.rc)||void 0===o?void 0:o.parser),{syntax:e.endsWith("ts")?"typescript":"ecmascript"}),target:r.target,externalHelpers:!0,loose:!1,minify:{compress:{drop_console:!1,drop_debugger:!1},toplevel:!0}},module:Object.assign({type:"commonjs",strictMode:!i,noInterop:!0,allowTopLevelThis:i},null===(t=r.rc)||void 0===t?void 0:t.module),inputSourceMap:s.inputMap?JSON.stringify(s.inputMap):void 0,sourceMaps:!0,filename:e,minify:"dev"!==r.resultType&&r.minify}),a=(0,swc_helper_1.replaceSWCHelpers)(p.code,e,c);return{code:a.transformCode,map:p.map?JSON.parse(p.map):void 0,helpers:a.helpers}}exports.swcCompileTask=swcCompileTask;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.swcCompileTask=swcCompileTask;const swc_helper_1=require("../../../../../utils/swc_helper"),swc=()=>require("@swc/core");async function swcCompileTask(e,s,r){var o,t;const i=r.disableUseStrict||/^\s*\/\/\s?use strict disable;/i.test(s.sourceCode||""),{swcRoot:c}=r,p=await require("@swc/core").transform(s.sourceCode,{jsc:{parser:Object.assign(Object.assign({},null===(o=r.rc)||void 0===o?void 0:o.parser),{syntax:e.endsWith("ts")?"typescript":"ecmascript"}),target:r.target,externalHelpers:!0,loose:!1,minify:{compress:{drop_console:!1,drop_debugger:!1},toplevel:!0}},module:Object.assign({type:"commonjs",strictMode:!i,noInterop:!0,allowTopLevelThis:i},null===(t=r.rc)||void 0===t?void 0:t.module),inputSourceMap:s.inputMap?JSON.stringify(s.inputMap):void 0,sourceMaps:!0,filename:e,minify:"dev"!==r.resultType&&r.minify}),a=(0,swc_helper_1.replaceSWCHelpers)(p.code,e,c);return{code:a.transformCode,map:p.map?JSON.parse(p.map):void 0,helpers:a.helpers}}
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});const minify_script_task_1=require("./script_task/minify_script_task");function default_1(e){const t=e.setting.minified;return{name:"summer-terser",workerMethods:{doCompress:minify_script_task_1.doCompress},async compress(e,s){const r=e.targetPath;if(!t||"dev"===s.resultType||!r.endsWith(".js"))return e;const o=Date.now(),a=await this.runWorkerMethod("doCompress",r,{code:e.target.code,map:e.target.map});return Object.assign(Object.assign({},e),{target:Object.assign(Object.assign({},e.target),{code:a.code,map:a.map}),process:[...e.process,{cost:Date.now()-o,pluginName:"summer-terser",action:"compress"}]})}}}exports.default=default_1;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=default_1;const minify_script_task_1=require("./script_task/minify_script_task");function default_1(e){const t=e.setting.minified;return{name:"summer-terser",workerMethods:{doCompress:minify_script_task_1.doCompress},async compress(e,s){const r=e.targetPath;if(!t||"dev"===s.resultType||!r.endsWith(".js"))return e;const o=Date.now(),a=await this.runWorkerMethod("doCompress",r,{code:e.target.code,map:e.target.map});return Object.assign(Object.assign({},e),{target:Object.assign(Object.assign({},e.target),{code:a.code,map:a.map}),process:[...e.process,{cost:Date.now()-o,pluginName:"summer-terser",action:"compress"}]})}}}
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});const tslib_1=require("tslib"),path_1=tslib_1.__importDefault(require("path")),pluginconfig_1=require("../pluginconfig"),babel_script_task_1=require("./script_task/babel_script_task");function default_1(t){return{name:"summer-typescript",resolveExt:{js:"ts"},workerMethods:{async doLoad(t,e,s){const r={sourceCode:t,inputMap:s};return await(0,babel_script_task_1.babelTransformTS)(r,e)}},async load(e,s){if(!(0,pluginconfig_1.couldUseSWCMode)(t.setting)&&s.endsWith(".ts")){const r=Date.now(),a=path_1.default.relative(t.projectPath,s),i=t.getFile("",a).toString(),o=t.stat("",a),n=await this.runWorkerMethod("doLoad",i,s);return{targetPath:e,source:Object.assign(Object.assign({},n),{mtime:null==o?void 0:o.mtimeMs}),process:[{cost:Date.now()-r,pluginName:"summer-typescript",action:"load"}]}}}}}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")),pluginconfig_1=require("../pluginconfig"),babel_script_task_1=require("./script_task/babel_script_task");function default_1(t){return{name:"summer-typescript",resolveExt:{js:"ts"},workerMethods:{async doLoad(t,e,s){const r={sourceCode:t,inputMap:s};return await(0,babel_script_task_1.babelTransformTS)(r,e)}},async load(e,s){if(!(0,pluginconfig_1.couldUseSWCMode)(t.setting)&&s.endsWith(".ts")){const r=Date.now(),a=path_1.default.relative(t.projectPath,s),i=t.getFile("",a).toString(),o=t.stat("",a),n=await this.runWorkerMethod("doLoad",i,s);return{targetPath:e,source:Object.assign(Object.assign({},n),{mtime:null==o?void 0:o.mtimeMs}),process:[{cost:Date.now()-r,pluginName:"summer-typescript",action:"load"}]}}}}}
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});const config_1=require("../../../../config/config"),_pluginTransformWorklet=()=>require("../../../../utils/babel_plugin_worklet"),babel7=()=>require("@babel/core"),worklet=(e,r)=>{const o=babel7();let t;try{const s={babelrc:!1,plugins:[require("../../../../utils/babel_plugin_worklet")],sourceFileName:r,inputSourceMap:!1,configFile:!1,code:!1,ast:!0,cloneInputAst:!1};if(e.astInfo){if(e.astInfo.type!==config_1.AstType.Babel)throw new Error("ast type is not babel");t=o.transformFromAstSync(e.astInfo.ast,e.sourceCode,s)}else{if(null===e.sourceCode)throw new Error("source.targetCode is null");t=babel7().transform(e.sourceCode,s)}}catch(e){const o=`file: ${r}\n ${e.message}`,t=new Error(o);throw t.code=config_1.BABEL_TRANS_JS_ERR,t}return{sourceCode:e.sourceCode,inputMap:e.inputMap,astInfo:{ast:t.ast,type:config_1.AstType.Babel}}};function default_1(e,r){return{name:"summer-worklet",workerMethods:{worklet:worklet},async transform(e,r,o,{isBabelIgnore:t}){if(r.endsWith(".js")&&!t){const{source:r}=e;if(r.sourceCode.includes('"worklet"')||r.sourceCode.includes("'worklet'")){const t=Date.now(),s=await this.runWorkerMethod("worklet",r,o);return Object.assign(Object.assign({},e),{source:Object.assign(Object.assign({},e.source),s),process:[...e.process,{cost:Date.now()-t,pluginName:"summer-worklet",action:"transform"}]})}return e}return e}}}exports.default=default_1;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=default_1;const config_1=require("../../../../config/config"),_pluginTransformWorklet=()=>require("../../../../utils/babel_plugin_worklet"),babel7=()=>require("@babel/core"),worklet=(e,r)=>{const o=babel7();let t;try{const s={babelrc:!1,plugins:[require("../../../../utils/babel_plugin_worklet")],sourceFileName:r,inputSourceMap:!1,configFile:!1,code:!1,ast:!0,cloneInputAst:!1};if(e.astInfo){if(e.astInfo.type!==config_1.AstType.Babel)throw new Error("ast type is not babel");t=o.transformFromAstSync(e.astInfo.ast,e.sourceCode,s)}else{if(null===e.sourceCode)throw new Error("source.targetCode is null");t=babel7().transform(e.sourceCode,s)}}catch(e){const o=`file: ${r}\n ${e.message}`,t=new Error(o);throw t.code=config_1.BABEL_TRANS_JS_ERR,t}return{sourceCode:e.sourceCode,inputMap:e.inputMap,astInfo:{ast:t.ast,type:config_1.AstType.Babel}}};function default_1(e,r){return{name:"summer-worklet",workerMethods:{worklet:worklet},async transform(e,r,o,{isBabelIgnore:t}){if(r.endsWith(".js")&&!t){const{source:r}=e;if(r.sourceCode.includes('"worklet"')||r.sourceCode.includes("'worklet'")){const t=Date.now(),s=await this.runWorkerMethod("worklet",r,o);return Object.assign(Object.assign({},e),{source:Object.assign(Object.assign({},e.source),s),process:[...e.process,{cost:Date.now()-t,pluginName:"summer-worklet",action:"transform"}]})}return e}return e}}}
@@ -1 +1 @@
1
- "use strict";function ensureArray(r){return Array.isArray(r)?r.filter(Boolean):r?[r]:[]}Object.defineProperty(exports,"__esModule",{value:!0}),exports.ensureArray=void 0,exports.ensureArray=ensureArray;
1
+ "use strict";function ensureArray(r){return Array.isArray(r)?r.filter(Boolean):r?[r]:[]}Object.defineProperty(exports,"__esModule",{value:!0}),exports.ensureArray=ensureArray;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.tryGetInputSourceMap=void 0;const tslib_1=require("tslib"),path_1=tslib_1.__importDefault(require("path")),fs_extra_1=tslib_1.__importDefault(require("fs-extra")),jsonParse_1=require("../../../../utils/jsonParse"),sourcemap=()=>require("source-map"),insertSourcesContent=async(e,t)=>{if(Array.isArray(e.sources)&&!Array.isArray(e.sourcesContent)){const r=e.sourcesContent;try{const r=path_1.default.posix.dirname(t),s=[],{sources:a}=e;for(const e of a){const t=await fs_extra_1.default.readFile(path_1.default.posix.join(r,e),"utf-8");s.push(t)}e.sourcesContent=s}catch(t){e.sourcesContent=r}}};async function tryGetInputSourceMap(e,t){try{const r=/\/\/[#|@] sourceMappingURL=[\s]*(\S*)[\s]*$/m.exec(e),s=path_1.default.posix.dirname(t),a=path_1.default.posix.basename(t);let o;if(null==r?void 0:r[1])if(r[1].endsWith(".js.map"))o=await fs_extra_1.default.readFile(path_1.default.posix.join(s,r[1]),"utf-8");else{const e=r[1].split("base64,")[1];o=Buffer.from(e,"base64").toString()}else{const e=path_1.default.posix.join(s,a+".map");fs_extra_1.default.existsSync(e)&&(o=await fs_extra_1.default.readFile(e,"utf-8"))}if(o){const e=(0,jsonParse_1.jsonParse)(o);new(require("source-map").SourceMapConsumer)(e);return await insertSourcesContent(e,t),e}}catch(e){console.log(`try to get input sourcemap of ${t} catch error ${e}`)}}exports.tryGetInputSourceMap=tryGetInputSourceMap;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.tryGetInputSourceMap=tryGetInputSourceMap;const tslib_1=require("tslib"),path_1=tslib_1.__importDefault(require("path")),fs_extra_1=tslib_1.__importDefault(require("fs-extra")),jsonParse_1=require("../../../../utils/jsonParse"),sourcemap=()=>require("source-map"),insertSourcesContent=async(e,t)=>{if(Array.isArray(e.sources)&&!Array.isArray(e.sourcesContent)){const s=e.sourcesContent;try{const s=path_1.default.posix.dirname(t),r=[],{sources:a}=e;for(const e of a){const t=await fs_extra_1.default.readFile(path_1.default.posix.join(s,e),"utf-8");r.push(t)}e.sourcesContent=r}catch(t){e.sourcesContent=s}}};async function tryGetInputSourceMap(e,t){try{const s=/\/\/[#|@] sourceMappingURL=[\s]*(\S*)[\s]*$/m.exec(e),r=path_1.default.posix.dirname(t),a=path_1.default.posix.basename(t);let o;if(null==s?void 0:s[1])if(s[1].endsWith(".js.map"))o=await fs_extra_1.default.readFile(path_1.default.posix.join(r,s[1]),"utf-8");else{const e=s[1].split("base64,")[1];o=Buffer.from(e,"base64").toString()}else{const e=path_1.default.posix.join(r,a+".map");fs_extra_1.default.existsSync(e)&&(o=await fs_extra_1.default.readFile(e,"utf-8"))}if(o){const e=(0,jsonParse_1.jsonParse)(o);new(require("source-map").SourceMapConsumer)(e);return await insertSourcesContent(e,t),e}}catch(e){console.log(`try to get input sourcemap of ${t} catch error ${e}`)}}
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.runSummerPluginHook=void 0;const customError_1=require("../../../utils/customError"),summerCPProject_1=require("../../../project/summerCPProject"),index_1=require("../../precompiler/index"),initPlugin_1=require("./initPlugin");class PluginContainer{constructor(){this.initedPlugins=new Map}getPluginInstance(r,e,t){let n=this.initedPlugins.get(r);return n||(n=(0,initPlugin_1.initPlugin)(r,e,t),this.initedPlugins.set(r,n)),n}clear(){this.initedPlugins.clear()}}const pluginContainer=new PluginContainer;async function runSummerPluginHook(r){var e;if("clear"===r.command)return pluginContainer.clear(),{};const{plugin:t,projectInfo:n,pluginOption:i,method:o,args:u}=r,l=new summerCPProject_1.SummerCPProject(n);await l.ready();const{targetPlatform:s,targetPlatformDefines:a}=n,c=new index_1.PreCompiler(l,void 0,void 0),m=await c.getPreCompileProject({targetPlatform:s,targetPlatformDefines:a,runEnv:"worker cp"}),P=pluginContainer.getPluginInstance(t,m,i);if("runMethod"===r.command){const r=null===(e=P.workerMethods)||void 0===e?void 0:e[o];if(!r||"function"!=typeof r)throw new Error(`the ${r} is not a workerMethod of plugin(${t})`);try{return{result:await r(...u)}}catch(r){return{error:r instanceof customError_1.CustomError?r.toJSON():r}}}return{}}exports.runSummerPluginHook=runSummerPluginHook;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.runSummerPluginHook=runSummerPluginHook;const customError_1=require("../../../utils/customError"),summerCPProject_1=require("../../../project/summerCPProject"),index_1=require("../../precompiler/index"),initPlugin_1=require("./initPlugin");class PluginContainer{constructor(){this.initedPlugins=new Map}getPluginInstance(r,e,t){let n=this.initedPlugins.get(r);return n||(n=(0,initPlugin_1.initPlugin)(r,e,t),this.initedPlugins.set(r,n)),n}clear(){this.initedPlugins.clear()}}const pluginContainer=new PluginContainer;async function runSummerPluginHook(r){var e;if("clear"===r.command)return pluginContainer.clear(),{};const{plugin:t,projectInfo:n,pluginOption:i,method:o,args:u}=r,l=new summerCPProject_1.SummerCPProject(n);await l.ready();const{targetPlatform:s,targetPlatformDefines:a}=n,c=new index_1.PreCompiler(l,void 0,void 0),P=await c.getPreCompileProject({targetPlatform:s,targetPlatformDefines:a,runEnv:"worker cp"}),g=pluginContainer.getPluginInstance(t,P,i);if("runMethod"===r.command){const r=null===(e=g.workerMethods)||void 0===e?void 0:e[o];if(!r||"function"!=typeof r)throw new Error(`the ${r} is not a workerMethod of plugin(${t})`);try{return{result:await r(...u)}}catch(r){return{error:r instanceof customError_1.CustomError?r.toJSON():r}}}return{}}