miniprogram-ci 2.1.31 → 2.1.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +5 -0
- package/README.md +5 -0
- package/dist/@types/ci/checkCodeQuality.d.ts +1 -1
- package/dist/@types/ci/cloud/utils.d.ts +1 -1
- package/dist/@types/ci/code-analyse.d.ts +1 -1
- package/dist/@types/ci/cos-upload.d.ts +0 -1
- package/dist/@types/ci/getCompiledResult.d.ts +0 -1
- package/dist/@types/ci/utils/filterUnusedFile.d.ts +0 -1
- package/dist/@types/ci/utils/pack.d.ts +0 -1
- package/dist/@types/ci/utils/packfile.d.ts +0 -1
- package/dist/@types/ci/utils/tools.d.ts +1 -1
- package/dist/@types/ci/utils/wxvpkg/unpack/version0.d.ts +0 -1
- package/dist/@types/ci/utils/wxvpkg/unpack/version10.d.ts +0 -1
- package/dist/@types/common/code-analyse/index.d.ts +16 -1
- package/dist/@types/config/compiletype.config.d.ts +4 -4
- package/dist/@types/config/config.d.ts +1 -1
- package/dist/@types/config/dir.config.d.ts +17 -0
- package/dist/@types/config/url.config.d.ts +42 -42
- package/dist/@types/index.d.ts +6 -2
- package/dist/@types/modules/corecompiler/baseCompiler.d.ts +3 -4
- package/dist/@types/modules/corecompiler/original/compile/common.d.ts +0 -1
- package/dist/@types/modules/corecompiler/original/compile/game.d.ts +1 -1
- package/dist/@types/modules/corecompiler/original/compile/gamePlugin.d.ts +0 -1
- package/dist/@types/modules/corecompiler/original/compile/handler/mpjson.d.ts +0 -1
- package/dist/@types/modules/corecompiler/original/compile/index.d.ts +1 -1
- package/dist/@types/modules/corecompiler/original/compile/miniprogram.d.ts +0 -1
- package/dist/@types/modules/corecompiler/original/compile/miniprogramPlugin.d.ts +0 -1
- package/dist/@types/modules/corecompiler/original/index.d.ts +1 -1
- package/dist/@types/modules/corecompiler/original/js/index.d.ts +0 -1
- package/dist/@types/modules/corecompiler/original/protect/uglifyfilenames.d.ts +0 -1
- package/dist/@types/modules/corecompiler/original/webWorker/webWorkerManager.d.ts +0 -1
- package/dist/@types/modules/corecompiler/original/workerThread/childprocessManager.d.ts +1 -1
- package/dist/@types/modules/corecompiler/original/workerThread/config.d.ts +3 -0
- package/dist/@types/modules/corecompiler/original/workerThread/task/compilejs.d.ts +4 -2
- package/dist/@types/modules/corecompiler/original/workerThread/task/compilewxss.d.ts +0 -1
- package/dist/@types/modules/corecompiler/original/workerThread/task/func.d.ts +4 -0
- package/dist/@types/modules/corecompiler/original/workerThread/task/minifywxml.d.ts +0 -1
- package/dist/@types/modules/corecompiler/original/workerThread/workerManager.d.ts +8 -0
- package/dist/@types/modules/corecompiler/originalCompiler.d.ts +1 -1
- package/dist/@types/modules/corecompiler/summer/graph/appconf.d.ts +1 -1
- package/dist/@types/modules/corecompiler/summer/graph/gameconf.d.ts +1 -1
- package/dist/@types/modules/corecompiler/summer/pipeManager/index.d.ts +6 -0
- package/dist/@types/modules/corecompiler/summer/pipeManager/pipeCPProject.d.ts +17 -0
- package/dist/@types/modules/corecompiler/summer/pipeManager/pipeContext.d.ts +10 -0
- package/dist/@types/modules/corecompiler/summer/pipeManager/pipeManager.d.ts +12 -0
- package/dist/@types/modules/corecompiler/summer/pipeManager/pipeWorker.d.ts +2 -0
- package/dist/@types/modules/corecompiler/summer/pipeManager/pipes/appservicePipe/index.d.ts +3 -0
- package/dist/@types/modules/corecompiler/summer/pipeManager/pipes/compileWxmlToGlassEaselPipe.d.ts +3 -0
- package/dist/@types/modules/corecompiler/summer/pipeManager/pipes/compileWxssPipe.d.ts +3 -0
- package/dist/@types/modules/corecompiler/summer/pipeManager/pipes/index.d.ts +2 -0
- package/dist/@types/modules/corecompiler/summer/pipeManager/pipes/pageInitSourcePipe/index.d.ts +4 -0
- package/dist/@types/modules/corecompiler/summer/pipeManager/pipes/pageframePipe/index.d.ts +3 -0
- package/dist/@types/modules/corecompiler/summer/pipeManager/pipes/utils/appdevserver/getAppService.d.ts +6 -0
- package/dist/@types/modules/corecompiler/summer/pipeManager/pipes/utils/appdevserver/getwxappcode.d.ts +9 -0
- package/dist/@types/modules/corecompiler/summer/pipeManager/pipes/utils/appservice/getjsfile.d.ts +12 -0
- package/dist/@types/modules/corecompiler/summer/pipeManager/pipes/utils/appservice/getmainpkgsortedjsfiles.d.ts +11 -0
- package/dist/@types/modules/corecompiler/summer/pipeManager/pipes/utils/appservice/getwxappcode.d.ts +8 -0
- package/dist/@types/modules/corecompiler/summer/pipeManager/pipes/utils/common/apperrcode.config.d.ts +92 -0
- package/dist/@types/modules/corecompiler/summer/pipeManager/pipes/utils/common/tools.d.ts +1 -0
- package/dist/@types/modules/corecompiler/summer/pipeManager/pipes/utils/project/appconfig.d.ts +6 -0
- package/dist/@types/modules/corecompiler/summer/pipeManager/pipes/utils/project/appjson.d.ts +3 -0
- package/dist/@types/modules/corecompiler/summer/pipeManager/pipes/utils/project/customcomponent.d.ts +21 -0
- package/dist/@types/modules/corecompiler/summer/pipeManager/pipes/utils/project/helper/theme.d.ts +40 -0
- package/dist/@types/modules/corecompiler/summer/pipeManager/pipes/utils/project/pagejson.d.ts +3 -0
- package/dist/@types/modules/corecompiler/summer/pipeManager/pipes/utils/project/wxappcodejson.d.ts +3 -0
- package/dist/@types/modules/corecompiler/summer/pipeManager/pipes/utils/trans/transwxmltojs.d.ts +19 -0
- package/dist/@types/modules/corecompiler/summer/pipeManager/pipes/utils/trans/transwxsstojs.d.ts +15 -0
- package/dist/@types/modules/corecompiler/summer/pipeManager/pipes/utils/web/processPath.d.ts +9 -0
- package/dist/@types/modules/corecompiler/summer/pipeManager/pipes/wccPipe.d.ts +3 -0
- package/dist/@types/modules/corecompiler/summer/pipeManager/types.d.ts +100 -0
- package/dist/@types/modules/corecompiler/summer/plugins/less.d.ts +0 -1
- package/dist/@types/modules/corecompiler/summer/plugins/script_task/minify_script_task.d.ts +1 -1
- package/dist/@types/modules/corecompiler/summer/resolver.d.ts +1 -1
- package/dist/@types/modules/corecompiler/summerCompiler.d.ts +12 -3
- package/dist/@types/modules/index.d.ts +1 -1
- package/dist/@types/modules/nativecompiler/ios/buildCloud.d.ts +2 -2
- package/dist/@types/modules/nativecompiler/processHandler.d.ts +1 -1
- package/dist/@types/modules/precompiler/conditioncompile/compiler/base.d.ts +0 -1
- package/dist/@types/modules/precompiler/conditioncompile/compiler/json.d.ts +0 -1
- package/dist/@types/modules/precompiler/conditioncompile/compiler/macro.d.ts +0 -1
- package/dist/@types/modules/precompiler/conditioncompile/compiler/plant.d.ts +1 -2
- package/dist/@types/modules/precompiler/conditioncompile/index.d.ts +1 -2
- package/dist/@types/project/advance/precompileProject.d.ts +1 -2
- package/dist/@types/project/advance/reactiveProject.d.ts +1 -2
- package/dist/@types/project/baseProject.d.ts +4 -3
- package/dist/@types/project/ciProjectWithMockBuffer.d.ts +0 -1
- package/dist/@types/services/accountcard/accountcard.d.ts +18 -0
- package/dist/@types/services/accountcard/accountcardService.d.ts +0 -0
- package/dist/@types/services/app/ci/appDirService.d.ts +6 -0
- package/dist/@types/services/app/common/appDirService.d.ts +10 -0
- package/dist/@types/services/app/common/appDirService.devtools.d.ts +7 -0
- package/dist/@types/services/app/electron/appDirService.d.ts +3 -0
- package/dist/@types/services/app/node/appDirService.d.ts +6 -0
- package/dist/@types/services/app/nw/appDirService.d.ts +3 -0
- package/dist/@types/services/builder/common/builder.d.ts +22 -0
- package/dist/@types/services/builder/nw/builder.d.ts +15 -0
- package/dist/@types/services/builder/webide/builder.d.ts +4 -0
- package/dist/@types/services/common/extensions.d.ts +8 -0
- package/dist/@types/services/common/getservice.d.ts +27 -0
- package/dist/@types/services/common/librarybase.d.ts +2063 -0
- package/dist/@types/services/common/vsbase.d.ts +3 -0
- package/dist/@types/services/compilewxml/common/compilewxmlService.d.ts +41 -0
- package/dist/@types/services/compilewxml/electron/compilewxmlService.d.ts +5 -0
- package/dist/@types/services/compilewxml/node/compileUtils.d.ts +3 -0
- package/dist/@types/services/compilewxml/node/compileglasseasel.d.ts +14 -0
- package/dist/@types/services/compilewxml/nw/compilewxmlService.d.ts +5 -0
- package/dist/@types/services/compilewxml/webide/compilewxmlService.d.ts +5 -0
- package/dist/@types/services/compilewxml/webide/pageFrameWasm/wcc/runWcc.d.ts +3 -0
- package/dist/@types/services/compilewxss/common/compilewxssService.d.ts +15 -0
- package/dist/@types/services/compilewxss/electron/compilewxssService.d.ts +4 -0
- package/dist/@types/services/compilewxss/node/compileUtils.d.ts +2 -0
- package/dist/@types/services/compilewxss/nw/compilewxssService.d.ts +4 -0
- package/dist/@types/services/compilewxss/webide/compilewxssService.d.ts +4 -0
- package/dist/@types/services/compilewxss/webide/pageFrameWasm/wcsc/runWcsc.d.ts +3 -0
- package/dist/@types/services/consoledisplay/common/consoledisplay.d.ts +5 -0
- package/dist/@types/services/consoledisplay/nw/consoledisplay.d.ts +6 -0
- package/dist/@types/services/fileUtilsManager/common/fileUtilsManager.d.ts +5 -0
- package/dist/@types/services/fileUtilsManager/nw/fileUtilsManager.d.ts +6 -0
- package/dist/@types/services/fs/common/fileService.d.ts +28 -0
- package/dist/@types/services/genTempFile/common/genTempFile.devtools.d.ts +4 -0
- package/dist/@types/services/genTempFile/common/genTempFile.node.d.ts +4 -0
- package/dist/@types/services/genTempFile/common/genTempFileService.d.ts +4 -0
- package/dist/@types/services/genTempFile/electron/genTempFileService.d.ts +3 -0
- package/dist/@types/services/genTempFile/node/genTempFileService.d.ts +3 -0
- package/dist/@types/services/genTempFile/nw/genTempFileService.d.ts +3 -0
- package/dist/@types/services/global/common/global.d.ts +10 -0
- package/dist/@types/services/global/nw/global.d.ts +12 -0
- package/dist/@types/services/initializeCheck/common/initializeCheck.d.ts +21 -0
- package/dist/@types/services/initializeCheck/nw/initializeCheck.d.ts +4 -0
- package/dist/@types/services/initializeCheck/webide/initializeCheck.d.ts +0 -0
- package/dist/@types/services/locales/common/locales.d.ts +7 -0
- package/dist/@types/services/locales/nw/locales.d.ts +9 -0
- package/dist/@types/services/log/common/logService.d.ts +9 -0
- package/dist/@types/services/miniappjson/common/miniappjson.d.ts +5 -0
- package/dist/@types/services/miniappjson/electron/miniappjson.d.ts +6 -0
- package/dist/@types/services/miniappjson/nw/miniappjson.d.ts +6 -0
- package/dist/@types/services/miniappjson/webide/miniappjson.d.ts +4 -0
- package/dist/@types/services/multiTaskManager/ci/multiTaskManager.d.ts +5 -0
- package/dist/@types/services/multiTaskManager/common/multiTaskManager.d.ts +5 -0
- package/dist/@types/services/multiTaskManager/electron/multiTaskManager.d.ts +5 -0
- package/dist/@types/services/multiTaskManager/webide/multiTaskManager.d.ts +5 -0
- package/dist/@types/services/nativeModule/ci/nativeModule.d.ts +3 -0
- package/dist/@types/services/nativeModule/common/nativeModule.d.ts +9 -0
- package/dist/@types/services/nativeModule/common/nativeModule.impl.d.ts +13 -0
- package/dist/@types/services/nativeModule/electron/nativeModule.d.ts +3 -0
- package/dist/@types/services/nativeModule/nw/nativeModule.d.ts +3 -0
- package/dist/@types/services/partialcompile/common/parialcompile.impl.d.ts +0 -0
- package/dist/@types/services/partialcompile/common/partialcompile.d.ts +0 -0
- package/dist/@types/services/partialcompile/nw/partialcompile.d.ts +0 -0
- package/dist/@types/services/partialcompile/webide/partialcompile.d.ts +0 -0
- package/dist/@types/services/performance/common/performance.d.ts +9 -0
- package/dist/@types/services/performance/nw/performance.d.ts +9 -0
- package/dist/@types/services/performance/webide/performance.d.ts +7 -0
- package/dist/@types/services/pluginFileReader/ci/pluginFileReader.d.ts +3 -0
- package/dist/@types/services/pluginFileReader/common/pluginFileReader.base.d.ts +9 -0
- package/dist/@types/services/pluginFileReader/common/pluginFileReader.d.ts +12 -0
- package/dist/@types/services/pluginFileReader/electron/pluginFileReader.d.ts +3 -0
- package/dist/@types/services/pluginFileReader/webide/pluginFileReader.d.ts +9 -0
- package/dist/@types/services/project/common/cloudProjectService.d.ts +0 -0
- package/dist/@types/services/project/common/createProjectService.d.ts +0 -0
- package/dist/@types/services/project/common/project.helper.d.ts +0 -0
- package/dist/@types/services/project/common/projectConfigService.d.ts +0 -0
- package/dist/@types/services/project/common/projectFileService.d.ts +0 -0
- package/dist/@types/services/project/common/projectconfigjsonutils.d.ts +0 -0
- package/dist/@types/services/project/electron-backend/projectManagerService.d.ts +0 -0
- package/dist/@types/services/project/node/createProjectService.d.ts +0 -0
- package/dist/@types/services/project/node/projectConfigService.d.ts +0 -0
- package/dist/@types/services/project/node/projectManagerService.d.ts +0 -0
- package/dist/@types/services/project/web/projectManagerService.d.ts +0 -0
- package/dist/@types/services/project/webide/projectConfigService.d.ts +0 -0
- package/dist/@types/services/project/webide/projectFileService.d.ts +0 -0
- package/dist/@types/services/project/webide/projectManagerService.d.ts +0 -0
- package/dist/@types/services/projectManager/common/buildServerProjectManager.d.ts +5 -0
- package/dist/@types/services/projectManager/common/projectManager.d.ts +7 -0
- package/dist/@types/services/projectManager/nw/projectManager.d.ts +9 -0
- package/dist/@types/services/root/ci/root.d.ts +11 -0
- package/dist/@types/services/root/ci/rootService.d.ts +2 -0
- package/dist/@types/services/root/common/createService.d.ts +12 -0
- package/dist/@types/services/root/electron/root.d.ts +11 -0
- package/dist/@types/services/root/electron/rootService.d.ts +2 -0
- package/dist/@types/services/root/nw/root.d.ts +11 -0
- package/dist/@types/services/root/nw/rootService.d.ts +0 -0
- package/dist/@types/services/root/webide/root.d.ts +11 -0
- package/dist/@types/services/root/webide/rootService.d.ts +2 -0
- package/dist/@types/services/staticConfig/common/staticConfigService.d.ts +5 -0
- package/dist/@types/services/staticConfig/nw/staticConfigService.d.ts +6 -0
- package/dist/@types/services/store/common/storeService.d.ts +17 -0
- package/dist/@types/services/uniapp/common/uniapp.d.ts +5 -0
- package/dist/@types/services/uniapp/nw/uniapp.d.ts +9 -0
- package/dist/@types/services/uniapp/webide/uniapp.d.ts +4 -0
- package/dist/@types/services/vendor/common/utils.d.ts +0 -0
- package/dist/@types/services/vendor/common/vendorService.d.ts +0 -0
- package/dist/@types/services/vendor/node/vendorService.d.ts +0 -0
- package/dist/@types/services/vendor/webide/vendorService.d.ts +0 -0
- package/dist/@types/types/ci.d.ts +1 -2
- package/dist/@types/types/core.d.ts +1 -2
- package/dist/@types/types/devtools.d.ts +0 -1
- package/dist/@types/types/summer.d.ts +0 -1
- package/dist/@types/utils/colorutils.d.ts +4 -0
- package/dist/@types/utils/common.d.ts +3 -1
- package/dist/@types/utils/cosUpload.d.ts +0 -1
- package/dist/@types/utils/debug.d.ts +1 -0
- package/dist/@types/utils/error.d.ts +1 -1
- package/dist/@types/utils/fsagent.d.ts +4 -4
- package/dist/@types/utils/locales/locales.d.ts +2 -114
- package/dist/@types/utils/locales/zh.d.ts +114 -113
- package/dist/@types/utils/miniappJson.d.ts +1 -1
- package/dist/@types/utils/node/common.d.ts +1 -0
- package/dist/@types/utils/packOptionsHelper.d.ts +1 -1
- package/dist/@types/utils/processBootstrap.d.ts +7 -0
- package/dist/@types/utils/signature.d.ts +0 -1
- package/dist/@types/utils/singletontask.d.ts +1 -0
- package/dist/@types/utils/subprocess/processManager.d.ts +1 -0
- package/dist/@types/utils/taskqueue.d.ts +0 -1
- package/dist/@types/utils/taskstatus.d.ts +1 -1
- package/dist/@types/utils/tools.d.ts +3 -4
- package/dist/@types/utils/web/common.d.ts +1 -0
- package/dist/@types/utils/wxapkg/pack.d.ts +2 -3
- package/dist/@types/utils/wxvpkgreader/wxvpkg/reader/version0.d.ts +0 -1
- package/dist/@types/utils/wxvpkgreader/wxvpkg/reader/version10.d.ts +0 -1
- package/dist/@types/utils/wxvpkgreader/wxvpkg/unpack/version0.d.ts +0 -1
- package/dist/@types/utils/wxvpkgreader/wxvpkg/unpack/version10.d.ts +0 -1
- package/dist/@types/utils/wxvpkgreader/wxvpkgreader.d.ts +0 -1
- package/dist/ci/android-miniapp-toolkit/dist/index.js +1 -1
- package/dist/ci/build-apk.js +1 -1
- package/dist/ci/build-ipa.js +1 -1
- package/dist/ci/checkCodeQuality.js +1 -1
- package/dist/ci/cloud/cloudapi.js +1 -1
- package/dist/ci/cloud/createTimeTrigger.js +1 -1
- package/dist/ci/cloud/uploadContainer.js +1 -1
- package/dist/ci/cloud/uploadFile.js +1 -1
- package/dist/ci/cloud/uploadFunction.js +1 -1
- package/dist/ci/cloud/utils.js +1 -1
- package/dist/ci/code-analyse.js +1 -1
- package/dist/ci/cos-upload.js +1 -1
- package/dist/ci/gamepkg/apkplug.js +1 -1
- package/dist/ci/gamepkg/index.js +1 -1
- package/dist/ci/getCompiledResult.js +1 -1
- package/dist/ci/getDevSourceMap.js +1 -1
- package/dist/ci/getLatestVersion.js +1 -1
- package/dist/ci/getcompiler.js +1 -1
- package/dist/ci/index.js +1 -1
- package/dist/ci/jsserver.js +1 -1
- package/dist/ci/miniapp/androidCloudBuild.js +1 -1
- package/dist/ci/miniapp/archive.js +1 -1
- package/dist/ci/miniapp/checkBuildArgument.js +1 -1
- package/dist/ci/miniapp/iosCloudBuild.js +1 -1
- package/dist/ci/miniapp/miniappPlugin.js +1 -1
- package/dist/ci/miniapp/sdkManager.js +1 -1
- package/dist/ci/miniapp/upload.js +1 -1
- package/dist/ci/miniapp-cloud-upload.js +1 -1
- package/dist/ci/miniappattr.js +1 -1
- package/dist/ci/preview.js +1 -1
- package/dist/ci/projectattr.js +1 -1
- package/dist/ci/upload.js +1 -1
- package/dist/ci/utils/ciRequest.js +1 -1
- package/dist/ci/utils/codeDenpendencyQualityChecker.js +1 -1
- package/dist/ci/utils/filterUnusedFile.js +1 -1
- package/dist/ci/utils/pack.js +1 -1
- package/dist/ci/utils/packfile.js +1 -1
- package/dist/ci/utils/terminalQrcode.js +1 -1
- package/dist/ci/utils/tools.js +1 -1
- package/dist/ci/utils/unpack.js +1 -1
- package/dist/ci/utils/wxvpkg/unpack/version0.js +1 -1
- package/dist/ci/utils/wxvpkg/unpack/version10.js +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/common/code-analyse/index.js +1 -1
- package/dist/config/config.js +1 -1
- package/dist/config/dir.config.js +1 -0
- package/dist/config/url.config.js +1 -1
- package/dist/index.js +1 -1
- package/dist/modules/corecompiler/baseCompiler.js +1 -1
- package/dist/modules/corecompiler/original/analyse/partial.js +1 -1
- package/dist/modules/corecompiler/original/compile/common.js +1 -1
- package/dist/modules/corecompiler/original/compile/game.js +1 -1
- package/dist/modules/corecompiler/original/compile/gamePlugin.js +1 -1
- package/dist/modules/corecompiler/original/compile/handler/js.js +1 -1
- package/dist/modules/corecompiler/original/compile/handler/mpjson.js +1 -1
- package/dist/modules/corecompiler/original/compile/handler/wxml.js +1 -1
- package/dist/modules/corecompiler/original/compile/handler/wxss.js +1 -1
- package/dist/modules/corecompiler/original/compile/index.js +1 -1
- package/dist/modules/corecompiler/original/compile/miniprogram.js +1 -1
- package/dist/modules/corecompiler/original/compile/miniprogramPlugin.js +1 -1
- package/dist/modules/corecompiler/original/index.js +1 -1
- package/dist/modules/corecompiler/original/js/enhance.js +1 -1
- package/dist/modules/corecompiler/original/js/es6Transform.js +1 -1
- package/dist/modules/corecompiler/original/js/generateMap.js +1 -1
- package/dist/modules/corecompiler/original/js/index.js +1 -1
- package/dist/modules/corecompiler/original/js/minifyjs.js +1 -1
- package/dist/modules/corecompiler/original/js/minifyjsAfterWrap.js +1 -1
- package/dist/modules/corecompiler/original/js/workletCompile.js +1 -1
- package/dist/modules/corecompiler/original/json/app/appJSON.js +1 -1
- package/dist/modules/corecompiler/original/json/app/checkAppFields.js +1 -1
- package/dist/modules/corecompiler/original/json/app/extJSON.js +1 -1
- package/dist/modules/corecompiler/original/json/app/index.js +1 -1
- package/dist/modules/corecompiler/original/json/common.js +1 -1
- package/dist/modules/corecompiler/original/json/game.js +1 -1
- package/dist/modules/corecompiler/original/json/page/checkPageJSON.js +1 -1
- package/dist/modules/corecompiler/original/json/page/getPageJSON.js +1 -1
- package/dist/modules/corecompiler/original/json/plugin/plugin.js +1 -1
- package/dist/modules/corecompiler/original/json/plugin/pluginPage.js +1 -1
- package/dist/modules/corecompiler/original/json/projectconfig.js +1 -1
- package/dist/modules/corecompiler/original/json/reactiveCache.js +1 -1
- package/dist/modules/corecompiler/original/json/signaturejson.js +1 -1
- package/dist/modules/corecompiler/original/json/sitemap.js +1 -1
- package/dist/modules/corecompiler/original/json/theme.js +1 -1
- package/dist/modules/corecompiler/original/npm/filterdeps.js +1 -1
- package/dist/modules/corecompiler/original/npm/packnpm.js +1 -1
- package/dist/modules/corecompiler/original/protect/fileFlatter.js +1 -1
- package/dist/modules/corecompiler/original/protect/uglifyfilenames.js +1 -1
- package/dist/modules/corecompiler/original/utils/logger.js +1 -1
- package/dist/modules/corecompiler/original/validate/schemaValidate.js +1 -1
- package/dist/modules/corecompiler/original/validate/validate.js +1 -1
- package/dist/modules/corecompiler/original/webWorker/configs.js +1 -1
- package/dist/modules/corecompiler/original/workerThread/childprocess.js +1 -1
- package/dist/modules/corecompiler/original/workerThread/childprocessManager.js +1 -1
- package/dist/modules/corecompiler/original/workerThread/config.js +1 -1
- package/dist/modules/corecompiler/original/workerThread/fork.js +1 -1
- package/dist/modules/corecompiler/original/workerThread/getWorkerPoolSize.js +1 -1
- package/dist/modules/corecompiler/original/workerThread/index.js +1 -1
- package/dist/modules/corecompiler/original/workerThread/task/call_func.js +1 -1
- package/dist/modules/corecompiler/original/workerThread/task/compilejs.js +1 -1
- package/dist/modules/corecompiler/original/workerThread/task/compilewxss.js +1 -1
- package/dist/modules/corecompiler/original/workerThread/task/func.js +1 -1
- package/dist/modules/corecompiler/original/workerThread/task/index.js +1 -1
- package/dist/modules/corecompiler/original/workerThread/task/minifywxml.js +1 -1
- package/dist/modules/corecompiler/original/workerThread/worker.js +1 -1
- package/dist/modules/corecompiler/original/workerThread/workerManager.js +1 -1
- package/dist/modules/corecompiler/originalCompiler.js +1 -1
- package/dist/modules/corecompiler/processHandler.js +1 -1
- package/dist/modules/corecompiler/summer/graph/appconf.js +1 -1
- package/dist/modules/corecompiler/summer/graph/appgraph.js +1 -1
- package/dist/modules/corecompiler/summer/graph/basegraph.js +1 -1
- package/dist/modules/corecompiler/summer/graph/gameconf.js +1 -1
- package/dist/modules/corecompiler/summer/graph/gamegraph.js +1 -1
- package/dist/modules/corecompiler/summer/graph/gamepluginconf.js +1 -1
- package/dist/modules/corecompiler/summer/graph/gameplugingraph.js +1 -1
- package/dist/modules/corecompiler/summer/graph/pluginconf.js +1 -1
- package/dist/modules/corecompiler/summer/graph/plugingraph.js +1 -1
- package/dist/modules/corecompiler/summer/graph/util.js +1 -1
- package/dist/modules/corecompiler/summer/index.js +1 -1
- package/dist/modules/corecompiler/summer/initPlugin.js +1 -1
- package/dist/modules/corecompiler/summer/module.js +1 -1
- package/dist/modules/corecompiler/summer/persistCache.js +1 -1
- package/dist/modules/corecompiler/summer/pipeManager/index.js +1 -0
- package/dist/modules/corecompiler/summer/pipeManager/pipeCPProject.js +1 -0
- package/dist/modules/corecompiler/summer/pipeManager/pipeContext.js +1 -0
- package/dist/modules/corecompiler/summer/pipeManager/pipeManager.js +1 -0
- package/dist/modules/corecompiler/summer/pipeManager/pipeWorker.js +1 -0
- package/dist/modules/corecompiler/summer/pipeManager/pipes/appservicePipe/index.js +1 -0
- package/dist/modules/corecompiler/summer/pipeManager/pipes/compileWxmlToGlassEaselPipe.js +1 -0
- package/dist/modules/corecompiler/summer/pipeManager/pipes/compileWxssPipe.js +1 -0
- package/dist/modules/corecompiler/summer/pipeManager/pipes/index.js +1 -0
- package/dist/modules/corecompiler/summer/pipeManager/pipes/pageInitSourcePipe/index.js +1 -0
- package/dist/modules/corecompiler/summer/pipeManager/pipes/pageframePipe/index.js +1 -0
- package/dist/modules/corecompiler/summer/pipeManager/pipes/utils/appdevserver/getAppService.js +1 -0
- package/dist/modules/corecompiler/summer/pipeManager/pipes/utils/appdevserver/getwxappcode.js +1 -0
- package/dist/modules/corecompiler/summer/pipeManager/pipes/utils/appservice/getjsfile.js +1 -0
- package/dist/modules/corecompiler/summer/pipeManager/pipes/utils/appservice/getmainpkgsortedjsfiles.js +1 -0
- package/dist/modules/corecompiler/summer/pipeManager/pipes/utils/appservice/getwxappcode.js +1 -0
- package/dist/modules/corecompiler/summer/pipeManager/pipes/utils/common/apperrcode.config.js +1 -0
- package/dist/modules/corecompiler/summer/pipeManager/pipes/utils/common/tools.js +1 -0
- package/dist/modules/corecompiler/summer/pipeManager/pipes/utils/project/appconfig.js +1 -0
- package/dist/modules/corecompiler/summer/pipeManager/pipes/utils/project/appjson.js +1 -0
- package/dist/modules/corecompiler/summer/pipeManager/pipes/utils/project/customcomponent.js +1 -0
- package/dist/modules/corecompiler/summer/pipeManager/pipes/utils/project/helper/theme.js +1 -0
- package/dist/modules/corecompiler/summer/pipeManager/pipes/utils/project/pagejson.js +1 -0
- package/dist/modules/corecompiler/summer/pipeManager/pipes/utils/project/wxappcodejson.js +1 -0
- package/dist/modules/corecompiler/summer/pipeManager/pipes/utils/trans/transwxmltojs.js +1 -0
- package/dist/modules/corecompiler/summer/pipeManager/pipes/utils/trans/transwxsstojs.js +1 -0
- package/dist/modules/corecompiler/summer/pipeManager/pipes/utils/web/processPath.js +1 -0
- package/dist/modules/corecompiler/summer/pipeManager/pipes/wccPipe.js +1 -0
- package/dist/modules/corecompiler/summer/pipeManager/types.js +1 -0
- package/dist/modules/corecompiler/summer/pluginDriver.js +1 -1
- package/dist/modules/corecompiler/summer/pluginconfig.js +1 -1
- package/dist/modules/corecompiler/summer/plugins/base/es6module.js +1 -1
- package/dist/modules/corecompiler/summer/plugins/base/javascript.js +1 -1
- package/dist/modules/corecompiler/summer/plugins/base/swc.js +1 -1
- package/dist/modules/corecompiler/summer/plugins/base/wxss.js +1 -1
- package/dist/modules/corecompiler/summer/plugins/enhance.js +1 -1
- package/dist/modules/corecompiler/summer/plugins/filetask/script.js +1 -1
- package/dist/modules/corecompiler/summer/plugins/less.js +1 -1
- package/dist/modules/corecompiler/summer/plugins/minifywxml.js +1 -1
- package/dist/modules/corecompiler/summer/plugins/sass.js +1 -1
- package/dist/modules/corecompiler/summer/plugins/script_task/babel_script_task.js +1 -1
- package/dist/modules/corecompiler/summer/plugins/script_task/load_script_task.js +1 -1
- package/dist/modules/corecompiler/summer/plugins/script_task/minify_script_task.js +1 -1
- package/dist/modules/corecompiler/summer/plugins/script_task/swc_task.js +1 -1
- package/dist/modules/corecompiler/summer/plugins/terser.js +1 -1
- package/dist/modules/corecompiler/summer/plugins/typescript.js +1 -1
- package/dist/modules/corecompiler/summer/plugins/worklet.js +1 -1
- package/dist/modules/corecompiler/summer/resolver.js +1 -1
- package/dist/modules/corecompiler/summer/summer.js +1 -1
- package/dist/modules/corecompiler/summer/utils/async.js +1 -1
- package/dist/modules/corecompiler/summer/utils/ensureArray.js +1 -1
- package/dist/modules/corecompiler/summer/utils/inputsourcemap.js +1 -1
- package/dist/modules/corecompiler/summer/worker.js +1 -1
- package/dist/modules/corecompiler/summerCompiler.js +1 -1
- package/dist/modules/corecompiler/summerEntryProcess.js +1 -1
- package/dist/modules/createSummer.js +1 -1
- package/dist/modules/fullcompiler/app/app.js +1 -1
- package/dist/modules/fullcompiler/app/contactandlaunch/updateContactForSubpkg.js +1 -1
- package/dist/modules/fullcompiler/app/contactandlaunch/updatecontactandlaunch.js +1 -1
- package/dist/modules/index.js +1 -1
- package/dist/modules/nativecompiler/android/adb.js +1 -1
- package/dist/modules/nativecompiler/android/device.js +1 -1
- package/dist/modules/nativecompiler/android/index.js +1 -1
- package/dist/modules/nativecompiler/android/projectconfig.js +1 -1
- package/dist/modules/nativecompiler/index.js +1 -1
- package/dist/modules/nativecompiler/ios/buildCloud.js +1 -1
- package/dist/modules/nativecompiler/ios/device.js +1 -1
- package/dist/modules/nativecompiler/ios/index.js +1 -1
- package/dist/modules/nativecompiler/ios/projectconfig.js +1 -1
- package/dist/modules/nativecompiler/nativeEntryProcess.js +1 -1
- package/dist/modules/nativecompiler/processHandler.js +1 -1
- package/dist/modules/precompiler/conditioncompile/compiler/json.js +1 -1
- package/dist/modules/precompiler/conditioncompile/compiler/macro.js +1 -1
- package/dist/modules/precompiler/conditioncompile/index.js +1 -1
- package/dist/project/advance/precompileProject.js +1 -1
- package/dist/project/advance/reactiveProject.js +1 -1
- package/dist/project/baseProject.js +1 -1
- package/dist/project/ciProjectWithMockBuffer.js +1 -1
- package/dist/project/summerCPProject.js +1 -1
- package/dist/services/accountcard/accountcard.js +1 -0
- package/dist/services/accountcard/accountcardService.js +1 -0
- package/dist/services/app/ci/appDirService.js +1 -0
- package/dist/services/app/common/appDirService.devtools.js +1 -0
- package/dist/services/app/common/appDirService.js +1 -0
- package/dist/services/app/electron/appDirService.js +1 -0
- package/dist/services/app/node/appDirService.js +1 -0
- package/dist/services/app/nw/appDirService.js +1 -0
- package/dist/services/builder/common/builder.js +1 -0
- package/dist/services/builder/nw/builder.js +1 -0
- package/dist/services/builder/webide/builder.js +1 -0
- package/dist/services/common/extensions.js +1 -0
- package/dist/services/common/getservice.js +1 -0
- package/dist/services/common/librarybase.js +1 -0
- package/dist/services/common/vsbase.js +1 -0
- package/dist/services/compilewxml/common/compilewxmlService.js +1 -0
- package/dist/services/compilewxml/electron/compilewxmlService.js +1 -0
- package/dist/services/compilewxml/node/compileUtils.js +1 -0
- package/dist/services/compilewxml/node/compileglasseasel.js +1 -0
- package/dist/services/compilewxml/nw/compilewxmlService.js +1 -0
- package/dist/services/compilewxml/webide/compilewxmlService.js +1 -0
- package/dist/services/compilewxml/webide/pageFrameWasm/wcc/runWcc.js +1 -0
- package/dist/services/compilewxss/common/compilewxssService.js +1 -0
- package/dist/services/compilewxss/electron/compilewxssService.js +1 -0
- package/dist/services/compilewxss/node/compileUtils.js +1 -0
- package/dist/services/compilewxss/nw/compilewxssService.js +1 -0
- package/dist/services/compilewxss/webide/compilewxssService.js +1 -0
- package/dist/services/compilewxss/webide/pageFrameWasm/wcsc/runWcsc.js +1 -0
- package/dist/services/consoledisplay/common/consoledisplay.js +1 -0
- package/dist/services/consoledisplay/nw/consoledisplay.js +1 -0
- package/dist/services/fileUtilsManager/common/fileUtilsManager.js +1 -0
- package/dist/services/fileUtilsManager/nw/fileUtilsManager.js +1 -0
- package/dist/services/fs/common/fileService.js +1 -0
- package/dist/services/genTempFile/common/genTempFile.devtools.js +1 -0
- package/dist/services/genTempFile/common/genTempFile.node.js +1 -0
- package/dist/services/genTempFile/common/genTempFileService.js +1 -0
- package/dist/services/genTempFile/electron/genTempFileService.js +1 -0
- package/dist/services/genTempFile/node/genTempFileService.js +1 -0
- package/dist/services/genTempFile/nw/genTempFileService.js +1 -0
- package/dist/services/global/common/global.js +1 -0
- package/dist/services/global/nw/global.js +1 -0
- package/dist/services/initializeCheck/common/initializeCheck.js +1 -0
- package/dist/services/initializeCheck/nw/initializeCheck.js +1 -0
- package/dist/services/initializeCheck/webide/initializeCheck.js +1 -0
- package/dist/services/locales/common/locales.js +1 -0
- package/dist/services/locales/nw/locales.js +1 -0
- package/dist/services/log/common/logService.js +1 -0
- package/dist/services/miniappjson/common/miniappjson.js +1 -0
- package/dist/services/miniappjson/electron/miniappjson.js +1 -0
- package/dist/services/miniappjson/nw/miniappjson.js +1 -0
- package/dist/services/miniappjson/webide/miniappjson.js +1 -0
- package/dist/services/multiTaskManager/ci/multiTaskManager.js +1 -0
- package/dist/services/multiTaskManager/common/multiTaskManager.js +1 -0
- package/dist/services/multiTaskManager/electron/multiTaskManager.js +1 -0
- package/dist/services/multiTaskManager/webide/multiTaskManager.js +1 -0
- package/dist/services/nativeModule/ci/nativeModule.js +1 -0
- package/dist/services/nativeModule/common/nativeModule.impl.js +1 -0
- package/dist/services/nativeModule/common/nativeModule.js +1 -0
- package/dist/services/nativeModule/electron/nativeModule.js +1 -0
- package/dist/services/nativeModule/nw/nativeModule.js +1 -0
- package/dist/services/partialcompile/common/parialcompile.impl.js +1 -0
- package/dist/services/partialcompile/common/partialcompile.js +1 -0
- package/dist/services/partialcompile/nw/partialcompile.js +1 -0
- package/dist/services/partialcompile/webide/partialcompile.js +1 -0
- package/dist/services/performance/common/performance.js +1 -0
- package/dist/services/performance/nw/performance.js +1 -0
- package/dist/services/performance/webide/performance.js +1 -0
- package/dist/services/pluginFileReader/ci/pluginFileReader.js +1 -0
- package/dist/services/pluginFileReader/common/pluginFileReader.base.js +1 -0
- package/dist/services/pluginFileReader/common/pluginFileReader.js +1 -0
- package/dist/services/pluginFileReader/electron/pluginFileReader.js +1 -0
- package/dist/services/pluginFileReader/webide/pluginFileReader.js +1 -0
- package/dist/services/project/common/cloudProjectService.js +1 -0
- package/dist/services/project/common/createProjectService.js +1 -0
- package/dist/services/project/common/project.helper.js +1 -0
- package/dist/services/project/common/projectConfigService.js +1 -0
- package/dist/services/project/common/projectFileService.js +1 -0
- package/dist/services/project/common/projectconfigjsonutils.js +1 -0
- package/dist/services/project/electron-backend/projectManagerService.js +1 -0
- package/dist/services/project/node/createProjectService.js +1 -0
- package/dist/services/project/node/projectConfigService.js +1 -0
- package/dist/services/project/node/projectManagerService.js +1 -0
- package/dist/services/project/web/projectManagerService.js +1 -0
- package/dist/services/project/webide/projectConfigService.js +1 -0
- package/dist/services/project/webide/projectFileService.js +1 -0
- package/dist/services/project/webide/projectManagerService.js +1 -0
- package/dist/services/projectManager/common/buildServerProjectManager.js +1 -0
- package/dist/services/projectManager/common/projectManager.js +1 -0
- package/dist/services/projectManager/nw/projectManager.js +1 -0
- package/dist/services/root/ci/root.js +1 -0
- package/dist/services/root/ci/rootService.js +1 -0
- package/dist/services/root/common/createService.js +1 -0
- package/dist/services/root/electron/root.js +1 -0
- package/dist/services/root/electron/rootService.js +1 -0
- package/dist/services/root/nw/root.js +1 -0
- package/dist/services/root/nw/rootService.js +1 -0
- package/dist/services/root/webide/root.js +1 -0
- package/dist/services/root/webide/rootService.js +1 -0
- package/dist/services/staticConfig/common/staticConfigService.js +1 -0
- package/dist/services/staticConfig/nw/staticConfigService.js +1 -0
- package/dist/services/store/common/storeService.js +1 -0
- package/dist/services/uniapp/common/uniapp.js +1 -0
- package/dist/services/uniapp/nw/uniapp.js +1 -0
- package/dist/services/uniapp/webide/uniapp.js +1 -0
- package/dist/services/vendor/common/utils.js +1 -0
- package/dist/services/vendor/common/vendorService.js +1 -0
- package/dist/services/vendor/node/vendorService.js +1 -0
- package/dist/services/vendor/webide/vendorService.js +1 -0
- package/dist/types/ci.js +1 -1
- package/dist/utils/asyncTask/index.js +1 -1
- package/dist/utils/babel_helper.js +1 -1
- package/dist/utils/babel_plugin_worklet.js +1 -1
- package/dist/utils/cache.js +1 -1
- package/dist/utils/codesign.js +1 -1
- package/dist/utils/colorutils.js +1 -0
- package/dist/utils/common.js +1 -1
- package/dist/utils/cosUpload.js +1 -1
- package/dist/utils/cp.js +1 -1
- package/dist/utils/customError.js +1 -1
- package/dist/utils/debug.js +1 -1
- package/dist/utils/download.js +1 -1
- package/dist/utils/env.js +1 -1
- package/dist/utils/expression.js +1 -1
- package/dist/utils/fs.js +1 -1
- package/dist/utils/fsagent.js +1 -1
- package/dist/utils/genTempFile.js +1 -1
- package/dist/utils/generateIpa.js +1 -1
- package/dist/utils/glob.js +1 -1
- package/dist/utils/hackrequire/wxvpkgreader.js +1 -1
- package/dist/utils/helper_util.js +1 -1
- package/dist/utils/jsonParse.js +1 -1
- package/dist/utils/jsonlint.js +1 -1
- package/dist/utils/locales/fomatable_string.js +1 -1
- package/dist/utils/locales/locales.js +1 -1
- package/dist/utils/log.js +1 -1
- package/dist/utils/messageHub.js +1 -1
- package/dist/utils/miniAppI18N.js +1 -1
- package/dist/utils/miniapp-builder.js +1 -1
- package/dist/utils/miniappJson.js +1 -1
- package/dist/utils/node/common.js +1 -0
- package/dist/utils/officialDonutPlugin.js +1 -1
- package/dist/utils/packOptionsHelper.js +1 -1
- package/dist/utils/processBootstrap.js +1 -0
- package/dist/utils/progressRecorder.js +1 -1
- package/dist/utils/report.js +1 -1
- package/dist/utils/request.js +1 -1
- package/dist/utils/sign.js +1 -1
- package/dist/utils/signature.js +1 -1
- package/dist/utils/singletontask.js +1 -1
- package/dist/utils/subprocess/entryProcess.js +1 -1
- package/dist/utils/subprocess/processManager.js +1 -1
- package/dist/utils/subprocess/processService.js +1 -1
- package/dist/utils/subprocess/stringifyPostMsg.js +1 -1
- package/dist/utils/swc_helper.js +1 -1
- package/dist/utils/taskmanager.js +1 -1
- package/dist/utils/tools.js +1 -1
- package/dist/utils/usbProcess.js +1 -1
- package/dist/utils/waitable.js +1 -1
- package/dist/utils/web/common.js +1 -0
- package/dist/utils/white_ext_list.js +1 -1
- package/dist/utils/wxapkg/pack.js +1 -1
- package/dist/utils/wxvpkgreader/wxvpkg/reader/version0.js +1 -1
- package/dist/utils/wxvpkgreader/wxvpkg/reader/version10.js +1 -1
- package/dist/utils/wxvpkgreader/wxvpkg/unpack/version0.js +1 -1
- package/dist/utils/wxvpkgreader/wxvpkg/unpack/version10.js +1 -1
- package/dist/utils/wxvpkgreader/wxvpkgreader.js +1 -1
- package/dist/utils/zip.js +1 -1
- package/dist/vendor/vslibrary/bundled/base.bundled.js +2 -0
- package/package.json +62 -3
- package/dist/modules/fullcompiler/trans/wcc/build/darwin_arm64/wcc.node +0 -0
- package/dist/modules/fullcompiler/trans/wcc/build/darwin_arm64/wcsc.node +0 -0
- package/dist/modules/fullcompiler/trans/wcc/build/darwin_x64/wcc.node +0 -0
- package/dist/modules/fullcompiler/trans/wcc/build/darwin_x64/wcsc.node +0 -0
- package/dist/modules/fullcompiler/trans/wcc/build/node_16.1.0_darwin_arm64_release/wcc.node +0 -0
- package/dist/modules/fullcompiler/trans/wcc/build/node_16.1.0_darwin_arm64_release/wcsc.node +0 -0
- package/dist/modules/fullcompiler/trans/wcc/build/node_16.1.0_darwin_x64_release/wcc.node +0 -0
- package/dist/modules/fullcompiler/trans/wcc/build/node_16.1.0_darwin_x64_release/wcsc.node +0 -0
- package/dist/modules/fullcompiler/trans/wcc/build/win32_ia32/wcc.node +0 -0
- package/dist/modules/fullcompiler/trans/wcc/build/win32_ia32/wcsc.node +0 -0
- package/dist/modules/fullcompiler/trans/wcc/build/win32_x64/wcc.node +0 -0
- package/dist/modules/fullcompiler/trans/wcc/build/win32_x64/wcsc.node +0 -0
- package/dist/modules/fullcompiler/trans/wcc/lib/addonVersion.js +0 -19
- package/dist/modules/fullcompiler/trans/wcc/lib/index.js +0 -4
- package/dist/modules/fullcompiler/trans/wcc/lib/util.js +0 -1134
- package/dist/modules/fullcompiler/trans/wcc/lib/wcc.js +0 -94
- package/dist/modules/fullcompiler/trans/wcc/lib/wcsc.js +0 -93
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.tryTranslateSingleFile=void 0;const tslib_1=require("tslib"),path_1=tslib_1.__importDefault(require("path")),parser=tslib_1.__importStar(require("@babel/parser")),traverse_1=tslib_1.__importDefault(require("@babel/traverse")),sourcemap=tslib_1.__importStar(require("source-map")),babel_code_frame_1=tslib_1.__importDefault(require("babel-code-frame"));class TranslateResult{constructor(){this.translated=!0,this.errMsg="",this.debugs=[],this.translatedContent="",this.fullPath="",this.translatedSourceMap=""}}function getErrorCodeFrame(e,n,t,r){let i;try{i=new sourcemap.SourceMapConsumer(n||""),e=i.sourceContentFor(t)||e}catch(e){}const o=[];for(const n of r){let t={line:n.line,column:n.column>0?n.column:0};try{i&&(t=i.originalPositionFor({line:n.line,column:n.column}))}catch(e){}const r=(0,babel_code_frame_1.default)(e,t.line,t.column);o.push(`${n.reason}\n${r}`)}return o.join("\n\n")}function translateCode(e,n){const t=e.replace(/\r\n/g,"\n").split("\n");for(let e=0;e<t.length;e++){const r=t[e],i=n[e+1];if(i){const n=[];let o=0;for(const e in i){const t=i[e];n.push(r.substr(o,t.column-o+1)),n.push(t.toString),o=t.column+t.fromString.length+1}n.push(r.substr(o)),t[e]=n.join("")}}return t.join("\n")}function translateSourceMap(e,n,t){const r=new sourcemap.SourceMapConsumer(e),i=new sourcemap.SourceMapGenerator({file:n});let o;return r.eachMapping(e=>{if("number"!=typeof e.originalLine||"number"!=typeof e.originalColumn)return;const n={generated:{line:e.generatedLine,column:e.generatedColumn},source:e.source,name:e.name,original:{line:e.originalLine,column:e.originalColumn}};if(o&&o.line===e.generatedLine?n.generated.column+=o.offset:o=void 0,t[e.generatedLine]){const n=t[e.generatedLine][e.generatedColumn];n&&(o&&o.line===n.line?o.offset+=n.offset:o={line:n.line,offset:n.offset})}i.addMapping(n)}),i.toString()}function dirname(e){const n=e.split("/");return n.pop(),n.join("/")}function getNpmRequirePath(e,n,t){if(e.startsWith(".")||e.startsWith("/"))return!1;let r,i=n;for(;i;)if(i=dirname(i),r=e.endsWith(".js")?path_1.default.posix.join(i,"miniprogram_npm",e):path_1.default.posix.join(i,"miniprogram_npm",e,"index.js"),t.includes(r))return r;return!1}const tryTranslateSingleFile=e=>{var n,t;const r=new TranslateResult,{filePath:i,nameMapping:o,code:a,rootPath:l,miniProgramJSFiles:s}=e;let u=path_1.default.posix.dirname(path_1.default.posix.relative(l,i));"."===u&&(u="");const c=[];let p;try{p=parser.parse(a)}catch(o){return c.push({line:(null===(n=o.loc)||void 0===n?void 0:n.line)||1,column:(null===(t=o.loc)||void 0===t?void 0:t.column)||1,reason:o.message}),r.translated=!1,r.errMsg=`in ${path_1.default.posix.join(l,i)}\n${getErrorCodeFrame(a,e.sourceMap,e.sourceFileName,c)}`,r}const d={};if((0,traverse_1.default)(p,{AssignmentExpression(e){const n=e.node.loc.start;"Identifier"===e.node.left.type&&"require"===e.node.left.name&&c.push({line:n.line,column:n.column,reason:"assigning other name with 'require'"}),"Identifier"===e.node.right.type&&"require"===e.node.right.name&&c.push({line:n.line,column:n.column,reason:"'require' should not be renamed"})},VariableDeclarator(e){const n=e.node.loc.start;e.node.id&&"Identifier"===e.node.id.type&&"require"===e.node.id.name&&c.push({line:n.line,column:n.column,reason:"(init) assigning other name with 'require'"}),e.node.init&&"Identifier"===e.node.init.type&&"require"===e.node.init.name&&c.push({line:n.line,column:n.column,reason:"(init) 'require' should not be renamed"})},CallExpression(n){const t=n.node.loc.start;for(const e of n.node.arguments)"Identifier"===e.type&&"require"===e.name&&c.push({line:t.line,column:t.column,reason:"passing 'require' as a parameter is not a good taste"});if("Identifier"===n.node.callee.type&&"require"===n.node.callee.name&&(1===n.node.arguments.length&&"StringLiteral"===n.node.arguments[0].type||c.push({line:t.line,column:t.column,reason:"'require' requires one and only one static string literal"})),"require"===n.node.callee.name&&1===n.node.arguments.length&&"StringLiteral"===n.node.arguments[0].type){const t=n.node.arguments[0].loc.start,a=n.node.arguments[0].value,c=e.resolveAlias(a);let p;p=c?path_1.default.posix.join(l,c):path_1.default.posix.normalize(path_1.default.posix.join(u,a)),p.endsWith(".js")||(p+=".js"),p.startsWith("/")&&(p=p.replace(/^\//,""));let m=o[p];if(m)m=o[i]?path_1.default.posix.relative(path_1.default.posix.dirname(o[i]),m):path_1.default.posix.relative(u,m),d[t.line]||(d[t.line]={}),d[t.line][t.column]={line:t.line,column:t.column,fromString:a,toString:m,offset:m.length-a.length},r.debugs.push([i,a,"replace",[p,m]]);else{if(o[i]){const e=getNpmRequirePath(a,i,s);e&&(p=e),m=path_1.default.posix.relative(path_1.default.posix.dirname(o[i]),p),d[t.line]||(d[t.line]={}),d[t.line][t.column]={line:t.line,column:t.column,fromString:a,toString:m,offset:m.length-a.length},r.debugs.push([i,a,"replace",[p,m]])}r.debugs.push([i,a,"ignored"])}}},Identifier(e){const n=e.node.loc.start;if("require"===e.node.name){if("UnaryExpression"===e.parent.type&&"typeof"===e.parent.operator)return;"CallExpression"!==e.parent.type&&c.push({line:n.line,column:n.column,reason:`require is not being used properly in '${e.parent.type}'`})}}}),c.length>0)return r.translated=!1,r.errMsg=`in ${i}\n${getErrorCodeFrame(a,e.sourceMap,e.sourceFileName,c)}`,r;if(Object.keys(d).length>0){r.translatedContent=translateCode(a,d);try{r.translatedSourceMap=translateSourceMap(e.sourceMap||"",e.sourceFileName,d)}catch(e){}}else r.translatedContent=a,r.translatedSourceMap=e.sourceMap;return r};exports.tryTranslateSingleFile=tryTranslateSingleFile;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.tryTranslateSingleFile=void 0;const tslib_1=require("tslib"),path_1=tslib_1.__importDefault(require("path")),parser=tslib_1.__importStar(require("@babel/parser")),traverse_1=tslib_1.__importDefault(require("@babel/traverse")),sourcemap=tslib_1.__importStar(require("source-map")),babel_code_frame_1=tslib_1.__importDefault(require("babel-code-frame"));class TranslateResult{constructor(){this.translated=!0,this.errMsg="",this.debugs=[],this.translatedContent="",this.fullPath="",this.translatedSourceMap=""}}function getErrorCodeFrame(e,n,t,r){let i;try{i=new sourcemap.SourceMapConsumer(n||""),e=i.sourceContentFor(t)||e}catch(e){}const o=[];for(const n of r){let t={line:n.line,column:n.column>0?n.column:0};try{i&&(t=i.originalPositionFor({line:n.line,column:n.column}))}catch(e){}const r=(0,babel_code_frame_1.default)(e,t.line,t.column);o.push(`${n.reason}\n${r}`)}return o.join("\n\n")}function translateCode(e,n){const t=e.replace(/\r\n/g,"\n").split("\n");for(let e=0;e<t.length;e++){const r=t[e],i=n[e+1];if(i){const n=[];let o=0;for(const e in i){const t=i[e];n.push(r.substr(o,t.column-o+1)),n.push(t.toString),o=t.column+t.fromString.length+1}n.push(r.substr(o)),t[e]=n.join("")}}return t.join("\n")}function translateSourceMap(e,n,t){const r=new sourcemap.SourceMapConsumer(e),i=new sourcemap.SourceMapGenerator({file:n});let o;return r.eachMapping((e=>{if("number"!=typeof e.originalLine||"number"!=typeof e.originalColumn)return;const n={generated:{line:e.generatedLine,column:e.generatedColumn},source:e.source,name:e.name,original:{line:e.originalLine,column:e.originalColumn}};if(o&&o.line===e.generatedLine?n.generated.column+=o.offset:o=void 0,t[e.generatedLine]){const n=t[e.generatedLine][e.generatedColumn];n&&(o&&o.line===n.line?o.offset+=n.offset:o={line:n.line,offset:n.offset})}i.addMapping(n)})),i.toString()}function dirname(e){const n=e.split("/");return n.pop(),n.join("/")}function getNpmRequirePath(e,n,t){if(e.startsWith(".")||e.startsWith("/"))return!1;let r,i=n;for(;i;)if(i=dirname(i),r=e.endsWith(".js")?path_1.default.posix.join(i,"miniprogram_npm",e):path_1.default.posix.join(i,"miniprogram_npm",e,"index.js"),t.includes(r))return r;return!1}const tryTranslateSingleFile=e=>{var n,t;const r=new TranslateResult,{filePath:i,nameMapping:o,code:a,rootPath:l,miniProgramJSFiles:s}=e;let u=path_1.default.posix.dirname(path_1.default.posix.relative(l,i));"."===u&&(u="");const c=[];let p;try{p=parser.parse(a)}catch(o){return c.push({line:(null===(n=o.loc)||void 0===n?void 0:n.line)||1,column:(null===(t=o.loc)||void 0===t?void 0:t.column)||1,reason:o.message}),r.translated=!1,r.errMsg=`in ${path_1.default.posix.join(l,i)}\n${getErrorCodeFrame(a,e.sourceMap,e.sourceFileName,c)}`,r}const d={};if((0,traverse_1.default)(p,{AssignmentExpression(e){const n=e.node.loc.start;"Identifier"===e.node.left.type&&"require"===e.node.left.name&&c.push({line:n.line,column:n.column,reason:"assigning other name with 'require'"}),"Identifier"===e.node.right.type&&"require"===e.node.right.name&&c.push({line:n.line,column:n.column,reason:"'require' should not be renamed"})},VariableDeclarator(e){const n=e.node.loc.start;e.node.id&&"Identifier"===e.node.id.type&&"require"===e.node.id.name&&c.push({line:n.line,column:n.column,reason:"(init) assigning other name with 'require'"}),e.node.init&&"Identifier"===e.node.init.type&&"require"===e.node.init.name&&c.push({line:n.line,column:n.column,reason:"(init) 'require' should not be renamed"})},CallExpression(n){const t=n.node.loc.start;for(const e of n.node.arguments)"Identifier"===e.type&&"require"===e.name&&c.push({line:t.line,column:t.column,reason:"passing 'require' as a parameter is not a good taste"});if("Identifier"===n.node.callee.type&&"require"===n.node.callee.name&&(1===n.node.arguments.length&&"StringLiteral"===n.node.arguments[0].type||c.push({line:t.line,column:t.column,reason:"'require' requires one and only one static string literal"})),"require"===n.node.callee.name&&1===n.node.arguments.length&&"StringLiteral"===n.node.arguments[0].type){const t=n.node.arguments[0].loc.start,a=n.node.arguments[0].value,c=e.resolveAlias(a);let p;p=c?path_1.default.posix.join(l,c):path_1.default.posix.normalize(path_1.default.posix.join(u,a)),p.endsWith(".js")||(p+=".js"),p.startsWith("/")&&(p=p.replace(/^\//,""));let m=o[p];if(m)m=o[i]?path_1.default.posix.relative(path_1.default.posix.dirname(o[i]),m):path_1.default.posix.relative(u,m),d[t.line]||(d[t.line]={}),d[t.line][t.column]={line:t.line,column:t.column,fromString:a,toString:m,offset:m.length-a.length},r.debugs.push([i,a,"replace",[p,m]]);else{if(o[i]){const e=getNpmRequirePath(a,i,s);e&&(p=e),m=path_1.default.posix.relative(path_1.default.posix.dirname(o[i]),p),d[t.line]||(d[t.line]={}),d[t.line][t.column]={line:t.line,column:t.column,fromString:a,toString:m,offset:m.length-a.length},r.debugs.push([i,a,"replace",[p,m]])}r.debugs.push([i,a,"ignored"])}}},Identifier(e){const n=e.node.loc.start;if("require"===e.node.name){if("UnaryExpression"===e.parent.type&&"typeof"===e.parent.operator)return;"CallExpression"!==e.parent.type&&c.push({line:n.line,column:n.column,reason:`require is not being used properly in '${e.parent.type}'`})}}}),c.length>0)return r.translated=!1,r.errMsg=`in ${i}\n${getErrorCodeFrame(a,e.sourceMap,e.sourceFileName,c)}`,r;if(Object.keys(d).length>0){r.translatedContent=translateCode(a,d);try{r.translatedSourceMap=translateSourceMap(e.sourceMap||"",e.sourceFileName,d)}catch(e){}}else r.translatedContent=a,r.translatedSourceMap=e.sourceMap;return r};exports.tryTranslateSingleFile=tryTranslateSingleFile;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getGameNameMapping=exports.getNameMapping=void 0,exports.uglifyFileNames=uglifyFileNames;const tslib_1=require("tslib"),path_1=tslib_1.__importDefault(require("path")),config_1=require("../../../../config/config"),error_1=require("../../../../utils/error"),tools_1=require("../../../../utils/tools"),game_1=tslib_1.__importDefault(require("../json/game")),app_1=require("../json/app"),url_config_1=require("../../../../config/url.config"),request_1=require("../../../../utils/request"),sign_1=require("../../../../utils/sign"),jsonParse_1=require("../../../../utils/jsonParse"),locales_1=tslib_1.__importDefault(require("../../../../utils/locales/locales")),config=tslib_1.__importStar(require("../../../../config/config")),common_1=require("../../../../utils/common"),fileFlatter_1=require("./fileFlatter");function checkPrefix(e,t){for(const a of t)if(e.startsWith(a))return a;return""}const getNameMapping=async(e,t)=>{if(process.env.isDevtools)return e.nameMappingFromDevtools||{};const a=e.getFileList(t,".js").map((e=>path_1.default.posix.relative(t,e)));try{let r={};if("miniProgram"===e.type){const o=(0,app_1.getAppJSON)(e);r=await getMiniProgramNameMapping(e,t,o,a)}if("miniGame"===e.type){const t=(0,game_1.default)(e);r=await(0,exports.getGameNameMapping)(e,t,a)}return r}catch(e){throw new error_1.CodeError(e.toString(),config_1.CODE_PROTECT_TRANSLATE_FILENAME)}};exports.getNameMapping=getNameMapping;const getMiniProgramNameMapping=async(e,t,a,r)=>{var o;const i=[{type:"file",value:"app.js"},{type:"regex",value:/\/miniprogram_npm\/|^miniprogram_npm\//},{type:"folder",value:"functional-pages/"}],s=e.getFileList(t,".wxml").map((e=>path_1.default.posix.relative(t,e)));for(const e of s)i.push({type:"file",value:`${e.replace(/\.wxml$/,".js")}`});let n=[];return a.subPackages&&(n=a.subPackages.map((e=>e.root))),(null===(o=null==a?void 0:a.widgets)||void 0===o?void 0:o.length)>0&&a.widgets.forEach((e=>{i.push({type:"folder",value:e.path.endsWith("/")?e.path:`${e.path}/`})})),a.workers&&i.push({type:"folder",value:(0,tools_1.getWorkersPath)(a.workers)}),a.openDataContext&&(i.push({type:"file",value:path_1.default.posix.join(a.openDataContext,"index.js")}),n.push(a.openDataContext)),await _getNameMapping(e,r,i,n)},getGameNameMapping=async(e,t,a)=>{const r=[{type:"file",value:"game.js"},{type:"regex",value:/\/miniprogram_npm\/|^miniprogram_npm\//}],o=[];if(t.subPackages&&t.subPackages.forEach((e=>{const t=e.root.replace(/^\//,"");t.endsWith(".js")?(r.push({type:"file",value:t}),o.push(path_1.default.posix.dirname(t))):(r.push({type:"file",value:path_1.default.posix.join(t,"./game.js")}),o.push(t))})),t.openDataContext&&(r.push({type:"file",value:path_1.default.posix.join(t.openDataContext,"index.js")}),o.push(t.openDataContext)),t.workers&&r.push({type:"folder",value:(0,tools_1.getWorkersPath)(t.workers)}),t.plugins)for(const e in t.plugins){const a=t.plugins[e];if(a.path){const e=a.path.replace(/^\//,"");r.push({type:"folder",value:e})}}return await _getNameMapping(e,a,r,o)};async function _getNameMapping(e,t,a,r=[]){const o={},i=[];for(const e of t){let t=!1;for(const r of a)if("file"===r.type&&r.value===e||"folder"===r.type&&e.startsWith(r.value)||"regex"===r.type&&r.value.test(e)){t=!0;break}t||i.push(e)}const s=await(0,sign_1.getSignature)(e.privateKey,e.appid),{body:n}=await(0,request_1.request)({url:url_config_1.TRANSLATE_FILENAME,method:"post",body:JSON.stringify({appid:e.appid,signature:s,arrPaths:i}),headers:{"content-type":"application/json"}}),p=(0,jsonParse_1.jsonRespParse)(n,url_config_1.TRANSLATE_FILENAME);if(0===p.errCode)return p.body.pairs.forEach((e=>{const t=checkPrefix(e.origin,r);o[e.origin]=(0,tools_1.normalizePath)(path_1.default.posix.join(t,`${e.translated}.js`))})),o;throw new Error(`errCode: ${p.errCode} errMsg: ${p.errMsg}`)}function genResolveAlias(e){if(e){const t=[];return Object.keys(e).forEach((a=>{let r=a;a.endsWith("*")&&(r=r.slice(0,-1));let o=e[a];e[a].endsWith("*")&&(o=o.slice(0,-1)),t.push({key:r,value:o})})),e=>{let a={key:"",value:""},r=!1;if(t.forEach((t=>{e.startsWith(t.key)&&a.key.length<t.key.length&&(a=t,r=!0)})),!r)return;let o=e.replace(a.key,a.value);return o.startsWith("/")&&(o=o.slice(1)),o}}return e=>{}}async function uglifyFileNames(e,t,a){let r={miniprogramRoot:""};try{r=JSON.parse(t["project.config.json"].toString())}catch(e){}let o=(0,tools_1.normalizePath)(r.miniprogramRoot);"."===o&&(o=""),a=a||await(0,exports.getNameMapping)(e,e.miniprogramRoot);const i=Object.keys(t).filter((e=>e.endsWith(".js"))),s={};let n,p=t[path_1.default.posix.join(o,"app.json")];p?(Buffer.isBuffer(p)&&(p=p.toString("utf-8")),p=JSON.parse(p),n=genResolveAlias(p.resolveAlias)):n=genResolveAlias(void 0);for(const e of i){if(/\/miniprogram_npm\/|^miniprogram_npm\//.test(e))continue;const r=e,p=t[e].toString(),l=t[`${e}.map`]||"";s[r]=(0,fileFlatter_1.tryTranslateSingleFile)({rootPath:o,code:p,nameMapping:a,check:!0,sourceFileName:e,sourceMap:l,filePath:e,miniProgramJSFiles:i,resolveAlias:n})}const l=Object.keys(t),u={};for(const e of l){u[(0,tools_1.normalizePath)(e)]=t[e]}for(const e in s){const t=(0,tools_1.normalizePath)(e);let r=t;const i=s[e];if(i.errMsg){if(!process.env.isDevtools)throw new Error(`\n${locales_1.default.config.COULD_NOT_USE_CODE_PROTECT}\n${i.errMsg}`);(0,common_1.throwError)({code:config.FILE_FLAT_ERR,msg:`${locales_1.default.config.COULD_NOT_USE_CODE_PROTECT}\n${i.errMsg}`,filePath:t})}const n=path_1.default.posix.relative(o,e);a[n]&&(r=(0,tools_1.normalizePath)(path_1.default.posix.join(o,a[n])),delete u[t],delete u[`${t}.map`]),u[r]=i.translatedContent,i.translatedSourceMap&&(u[`${r}.map`]=i.translatedSourceMap)}return u}exports.getGameNameMapping=getGameNameMapping;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.logger=void 0;const workerThread_1=require("../workerThread"),env_1=require("./env");function pad(e,r=2){return e>10**r?String(e):`${new Array(r).join("0")}${e}`.slice(-r)}const LevelMap={trace:1,info:2,log:3,warn:4,error:5};class Logger{constructor(e){this.output=e,this.enableLevel=LevelMap.log,this.ready=!1,this.logs=[]}setOutput(e){this.output=e}setEnableLevel(e){this.enableLevel=e}setReady(){if(this.ready=!0,this.logs.length>0)for(const e of this.logs)this.output(e.level,e.args)}send(e,r){this.ready?this.output(e,r):this.logs.push({level:e,args:r})}getPrintTime(){const e=new Date;return`${String(e.getFullYear())}-${pad(e.getMonth()+1)}-${pad(e.getDate())} ${pad(e.getHours())}:${pad(e.getMinutes())}:${pad(e.getSeconds())}.${pad(e.getMilliseconds(),3)}`}_receive(e,r,t){const s=LevelMap[e];this.enableLevel>s||(t=[r=`[compiler][${env_1.processEnv}][${this.getPrintTime()}] ${r}`,...t],this.send(e,t))}info(e,...r){this._receive("info",e,r)}log(e,...r){this._receive("log",e,r)}error(e,...r){this._receive("error",e,r)}}if(exports.logger=new Logger((e,r)=>{console[e](...r)}),exports.logger.setReady(),"ci"===env_1.hostEnv&&("compiler"===process.env.debug?exports.logger.setEnableLevel(LevelMap.info):exports.logger.setEnableLevel(LevelMap.warn)),"childprocess"===env_1.processEnv&&exports.logger.setOutput((e,r)=>{process.send({command:workerThread_1.COMMAND.SEND_LOG,data:{level:e,args:r}})}),"workerthread"===env_1.processEnv){const e=require("worker_threads").parentPort;e&&exports.logger.setOutput((r,t)=>{e.postMessage({command:workerThread_1.COMMAND.SEND_LOG,data:{level:r,args:t}})})}
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.logger=void 0;const workerThread_1=require("../workerThread"),env_1=require("./env");function pad(e,r=2){return e>10**r?String(e):`${new Array(r).join("0")}${e}`.slice(-r)}const LevelMap={trace:1,info:2,log:3,warn:4,error:5};class Logger{constructor(e){this.output=e,this.enableLevel=LevelMap.log,this.ready=!1,this.logs=[]}setOutput(e){this.output=e}setEnableLevel(e){this.enableLevel=e}setReady(){if(this.ready=!0,this.logs.length>0)for(const e of this.logs)this.output(e.level,e.args)}send(e,r){this.ready?this.output(e,r):this.logs.push({level:e,args:r})}getPrintTime(){const e=new Date;return`${String(e.getFullYear())}-${pad(e.getMonth()+1)}-${pad(e.getDate())} ${pad(e.getHours())}:${pad(e.getMinutes())}:${pad(e.getSeconds())}.${pad(e.getMilliseconds(),3)}`}_receive(e,r,t){const s=LevelMap[e];this.enableLevel>s||(t=[r=`[compiler][${env_1.processEnv}][${this.getPrintTime()}] ${r}`,...t],this.send(e,t))}info(e,...r){this._receive("info",e,r)}log(e,...r){this._receive("log",e,r)}error(e,...r){this._receive("error",e,r)}}if(exports.logger=new Logger(((e,r)=>{console[e](...r)})),exports.logger.setReady(),"ci"===env_1.hostEnv&&("compiler"===process.env.debug?exports.logger.setEnableLevel(LevelMap.info):exports.logger.setEnableLevel(LevelMap.warn)),"childprocess"===env_1.processEnv&&exports.logger.setOutput(((e,r)=>{process.send({command:workerThread_1.COMMAND.SEND_LOG,data:{level:e,args:r}})})),"workerthread"===env_1.processEnv){const e=require("worker_threads").parentPort;e&&exports.logger.setOutput(((r,t)=>{e.postMessage({command:workerThread_1.COMMAND.SEND_LOG,data:{level:r,args:t}})}))}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.NEW_CHECK_JSON_WAY=exports.
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.NEW_CHECK_JSON_WAY=exports.config=void 0,exports.schemaValidate=schemaValidate,exports.transValidateResult=transValidateResult;const tslib_1=require("tslib"),jsonschema_1=require("jsonschema"),locales_1=tslib_1.__importDefault(require("../../../../utils/locales/locales")),common_1=require("../../../../utils/common"),validator=new jsonschema_1.Validator,app=require("../../../../schema/dist/app.js"),ext=require("../../../../schema/dist/ext.js"),game=require("../../../../schema/dist/game.js"),page=require("../../../../schema/dist/page.js"),plugin=require("../../../../schema/dist/plugin.js"),pluginpage=require("../../../../schema/dist/pluginpage.js"),projectconfig=require("../../../../schema/dist/projectconfig.js"),sitemap=require("../../../../schema/dist/sitemap.js"),theme=require("../../../../schema/dist/theme.js");exports.config={app:app,ext:ext,game:game,page:page,plugin:plugin,pluginpage:pluginpage,projectconfig:projectconfig,sitemap:sitemap,theme:theme};const SchemaMap=Object.assign({},exports.config);function schemaValidate(e,r){const t=validator.validate(r,SchemaMap[e]).errors,a=t.filter((e=>"additionalProperties"===e.name)),o=t.filter((e=>"additionalProperties"!==e.name)).map((e=>{if("type"===e.name||"enum"===e.name||"anyOf"===e.name){let r=e.argument;if("string"==typeof r&&(r=[r]),"anyOf"===e.name){r=[(e.schema.anyOf||[]).map((e=>e.type)).join(", ")]}const t=e.property.replace(/^instance\.?/,"");return{errorType:e.name,errorProperty:t,correctType:r}}return{errorType:e.name,errorProperty:e.property.replace(/^instance\.?/,""),requireProperty:e.argument}}));return{warning:a.map((r=>{const t=r.property.replace(/^instance\.?/,"");return`${e}.json ${t.length?t:""}["${r.argument}"]`})).join("、")||"",error:o}}function transValidateResult(e,r,t=!1){var a;if(null===(a=null==r?void 0:r.error)||void 0===a?void 0:a.length){const a=r.error.map((e=>{if("type"===e.errorType||"enum"===e.errorType||"anyOf"===e.errorType)return locales_1.default.config.JSON_CONTENT_SHOULD_BE.format([e.errorProperty,e.correctType]);const r=""===e.errorProperty?e.requireProperty:`${e.errorProperty}.${e.requireProperty}`;return locales_1.default.config.SHOULD_NOT_BE_EMPTY.format([r])})).join("\n");return t||(0,common_1.throwError)({msg:a,filePath:e}),a}return""}exports.NEW_CHECK_JSON_WAY=!0;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const tslib_1=require("tslib"),locales_1=tslib_1.__importDefault(require("../../../../utils/locales/locales"));function getType(e){return Object.prototype.toString.call(e).toLowerCase().split(" ")[1].replace("]","")}class T{constructor(e,t,r){this.type=e,this.required=t||!1;const o=this.valueType=getType(r);if("undefined"!==o)if(r instanceof T){if("array"!==e&&"object"!==e)throw new Error("value can be instance of ValidateType only when type is object or array");this.value=r}else if("array"!==o)if("regexp"!==o)if("object"!==o){if(e!==o)throw new Error(`value should be ${e} instead of ${o}`);this.value=r}else{if("object"!==e)throw new Error(e
|
|
1
|
+
"use strict";const tslib_1=require("tslib"),locales_1=tslib_1.__importDefault(require("../../../../utils/locales/locales"));function getType(e){return Object.prototype.toString.call(e).toLowerCase().split(" ")[1].replace("]","")}class T{constructor(e,t,r){this.type=e,this.required=t||!1;const o=this.valueType=getType(r);if("undefined"!==o)if(r instanceof T){if("array"!==e&&"object"!==e)throw new Error("value can be instance of ValidateType only when type is object or array");this.value=r}else if("array"!==o)if("regexp"!==o)if("object"!==o){if(e!==o)throw new Error(`value should be ${e} instead of ${o}`);this.value=r}else{if("object"!==e)throw new Error(`${e} could not have object value`);for(const e in r)if(!(r[e]instanceof T))throw new Error(`value["${e}"] should be instance of ValidateType`);this.value=r}else{if("regexp"!==e&&"string"!==e)throw new Error(`${e} could not have regexp value`);this.value=r}else{if("array"===e||"object"===e||"function"===e)throw new Error(`${e} could not have optional value`);for(let t=0,o=r.length;t<o;t++){const o=getType(r[t]);if(o!==e)throw new Error(`value[${t}] should be ${e} instead of ${o}`)}this.value=r}}static invalidKeys(e,t){const r=[];if(e instanceof T){try{e.check(t)}catch(e){return}if("object"!==e.type||"object"!==e.valueType||"object"!==getType(t))return;const o=e.value instanceof T;for(const i in t){let n=[];if(o)n=T.invalidKeys(e.value,t[i]);else{if(!e.value.hasOwnProperty(i)){r.push(`["${i}"]`);continue}n=T.invalidKeys(e.value[i],t[i])}n&&n.forEach((e=>{r.push(`["${i}"]${e}`)}))}}else for(const o in t){if(!e.hasOwnProperty(o)){r.push(`["${o}"]`);continue}const i=T.invalidKeys(e[o],t[o]);i&&i.forEach((e=>{r.push(`["${o}"]${e}`)}))}if(r.length>0)return r}check(e){const t=getType(e);if(!this.required&&"undefined"===t)return;if("ignore"===this.type)return;if(t!==this.type)throw new Error(locales_1.default.config.JSON_CONTENT_SHOULD_BE.format(["",this.type]));const{valueType:r}=this;if("undefined"!==r){if(this.value instanceof T){if("object"===this.type){for(const t in e)try{this.value.check(e[t])}catch(e){throw new Error(`["${t}"]${e.message}`)}return}if("array"===this.type){if(0===e.length&&this.value.required)throw new Error(locales_1.default.config.SHOULD_AT_LEAST_ONE_ITEM.format(""));for(let t=0,r=e.length;t<r;t++)try{this.value.check(e[t])}catch(e){throw new Error(`[${t}]${e.message}`)}return}}if("array"!==r)if("object"!==r)if("regexp"!==r){if(this.value!==e)throw new Error(locales_1.default.config.SHOULD_EQUAL.format(["",this.value.toString()]))}else{if("string"===this.type){if(!this.value.test(e))throw new Error(locales_1.default.config.SHOULD_MATCH.format(["",this.value.toString()]));return}if("regexp"===this.type&&this.value.toString()!==e.toString())throw new Error(locales_1.default.config.SHOULD_EQUAL.format(["",this.value.toString()]))}else for(const t in this.value){const r=this.value[t];try{r.check(e[t])}catch(e){throw new Error(`["${t}"]${e.message}`)}}else{let t=!1;for(const r of this.value)if(r===e){t=!0;break}if(!t)throw new Error(locales_1.default.config.JSON_CONTENT_SHOULD_BE.format(["",this.value.join(` ${locales_1.default.config.OR} `)]))}}}}module.exports=T;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var MSG_TYPE;Object.defineProperty(exports,"__esModule",{value:!0}),exports.MSG_TYPE=void 0,function(R){R.CREATE_WORKER="CREATE_WORKER",R.CREATE_WORKER_RESULT="CREATE_WORKER_RESULT",R.PROXY_WORKER_TO_FROM_WORKER_PROXY_MSG="PROXY_WORKER_TO_FROM_WORKER_PROXY_MSG",R.MAIN_TO_WORKER_PROXY_MSG="MAIN_TO_WORKER_PROXY_MSG",R.TERMINATE_WORKER_PROXY_MSG="TERMINATE_WORKER_PROXY_MSG",R.ON_WORKER_ERROR="ON_WORKER_ERROR",R.WEBWORKER_FS_OPERATE_CALLBACK="WEBWORKER_FS_OPERATE_CALLBACK",R.WEBWORKER_FS_OPERATE="WEBWORKER_FS_OPERATE",R.WEBWORKER_FS_OPERATE_SYNC="WEBWORKER_FS_OPERATE_SYNC",R.SYNC_CHANNEL="SYNC_CHANNEL",R.WORKER_LOGIC_MSG="WORKER_LOGIC_MSG"}(MSG_TYPE
|
|
1
|
+
"use strict";var MSG_TYPE;Object.defineProperty(exports,"__esModule",{value:!0}),exports.MSG_TYPE=void 0,function(R){R.CREATE_WORKER="CREATE_WORKER",R.CREATE_WORKER_RESULT="CREATE_WORKER_RESULT",R.PROXY_WORKER_TO_FROM_WORKER_PROXY_MSG="PROXY_WORKER_TO_FROM_WORKER_PROXY_MSG",R.MAIN_TO_WORKER_PROXY_MSG="MAIN_TO_WORKER_PROXY_MSG",R.TERMINATE_WORKER_PROXY_MSG="TERMINATE_WORKER_PROXY_MSG",R.ON_WORKER_ERROR="ON_WORKER_ERROR",R.WEBWORKER_FS_OPERATE_CALLBACK="WEBWORKER_FS_OPERATE_CALLBACK",R.WEBWORKER_FS_OPERATE="WEBWORKER_FS_OPERATE",R.WEBWORKER_FS_OPERATE_SYNC="WEBWORKER_FS_OPERATE_SYNC",R.SYNC_CHANNEL="SYNC_CHANNEL",R.WORKER_LOGIC_MSG="WORKER_LOGIC_MSG"}(MSG_TYPE||(exports.MSG_TYPE=MSG_TYPE={}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
process.env&&process.env.isDevtools&&require("../../../../utils/hackrequire/index"),Object.defineProperty(exports,"__esModule",{value:!0});const tslib_1=require("tslib");require("../../../../utils/processBootstrap").installProcessBootstrap({baseDir:__dirname,hackRequirePath:"../../../../utils/hackrequire/index",moduleFallbackPath:"../../../../../../../unpack/module-fallback"});const log=tslib_1.__importStar(require("../../../../utils/log")),logger_1=require("../utils/logger"),config_1=require("./config"),workerManager_1=require("./workerManager"),workerManager=(0,workerManager_1.getWorkerManager)(!!process.env.isDevtools);class TaskManager{constructor(){this._taskSet=new Set,this._suicideTime=config_1.SUICIDE_TIME["miniprogram-ci"],process.env.isDevtools&&(this._suicideTime=config_1.SUICIDE_TIME.devtools)}runTask(e,s,i){clearTimeout(this._suicideTimer),this._taskSet.add(e),workerManager.runTask(s,i).then(this.onResolve.bind(this,e)).catch(this.onReject.bind(this,e))}onResolve(e,s){this._taskSet.delete(e),process.send({command:config_1.COMMAND.TASK_DONE,data:{taskId:e,result:s}}),this.setUpSuicideTimer()}onReject(e,s){process.send({command:config_1.COMMAND.TASK_DONE,data:{taskId:e,result:{error:s.toString()}}}),this.setUpSuicideTimer()}setUpSuicideTimer(){this._taskSet.size>0||(this._suicideTimer=setTimeout((()=>{clearTimeout(this._suicideTimer),process.exit(0)}),this._suicideTime))}}const taskManager=new TaskManager;function suicide(){try{process.exit(0),setTimeout((()=>{process.kill(process.pid,"SIGTERM")}),5e3)}catch(e){process.kill(process.pid,"SIGTERM")}}process.on("message",(e=>{if("object"!=typeof e)return void log.error(`child process unrecognized message ${e}`);const{command:s,data:i}=e;s===config_1.COMMAND.RUN_TASK?(logger_1.logger.info("child-process recieve message",s,i.filePath),taskManager.runTask(i.taskId,i.taskName,i.data)):log.error(`child process unrecognized message ${e}`)})),process.on("disconnect",(()=>{suicide()}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.childProcessManager=exports.ChildProcessCrashedError=void 0;const tslib_1=require("tslib"),path_1=tslib_1.__importDefault(require("path")),child_process_1=require("child_process"),events_1=tslib_1.__importDefault(require("events")),os=tslib_1.__importStar(require("os")),log=tslib_1.__importStar(require("../../../../utils/log")),logger_1=require("../utils/logger"),config_1=require("./config"),cpus=os.cpus().length,FORK_PATH=path_1.default.posix.join(__dirname,"./childprocess.js"),MAX_TASK_TRY_TIME=2;class ChildProcessCrashedError extends Error{constructor(s,e){super(e),this.type=s}}exports.ChildProcessCrashedError=ChildProcessCrashedError;class ChildProcessInstance extends events_1.default{constructor(s){super(),this.status=config_1.EChildProcessStatus.free,this._lastActiveTime=0,this._taskMap={},this._fullload_task_count=4,this._suicideTime=config_1.SUICIDE_TIME["miniprogram-ci"],this._fullload_task_count=s;const e={stdio:["pipe","pipe","pipe","ipc"],env:Object.assign(Object.assign({},process.env),{cpprocessEnv:"childprocess"})};if(e.env.isDevtools=process.__nwjs&&"wechatwebdevtools"===nw.App.manifest.appname,e.env.isDevtools){this._suicideTime=config_1.SUICIDE_TIME.devtools;let s=path_1.default.join(path_1.default.dirname(process.execPath),"node");"darwin"!==process.platform&&(s+=".exe"),e.execPath=s}logger_1.logger.info("fork childprocess start");const t=(0,child_process_1.fork)(FORK_PATH,["--expose-gc"],e);t.stdout.setEncoding("utf8"),logger_1.logger.info("fork childprocess end"),t.stdout.on("data",s=>{log.log(
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.childProcessManager=exports.ChildProcessCrashedError=void 0;const tslib_1=require("tslib"),path_1=tslib_1.__importDefault(require("path")),child_process_1=require("child_process"),events_1=tslib_1.__importDefault(require("events")),os=tslib_1.__importStar(require("os")),log=tslib_1.__importStar(require("../../../../utils/log")),logger_1=require("../utils/logger"),config_1=require("./config"),cpus=os.cpus().length,FORK_PATH=path_1.default.posix.join(__dirname,"./childprocess.js"),MAX_TASK_TRY_TIME=2;class ChildProcessCrashedError extends Error{constructor(s,e){super(e),this.type=s}}exports.ChildProcessCrashedError=ChildProcessCrashedError;class ChildProcessInstance extends events_1.default{constructor(s){super(),this.status=config_1.EChildProcessStatus.free,this._lastActiveTime=0,this._taskMap={},this._fullload_task_count=4,this._suicideTime=config_1.SUICIDE_TIME["miniprogram-ci"],this._fullload_task_count=s;const e={stdio:["pipe","pipe","pipe","ipc"],env:Object.assign(Object.assign({},process.env),{cpprocessEnv:"childprocess"})};if(e.env.isDevtools=process.__nwjs&&"wechatwebdevtools"===nw.App.manifest.appname,e.env.isDevtools){this._suicideTime=config_1.SUICIDE_TIME.devtools;let s=path_1.default.join(path_1.default.dirname(process.execPath),"node");"darwin"!==process.platform&&(s+=".exe"),e.execPath=s}logger_1.logger.info("fork childprocess start");const t=(0,child_process_1.fork)(FORK_PATH,["--expose-gc"],e);t.stdout.setEncoding("utf8"),logger_1.logger.info("fork childprocess end"),t.stdout.on("data",(s=>{log.log(`child process stdout: ${s}`)})),t.stderr.on("data",(s=>{log.error(`child process stderr: ${s}`),this.checkIfProcessCrashed(s.toString())})),t.on("message",this.onChildSummerProcessMessage.bind(this,t)),t.on("exit",(s=>{this.emit("exit",{code:s,crashedReason:this.crashedReason,status:this.status,tasks:Object.values(this._taskMap),pid:t.pid})})),t.unref(),this._instance=t}checkIfProcessCrashed(s){s.includes("ERR_WORKER_OUT_OF_MEMORY")&&(this.crashedReason=new ChildProcessCrashedError("ERR_WORKER_OUT_OF_MEMORY",s))}onChildSummerProcessMessage(s,e){if("object"!=typeof e)return void logger_1.logger.error("unrecognized message from child process",e);const{command:t,data:i}=e;t!==config_1.COMMAND.SEND_LOG?(logger_1.logger.info(`onChildSummerProcessMessage ${t}`,i),t===config_1.COMMAND.TASK_DONE?this.onTaskDone(i):t===config_1.COMMAND.SEND_LOG&&logger_1.logger.send(i.level,i.args)):logger_1.logger.send(i.level,i.args)}onTaskDone(s){const{taskId:e,result:t}=s,i=this._taskMap[e];delete this._taskMap[e],i?(i.resolve&&(i.onStatusUpdate(config_1.ETaskStatus.done),i.resolve(t)),0===Object.keys(this._taskMap).length&&(this.status=config_1.EChildProcessStatus.free,this.setUpSuicideTimer()),this.emit("taskDone")):log.error(`child process task: ${e} not found`)}setUpSuicideTimer(){this._suicideTimer=setTimeout((()=>{clearTimeout(this._suicideTimer),this.status===config_1.EChildProcessStatus.free?(this.status=config_1.EChildProcessStatus.dying,this._instance.kill("SIGTERM")):this._suicideTimer||this.setUpSuicideTimer()}),this._suicideTime)}runTask(s){clearTimeout(this._suicideTimer),this.status=config_1.EChildProcessStatus.busy,this._lastActiveTime=Date.now();const e=getId();this._taskMap[e]=s,Object.keys(this._taskMap).length>=this._fullload_task_count?this.status=config_1.EChildProcessStatus.fullload:this.status=config_1.EChildProcessStatus.busy,s.onStatusUpdate(config_1.ETaskStatus.progress),this._instance.send({command:config_1.COMMAND.RUN_TASK,data:{taskId:e,taskName:s.name,data:s.data}})}}const getId=(()=>{let s=0;return()=>s++})();class TaskManager{constructor(){this._taskQueue=[],this.onChildProcessExit=s=>{const{code:e,crashedReason:t,status:i,tasks:o,pid:r}=s;if(this._instance=void 0,i===config_1.EChildProcessStatus.busy||i===config_1.EChildProcessStatus.fullload)for(const s of o)s.retryTimes+=1,s.retryTimes<=2?(log.error(`child process: ${r} exit with code: ${e} when it is busy, retry running ${s.retryTimes} times`),this._taskQueue.push(s)):t||t?s.reject(t):s.reject(`child process exit with code: ${e} when it is busy`);this._run()},this.onTaskDone=()=>{this._run()}}runTask(s,e,t=(()=>{})){return new Promise(((i,o)=>{const r={name:s,data:e,resolve:i,reject:o,retryTimes:0,onStatusUpdate:t};t(config_1.ETaskStatus.waiting),this._taskQueue.push(r),this._run()}))}_run(){if(0===this._taskQueue.length)return;const s=this.allocChildProcess();s.status!==config_1.EChildProcessStatus.fullload&&s.status!==config_1.EChildProcessStatus.dying&&(s.runTask(this._taskQueue.shift()),this._run())}allocChildProcess(){return this._instance||(this._instance=new ChildProcessInstance(2*cpus),this._instance.on("exit",this.onChildProcessExit),this._instance.on("taskDone",this.onTaskDone)),this._instance}}exports.childProcessManager=new TaskManager;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var ETaskStatus,EWorkerStatus,EChildProcessStatus;Object.defineProperty(exports,"__esModule",{value:!0}),exports.SUICIDE_TIME=exports.EChildProcessStatus=exports.EWorkerStatus=exports.COMMAND=exports.TASK_NAME=exports.ETaskStatus=void 0,function(s){s[s.waiting=0]="waiting",s[s.progress=1]="progress",s[s.done=2]="done"}(ETaskStatus
|
|
1
|
+
"use strict";var ETaskStatus,EWorkerStatus,EChildProcessStatus;Object.defineProperty(exports,"__esModule",{value:!0}),exports.SUICIDE_TIME=exports.EChildProcessStatus=exports.EWorkerStatus=exports.COMMAND=exports.TASK_NAME=exports.ETaskStatus=void 0,function(s){s[s.waiting=0]="waiting",s[s.progress=1]="progress",s[s.done=2]="done"}(ETaskStatus||(exports.ETaskStatus=ETaskStatus={})),exports.TASK_NAME={COMPILE_JS:"COMPILE_JS",COMPILE_WXSS:"COMPILE_WXSS",MINIFY_WXML:"MINIFY_WXML",SUMMER_HOOK:"SUMMER_HOOK",PIPE_TASK:"PIPE_TASK"},exports.COMMAND={INIT_START:"INIT_START",INIT_READY:"INIT_READY",RUN_TASK:"RUN_TASK",TASK_DONE:"TASK_DONE",CALL_FUNC:"CALL_FUNC",CALL_FUNC_RESULT:"CALL_FUNC_RESULT",CHILD_PROCESS_READY:"CHILD_PROCESS_READY",SEND_LOG:"SEND_LOG"},function(s){s[s.free=0]="free",s[s.busy=1]="busy",s[s.dying=2]="dying"}(EWorkerStatus||(exports.EWorkerStatus=EWorkerStatus={})),function(s){s[s.free=0]="free",s[s.busy=1]="busy",s[s.fullload=2]="fullload",s[s.dying=3]="dying"}(EChildProcessStatus||(exports.EChildProcessStatus=EChildProcessStatus={})),exports.SUICIDE_TIME={devtools:864e5,"miniprogram-ci":1e4,webide:864e5};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const tslib_1=require("tslib"),log=tslib_1.__importStar(require("../../../../utils/log")),index_1=tslib_1.__importDefault(require("./task/index")),config_1=require("./config"),getProcess_1=require("../../../../utils/subprocess/getProcess"),process=(0,getProcess_1.getProcess)();let isbusy=!1;process.on("message",
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const tslib_1=require("tslib");require("../../../../utils/processBootstrap").installProcessBootstrap({baseDir:__dirname,moduleFallbackPath:"../../../../../../../unpack/module-fallback"});const log=tslib_1.__importStar(require("../../../../utils/log")),index_1=tslib_1.__importDefault(require("./task/index")),config_1=require("./config"),getProcess_1=require("../../../../utils/subprocess/getProcess"),getservice_1=require("../../../../services/common/getservice"),process=(0,getProcess_1.getProcess)();let isbusy=!1;process.on("message",(e=>{const{command:s,data:r}=e;if(s===config_1.COMMAND.INIT_START){const e=(0,getservice_1.getServicesEnv)();return(0,getservice_1.initServices)(e,r),void process.send({command:config_1.COMMAND.INIT_READY})}s===config_1.COMMAND.RUN_TASK&&(isbusy=!0,(0,index_1.default)(r.taskName,r.data).then((e=>{isbusy=!1,process.send({command:config_1.COMMAND.TASK_DONE,data:e})})).catch((e=>{isbusy=!1,process.send({command:config_1.COMMAND.TASK_DONE,data:{error:e.toString()}})})))})),process.on("SIGTERM",(()=>{isbusy&&(log.error("forked sub process is kill when busy"),process.exit(1)),process.exit(0)}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const tslib_1=require("tslib"),os_1=tslib_1.__importDefault(require("os"));let cpus=1;cpus=os_1.default.cpus().length;const envCpus=parseInt(process.env.COMPILE_THREADS||"0",10);function default_1(){return cpus}envCpus<=0||envCpus>cpus||(cpus=envCpus)
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=default_1;const tslib_1=require("tslib"),os_1=tslib_1.__importDefault(require("os"));let cpus=1;cpus=os_1.default.cpus().length;const envCpus=parseInt(process.env.COMPILE_THREADS||"0",10);function default_1(){return cpus}envCpus<=0||envCpus>cpus||(cpus=envCpus);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.runTask=runTask,exports.abortTask=abortTask;const tslib_1=require("tslib"),logger_1=require("../utils/logger"),workerManager_1=require("./workerManager"),index_1=tslib_1.__importDefault(require("./task/index")),getservice_1=tslib_1.__importDefault(require("../../../../services/common/getservice")),multiTaskManager_1=require("../../../../services/multiTaskManager/common/multiTaskManager");tslib_1.__exportStar(require("./config"),exports);const isDevtools=void 0!==(null===process||void 0===process?void 0:process.env.__nwjs);async function runTask(e,r,a=(()=>{})){if(logger_1.logger.info("runTask",e,r.filePath),global.__MINIPROGRAM_CI_TEST__)return(0,index_1.default)(e,r);try{return await(0,getservice_1.default)(multiTaskManager_1.IMultiTaskManagerService).runTask(e,r,a)}catch(a){throw logger_1.logger.error(`runTask ${e}, ${r.filePath} catch error ${a}`),a}}function abortTask(e){(0,workerManager_1.getWorkerManager)(isDevtools).abort(e)}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.call=
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.call=call;const tslib_1=require("tslib"),config_1=require("../config"),FUNC=tslib_1.__importStar(require("./func"));let workerThreads,supportWorkerThread=!1;try{workerThreads=require("worker_threads"),supportWorkerThread=!0}catch(r){supportWorkerThread=!1}const callMainThread=function(){if(!supportWorkerThread||workerThreads.isMainThread)return(r,e)=>{};let r=0;const e={};return workerThreads.parentPort.on("message",(r=>{const{command:o,data:t}=r;if(o!==config_1.COMMAND.CALL_FUNC_RESULT)return;const{id:a,result:s,error:n}=t,i=e[a];return delete e[a],i?n?i.reject(n):void i.resolve(s):void 0})),(o,t)=>new Promise(((a,s)=>{const n=r++;e[n]={resolve:a,reject:s},workerThreads.parentPort.postMessage({command:config_1.COMMAND.CALL_FUNC,data:{id:n,funcName:o,args:t}})}))}();function call(r,...e){return!supportWorkerThread||workerThreads.isMainThread?FUNC[r].apply(null,e):callMainThread(r,e)}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const tslib_1=require("tslib"),fs_1=tslib_1.__importDefault(require("fs")),path_1=tslib_1.__importDefault(require("path")),locales_1=tslib_1.__importDefault(require("../../../../../utils/locales/locales")),tools_1=require("../../../../../utils/tools"),config_1=require("../../../../../config/config"),log=tslib_1.__importStar(require("../../../../../utils/log")),babel_helper_1=require("../../../../../utils/babel_helper"),jsonParse_1=require("../../../../../utils/jsonParse"),call_func_1=require("./call_func"),sourcemap=()=>require("source-map"),enhanceCompile=()=>require("../../js/enhance"),workletCompile=()=>require("../../js/workletCompile"),es6Compile=()=>require("../../js/es6Transform"),minifyJS=()=>require("../../js/minifyjs"),minifyJSAfterWrap=()=>require("../../js/minifyjsAfterWrap");async function tryGetInputSourceMap(e,r){try{const t=/\/\/[#|@] sourceMappingURL=[\s]*(\S*)[\s]*$/m.exec(e),
|
|
1
|
+
"use strict";const tslib_1=require("tslib"),fs_1=tslib_1.__importDefault(require("fs")),path_1=tslib_1.__importDefault(require("path")),locales_1=tslib_1.__importDefault(require("../../../../../utils/locales/locales")),tools_1=require("../../../../../utils/tools"),config_1=require("../../../../../config/config"),log=tslib_1.__importStar(require("../../../../../utils/log")),babel_helper_1=require("../../../../../utils/babel_helper"),jsonParse_1=require("../../../../../utils/jsonParse"),call_func_1=require("./call_func"),sourcemap=()=>require("source-map"),enhanceCompile=()=>require("../../js/enhance"),workletCompile=()=>require("../../js/workletCompile"),es6Compile=()=>require("../../js/es6Transform"),minifyJS=()=>require("../../js/minifyjs"),minifyJSAfterWrap=()=>require("../../js/minifyjsAfterWrap");async function tryGetInputSourceMap(e,r){try{const t=/\/\/[#|@] sourceMappingURL=[\s]*(\S*)[\s]*$/m.exec(e),o=path_1.default.posix.dirname(r),s=path_1.default.posix.basename(r);let i;if(null==t?void 0:t[1])if(t[1].endsWith(".js.map"))i=await(0,call_func_1.call)("readFileAsync",path_1.default.posix.join(o,t[1]),"utf-8");else{const e=t[1].split("base64,")[1];i=Buffer.from(e,"base64").toString()}else{const e=path_1.default.posix.join(o,`${s}.map`);fs_1.default.existsSync(e)&&(i=await(0,call_func_1.call)("readFileAsync",e,"utf-8"))}if(i){const e=(0,jsonParse_1.jsonParse)(i);new(sourcemap().SourceMapConsumer)(e);return await insertSourcesContent(e,r),e}}catch(e){log.log(`try to get input sourcemap of ${r} catch error ${e}`)}}const insertSourcesContent=async(e,r)=>{if(Array.isArray(e.sources)&&!Array.isArray(e.sourcesContent)){const t=e.sourcesContent;try{const t=path_1.default.posix.dirname(r),o=[],{sources:s}=e;for(const e of s){const r=await(0,call_func_1.call)("readFileAsync",path_1.default.posix.join(t,e),"utf-8");o.push(r)}e.sourcesContent=o}catch(r){e.sourcesContent=t}}};async function compileJS(e){const{code:r,filePath:t,projectPath:o,setting:s,babelRoot:i="@babel/runtime",root:a="",babelIgnore:n=[]}=e,{enhance:l,es6:c,disableUseStrict:u,compileWorklet:p}=s,f="string"==typeof r?r:(0,tools_1.bufferToUtf8String)(Buffer.from(r)),_=path_1.default.posix.join(a,t),m=s.minified;if(void 0===f)return{error:{code:config_1.FILE_NOT_UTF8,path:_,message:locales_1.default.config.FILE_NOT_UTF8.format(_)}};const b=f.length>=config_1.MAX_CODE_LENGTH;let h=!1;l&&(h=(0,babel_helper_1.isIgnore)(n,t));const d=await tryGetInputSourceMap(f,path_1.default.posix.join(o,a,t));if(b||h)return{error:null,isLargeFile:b,isBabelIgnore:h,map:"object"==typeof d?JSON.stringify(d):d,code:f,helpers:[]};let g=f,j=d,y=[];if(l){const e=await enhanceCompile()({code:f,babelRoot:i,filePath:t,disableUseStrict:u,inputSourceMap:d});if(e.error)return{error:Object.assign(Object.assign({},e.error),{path:_})};g=e.code||"",j=e.map,y=e.helpers||[]}else if(c){const e=es6Compile()({code:f,filePath:t,inputSourceMap:d});if(e.error)return{error:Object.assign(Object.assign({},e.error),{path:_})};g=e.code||"",j=e.map}else if(p){if(f.includes('"worklet"')||f.includes("'worklet'")){const e=await workletCompile()({code:f,babelRoot:i,filePath:t,disableUseStrict:u,inputSourceMap:d});if(e.error)return{error:Object.assign(Object.assign({},e.error),{path:_})};g=e.code||"",j=e.map,y=e.helpers||[]}}if(m){if(!c&&!l){const e=minifyJSAfterWrap()({filePath:t,code:g,inputSourceMap:j});if("error"in e)return{error:Object.assign(Object.assign({},e.error),{path:_})};g=e.code,j=e.map}else{const e=minifyJS()({filePath:t,code:g,useTerser:!!l,inputSourceMap:j});if("error"in e)return{error:Object.assign(Object.assign({},e.error),{path:_})};g=e.code,j=e.map}}if("string"!=typeof j)try{(null==j?void 0:j.sourcesContent)&&(j.sourcesContent=j.sourcesContent.map((e=>e.replace(/\r\n/g,"\n")))),j=JSON.stringify(j)}catch(e){j=""}else j=j.replace(/\\r\\n/g,"\\n");return{error:null,isLargeFile:b,isBabelIgnore:h,map:j,code:g.replace(/\r\n/g,"\n"),helpers:y||[]}}module.exports=compileJS;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const tslib_1=require("tslib"),path_1=tslib_1.__importDefault(require("path")),postcss_1=tslib_1.__importDefault(require("postcss")),autoprefixer_1=tslib_1.__importDefault(require("autoprefixer")),cssnano_1=tslib_1.__importDefault(require("cssnano")),locales_1=tslib_1.__importDefault(require("../../../../../utils/locales/locales")),tools_1=require("../../../../../utils/tools"),config_1=require("../../../../../config/config"),log=tslib_1.__importStar(require("../../../../../utils/log")),wxssBrowser=["iOS >= 8","Chrome >= 37"];async function compileWXSS(e){const{code:r,filePath:o,setting:s={},root:t=""}=e,i=Buffer.from(r),l=(0,tools_1.bufferToUtf8String)(i),{minifyWXSS:c,postcss:a}=s,u=path_1.default.posix.join(t,o),_=c;if(void 0===l)return{error:{code:config_1.FILE_NOT_UTF8,path:u,message:locales_1.default.config.FILE_NOT_UTF8.format(u)}};if(_||a)try{const e=[];a&&e.push((0,autoprefixer_1.default)({overrideBrowserslist:wxssBrowser,remove:!1})),_&&e.push((0,cssnano_1.default)({preset:["default",{reduceTransforms:!1,calc:!1,minifySelectors:!1,normalizeUrl:!1,reduceInitial:!1}]}));return{error:null,code:(await(0,postcss_1.default)(e).process(l,{from:(0,tools_1.leading)(o,"/")})).css.replace(/\r\n/g,"\n")}}catch(e){return log.error(
|
|
1
|
+
"use strict";const tslib_1=require("tslib"),path_1=tslib_1.__importDefault(require("path")),postcss_1=tslib_1.__importDefault(require("postcss")),autoprefixer_1=tslib_1.__importDefault(require("autoprefixer")),cssnano_1=tslib_1.__importDefault(require("cssnano")),locales_1=tslib_1.__importDefault(require("../../../../../utils/locales/locales")),tools_1=require("../../../../../utils/tools"),config_1=require("../../../../../config/config"),log=tslib_1.__importStar(require("../../../../../utils/log")),wxssBrowser=["iOS >= 8","Chrome >= 37"];async function compileWXSS(e){const{code:r,filePath:o,setting:s={},root:t=""}=e,i=Buffer.from(r),l=(0,tools_1.bufferToUtf8String)(i),{minifyWXSS:c,postcss:a}=s,u=path_1.default.posix.join(t,o),_=c;if(void 0===l)return{error:{code:config_1.FILE_NOT_UTF8,path:u,message:locales_1.default.config.FILE_NOT_UTF8.format(u)}};if(_||a)try{const e=[];a&&e.push((0,autoprefixer_1.default)({overrideBrowserslist:wxssBrowser,remove:!1})),_&&e.push((0,cssnano_1.default)({preset:["default",{reduceTransforms:!1,calc:!1,minifySelectors:!1,normalizeUrl:!1,reduceInitial:!1}]}));return{error:null,code:(await(0,postcss_1.default)(e).process(l,{from:(0,tools_1.leading)(o,"/")})).css.replace(/\r\n/g,"\n")}}catch(e){return log.error(`postcss error @ ${u}`),log.error(e),{error:{code:config_1.POST_WXSS_ERR,path:u,message:e.message}}}return{error:null,code:l.replace(/\r\n/g,"\n")}}process.env.BROWSERSLIST=process.env.BROWSERSLIST||"iOS >= 8, Chrome >= 37",module.exports=compileWXSS;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.readFileAsync=
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.readFileAsync=readFileAsync,exports.setPipeIPCHandler=setPipeIPCHandler,exports.handlePipeIPC=handlePipeIPC;const tslib_1=require("tslib"),fs_1=tslib_1.__importDefault(require("fs")),progressRecorder_1=require("../../../../../utils/progressRecorder");function readFileAsync(e,r){return new Promise(((i,n)=>{fs_1.default.readFile(e,r,((e,r)=>{if(e)return n(e);i(r)}))}))}let _pipeIPCHandler;function setPipeIPCHandler(e){_pipeIPCHandler=e}async function handlePipeIPC(e){if(!_pipeIPCHandler)throw new Error("pipeIPCHandler not registered");const r=new progressRecorder_1.Recorder((()=>{}));return _pipeIPCHandler(e,r)}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const config_1=require("../config"),compileJS=()=>require("./compilejs"),compileWXSS=()=>require("./compilewxss"),summerWorker=()=>require("../../../summer/worker");async function processTask(e,r){return e===config_1.TASK_NAME.COMPILE_JS?
|
|
1
|
+
"use strict";const config_1=require("../config"),compileJS=()=>require("./compilejs"),compileWXSS=()=>require("./compilewxss"),summerWorker=()=>require("../../../summer/worker"),pipeWorker=()=>require("../../../summer/pipeManager/pipeWorker");async function processTask(e,r){return e===config_1.TASK_NAME.COMPILE_JS?compileJS()(r):e===config_1.TASK_NAME.COMPILE_WXSS?compileWXSS()(r):e===config_1.TASK_NAME.SUMMER_HOOK?summerWorker().runSummerPluginHook(r):e===config_1.TASK_NAME.PIPE_TASK?pipeWorker().runPipeTask(r):void 0}module.exports=processTask;
|
|
@@ -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
|
-
|
|
1
|
+
process.env&&process.env.isDevtools&&require("../../../../utils/hackrequire/index"),Object.defineProperty(exports,"__esModule",{value:!0});const tslib_1=require("tslib");require("../../../../utils/processBootstrap").installProcessBootstrap({baseDir:__dirname,hackRequirePath:"../../../../utils/hackrequire/index",moduleFallbackPath:"../../../../../../../unpack/module-fallback"});const worker_threads_1=require("worker_threads"),logger_1=require("../utils/logger"),index_1=tslib_1.__importDefault(require("./task/index")),config_1=require("./config"),getservice_1=require("../../../../services/common/getservice");worker_threads_1.isMainThread?module.exports=index_1.default:worker_threads_1.parentPort.on("message",(e=>{const{command:r,data:t}=e;if(r===config_1.COMMAND.INIT_START){const e=(0,getservice_1.getServicesEnv)();return(0,getservice_1.initServices)(e,t),void worker_threads_1.parentPort.postMessage({command:config_1.COMMAND.INIT_READY})}r===config_1.COMMAND.RUN_TASK&&(logger_1.logger.info("worker process task start",r,t.data.filePath),(0,index_1.default)(t.taskName,t.data).then((e=>{logger_1.logger.info("worker process task end",r,t.data.filePath),worker_threads_1.parentPort.postMessage({command:config_1.COMMAND.TASK_DONE,data:e})})).catch((e=>{worker_threads_1.parentPort.postMessage({command:config_1.COMMAND.TASK_DONE,data:{error:e.toString()}})})))}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getWorkerManager=exports.AbortEvent=void 0;const tslib_1=require("tslib"),path_1=tslib_1.__importDefault(require("path")),events_1=tslib_1.__importDefault(require("events")),log=tslib_1.__importStar(require("../../../../utils/log")),logger_1=require("../utils/logger"),env_1=require("../utils/env"),child_process_1=require("child_process"),call_func_1=require("./task/call_func"),config_1=require("./config"),getWorkerPoolSize_1=tslib_1.__importDefault(require("./getWorkerPoolSize")),cpus=(0,getWorkerPoolSize_1.default)(),WORKER_PATH=path_1.default.posix.join(__dirname,"./worker.js"),FORK_PATH=path_1.default.posix.join(__dirname,"./fork.js"),MAX_TASK_TRY_TIME=2;let envIsDevtools=!1;function getCurrentScriptPath(){const e=path_1.default.posix.relative(process.cwd(),__filename);return process.cwd()===__dirname?`.${path_1.default.posix.resolve}${e}`:e}const supportWebWorkerThread="undefined"!=typeof WEBIDE_WEBPECK_DEFINE_PLUGIN;let Worker,
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getWorkerManager=exports.AbortEvent=void 0;const tslib_1=require("tslib"),path_1=tslib_1.__importDefault(require("path")),events_1=tslib_1.__importDefault(require("events")),log=tslib_1.__importStar(require("../../../../utils/log")),logger_1=require("../utils/logger"),env_1=require("../utils/env"),child_process_1=require("child_process"),call_func_1=require("./task/call_func"),config_1=require("./config"),getWorkerPoolSize_1=tslib_1.__importDefault(require("./getWorkerPoolSize")),debug_1=require("../../../../utils/debug"),async_1=require("../../summer/utils/async"),getservice_1=tslib_1.__importDefault(require("../../../../services/common/getservice")),appDirService_1=require("../../../../services/app/common/appDirService"),nativeModule_1=require("../../../../services/nativeModule/common/nativeModule"),cpus=(0,getWorkerPoolSize_1.default)(),WORKER_PATH=path_1.default.posix.join(__dirname,"./worker.js"),FORK_PATH=path_1.default.posix.join(__dirname,"./fork.js"),MAX_TASK_TRY_TIME=2;let envIsDevtools=!1;function getCurrentScriptPath(){const e=path_1.default.posix.relative(process.cwd(),__filename);return process.cwd()===__dirname?`.${path_1.default.posix.resolve}${e}`:e}const supportWebWorkerThread="undefined"!=typeof WEBIDE_WEBPECK_DEFINE_PLUGIN;let Worker,supportWorkerThread=!1;try{Worker=require("worker_threads").Worker,supportWorkerThread=!0}catch(e){supportWorkerThread=!1}let workerManagerInstance,_workerInspectPort=9320;function resolveTaskLabel(e,t){return e===config_1.TASK_NAME.SUMMER_HOOK&&(null==t?void 0:t.method)?`${e}:${t.plugin}:${t.method}`:e===config_1.TASK_NAME.PIPE_TASK&&(null==t?void 0:t.pipeName)?`${e}:${t.pipeName}`:e}exports.AbortEvent="WorkerTaskAborted";class WorkerInstance extends events_1.default{constructor(){super(),this.status=config_1.EWorkerStatus.free,this.threadId=-1,this._suicideTime=config_1.SUICIDE_TIME["miniprogram-ci"],this._postMessage=()=>{},this._initBarrier=null,this._taskStartTime=0}async init(){envIsDevtools&&(this._suicideTime=config_1.SUICIDE_TIME.devtools);const e={NODE_PATH:process.env.NODE_PATH||path_1.default.posix.join(__filename,"../../../../../../../../node_modules"),ELECTRON_MODULE_FALLBACK_DIRS:process.env.ELECTRON_MODULE_FALLBACK_DIRS||"",ELECTRON_ACTIVE_APP_PATH:process.env.ELECTRON_ACTIVE_APP_PATH||"",ELECTRON_BASE_APP_PATH:process.env.ELECTRON_BASE_APP_PATH||"",isDevtools:String(envIsDevtools)};if(console.log("NODE_ENV",process.cwd(),__filename,getCurrentScriptPath(),e),supportWebWorkerThread);else if(supportWorkerThread){const t=await(0,debug_1.shouldInspectWorker)()?["--inspect-brk="+_workerInspectPort++]:[];this._instance=new Worker(WORKER_PATH,{env:Object.assign(Object.assign({},e),{cpprocessEnv:"workerthread"}),stdout:!0,execArgv:t}),this.threadId=this._instance.threadId,this._postMessage=this._instance.postMessage.bind(this._instance)}else{const t=await(0,debug_1.shouldInspectWorker)()?["--inspect-brk="+_workerInspectPort++]:[];this._instance=(0,child_process_1.fork)(FORK_PATH,[""],{env:Object.assign(Object.assign({},e),{cpprocessEnv:"workerprocess"}),execArgv:t}),this.threadId=this._instance.pid,this._postMessage=this._instance.send.bind(this._instance)}const t=e=>{var t;const{command:s,data:r}=e;s===config_1.COMMAND.INIT_READY&&(null===(t=this._initBarrier)||void 0===t||t.open(),console.log("worker init_ready")),s===config_1.COMMAND.TASK_DONE&&this.onTaskDone(r),s===config_1.COMMAND.SEND_LOG&&logger_1.logger.send(r.level,r.args),s===config_1.COMMAND.CALL_FUNC&&call_func_1.call.apply(null,[r.funcName,...r.args]).then((e=>{this._postMessage({command:config_1.COMMAND.CALL_FUNC_RESULT,data:{id:r.id,result:e}})})).catch((e=>{this._postMessage({command:config_1.COMMAND.CALL_FUNC_RESULT,data:{id:r.id,error:e.toString()}})}))},s=e=>{0!==e&&1!==e&&log.error(`worker thread: ${this.threadId}, status: ${this.status}, exit with code: ${e}`),this.emit("exit",{code:e,status:this.status,task:this._task,threadId:this.threadId})};supportWebWorkerThread?(this._instance.onMsg(t),this._instance.onError(s)):(this._instance.on("message",t),this._instance.on("exit",s)),await this._initWorkerServices()}on(e,t){return super.on(e,t)}async _initWorkerServices(){const e=await(0,getservice_1.default)(appDirService_1.IAppDirService).get("WeappCompileCache"),t=await(0,getservice_1.default)(nativeModule_1.INativeModuleService);this._postMessage({command:config_1.COMMAND.INIT_START,data:{NativeModule:{WXMLParsePath:await t.getWXMLParsePath(),WXSSParsePath:await t.getWXSSParsePath(),GlassEaselLazyModulePath:await t.getGlassEaselTemplateCompilerPath()},AppDirService:{WeappCompileCache:e}}}),this._initBarrier=new async_1.Barrier,await this._initBarrier.wait()}onTaskDone(e){var t,s,r,i;const o=Date.now()-this._taskStartTime,a=resolveTaskLabel(null!==(s=null===(t=this._task)||void 0===t?void 0:t.name)&&void 0!==s?s:"",null===(r=this._task)||void 0===r?void 0:r.data);this.status=config_1.EWorkerStatus.free,(null===(i=this._task)||void 0===i?void 0:i.resolve)&&(this._task.onStatusUpdate(config_1.ETaskStatus.done),this._task.resolve(e)),this._task=void 0,this.emit("taskDone",this.threadId,a,o),env_1.summerProcess&&env_1.nativeProcess||this.setUpSuicideTimer()}setUpSuicideTimer(){this._suicideTimer=setTimeout((()=>{clearTimeout(this._suicideTimer),this.status===config_1.EWorkerStatus.free?(this.status=config_1.EWorkerStatus.dying,supportWebWorkerThread?this._instance.kill():supportWorkerThread?this._instance.terminate():this._instance.kill("SIGTERM")):this._suicideTimer||this.setUpSuicideTimer()}),this._suicideTime)}runTask(e){clearTimeout(this._suicideTimer),this.status=config_1.EWorkerStatus.busy,this._task=e,this._taskStartTime=Date.now(),this._task.onStatusUpdate(config_1.ETaskStatus.progress),this._postMessage({command:config_1.COMMAND.RUN_TASK,data:{taskName:e.name,data:e.data}})}}class WorkerManager{constructor(e,t=!1){this._taskQueue=[],this._workerPool={},this._max_pool_size=4,this._taskRecords=[],this.onWorkerExit=async e=>{const{code:t,status:s,task:r,threadId:i}=e;delete this._workerPool[i],s===config_1.EWorkerStatus.busy&&(r.retryTimes+=1,r.retryTimes<=2?(log.error(`worker thread: ${i} exit with code: ${t} when it is busy, retry ${r.retryTimes} times`),this._taskQueue.push(r)):r.reject(`worker thread exit with code: ${t} when it is busy`)),await this._run()},this._actualWorkerPoolSize=1,this._doneThreadSet=new Set,this.onTaskDone=async(e,t,s)=>{null!=t&&null!=s&&this._taskRecords.push({workerId:e,taskName:t,duration:s}),this._doneThreadSet.add(e),this._actualWorkerPoolSize=Math.min(howManyWorker(this._doneThreadSet.size),this._max_pool_size),await this._run()},this._max_pool_size=e>8?8:e,envIsDevtools=t}runTask(e,t,s=(()=>{})){return new Promise(((r,i)=>{const o={name:e,data:t,resolve:r,reject:i,retryTimes:0,onStatusUpdate:s};s(config_1.ETaskStatus.waiting),this._taskQueue.push(o),this._run()}))}getTaskRecords(){return this._taskRecords}clearTaskRecords(){this._taskRecords=[]}abort(e){const t=[],s=[];this._taskQueue.forEach((r=>{r.name!==e?s.push(r):t.push(r)})),t.forEach((e=>{e.reject(exports.AbortEvent)})),this._taskQueue=s}async _run(){let e=this._taskQueue[0];for(;e;){const t=this.getFreeWorker();if(!t)return;this._taskQueue.shift(),t.runTask(e),e=this._taskQueue[0]}}getFreeWorker(){for(const e in this._workerPool){const t=this._workerPool[e];if(t.status===config_1.EWorkerStatus.free)return t}return this.allocWorker(),null}async allocWorker(){if(this.workerCount()<this._max_pool_size){const e=new WorkerInstance;return await e.init(),e.on("taskDone",this.onTaskDone),e.on("exit",this.onWorkerExit),this._workerPool[e.threadId]=e,this._run(),e}return null}workerCount(){return Object.keys(this._workerPool).length}}function howManyWorker(e){switch(e){case 1:return 4;case 2:return 6;default:return 8}}const getWorkerManager=function(e=!1){return workerManagerInstance||(workerManagerInstance=new WorkerManager(cpus,e)),workerManagerInstance};exports.getWorkerManager=getWorkerManager;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.OriginalCompiler=void 0;const tslib_1=require("tslib"),path_1=tslib_1.__importDefault(require("path")),lodash_1=tslib_1.__importDefault(require("lodash")),baseCompiler_1=require("./baseCompiler"),original_1=require("./original"),tools_1=require("../../utils/tools");class OriginalCompiler extends baseCompiler_1.BaseCoreCompiler{async waitSubProcessReady(){}constructor(e){super(e),this.isSummer=!1,this.ready()}destroy(){this._checkReadyTask=void 0,this.compileManager=void 0}async init(){this.compileManager=new original_1.OriginalCompileManager(this.project)}async isGameApp(){if(!this.project)return!1;const e=await this.project.attr();return null==e?void 0:e.gameApp}checkProject(){}async getExtJSON(){return await this.compileManager.getExtJSON()}async getAppJSON(){return this.checkProject(),await this.compileManager.getAppJSON()}async getSiteMapJSON(){const e=await this.compileManager.getSiteMapJSON();return lodash_1.default.cloneDeep(e)}async getPageJSON(e){this.checkProject();return await this.compileManager.getPageJSON({miniprogramRoot:this.project.miniprogramRoot,pagePath:e})}async getGameJSON(){return this.checkProject(),this.compileManager.getGameJSON()}async getPluginJSON(e=""){return this.checkProject(),await this.compileManager.getPluginJSON(e)}async getPluginPageJSON(e){this.checkProject();return await this.compileManager.getPluginPageJSON({root:this.project.pluginRoot,project:this.project,filePath:path_1.default.posix.join(this.project.pluginRoot||""
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.OriginalCompiler=void 0;const tslib_1=require("tslib"),path_1=tslib_1.__importDefault(require("path")),lodash_1=tslib_1.__importDefault(require("lodash")),baseCompiler_1=require("./baseCompiler"),original_1=require("./original"),tools_1=require("../../utils/tools");class OriginalCompiler extends baseCompiler_1.BaseCoreCompiler{async waitSubProcessReady(){}constructor(e){super(e),this.isSummer=!1,this.ready()}destroy(){this._checkReadyTask=void 0,this.compileManager=void 0}async init(){this.compileManager=new original_1.OriginalCompileManager(this.project)}async isGameApp(){if(!this.project)return!1;const e=await this.project.attr();return null==e?void 0:e.gameApp}checkProject(){}async getExtJSON(){return await this.compileManager.getExtJSON()}async getAppJSON(){return this.checkProject(),await this.compileManager.getAppJSON()}async getSiteMapJSON(){const e=await this.compileManager.getSiteMapJSON();return lodash_1.default.cloneDeep(e)}async getPageJSON(e){this.checkProject();return await this.compileManager.getPageJSON({miniprogramRoot:this.project.miniprogramRoot,pagePath:e})}async getGameJSON(){return this.checkProject(),this.compileManager.getGameJSON()}async getPluginJSON(e=""){return this.checkProject(),await this.compileManager.getPluginJSON(e)}async getPluginPageJSON(e){this.checkProject();return await this.compileManager.getPluginPageJSON({root:this.project.pluginRoot,project:this.project,filePath:path_1.default.posix.join(this.project.pluginRoot||"",`${e}.json`)})}async getPluginComponents(){var e;const t=this.getPluginJSONFileList(),o=[];for(let i=0,r=t.length;i<r;i++){const r=t[i].replace(/\.json$/,"");"plugin"!==path_1.default.normalize(r)&&(this.isValidComponent(null===(e=this.project)||void 0===e?void 0:e.pluginRoot,r)&&o.push(r))}return o}getWxssMap(e,t){throw new Error("Method not implemented.")}async getPluginJSFiles(){const e=this.getPluginJSFileList();return{jsFiles:e,content:e.reduce(((e,t)=>{var o;return e[t]=this.project.getFile((null===(o=this.project)||void 0===o?void 0:o.pluginRoot)||"",t).toString(),e}),{})}}async getPluginWxssFiles(){const e=this.getPluginWXSSFileList();return{wxssFiles:e,content:e.reduce(((e,t)=>{var o;return e[t]=this.project.getFile((null===(o=this.project)||void 0===o?void 0:o.pluginRoot)||"",t).toString(),e}),{})}}async getPluginWxmlAndWxsFiles(){const e=this.getPluginWXSFileList(),t=this.getPluginWXMLFileList(),o=e.concat(t);return{wxsFiles:e,wxmlFiles:t,content:o.reduce(((e,t)=>{var o;return e[t]=this.project.getFile((null===(o=this.project)||void 0===o?void 0:o.pluginRoot)||"",t).toString(),e}),{})}}async getMPFileInfo(){var e,t;const o=null===(e=this.project)||void 0===e?void 0:e.miniprogramRoot;return this.excludeKeyRoot(this.getAllFileInfo(null===(t=this.project)||void 0===t?void 0:t.miniprogramRoot),o)}async getPluginFileInfo(){var e,t;const o=null===(e=this.project)||void 0===e?void 0:e.pluginRoot;return this.excludeKeyRoot(this.getAllFileInfo(null===(t=this.project)||void 0===t?void 0:t.pluginRoot),o)}async checkThemeJSON(e){return this.checkProject(),await this.compileManager.checkThemeJSON(e)}async compile(e){return this.checkProject(),await this.compileManager.compile({nameMapping:e.nameMapping||{},setting:e.setting,onProgressUpdate:e.onProgressUpdate,__compileDebugInfo__:e.__compileDebugInfo__,compilePages:e.compilePages,analyzer:e.analyzer,devToolsCompileCache:e.devToolsCompileCache,disableSpreadingUsingComponents:e.disableSpreadingUsingComponents,resultType:e.resultType})}async compileJS(e){this.checkProject();const{root:t,filePath:o,babelRoot:i="@babel/runtime"}=e;try{return await this.compileManager.compileJS(o,{root:t,sourceCode:e.sourceCode,setting:Object.assign({},e.setting),babelRoot:i,onProgressUpdate:e.onProgressUpdate})}catch(e){throw e}}setLocale(e){this.compileManager.setLocale(e)}clearCache(){this.compileManager.clearCache()}async getPackageWxssFileList(e){return[]}async getPackageWxssFiles(e){return{}}async getPackageWxmlAndWxsFiles(e){return{}}async getAllWxmlAndWxsFiles(){return{}}getAllSortedJSFiles(){throw new Error("Method not implemented.")}getMainPkgSortedJSFiles(){throw new Error("Method not implemented.")}async getPackageFiles(e,t){if(this.isGameType(e)){const e=await this.getGameJSON(),o=this.getMPFileList();let i=e.workers||"";i="string"==typeof i?i:i.path;const r=e.openDataContext,n={__APP__:[],[r]:[]};i&&(n[i]=[]);for(const t of o)if(r&&(0,tools_1.isLeftSubPathOfRight)(t,r))n[r].push({path:t,source:t,sourceExt:path_1.default.extname(t),independentRoot:r,isBabelIgnore:!1});else if(i&&(0,tools_1.isLeftSubPathOfRight)(t,i))n[i].push({path:t,source:t,sourceExt:path_1.default.extname(t),independentRoot:"object"==typeof e.workers&&e.workers.isSubpackage?i:"",isBabelIgnore:!1});else{if(e.subPackages){let o=!1;for(const i of e.subPackages){const e=i.root.replace(/^\//,"");if((0,tools_1.isLeftSubPathOfRight)(t,e)){n[i.root]||(n[e]=[]),n[e].push({path:t,source:t,sourceExt:path_1.default.extname(t),independentRoot:i.independent?e:"",isBabelIgnore:!1}),o=!0;break}}if(o)continue}n.__APP__.push({path:t,source:t,sourceExt:path_1.default.extname(t),independentRoot:"",isBabelIgnore:!1})}return n[t]||[]}throw new Error("Method not implemented.")}getSubPkgSortedJSFiles(e){throw new Error("Method not implemented.")}getCompAndPagesOfConf(){throw new Error("Method not implemented.")}async getAllPageAndComponent(){var e;const t=this.getMPJSONFileList(),o=[];for(let i=0,r=t.length;i<r;i++){const r=t[i].replace(/\.json$/,"");this.isValidComponent(null===(e=this.project)||void 0===e?void 0:e.miniprogramRoot,r)&&o.push(r)}return o}}exports.OriginalCompiler=OriginalCompiler;
|